dom/tests/mochitest/beacon/test_beacon.html

branch
TOR_BUG_9701
changeset 15
b8a032363ba2
equal deleted inserted replaced
-1:000000000000 0:28838e644b4f
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>
14
15 <div id="content">
16 </div>
17 <pre id="test">
18 <script class="testbody" type="text/javascript">
19
20 SimpleTest.waitForExplicitFinish();
21 SpecialPowers.pushPrefEnv({'set': [["beacon.enabled", true]]}, beginTest);
22
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.");
32
33 try {
34 is(false, navigator.sendBeacon());
35 threw = false;
36 } catch (e) {
37 threw = true;
38 }
39 ok(threw, "sendBeacon needs more parameters.");
40
41 SimpleTest.finish()
42 }
43
44 </script>
45 </pre>
46 </body>
47 </html>
48

mercurial