2 <?xml-stylesheet type=
"text/css" href=
"chrome://global/skin"?>
3 <?xml-stylesheet type=
"text/css" href=
"chrome://mochikit/content/tests/SimpleTest/test.css"?>
5 https://bugzilla.mozilla.org/show_bug.cgi?id=932906
7 <window title=
"Mozilla Bug 932906"
8 xmlns=
"http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
9 <script src=
"chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
11 <!-- test results are displayed in the html:body -->
12 <body xmlns=
"http://www.w3.org/1999/xhtml">
13 <a href=
"https://bugzilla.mozilla.org/show_bug.cgi?id=932906"
14 target=
"_blank">Mozilla Bug
932906</a>
17 <!-- test code goes here -->
18 <script type=
"application/javascript">
20 /** Test for Bug
932906 **/
21 SimpleTest.waitForExplicitFinish();
23 function passToContent(shouldThrow) {
25 $('ifr').contentWindow.obs = Services.obs;
26 ok(!shouldThrow,
"Didn't throw when passing non-DOM XPCWN to content");
28 ok(shouldThrow,
"Threw when passing non-DOM XPCWN to content");
29 ok(/denied/.test(e),
"Threw correct exception: " + e);
38 else if (gLoadCount ==
2)
41 ok(false,
"Didn't expect three loads");
46 // Make sure that the pref is what we expect for mochitests.
47 is(Services.prefs.getBoolPref('dom.use_xbl_scopes_for_remote_xul'), true,
48 "Test harness set up like we expect");
51 // First, test that we can't normally pass non-DOM XPCWNs to content.
52 passToContent(/* shouldThrow = */ true);
54 // Now, make sure we _can_ for the remote xul case. We use SpecialPowers
55 // for the pref munging because it cleans up after us.
56 SpecialPowers.pushPrefEnv({set: [['dom.use_xbl_scopes_for_remote_xul', false]]}, function() {
57 $('ifr').contentWindow.location.reload();
62 passToContent(/* shouldThrow = */ false);
68 <iframe id=
"ifr" onload=
"loaded();" type=
"content" src=
"http://example.org/tests/js/xpconnect/tests/mochitest/file_empty.html" />