Opened 12 years ago

Closed 12 years ago

#3573 closed defect (fixed)

popup: window.top reference throws exception in iframe

Reported by: Adam Peller Owned by: bill
Priority: high Milestone: 0.9
Component: Dijit Version: 0.9
Keywords: Cc: James Burke
Blocked By: Blocking:

Description

in this._onEvent. One of these references is wrapped in a try/catch with a squelch, the other is not. I think we need to wrap both. Is it necessary to start from 'top' here?

Change History (8)

comment:1 Changed 12 years ago by James Burke

This issue just bit me in 0.4.3 (in that codebase, it is function dojo.widget.PopupManager?.registerAllWindows in src/widget/PopupContainer.js).

My test case: I had a page on a different domain with an iframe that loaded the page that had a dojo menu (the top page did not need to communicate with the iframe page). In that case I got a security exception since the code tries to add a property to top's document.

It seems like reevaluating if it needs to start at top or putting the code in a try catch might be useful. Right now I have an ugly hack to avoid the issue in 0.4.3.

comment:2 Changed 12 years ago by bill

It's certainly better to start from top. The goal is that clicking anywhere in the browser window closes the drop down. But I guess if it's not possible then it's not possible.

I don't really understand Adam's description. There are two references to window.top on the same line, but that line isn't in _onEvent.

comment:3 Changed 12 years ago by James Burke

Yes, the problem I was referring to would be caused by the _connectHandlers function in diijit/util/popup.js, where it uses window.top, then later tries to do a dojo.connect with its document.

comment:4 Changed 12 years ago by James Burke

So the first time through _connectHandlers, when no targetWindow is passed, would be the problem case.

comment:5 Changed 12 years ago by Adam Peller

(In [9451]) Safeguard against cross-domain exception. Refs #3573.

comment:6 Changed 12 years ago by Adam Peller

I put in a try/catch in lieu of a better solution. Leaving open in case jburke has any suggestions.

comment:7 Changed 12 years ago by Adam Peller

Cc: James Burke added

comment:8 Changed 12 years ago by bill

Resolution: fixed
Status: newclosed

OK, I guess this is the best we can do. Closing bug.

Note: See TracTickets for help on using tickets.