Opened 13 years ago

Closed 13 years ago

#7498 closed defect (fixed)

dijit.getDocumentWindow() throws exception in Safari

Reported by: Javier Pedemonte Owned by: bill
Priority: high Milestone: 1.2
Component: Dijit Version: 1.1.1
Keywords: Cc:
Blocked By: Blocking:

Description (last modified by dante)

My Dojo-based web app is displaying exceptions in Safari, which I traced to the method dijit.getDocumentWindow().

The exceptions thrown look like this: Unsafe JavaScript? attempt to access frame with URL domainA from frame with URL domainB. Domains, protocols and ports must match.

The problem is with the Safari 'fix' at the top of dijit.getDocumentWindow(). The structure of my web app is something like this:

             MAIN PAGE (domainA)
            /                  \
 IFRAME 1 (domainA)      IFRAME 2 (domainB)

If there is a call to dijit.getDocumentWindow() in IFRAME 1, then the Safari-fix code starts at (MAIN PAGE, in this case) and down through each frame, adding "_parentWindow" to the DOMWindow.

Well, it looks like Safari has restrictions on sibling frames accessing attributes on each other, if they are in different domains. Since dijit.getDocumentWindow() was called from IFRAME 1, when the Safari-fix code tries to access IFRAME 2, the exception above is thrown.

Also, since it looks like Dojo no longer supports Safari 2, then this Safari-fix code is no longer necessary -- Safari 3 properly supports doc.defaultView. So the fix for my web app was to completely remove the Safari-fix code.

Change History (5)

comment:1 Changed 13 years ago by dante

does dojo.withDoc and/or dojo.withGlobal solve your issue?

also, not sure why you say Dojo no longer supports Safari 3? Is this incorrectly documented somewhere?

comment:2 Changed 13 years ago by Javier Pedemonte

This page says Safari 2.0 support has been dropped:

dojo.withDoc/dojo.withGlobal won't fix my issue, since I don't directly call dijit.getDocumentWindow(). Rather, I am instantiating a new dijit.Menu (in IFRAME 1), which eventually leads to a call to dijit.getDocumentWindow().

comment:3 Changed 13 years ago by dante

Description: modified (diff)

okay, i'll update the description to reflect what I think you meant to say then.

comment:4 Changed 13 years ago by bill

Milestone: tbd1.2
Owner: set to bill
Status: newassigned

Hmm, OK, I don't have a good test for this but I'll take your word for it and remove that code. Thanks for the fix!

comment:5 Changed 13 years ago by bill

Resolution: fixed
Status: assignedclosed

(In [14930]) Fixes #7498: dijit.getDocumentWindow() throws exception in Safari The safari-only code block is apparently no longer needed in safari 3, and it causes issues in some circumstances, so removing it.

Note: See TracTickets for help on using tickets.