Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Warnings
- This test gets skipped with pattern: os == 'android'
- Manifest: js/xpconnect/tests/chrome/chrome.toml
<?xml version="1.0"?>
<!--
-->
<!-- test results are displayed in the html:body -->
</body>
<!-- test code goes here -->
<script type="application/javascript">
<![CDATA[
SimpleTest.waitForExplicitFinish();
function passToContent(shouldThrow) {
try {
$('ifr').contentWindow.obs = Services.obs;
ok(!shouldThrow, "Didn't throw when passing non-DOM XPCWN to content");
} catch (e) {
ok(shouldThrow, "Threw when passing non-DOM XPCWN to content");
ok(/denied/.test(e), "Threw correct exception: " + e);
}
}
var gLoadCount = 0;
function loaded() {
++gLoadCount;
if (gLoadCount == 1)
part1();
else if (gLoadCount == 2)
part2();
else
ok(false, "Didn't expect three loads");
}
function part1() {
// Make sure that the pref is what we expect for mochitests.
is(Services.prefs.getBoolPref('dom.use_xbl_scopes_for_remote_xul'), true,
"Test harness set up like we expect");
// First, test that we can't normally pass non-DOM XPCWNs to content.
passToContent(/* shouldThrow = */ true);
// Now, make sure we _can_ for the remote xul case. We use SpecialPowers
// for the pref munging because it cleans up after us.
SpecialPowers.pushPrefEnv({set: [['dom.use_xbl_scopes_for_remote_xul', false]]}, function() {
$('ifr').contentWindow.location.reload();
});
}
function part2() {
passToContent(/* shouldThrow = */ false);
SimpleTest.finish();
}
]]>
</script>
<iframe id="ifr" onload="loaded();" type="content" src="http://example.org/tests/js/xpconnect/tests/mochitest/file_empty.html" />
</window>