2 <?xml-stylesheet href=
"chrome://global/skin" type=
"text/css"?>
3 <?xml-stylesheet href=
"chrome://mochikit/content/tests/SimpleTest/test.css"
6 https://bugzilla.mozilla.org/show_bug.cgi?id=533596
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>
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.
23 /* global XPCNativeWrapper */
25 /** Test for Bug
533596 **/
28 try { XPCNativeWrapper.unwrap(); } catch (e) {}
29 try { XPCNativeWrapper.unwrap(
0); } catch (e) {}
30 try { XPCNativeWrapper.unwrap(null); } catch (e) {}
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");
50 SimpleTest.waitForExplicitFinish();
53 <iframe type=
"content"
54 src=
"http://example.org/tests/js/xpconnect/tests/mochitest/bug500931_helper.html"