Bug 1207635 - get rid of dom.workers.sharedWorkers.enabled pref, r=khuey
authorAndrea Marchesini <amarchesini@mozilla.com>
Wed, 23 Sep 2015 19:33:40 +0100
changeset 264032 d662ed69c8bbd25ef047db6b38e9e76e1c3f96a9
parent 264031 8f459c4b475dee91906d6db588eb44f374e0bd36
child 264033 414686e07ce3b033086aaa63a8dfddafa3774d9d
push id65508
push useramarchesini@mozilla.com
push dateWed, 23 Sep 2015 18:35:23 +0000
treeherdermozilla-inbound@d662ed69c8bb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskhuey
bugs1207635
milestone44.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 1207635 - get rid of dom.workers.sharedWorkers.enabled pref, r=khuey
devtools/client/webconsole/test/browser_webconsole_console_logging_workers_api.js
dom/broadcastchannel/tests/test_broadcastchannel_sharedWorker.html
dom/webidl/SharedWorker.webidl
dom/workers/test/test_bug1132395.html
dom/workers/test/test_bug949946.html
dom/workers/test/test_consoleSharedWorkers.html
dom/workers/test/test_multi_sharedWorker.html
dom/workers/test/test_multi_sharedWorker_lifetimes.html
dom/workers/test/test_sharedWorker.html
dom/workers/test/test_sharedWorker_lifetime.html
dom/workers/test/test_sharedWorker_performance_user_timing.html
dom/workers/test/test_sharedWorker_ports.html
dom/workers/test/test_sharedWorker_privateBrowsing.html
dom/workers/test/test_webSocket_sharedWorker.html
modules/libpref/init/all.js
--- a/devtools/client/webconsole/test/browser_webconsole_console_logging_workers_api.js
+++ b/devtools/client/webconsole/test/browser_webconsole_console_logging_workers_api.js
@@ -4,27 +4,17 @@
 // Tests that the basic console.log()-style APIs and filtering work for
 // sharedWorkers
 
 "use strict";
 
 const TEST_URI = "http://example.com/browser/devtools/client/webconsole/" +
                  "test/test-console-workers.html";
 
