Bug 849642 - Intermittent test_networkstats_enabled_perm.html. r=ettseng, a=test-only
authorAlbert Crespell <alberto.crespellperez@telefonica.com>
Fri, 15 May 2015 20:05:02 +0200
changeset 260546 bee6825f6c92
parent 260545 9e473441cbd9
child 260547 ad098fdd6f81
push id815
push userryanvm@gmail.com
push date2015-05-21 17:19 +0000
treeherdermozilla-release@3ef925962765 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersettseng, test-only
bugs849642
milestone38.0.5
Bug 849642 - Intermittent test_networkstats_enabled_perm.html. r=ettseng, a=test-only
dom/network/tests/test_networkstats_enabled_perm.html
--- a/dom/network/tests/test_networkstats_enabled_perm.html
+++ b/dom/network/tests/test_networkstats_enabled_perm.html
@@ -11,31 +11,33 @@
 </div>
 <pre id="test">
 <script type="application/javascript">
 
 "use strict";
 
 SimpleTest.waitForExplicitFinish();
 
-// Test to ensure NetworkStats is not accessible when it is disabled
-SpecialPowers.addPermission("networkstats-manage", true, document);
+// Test to ensure NetworkStats is not accessible when it is disabled.
 SpecialPowers.pushPrefEnv({'set': [["dom.mozNetworkStats.enabled", true]]},
-                          function(){
-  ok(SpecialPowers.hasPermission("networkstats-manage", document),
-     "Has permission 'networkstats-manage'.");
+                          function() {
+  SpecialPowers.pushPermissions([{ 'type': 'networkstats-manage', 'allow': 1, 'context': window.document }],
+                                function() {
+
+    ok(SpecialPowers.hasPermission("networkstats-manage", document),
+       "Has permission 'networkstats-manage'.");
 
-  ok(SpecialPowers.getBoolPref("dom.mozNetworkStats.enabled"),
-     "Preference 'dom.mozNetworkStats.enabled' is true.");
+    ok(SpecialPowers.getBoolPref("dom.mozNetworkStats.enabled"),
+       "Preference 'dom.mozNetworkStats.enabled' is true.");
 
-  ok('mozNetworkStats' in navigator, "navigator.mozNetworkStats should exist");
+    ok('mozNetworkStats' in navigator, "navigator.mozNetworkStats should exist");
 
-  ok(navigator.mozNetworkStats instanceof SpecialPowers.Ci.nsIDOMMozNetworkStatsManager,
-     "navigator.mozNetworkStats should be a nsIDOMMozNetworkStatsManager object");
+    ok(navigator.mozNetworkStats instanceof SpecialPowers.Ci.nsIDOMMozNetworkStatsManager,
+       "navigator.mozNetworkStats should be a nsIDOMMozNetworkStatsManager object");
 
-  SpecialPowers.removePermission("networkstats-manage", document);
-  SimpleTest.finish();
+    SimpleTest.finish();
+  });
 });
 
 </script>
 </pre>
 </body>
 </html>