Bug 1915045 Ensure decode tasks are scheduled on BufferingState::Enter() r=media...
[gecko.git] / js / xpconnect / tests / chrome / test_bug932906.xhtml
blobf7e839d980b4323a3b4adb9a3d15f1900d250f28
1 <?xml version="1.0"?>
2 <?xml-stylesheet type="text/css" href="chrome://global/skin"?>
3 <?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?>
4 <!--
5 https://bugzilla.mozilla.org/show_bug.cgi?id=932906
6 -->
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>
15 </body>
17 <!-- test code goes here -->
18 <script type="application/javascript">
19 <![CDATA[
20 /** Test for Bug 932906 **/
21 SimpleTest.waitForExplicitFinish();
23 function passToContent(shouldThrow) {
24 try {
25 $('ifr').contentWindow.obs = Services.obs;
26 ok(!shouldThrow, "Didn't throw when passing non-DOM XPCWN to content");
27 } catch (e) {
28 ok(shouldThrow, "Threw when passing non-DOM XPCWN to content");
29 ok(/denied/.test(e), "Threw correct exception: " + e);
33 var gLoadCount = 0;
34 function loaded() {
35 ++gLoadCount;
36 if (gLoadCount == 1)
37 part1();
38 else if (gLoadCount == 2)
39 part2();
40 else
41 ok(false, "Didn't expect three loads");
44 function part1() {
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();
58 });
61 function part2() {
62 passToContent(/* shouldThrow = */ false);
63 SimpleTest.finish();
66 ]]>
67 </script>
68 <iframe id="ifr" onload="loaded();" type="content" src="http://example.org/tests/js/xpconnect/tests/mochitest/file_empty.html" />
69 </window>