js/xpconnect/tests/chrome/test_bug706301.xul

branch
TOR_BUG_3246
changeset 7
129ffea94266
equal deleted inserted replaced
-1:000000000000 0:e4d27efb162d
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=706301
6 -->
7 <window title="Mozilla Bug 706301"
8 xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
9 <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
10
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=706301"
14 target="_blank">Mozilla Bug 706301</a>
15 <iframe id="ifr" src="http://mochi.test:8888/tests/js/xpconnect/tests/mochitest/file_bug706301.html" onload="doTest();" />
16 </body>
17
18 <!-- test code goes here -->
19 <script type="application/javascript">
20 <![CDATA[
21 /** Test for Bug 706301 **/
22
23 SimpleTest.waitForExplicitFinish();
24
25 function getLengthInChrome(nodelist) {
26
27 // Make sure the object is Xray wrapped.
28 ok(nodelist === XPCNativeWrapper(nodelist), "object passed from content to chrome " +
29 "should be Xray-wrapped.");
30
31 // Perform the operation.
32 Object.getOwnPropertyDescriptor(nodelist, 'length');
33 return nodelist['length'] == 0;
34 }
35
36 function finishTestInChrome() {
37 SimpleTest.finish();
38 }
39
40 function doTest() {
41
42 // Set up the callbacks for content.
43 $('ifr').contentWindow.wrappedJSObject.getLengthInChrome = getLengthInChrome;
44 $('ifr').contentWindow.wrappedJSObject.finishTestInChrome = finishTestInChrome;
45 $('ifr').contentWindow.wrappedJSObject.ok = ok;
46
47 // Kick off the test.
48 $('ifr').contentWindow.postMessage({}, '*');
49 }
50 ]]>
51 </script>
52 </window>

mercurial