|
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=618176 |
|
7 --> |
|
8 <window title="Mozilla Bug 618176" |
|
9 xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" |
|
10 onload="start()"> |
|
11 <label value="Mozilla Bug 618176"/> |
|
12 <!-- test code goes here --> |
|
13 <script type="application/javascript"><![CDATA[ |
|
14 |
|
15 const TEST_PAGE = |
|
16 "data:text/html,<script>var a=[1,2,3];</script>Hi"; |
|
17 |
|
18 const FRAME_SCRIPT = |
|
19 "data:,addEventListener('pageshow', function() { sendAsyncMessage('test', content.wrappedJSObject.a) }, false);"; |
|
20 // s/content.wrappedJSObject.a/[ 1, 2, 3]/ and the test passes |
|
21 |
|
22 function recvTest(m) { |
|
23 var a = m.json; |
|
24 opener.wrappedJSObject.is(a.length, 3, "array was serialized and deserialized"); |
|
25 |
|
26 messageManager.removeMessageListener("test", recvTest); |
|
27 finish(); |
|
28 } |
|
29 |
|
30 function start() { |
|
31 messageManager.addMessageListener("test", recvTest); |
|
32 messageManager.loadFrameScript(FRAME_SCRIPT, true); |
|
33 setTimeout(function () { document.getElementById("browser").loadURI(TEST_PAGE); }, 0); |
|
34 } |
|
35 |
|
36 function finish() { |
|
37 opener.setTimeout("done()", 0); |
|
38 window.close(); |
|
39 } |
|
40 |
|
41 ]]></script> |
|
42 |
|
43 <browser id="browser" type="content" style="width: 200px; height: 200px;"/> |
|
44 </window> |