Closed Bug 379395 Opened 18 years ago Closed 4 years ago

remote XUL can't access contentWindow/contentDocument of xul:iframe (Error: uncaught exception: Permission denied to create wrapper for object of class UnnamedClass)

Categories

(Core :: XUL, defect)

defect
Not set
normal

Tracking

()

RESOLVED WONTFIX

People

(Reporter: hyperstruct+bugzilla, Unassigned)

References

()

Details

(Keywords: testcase)

Attachments

(2 files)

339 bytes, application/vnd.mozilla.xul+xml
Details
298 bytes, application/vnd.mozilla.xul+xml
Details
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.3) Gecko/20070321 Firefox/2.0.0.3 (Swiftfox) Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.3) Gecko/20070321 Firefox/2.0.0.3 (Swiftfox) Given a XUL page loaded in content, either from file://, http://, or chrome:// URL ("outer page"), containing an iframe where another XUL page is loaded from the same origin ("inner page"), a script from the outer page is not able to call a function defined in the inner page, as in: document.getElementById('inner').contentWindow.foo(); Reproducible: Always Steps to Reproduce: 1. load URL or attached test case 2. click on button labeled "call foo() in inner frame" 3. check error console Actual Results: If pages are served from http:// or file://, foo() is not called and console displays: Error: uncaught exception: Permission denied to create wrapper for object of class UnnamedClass If pages are served from chrome://, foo() is not called and console displays: Error: document.getElementById("inner").contentWindow.foo is not a function Source File: chrome://workbench/content/outer.xul Line: 1 Expected Results: foo() function in inner.xul should be executed. Procedure works only when pages are served from chrome:// and when the following call: document.getElementById("inner").contentWindow.foo(); ...is replaced with: document.getElementById("inner").contentWindow.wrappedJSObject.foo();
Attached file outer page
Attached file inner page
Depends on: remote-xul
The message comes from the contentWindow getter actually, the code in the binding does not get access to the docshell: http://bonsai.mozilla.org/cvsblame.cgi?file=/mozilla/toolkit/content/widgets/general.xml&rev=1.18#220 This can be reproduced using the "outer page" attachment, even though the referenced document in the iframe is 404. As for contentWindow.foo is not a function, it's not a bug, as you notice later in the report it's caused by contentWindow being an XPCNativeWrapper.
Status: UNCONFIRMED → NEW
Component: General → XP Toolkit/Widgets: XUL
Ever confirmed: true
Keywords: testcase
OS: Linux → All
Product: Firefox → Core
QA Contact: general → xptoolkit.xul
Hardware: PC → All
Summary: xul loaded in content cannot call functions defined in (same-origin-) xul loaded in iframes → remote XUL can't access contentWindow/contentDocument of xul:iframe (Error: uncaught exception: Permission denied to create wrapper for object of class UnnamedClass)
Version: unspecified → Trunk
(In reply to comment #3) > As for contentWindow.foo is not a function, it's not a bug, as you notice later > in the report it's caused by contentWindow being an XPCNativeWrapper. Perhaps I am missing something, but is the outer chrome:// page supposed to "XPCNativeWrap" the inner chrome:// page?
Without the type="content-primary" or some such on the iframe, I don't think so, but let's not confuse this report with a second issue. File a separate one or try asking in #extdev or dev-extensions about the second issue if you feel it's a bug.
In case somebody needs a workaround before this is fixed, drax [at] sweon.net suggested the following. Instead of: document.getElementById("inner").contentWindow.foo(); Use: window.frames['inner'].foo();
Does <browser type="content-primary"> instead of <iframe> work?
Fixing dependency direction.
Blocks: remote-xul
No longer depends on: remote-xul
Component: XP Toolkit/Widgets: XUL → XUL
QA Contact: xptoolkit.xul → xptoolkit.widgets

WONTFIX because remote XUL is no longer supported.

Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: