dom/workers/test/suspend_iframe.html

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 <!--
     2   Any copyright is dedicated to the Public Domain.
     3   http://creativecommons.org/publicdomain/zero/1.0/
     4 -->
     5 <!DOCTYPE HTML>
     6 <html>
     7 <head>
     8   <meta charset="utf-8">
     9   <title>Test for DOM Worker Threads Suspending</title>
    10   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
    11 </head>
    12 <body>
    13 <pre id="test">
    14 <div id="output"></div>
    15 <script class="testbody" type="text/javascript">
    17   var output = document.getElementById("output");
    19   var worker;
    21   function terminateWorker() {
    22     if (worker) {
    23       worker.postMessage("stop");
    24       worker = null;
    25     }
    26   }
    28   function startWorker(messageCallback, errorCallback) {
    29     var lastData;
    30     worker = new Worker("suspend_worker.js");
    32     worker.onmessage = function(event) {
    33       output.textContent = (lastData ? lastData + " -> " : "") + event.data;
    34       lastData = event.data;
    35       messageCallback(event.data);
    36     };
    38     worker.onerror = function(event) {
    39       this.terminate();
    40       errorCallback(event.message);
    41     };
    42   }
    44 </script>
    45 </pre>
    46 </body>
    47 </html>

mercurial