Bug Tracker

Ticket #14535 (closed bug: fixed)

Opened 10 months ago

Last modified 4 months ago

Selection fails in IE11 when the last context is a no-longer-present iframe document

Reported by: gibson042 Owned by: gibson042
Priority: high Milestone: 1.11/2.1
Component: selector Version: 2.0.3
Keywords: Cc:
Blocking: Blocked by:

Description

Per #14386 comment 7 and  https://connect.microsoft.com/IE/feedback/details/802251/script70-permission-denied-error-when-trying-to-access-old-document-from-reloaded-iframe, IE11 throws the same "SCRIPT70: Permission denied" exception from #13936, but the Sizzle fix working around it fails because IE11 lacks attachEvent.

 http://jsfiddle.net/G8NCw/66/

Change History

comment:1 Changed 10 months ago by anonymous

One workaround, for now, is to redraw the iframe element, rather than reload it Hack, I know, but may help someone

comment:2 Changed 10 months ago by gibson042

  • Owner set to gibson042
  • Priority changed from undecided to high
  • Status changed from new to assigned
  • Component changed from unfiled to selector

comment:3 Changed 10 months ago by Timmy Willison

  • Status changed from assigned to closed
  • Resolution set to fixed

Fixes #14535: update Sizzle to 1.10.13

Changeset: c389c2e6ba698e95c683ad113d728e757a4da29a

comment:4 follow-up: ↓ 6 Changed 10 months ago by anonymous

Not familiar with the bug system here. When will this be included as part of jQuery?

comment:5 Changed 10 months ago by anonymous

Not familiar with the bug system here. When will this be included as part of jQuery?

comment:6 in reply to: ↑ 4 Changed 10 months ago by gibson042

Replying to anonymous:

Not familiar with the bug system here. When will this be included as part of jQuery?

The next release (1.11 & 2.1).

comment:7 Changed 10 months ago by dmethvin

  • Milestone changed from None to 1.11/2.1

comment:8 Changed 10 months ago by anonymous

Any estimate on when 1.11 will be rolling out?

comment:9 Changed 10 months ago by dmethvin

 http://blog.jquery.com will let you know. There's a beta coming out today.

comment:10 Changed 10 months ago by anonymous

Great thanks!

comment:11 Changed 9 months ago by muley

I also get permission denied in jQuery/Sizzle when using IE and iframes. I manipulate the source of the iframe from the parent document (yes, all documents are on the same domain), and I see these errors sporadically when the iframe has unloaded and reloaded with new content. I have not been able to produce a consistent test case. So I'm not entirely sure this is the same issue, but I've tracked it down to jQuery 1.10.2, line #1188:

if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {

I sometimes get "Permission Denied" when the line above tries to access "document". I've found a workaround by manually resetting the document object to be "window.document" before this line. It makes no sense to me. See fiddle for the edited source block:

 http://jsfiddle.net/xqb4s/

comment:12 Changed 9 months ago by dmethvin

@muley, are you saying you are *still* seeing these problems with the  http://code.jquery.com/jquery-git.js version? Or are you just saying you didn't understand the conversation above saying it was fixed and would be in the 1.11 release?

comment:13 Changed 9 months ago by muley

I was previously testing with jQuery 1.9.1 and 1.10.2 (mostly 1.10.2). I did just now test with the jQuery-git.js version you referenced. And, though it seems better (i.e. harder to break), I still eventually get permission denied errors after unloading/loading multiple pages in the iframe. This only breaks in IE:  http://www.dumpt.com/img/viewer.php?file=rw31xdr5kgpegtcyurg1.png

The errors seem to be thrown in the main/parent window though. I use .on() in the parent and those are the events that end up throwing the exceptions. The workaround I provided earlier still seems to resolve the issue. I'll attempt to put together a simplified testcase in the next few days. My issue could be completely unrelated to this case above.

comment:14 Changed 9 months ago by dmethvin

Please put together a test case, preferably using jsfiddle.net or jsbin.com, and create a new ticket.

comment:15 Changed 9 months ago by anonymous

I have tested my project with jquery-1.11.0-beta2.js and it still produces the "SCRIPT70: Permission denied" error in IE10. The onbeforeunload event handler on the iframe should remove the obsolete document object from the context.

But the onbeforeunload does not get fired when window.location.href is used to navigate inside the Iframe when I set it in the onload event fo the iframe.

When I add

	if ( parent && parent.attachEvent && parent !== parent.top ) {
		parent.attachEvent( "onunload", function() {
			setDocument();
		});
	}

it works

comment:16 Changed 4 months ago by Frank

When I access the content and/or update the source of an iframe IE9/10/11 returns the error: SCRIPT70: Access is denied; only applying the fix reported in comment11 posted by "Muley" (fix->  http://jsfiddle.net/xqb4s/) the fault no longer occurs.

comment:17 Changed 4 months ago by Frank

This anomaly is also found on new version of jquery 1.11.1.

Note: See TracTickets for help on using tickets.