Bug 1915045 Ensure decode tasks are scheduled on BufferingState::Enter() r=media...
[gecko.git] / js / xpconnect / tests / chrome / test_bug533596.xhtml
blob3c3e610e8114c899ce8f91b6141898f8bae4edd1
1 <?xml version="1.0"?>
2 <?xml-stylesheet href="chrome://global/skin" type="text/css"?>
3 <?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
4 type="text/css"?>
5 <!--
6 https://bugzilla.mozilla.org/show_bug.cgi?id=533596
7 -->
8 <window title="Mozilla Bug 533596"
9 xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
10 <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
12 <!-- test results are displayed in the html:body -->
13 <body xmlns="http://www.w3.org/1999/xhtml">
14 <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=533596"
15 target="_blank">Mozilla Bug 533596</a>
16 </body>
18 <!-- test code goes here -->
19 <script type="application/javascript"><![CDATA[
21 // XPCNativeWrapper is not defined globally in ESLint as it may be going away.
22 // See bug 1481337.
23 /* global XPCNativeWrapper */
25 /** Test for Bug 533596 **/
27 function go() {
28 try { XPCNativeWrapper.unwrap(); } catch (e) {}
29 try { XPCNativeWrapper.unwrap(0); } catch (e) {}
30 try { XPCNativeWrapper.unwrap(null); } catch (e) {}
32 var o = {};
33 is(o, XPCNativeWrapper.unwrap(o), "unwrap on a random object returns it");
35 var win = $('ifr').contentWindow;
36 var utils = window.windowUtils;
37 is(utils.getClassName(win), "Proxy", "win is a Proxy");
38 ok("x" in XPCNativeWrapper.unwrap(win), "actually unwrapped");
39 is(utils.getClassName(XPCNativeWrapper.unwrap(win)), "Proxy",
40 "unwrap on an Proxy returns the same object");
41 is(utils.getClassName(XPCNativeWrapper.unwrap(new XPCNativeWrapper(win))), "Proxy",
42 "unwrap on an explicit NW works too");
44 ok(utils.getClassName(window) !== "XPCNativeWrapper", "window is not a native wrapper");
45 ok(utils.getClassName(XPCNativeWrapper.unwrap(new XPCNativeWrapper(window))) !== "XPCSafeJSObjectWrapper",
46 "unwrapping a chrome object returns the object itself");
47 SimpleTest.finish();
50 SimpleTest.waitForExplicitFinish();
52 ]]></script>
53 <iframe type="content"
54 src="http://example.org/tests/js/xpconnect/tests/mochitest/bug500931_helper.html"
55 onload="go()"
56 id="ifr">
57 </iframe>
58 </window>