js/xpconnect/tests/chrome/file_bug618176.xul

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     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[
    15     const TEST_PAGE =
    16 "data:text/html,<script>var a=[1,2,3];</script>Hi";
    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
    22     function recvTest(m) {
    23       var a = m.json;
    24       opener.wrappedJSObject.is(a.length, 3, "array was serialized and deserialized");
    26       messageManager.removeMessageListener("test", recvTest);
    27       finish();
    28     }
    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     }
    36     function finish() {
    37       opener.setTimeout("done()", 0);
    38       window.close();
    39     }
    41   ]]></script>
    43   <browser id="browser" type="content" style="width: 200px; height: 200px;"/>
    44 </window>

mercurial