js/xpconnect/tests/chrome/file_bug618176.xul

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/xpconnect/tests/chrome/file_bug618176.xul	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,44 @@
     1.4 +<?xml version="1.0"?>
     1.5 +<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
     1.6 +<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
     1.7 +                 type="text/css"?>
     1.8 +<!--
     1.9 +https://bugzilla.mozilla.org/show_bug.cgi?id=618176
    1.10 +-->
    1.11 +<window title="Mozilla Bug 618176"
    1.12 +  xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
    1.13 +  onload="start()">
    1.14 +  <label value="Mozilla Bug 618176"/>
    1.15 +  <!-- test code goes here -->
    1.16 +  <script type="application/javascript"><![CDATA[
    1.17 +
    1.18 +    const TEST_PAGE =
    1.19 +"data:text/html,<script>var a=[1,2,3];</script>Hi";
    1.20 +
    1.21 +    const FRAME_SCRIPT = 
    1.22 +"data:,addEventListener('pageshow', function() { sendAsyncMessage('test', content.wrappedJSObject.a) }, false);";
    1.23 +   // s/content.wrappedJSObject.a/[ 1, 2, 3]/ and the test passes
    1.24 +
    1.25 +    function recvTest(m) {
    1.26 +      var a = m.json;
    1.27 +      opener.wrappedJSObject.is(a.length, 3, "array was serialized and deserialized");
    1.28 +
    1.29 +      messageManager.removeMessageListener("test", recvTest);
    1.30 +      finish();
    1.31 +    }
    1.32 +
    1.33 +    function start() {
    1.34 +      messageManager.addMessageListener("test", recvTest);
    1.35 +      messageManager.loadFrameScript(FRAME_SCRIPT, true);
    1.36 +      setTimeout(function () { document.getElementById("browser").loadURI(TEST_PAGE); }, 0);
    1.37 +    }
    1.38 +
    1.39 +    function finish() {
    1.40 +      opener.setTimeout("done()", 0);
    1.41 +      window.close();
    1.42 +    }
    1.43 +
    1.44 +  ]]></script>
    1.45 +
    1.46 +  <browser id="browser" type="content" style="width: 200px; height: 200px;"/>
    1.47 +</window>

mercurial