file_bug618176.xul 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. const TEST_PAGE =
  15. "data:text/html,<script>var a=[1,2,3];</script>Hi";
  16. const FRAME_SCRIPT =
  17. "data:,addEventListener('pageshow', function() { sendAsyncMessage('test', content.wrappedJSObject.a) }, false);";
  18. // s/content.wrappedJSObject.a/[ 1, 2, 3]/ and the test passes
  19. function recvTest(m) {
  20. var a = m.json;
  21. opener.wrappedJSObject.is(a.length, 3, "array was serialized and deserialized");
  22. messageManager.removeMessageListener("test", recvTest);
  23. finish();
  24. }
  25. function start() {
  26. messageManager.addMessageListener("test", recvTest);
  27. messageManager.loadFrameScript(FRAME_SCRIPT, true);
  28. setTimeout(function () { document.getElementById("browser").loadURI(TEST_PAGE); }, 0);
  29. }
  30. function finish() {
  31. opener.setTimeout("done()", 0);
  32. window.close();
  33. }
  34. ]]></script>
  35. <browser id="browser" type="content" style="width: 200px; height: 200px;"/>
  36. </window>