Bug Tracker

Opened 13 years ago

Closed 12 years ago

Last modified 12 years ago

#8018 closed bug (fixed)

Unsafe access to frameElement causes error in crossdomain (i)frames

Reported by: SlexAxton Owned by: SlexAxton
Priority: blocker Milestone: 1.6
Component: event Version: 1.4.4
Keywords: frameElement, cross-domain Cc:
Blocked by: Blocking:


We have 2 references to the frameElement property on an element in the jQuery source. The first is wrapped in a try/catch because if the frame is on a different domain, an access restricted exception occurs.

In bindReady:

try {
  toplevel = window.frameElement == null;
} catch(e) {}

In jQuery.event (the unsafe one):

// For whatever reason, IE has trouble passing the window object
// around, causing it to be cloned in the process
if ( jQuery.isWindow( elem ) && ( elem !== window && !elem.frameElement ) ) {
  elem = window;

I'll attach a patch that avoids the frameWindow access altogether in this case, or we could consider just wrapping a try/catch. I think this solution is better though.

It so happens that while this fails"

  elem === window

This does not (so we can avoid the access):

  elem == window

More details from Shawn Smith (who found the fix) here:


Change History (6)

comment:1 Changed 13 years ago by SlexAxton

Owner: set to SlexAxton
Status: newassigned

As promised, here is the pull request: https://github.com/jquery/jquery/pull/193

comment:2 Changed 13 years ago by SlexAxton

Component: unfiledevent
Keywords: frameElement cross-domain added
Milestone: 1.next1.5
Priority: undecidedlow

comment:3 Changed 13 years ago by jitter

Milestone: 1.5.1

comment:4 Changed 13 years ago by SlexAxton

Another potential fix:


The first pull request says "Yes, we work on other frames and windows' window objects"

and this pull request says "We only work on the original window object"

comment:5 Changed 13 years ago by snover

Priority: lowblocker

workaround committed in [752db8fffeffa796f5cdb5553331436c0a4cc44e]; retargeting permanent fix as 1.6 blocker

comment:6 Changed 12 years ago by john

Resolution: fixed
Status: assignedclosed
Note: See TracTickets for help on using tickets.