-function pushPrefEnv() {
-  let deferred = promise.defer();
-  let options = {
-    set: [["dom.workers.sharedWorkers.enabled", true]]
-  };
-  SpecialPowers.pushPrefEnv(options, deferred.resolve);
-  return deferred.promise;
-}
-
 var test = asyncTest(function*() {
-  yield pushPrefEnv();
   yield loadTab(TEST_URI);
 
   let hud = yield openConsole();
 
   yield waitForMessages({
     webconsole: hud,
     messages: [{
       text: "foo-bar-shared-worker"
--- a/dom/broadcastchannel/tests/test_broadcastchannel_sharedWorker.html
+++ b/dom/broadcastchannel/tests/test_broadcastchannel_sharedWorker.html
@@ -39,14 +39,14 @@ function runTests() {
     bc.close();
     SimpleTest.finish();
   }
 
   worker.port.postMessage('go');
 }
 
 SimpleTest.waitForExplicitFinish();
-SpecialPowers.pushPrefEnv({"set": [["dom.workers.sharedWorkers.enabled", true]]}, runTests);
+runTests();
 
 </script>
 </pre>
 </body>
 </html>
--- a/dom/webidl/SharedWorker.webidl
+++ b/dom/webidl/SharedWorker.webidl
@@ -1,13 +1,12 @@
 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
-[Pref="dom.workers.sharedWorkers.enabled",
- Constructor(DOMString scriptURL, optional DOMString name)]
+[Constructor(DOMString scriptURL, optional DOMString name)]
 interface SharedWorker : EventTarget {
     readonly attribute MessagePort port;
 };
 
 SharedWorker implements AbstractWorker;
--- a/dom/workers/test/test_bug1132395.html
+++ b/dom/workers/test/test_bug1132395.html
@@ -11,32 +11,30 @@
 </head>
 <body>
 
 <script class="testbody" type="text/javascript">
 
 // This test is full of dummy debug messages. This is because I need to follow
 // an hard-to-reproduce timeout failure.
 
-SpecialPowers.pushPrefEnv({ set: [["dom.workers.sharedWorkers.enabled", true]] }, function() {
-  info("test started");
-  var sw = new SharedWorker('bug1132395_sharedWorker.js');
-  sw.port.onmessage = function(event) {
-    info("sw.onmessage received");
-    ok(true, "We didn't crash.");
-    SimpleTest.finish();
-  }
+info("test started");
+var sw = new SharedWorker('bug1132395_sharedWorker.js');
+sw.port.onmessage = function(event) {
+  info("sw.onmessage received");
+  ok(true, "We didn't crash.");
+  SimpleTest.finish();
+}
 
-  sw.onerror = function(event) {
-    ok(false, "Failed to create a ServiceWorker");
-    SimpleTest.finish();
-  }
+sw.onerror = function(event) {
+  ok(false, "Failed to create a ServiceWorker");
+  SimpleTest.finish();
+}
 
-  info("sw.postmessage called");
-  sw.port.postMessage('go');
-});
+info("sw.postmessage called");
+sw.port.postMessage('go');
 
 SimpleTest.waitForExplicitFinish();
 
 </script>
 </pre>
 </body>
 </html>
--- a/dom/workers/test/test_bug949946.html
+++ b/dom/workers/test/test_bug949946.html
@@ -10,22 +10,17 @@
   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
 </head>
 <body>
 <p id="display"></p>
 <div id="content" style="display: none"></div>
 <pre id="test"></pre>
 <script class="testbody" type="text/javascript">
 
-  SpecialPowers.pushPrefEnv({ set: [["dom.workers.sharedWorkers.enabled", true]] }, function() {
-    new SharedWorker('sharedWorker_sharedWorker.js');
-    new SharedWorker('sharedWorker_sharedWorker.js', ':');
-    new SharedWorker('sharedWorker_sharedWorker.js', '|||');
-    ok(true, "3 SharedWorkers created!");
-    SimpleTest.finish();
-  });
-
-  SimpleTest.waitForExplicitFinish();
+new SharedWorker('sharedWorker_sharedWorker.js');
+new SharedWorker('sharedWorker_sharedWorker.js', ':');
+new SharedWorker('sharedWorker_sharedWorker.js', '|||');
+ok(true, "3 SharedWorkers created!");
 
 </script>
 </pre>
 </body>
 </html>
--- a/dom/workers/test/test_consoleSharedWorkers.html
+++ b/dom/workers/test/test_consoleSharedWorkers.html
@@ -42,18 +42,15 @@
         SpecialPowers.removeObserver(this, "console-api-log-event");
         SimpleTest.finish();
         return;
       }
     }
   }
 
   var cl = new consoleListener();
-
-  SpecialPowers.pushPrefEnv({ set: [["dom.workers.sharedWorkers.enabled", true]] }, function() {
-    new SharedWorker('sharedWorker_console.js');
-  });
+  new SharedWorker('sharedWorker_console.js');
 
   SimpleTest.waitForExplicitFinish();
 
     </script>
   </body>
 </html>
--- a/dom/workers/test/test_multi_sharedWorker.html
+++ b/dom/workers/test/test_multi_sharedWorker.html
@@ -6,18 +6,16 @@
 <html>
   <head>
     <title>Test for SharedWorker</title>
     <script src="/tests/SimpleTest/SimpleTest.js"></script>
     <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
       <script class="testbody" type="text/javascript;version=1.7">
         "use strict";
 
-        const swPref = "dom.workers.sharedWorkers.enabled";
-
         const basePath =
           location.pathname.substring(0,
                                       location.pathname.lastIndexOf("/") + 1);
         const baseURL = location.origin + basePath;
 
         const frameRelativeURL = "multi_sharedWorker_frame.html";
         const frameAbsoluteURL = baseURL + frameRelativeURL;
         const workerAbsoluteURL =
@@ -25,23 +23,16 @@
 
         const storedData = "0123456789abcdefghijklmnopqrstuvwxyz";
         const errorMessage = "Error: Expected";
         const errorLineno = 34;
 
         let testGenerator = (function() {
           SimpleTest.waitForExplicitFinish();
 
-          if (!SpecialPowers.getBoolPref(swPref)) {
-            ok(!("SharedWorker" in window), "No SharedWorker without pref set");
-          }
-
-          SpecialPowers.pushPrefEnv({ set: [[swPref, true]] }, sendToGenerator);
-          yield undefined;
-
           window.addEventListener("message", function(event) {
             if (typeof(event.data) == "string") {
               info(event.data);
             } else {
               sendToGenerator(event);
             }
           });
 
--- a/dom/workers/test/test_multi_sharedWorker_lifetimes.html
+++ b/dom/workers/test/test_multi_sharedWorker_lifetimes.html
@@ -6,38 +6,32 @@
 <html>
   <head>
     <title>Test for SharedWorker</title>
     <script src="/tests/SimpleTest/SimpleTest.js"></script>
     <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
       <script class="testbody" type="text/javascript;version=1.7">
         "use strict";
 
-        const swPref = "dom.workers.sharedWorkers.enabled";
         const scrollbarPref = "layout.testing.overlay-scrollbars.always-visible";
         const bfCacheEnabledPref = "browser.sessionhistory.cache_subframes";
         const bfCacheDepthPref = "browser.sessionhistory.max_total_viewers";
         const bfCacheDepth = 10;
 
         const frameRelativeURL = "multi_sharedWorker_frame.html";
         const storedData = "0123456789abcdefghijklmnopqrstuvwxyz";
 
         let testGenerator = (function() {
           SimpleTest.waitForExplicitFinish();
 
-          if (!SpecialPowers.getBoolPref(swPref)) {
-            ok(!("SharedWorker" in window), "No SharedWorker without pref set");
-          }
-
-          // Enable SharedWorkers and force scrollbar to always be shown.  The
-          // scrollbar setting is necessary to avoid the fade-in/fade-out from
-          // evicting our document from the BF cache below.  If bug 1049277
-          // is fixed, then we can stop setting the scrollbar pref here.
-          SpecialPowers.pushPrefEnv({ set: [[swPref, true],
-                                            [scrollbarPref, true]] },
+	  // Force scrollbar to always be shown.  The scrollbar setting is
+	  // necessary to avoid the fade-in/fade-out from evicting our document
+	  // from the BF cache below.  If bug 1049277 is fixed, then we can
+	  // stop setting the scrollbar pref here.
+          SpecialPowers.pushPrefEnv({ set: [[scrollbarPref, true]] },
                                     sendToGenerator);
           yield undefined;
 
           window.addEventListener("message", function(event) {
             if (typeof(event.data) == "string") {
               info(event.data);
             } else {
               sendToGenerator(event);
--- a/dom/workers/test/test_sharedWorker.html
+++ b/dom/workers/test/test_sharedWorker.html
@@ -12,68 +12,60 @@
   </head>
   <body>
     <p id="display"></p>
     <div id="content" style="display: none"></div>
     <pre id="test">
       <script class="testbody">
         "use strict";
 
-        const swPref = "dom.workers.sharedWorkers.enabled";
-
         const href = window.location.href;
         const filename = "sharedWorker_sharedWorker.js";
         const sentMessage = "ping";
         const errorFilename = href.substring(0, href.lastIndexOf("/") + 1) +
                               filename;
         const errorLine = 86;
         const errorColumn = 0;
 
-        if (!SpecialPowers.getBoolPref(swPref)) {
-          ok(!("SharedWorker" in window), "No SharedWorker without pref set");
-        }
-
-        SpecialPowers.pushPrefEnv({ set: [[swPref, true]] }, function() {
-          var worker = new SharedWorker(filename);
+        var worker = new SharedWorker(filename);
 
-          ok(worker instanceof SharedWorker, "Got SharedWorker instance");
-          ok(!("postMessage" in worker), "SharedWorker has no 'postMessage'");
-          ok(worker.port instanceof MessagePort,
-            "Shared worker has MessagePort");
+        ok(worker instanceof SharedWorker, "Got SharedWorker instance");
+        ok(!("postMessage" in worker), "SharedWorker has no 'postMessage'");
+        ok(worker.port instanceof MessagePort,
+          "Shared worker has MessagePort");
 
-          var receivedMessage;
-          var receivedError;
+        var receivedMessage;
+        var receivedError;
 
-          worker.port.onmessage = function(event) {
-            ok(event instanceof MessageEvent, "Got a MessageEvent");
-            ok(event.target === worker.port,
-               "MessageEvent has correct 'target' property");
-            is(event.data, sentMessage, "Got correct message");
-            ok(receivedMessage === undefined, "Haven't gotten message yet");
-            receivedMessage = event.data;
-            if (receivedError) {
-              SimpleTest.finish();
-            }
-          };
+        worker.port.onmessage = function(event) {
+          ok(event instanceof MessageEvent, "Got a MessageEvent");
+          ok(event.target === worker.port,
+             "MessageEvent has correct 'target' property");
+          is(event.data, sentMessage, "Got correct message");
+          ok(receivedMessage === undefined, "Haven't gotten message yet");
+          receivedMessage = event.data;
+          if (receivedError) {
+            SimpleTest.finish();
+          }
+        };
 
-          worker.onerror = function(event) {
-            ok(event instanceof ErrorEvent, "Got an ErrorEvent");
-            is(event.message, "Error: " + sentMessage, "Got correct error");
-            is(event.filename, errorFilename, "Got correct filename");
-            is(event.lineno, errorLine, "Got correct lineno");
-            is(event.colno, errorColumn, "Got correct column");
-            ok(receivedError === undefined, "Haven't gotten error yet");
-            receivedError = event.message;
-            event.preventDefault();
-            if (receivedMessage) {
-              SimpleTest.finish();
-            }
-          };
+        worker.onerror = function(event) {
+          ok(event instanceof ErrorEvent, "Got an ErrorEvent");
+          is(event.message, "Error: " + sentMessage, "Got correct error");
+          is(event.filename, errorFilename, "Got correct filename");
+          is(event.lineno, errorLine, "Got correct lineno");
+          is(event.colno, errorColumn, "Got correct column");
+          ok(receivedError === undefined, "Haven't gotten error yet");
+          receivedError = event.message;
+          event.preventDefault();
+          if (receivedMessage) {
+            SimpleTest.finish();
+          }
+        };
 
-          worker.port.postMessage(sentMessage);
-        });
+        worker.port.postMessage(sentMessage);
 
         SimpleTest.waitForExplicitFinish();
 
       </script>
     </pre>
   </body>
 </html>
--- a/dom/workers/test/test_sharedWorker_lifetime.html
+++ b/dom/workers/test/test_sharedWorker_lifetime.html
@@ -8,25 +8,23 @@
     <title>Test for MessagePort and SharedWorkers</title>
     <meta http-equiv="content-type" content="text/html; charset=UTF-8">
     <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
   </head>
   <body>
     <script class="testbody" type="text/javascript">
 
 var gced = false;
-SpecialPowers.pushPrefEnv({ set: [["dom.workers.sharedWorkers.enabled", true]]},
-function() {
-  var sw = new SharedWorker('sharedWorker_lifetime.js');
-  sw.port.onmessage = function(event) {
-    ok(gced, "The SW is still alive also after GC");
-    SimpleTest.finish();
-  }
 
-  sw = null;
-  SpecialPowers.forceGC();
-  gced = true;
-});
+var sw = new SharedWorker('sharedWorker_lifetime.js');
+sw.port.onmessage = function(event) {
+  ok(gced, "The SW is still alive also after GC");
+  SimpleTest.finish();
+}
+
+sw = null;
+SpecialPowers.forceGC();
+gced = true;
 
 SimpleTest.waitForExplicitFinish();
     </script>
   </body>
 </html>
--- a/dom/workers/test/test_sharedWorker_performance_user_timing.html
+++ b/dom/workers/test/test_sharedWorker_performance_user_timing.html
@@ -7,24 +7,21 @@
   <head>
     <title>Test for worker performance timing API</title>
     <meta http-equiv="content-type" content="text/html; charset=UTF-8">
     <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
   </head>
   <body>
     <script class="testbody" type="text/javascript">
 
-SpecialPowers.pushPrefEnv({ set: [["dom.workers.sharedWorkers.enabled", true]]},
-function() {
-  var sw = new SharedWorker('sharedworker_performance_user_timing.js');
-  sw.port.onmessage = function(event) {
-    if (event.data.type == 'finish') {
-      SimpleTest.finish();
-    } else if (event.data.type == 'status') {
-      ok(event.data.status, event.data.msg);
-    }
+var sw = new SharedWorker('sharedworker_performance_user_timing.js');
+sw.port.onmessage = function(event) {
+  if (event.data.type == 'finish') {
+    SimpleTest.finish();
+  } else if (event.data.type == 'status') {
+    ok(event.data.status, event.data.msg);
   }
-});
+}
 
 SimpleTest.waitForExplicitFinish();
     </script>
   </body>
 </html>
--- a/dom/workers/test/test_sharedWorker_ports.html
+++ b/dom/workers/test/test_sharedWorker_ports.html
@@ -7,36 +7,33 @@
   <head>
     <title>Test for MessagePort and SharedWorkers</title>
     <meta http-equiv="content-type" content="text/html; charset=UTF-8">
     <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
   </head>
   <body>
     <script class="testbody" type="text/javascript">
 
-SpecialPowers.pushPrefEnv({ set: [["dom.workers.sharedWorkers.enabled", true]]},
-function() {
-  var sw1 = new SharedWorker('sharedWorker_ports.js');
-  sw1.port.onmessage = function(event) {
-    if (event.data.type == "connected") {
-      ok(true, "The SharedWorker is alive.");
+var sw1 = new SharedWorker('sharedWorker_ports.js');
+sw1.port.onmessage = function(event) {
+  if (event.data.type == "connected") {
+    ok(true, "The SharedWorker is alive.");
+
+    var sw2 = new SharedWorker('sharedWorker_ports.js');
+    sw1.port.postMessage("Port from the main-thread!", [sw2.port]);
+    return;
+  }
 
-      var sw2 = new SharedWorker('sharedWorker_ports.js');
-      sw1.port.postMessage("Port from the main-thread!", [sw2.port]);
-      return;
-    }
+  if (event.data.type == "status") {
+    ok(event.data.test, event.data.msg);
+    return;
+  }
 
-    if (event.data.type == "status") {
-      ok(event.data.test, event.data.msg);
-      return;
-    }
-
-    if (event.data.type == "finish") {
-      SimpleTest.finish();
-    }
+  if (event.data.type == "finish") {
+    SimpleTest.finish();
   }
-});
+}
 
 SimpleTest.waitForExplicitFinish();
     </script>
   </body>
 </html>
 
--- a/dom/workers/test/test_sharedWorker_privateBrowsing.html
+++ b/dom/workers/test/test_sharedWorker_privateBrowsing.html
@@ -87,16 +87,15 @@ function runTest() {
   }
 
   var step = steps.shift();
   step();
 }
 
 SimpleTest.waitForExplicitFinish();
 SpecialPowers.pushPrefEnv({"set": [
-  ["dom.workers.sharedWorkers.enabled", true],
   ["browser.startup.page", 0],
   ["browser.startup.homepage_override.mstone", "ignore"],
 ]}, runTest);
 
 </script>
 </body>
 </html>
--- a/dom/workers/test/test_webSocket_sharedWorker.html
+++ b/dom/workers/test/test_webSocket_sharedWorker.html
@@ -8,26 +8,23 @@
   <title>Test for bug 1090183</title>
   <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
 </head>
 <body>
 
 <script class="testbody" type="text/javascript">
 
-SpecialPowers.pushPrefEnv({ set: [["dom.workers.sharedWorkers.enabled", true]]},
-function() {
-  var sw = new SharedWorker('webSocket_sharedWorker.js');
-  sw.port.onmessage = function(event) {
-    if (event.data.type == 'finish') {
-      SimpleTest.finish();
-    } else if (event.data.type == 'status') {
-      ok(event.data.status, event.data.msg);
-    }
+var sw = new SharedWorker('webSocket_sharedWorker.js');
+sw.port.onmessage = function(event) {
+  if (event.data.type == 'finish') {
+    SimpleTest.finish();
+  } else if (event.data.type == 'status') {
+    ok(event.data.status, event.data.msg);
   }
-});
+}
 
 SimpleTest.waitForExplicitFinish();
 
 </script>
 </pre>
 </body>
 </html>
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -141,19 +141,16 @@ pref("dom.select_events.enabled", true);
 pref("dom.select_events.enabled", false);
 #endif
 
 // Whether or not Web Workers are enabled.
 pref("dom.workers.enabled", true);
 // The number of workers per domain allowed to run concurrently.
 pref("dom.workers.maxPerDomain", 20);
 
-// Whether or not Shared Web Workers are enabled.
-pref("dom.workers.sharedWorkers.enabled", true);
-
 pref("dom.serviceWorkers.enabled", false);
 
 // Allow service workers to intercept network requests using the fetch event
 pref("dom.serviceWorkers.interception.enabled", false);
 
 // Allow service workers to intercept opaque (cross origin) responses
 pref("dom.serviceWorkers.interception.opaque.enabled", false);