|
1 <!DOCTYPE HTML> |
|
2 <html> |
|
3 <head> |
|
4 <title>Test to ensure NetworkStats is not accessible when it is disabled</title> |
|
5 <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
|
6 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> |
|
7 </head> |
|
8 <body> |
|
9 <p id="display"></p> |
|
10 <div id="content" style="display: none"> |
|
11 </div> |
|
12 <pre id="test"> |
|
13 <script type="application/javascript"> |
|
14 |
|
15 "use strict"; |
|
16 |
|
17 SimpleTest.waitForExplicitFinish(); |
|
18 |
|
19 // Test to ensure NetworkStats is not accessible when it is disabled |
|
20 SpecialPowers.addPermission("networkstats-manage", true, document); |
|
21 SpecialPowers.pushPrefEnv({'set': [["dom.mozNetworkStats.enabled", true]]}, function(){ |
|
22 |
|
23 ok('mozNetworkStats' in navigator, "navigator.mozNetworkStats should exist"); |
|
24 ok(navigator.mozNetworkStats instanceof SpecialPowers.Ci.nsIDOMMozNetworkStatsManager, |
|
25 "navigator.mozNetworkStats should be a nsIDOMMozNetworkStatsManager object"); |
|
26 |
|
27 SpecialPowers.removePermission("networkstats-manage", document); |
|
28 SimpleTest.finish(); |
|
29 }); |
|
30 |
|
31 </script> |
|
32 </pre> |
|
33 </body> |
|
34 </html> |