Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#10107 closed defect (fixed)

[patch][ccla]IE: PermissionDenied exception in getCachedTemplate

Reported by: Douglas Hays Owned by: Douglas Hays
Priority: high Milestone: 1.4
Component: Dijit Version: 1.4.0b
Keywords: Cc: James Burke
Blocked By: Blocking:

Description (last modified by Douglas Hays)

Run the attached cachebug.html with any IE browser.
1) click the button to create a widget in the main window.
2) click the button to create a widget in the iframe.
3) click the button to destroy the iframe widget.
4) click the button to reload the iframe.
5) click the button to create a widget in the newly refreshed iframe.
PermissionDenied?? exception is thrown from dijit._Templated.getCachedTemplate trying to access a node's attribute from another document.

Attachments (3)

cachebug.html (1.2 KB) - added by Douglas Hays 10 years ago.
test file
iframesrc.html (144 bytes) - added by Douglas Hays 10 years ago.
test iframe source file
10107.patch (1.1 KB) - added by Douglas Hays 10 years ago.
possible fix to avoid peeking at node attributes from another document

Download all attachments as: .zip

Change History (12)

Changed 10 years ago by Douglas Hays

Attachment: cachebug.html added

test file

Changed 10 years ago by Douglas Hays

Attachment: iframesrc.html added

test iframe source file

comment:1 Changed 10 years ago by Douglas Hays

Cc: James Burke added
Summary: IE: PermissionDenied exception in getCachedTemplate[patch][ccla]IE: PermissionDenied exception in getCachedTemplate

There's a dojo.byId component to the patch. You also get PermissionDenied? in byId() when node.nodeType is checked. Since the node is either an object or a string, it suffices to just check type node's type and not get the nodeType attribute.

comment:2 Changed 10 years ago by Douglas Hays

Description: modified (diff)

comment:3 Changed 10 years ago by bill

Dijit doesn't support creating widgets into an iframe using dojo from the main document.

Having said that, the change to dijit looks harmless so I don't mind you putting it in.

Changed 10 years ago by Douglas Hays

Attachment: 10107.patch added

possible fix to avoid peeking at node attributes from another document

comment:4 Changed 10 years ago by Douglas Hays

jburke, can you review the small tweak to html.js in this patch to dojo.byId? The method was checking for id.nodeType to determine if id was a DOM node or a string, and then else assumed string. If the method checks for string directly, then IE does not throw an exception. I use dojo.isString instead of typeof == object in case the user prefers new String.

comment:5 Changed 10 years ago by James Burke

This feels like whack-a-mole for cross-frame support: there are going to be other bugs with cross-frame use of Dojo, and it will continue to get more esoteric and harder to track down.

It seems troubling that you cannot access node.nodeType from across the frame. Then, what about things like appendChild() or other fundamental DOM properties?

I prefer to not do the change to dojo.byId to use isString, particularly since we talked about explicitly not supporting cross-frame use of Dojo, precisely because of these kinds of problems.

comment:6 Changed 10 years ago by Douglas Hays

Milestone: tbd1.4
Owner: changed from bill to Douglas Hays
Status: newassigned

I'll add a try/catch around dojo.destroy(node) in dijit where the node's document may have changed. I like the whack-a-mole analogy, but I wish I could have gotten dojo.byId changed since it "appears" to be the last mole that needed to be whacked.

comment:7 Changed 10 years ago by Douglas Hays

Resolution: fixed
Status: assignedclosed

(In [20587]) Fixes #10107. Add try/catch/"squelch" constructs to _Templated.js in places where accessing a node in a different document could throw PermissionDenied? exceptions (especially in IE).

comment:8 Changed 10 years ago by Douglas Hays

There is a leak in IE whenever dojo.destroy() throws a squelched exception, but that'll have to be the price of using unsupported iframe containers for widgets.

comment:9 Changed 10 years ago by bill

(In [20606]) Make dojo.byId(node) on IE work for nodes from other documents again; it stopped working in [17266] (refs #9114). Using typeof check rather than dojo.isString() for performance (refs #9131).

Revert the dojo.destroy() workaround code in [20587] (refs #10107) which is no longer needed.

!strict

Note: See TracTickets for help on using tickets.