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 267527 9c8e8001ea48767b37afff4ee3786e5a5eb8f7a7
parent 267526 08e1085240f73d98a9f96822ebe1174d0a7b4ebb
child 267528 6d046782401f59ccf4e9d28e592a87968f3a6bd1
push id830
push userraliiev@mozilla.com
push dateFri, 19 Jun 2015 19:24:37 +0000
treeherdermozilla-release@932614382a68 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersettseng, test-only
bugs849642
milestone39.0
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>