Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
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>