dom/tests/mochitest/beacon/test_beacon.html

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

     1 <!DOCTYPE HTML>
     2 <html>
     3 <!--
     4 https://bugzilla.mozilla.org/show_bug.cgi?id=936340
     5 -->
     6 <head>
     7   <title>Test whether sendBeacon fails for non-HTTP URIs and syntactically incorrect calls</title>
     8   <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
     9   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
    10 </head>
    11 <body>
    12 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=936340">Mozilla Bug 936340</a>
    13 <p id="display"></p>
    15 <div id="content">
    16 </div>
    17 <pre id="test">
    18 <script class="testbody" type="text/javascript">
    20 SimpleTest.waitForExplicitFinish();
    21 SpecialPowers.pushPrefEnv({'set': [["beacon.enabled", true]]}, beginTest);
    23 function beginTest() {
    24   var threw;
    25   try {
    26     is(false, navigator.sendBeacon("ftp://example.com", "0"));
    27     threw = false;
    28   } catch (ex) {
    29     threw = true;
    30   }
    31   ok(threw, "sendBeacon not supported for non ftp calls.");
    33   try {
    34     is(false, navigator.sendBeacon());
    35     threw = false;
    36   } catch (e) {
    37     threw = true;
    38   }
    39   ok(threw, "sendBeacon needs more parameters.");
    41   SimpleTest.finish()
    42 }
    44 </script>
    45 </pre>
    46 </body>
    47 </html>

mercurial