dom/workers/test/test_navigator.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 <!--
     8 Tests of DOM Worker Navigator
     9 -->
    10 <head>
    11   <title>Test for DOM Worker Navigator</title>
    12   <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    13   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
    14 </head>
    15 <body>
    16 <p id="display"></p>
    17 <div id="content" style="display: none">
    19 </div>
    20 <pre id="test">
    21 <script class="testbody" language="javascript">
    23   var worker = new Worker("navigator_worker.js");
    25   worker.onmessage = function(event) {
    26     var args = JSON.parse(event.data);
    28     if (args.name == "testFinished") {
    29       SimpleTest.finish();
    30       return;
    31     }
    33     if (typeof navigator[args.name] == "undefined") {
    34       ok(false, "Navigator has no '" + args.name + "' property!");
    35       return;
    36     }
    38     if (args.name === "taintEnabled") {
    39       is(navigator[args.name](), args.value, args.name + "() returns false.");
    40       return;
    41     }
    43     is(navigator[args.name], args.value,
    44        "Mismatched navigator string for " + args.name + "!");
    45   };
    47   worker.onerror = function(event) {
    48     ok(false, "Worker had an error: " + event.message);
    49     SimpleTest.finish();
    50   }
    52   SimpleTest.waitForExplicitFinish();
    54 </script>
    55 </pre>
    56 </body>
    57 </html>

mercurial