Bug 1915045 Ensure decode tasks are scheduled on BufferingState::Enter() r=media...
[gecko.git] / js / xpconnect / tests / mochitest / test_getWebIDLCaller.html
blob22a4ae1c3bba696218870bbb5d9c8d4d72fbe6c1
1 <!DOCTYPE HTML>
2 <html>
3 <!--
4 https://bugzilla.mozilla.org/show_bug.cgi?id=968335
5 -->
6 <head>
7 <meta charset="utf-8">
8 <title>Test for Bug 968335</title>
9 <script src="/tests/SimpleTest/SimpleTest.js"></script>
10 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
11 <script type="application/javascript">
13 /** Test for Cu.getCallerPrincipal (within JS-implemented WebIDL). **/
15 SimpleTest.waitForExplicitFinish();
16 SpecialPowers.pushPrefEnv({set: [['dom.expose_test_interfaces', true]]}, go);
19 function go() {
20 var t = new TestInterfaceJS();
21 is(t.getCallerPrincipal(), location.origin,
22 "Cu.getCallerPrincipal works right within JS-implemented WebIDL");
24 try {
25 SpecialPowers.Cu.getWebIDLCallerPrincipal();
26 ok(false, "Should have thrown");
27 } catch (e) {
28 ok(/NOT_AVAILABLE/.test(SpecialPowers.wrap(e)),
29 "API should throw when invoked outside of JS-implemented WebIDL");
32 SimpleTest.finish();
38 </script>
39 </head>
40 <body>
41 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=968335">Mozilla Bug 968335</a>
42 <p id="display"></p>
43 <div id="content" style="display: none">
45 </div>
46 <pre id="test">
47 </pre>
48 </body>
49 </html>