Ticket #2723 (closed defect: fixed)
[patch][ccla] PopupContainer load error within a cross-domain IFRAME
| Reported by: | guest | Owned by: | bill |
|---|---|---|---|
| Priority: | normal | Milestone: | 0.9 |
| Component: | Dijit | Version: | 0.4.1 |
| Severity: | normal | Keywords: | cross domain popupcontainer |
| Cc: |
Description
If PopupContainer? is loaded from within an IFRAME that is loaded cross-domain from the original page, an error occurs (FF,IE,Opera).
In Firefox the error is:
[Exception... "'Permission denied to get property HTMLDocument._parentWindow' when calling method: [nsIDOMEventListener::handleEvent]" nsresult: "0x8057001e (NS_ERROR_XPC_JS_THREW_STRING)" location: "<unknown>" data: no]
Steps to reproduce:
- load test_Menu2.html cross-domain from within an iframe.
- above error happens during dojo onLoad processing.
Cause:
PopupManager?.registerAllWindows() calls dojo.html.getDocumentWindow() which tries to access the _parentWindow property of the outer window, which violates the rules.
Fix:
The attached patch fixes my test case, by catching the error and falling back to working from the IFRAME window - which isn't ideal, but a sensible fallback and no errors.
It might be one idea to look at d.html.getDocumentWindow, but there are a number of other try-catch blocks around it throughout the code, so presumably it's not regarded as error-safe.