Bug 1357517 - Remove Preferences.jsm usage from workers test. r=bz
authorMarco Castelluccio <mcastelluccio@mozilla.com>
Fri, 28 Jul 2017 21:20:53 +0200
changeset 420581 b0b3cced9169bbf36dd0834218bca511982ef40d
parent 420580 2fbfb1b926ef82252891b23caa051ba1e73b8f6e
child 420582 526b29eb6c64929ace38535153a7e4f9b11d4d6c
push id7566
push usermtabara@mozilla.com
push dateWed, 02 Aug 2017 08:25:16 +0000
treeherdermozilla-beta@86913f512c3c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs1357517
milestone56.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1357517 - Remove Preferences.jsm usage from workers test. r=bz
dom/workers/test/browser_bug1047663.js
--- a/dom/workers/test/browser_bug1047663.js
+++ b/dom/workers/test/browser_bug1047663.js
@@ -4,24 +4,20 @@
 "use strict";
 
 const TAB_URL = EXAMPLE_URL + "bug1047663_tab.html";
 const WORKER_URL = EXAMPLE_URL + "bug1047663_worker.sjs";
 
 function test() {
   waitForExplicitFinish();
 
-  // Disable rcwn to make cache behavior deterministic.
-  let rcwnEnabled = Preferences.get("network.http.rcwn.enabled");
-  Preferences.set("network.http.rcwn.enabled", false);
-  registerCleanupFunction(()=>{
-    Preferences.set("network.http.rcwn.enabled", rcwnEnabled);
-  });
+  (async function() {
+    // Disable rcwn to make cache behavior deterministic.
+    await SpecialPowers.pushPrefEnv({set: [["network.http.rcwn.enabled", false]]});
 
-  (async function() {
     let tab = await addTab(TAB_URL);
 
     // Create a worker. Post a message to it, and check the reply. Since the
     // server side JavaScript file returns the first source for the first
     // request, the reply should be "one". If the reply is correct, terminate
     // the worker.
     await createWorkerInTab(tab, WORKER_URL);
     let message = await postMessageToWorkerInTab(tab, WORKER_URL, "ping");