Bug 1219523 - Remove the "dom.workers.latestJSVersion" pref. r?baku draft
authorMasatoshi Kimura <VYV03354@nifty.ne.jp>
Sun, 12 Feb 2017 13:37:38 +0900
changeset 482354 4ba99a0a339f3dfef25c404f25a491f10dfbcb7e
parent 482353 09ef6a4f41186ea6951830d1506f741005dcc46f
child 545408 84fd7f7d4810ae6d206c223271e4955eb6e778be
push id45053
push userVYV03354@nifty.ne.jp
push dateSun, 12 Feb 2017 04:45:50 +0000
reviewersbaku
bugs1219523
milestone54.0a1
Bug 1219523 - Remove the "dom.workers.latestJSVersion" pref. r?baku MozReview-Commit-ID: 92fCMCLTxRp
dom/indexedDB/test/helpers.js
dom/workers/RuntimeService.cpp
dom/workers/RuntimeService.h
dom/workers/WorkerPrefs.h
dom/workers/test/jsversion_worker.js
dom/workers/test/mochitest.ini
dom/workers/test/test_jsversion.html
--- a/dom/indexedDB/test/helpers.js
+++ b/dom/indexedDB/test/helpers.js
@@ -71,17 +71,16 @@ function* testHarnessSteps() {
   info("Pushing preferences");
 
   SpecialPowers.pushPrefEnv(
     {
       "set": [
         ["dom.indexedDB.testing", true],
         ["dom.indexedDB.experimental", true],
         ["dom.archivereader.enabled", true],
-        ["dom.workers.latestJSVersion", true],
         ["javascript.options.wasm", true]
       ]
     },
     nextTestHarnessStep
   );
   yield undefined;
 
   info("Pushing permissions");
--- a/dom/workers/RuntimeService.cpp
+++ b/dom/workers/RuntimeService.cpp
@@ -2762,26 +2762,16 @@ RuntimeService::WorkerPrefChanged(const 
   }
 
   RuntimeService* rts = RuntimeService::GetService();
   if (rts) {
     rts->UpdateAllWorkerPreference(key, sDefaultPreferences[key]);
   }
 }
 
-void
-RuntimeService::JSVersionChanged(const char* /* aPrefName */, void* /* aClosure */)
-{
-  AssertIsOnMainThread();
-
-  bool useLatest = Preferences::GetBool("dom.workers.latestJSVersion", false);
-  JS::CompartmentOptions& options = sDefaultJSSettings.content.compartmentOptions;
-  options.behaviors().setVersion(useLatest ? JSVERSION_LATEST : JSVERSION_DEFAULT);
-}
-
 bool
 LogViolationDetailsRunnable::MainThreadRun()
 {
   AssertIsOnMainThread();
 
   nsIContentSecurityPolicy* csp = mWorkerPrivate->GetCSP();
   if (csp) {
     NS_NAMED_LITERAL_STRING(scriptSample,
--- a/dom/workers/RuntimeService.h
+++ b/dom/workers/RuntimeService.h
@@ -266,19 +266,16 @@ private:
   ScheduleWorker(WorkerPrivate* aWorkerPrivate);
 
   static void
   ShutdownIdleThreads(nsITimer* aTimer, void* aClosure);
 
   static void
   WorkerPrefChanged(const char* aPrefName, void* aClosure);
 
-  static void
-  JSVersionChanged(const char* aPrefName, void* aClosure);
-
   nsresult
   CreateSharedWorkerFromLoadInfo(JSContext* aCx,
                                  WorkerLoadInfo* aLoadInfo,
                                  const nsAString& aScriptURL,
                                  const nsACString& aName,
                                  SharedWorker** aSharedWorker);
 };
 
--- a/dom/workers/WorkerPrefs.h
+++ b/dom/workers/WorkerPrefs.h
@@ -35,16 +35,15 @@ WORKER_SIMPLE_PREF("dom.serviceWorkers.e
 WORKER_SIMPLE_PREF("dom.serviceWorkers.testing.enabled", ServiceWorkersTestingEnabled, SERVICEWORKERS_TESTING_ENABLED)
 WORKER_SIMPLE_PREF("dom.serviceWorkers.openWindow.enabled", OpenWindowEnabled, OPEN_WINDOW_ENABLED)
 WORKER_SIMPLE_PREF("dom.storageManager.enabled", StorageManagerEnabled, STORAGEMANAGER_ENABLED)
 WORKER_SIMPLE_PREF("dom.push.enabled", PushEnabled, PUSH_ENABLED)
 WORKER_SIMPLE_PREF("dom.requestcontext.enabled", RequestContextEnabled, REQUESTCONTEXT_ENABLED)
 WORKER_SIMPLE_PREF("gfx.offscreencanvas.enabled", OffscreenCanvasEnabled, OFFSCREENCANVAS_ENABLED)
 WORKER_SIMPLE_PREF("dom.webkitBlink.dirPicker.enabled", WebkitBlinkDirectoryPickerEnabled, DOM_WEBKITBLINK_DIRPICKER_WEBKITBLINK)
 WORKER_SIMPLE_PREF("dom.netinfo.enabled", NetworkInformationEnabled, NETWORKINFORMATION_ENABLED)
-WORKER_PREF("dom.workers.latestJSVersion", JSVersionChanged)
 WORKER_PREF("intl.accept_languages", PrefLanguagesChanged)
 WORKER_PREF("general.appname.override", AppNameOverrideChanged)
 WORKER_PREF("general.appversion.override", AppVersionOverrideChanged)
 WORKER_PREF("general.platform.override", PlatformOverrideChanged)
 #ifdef JS_GC_ZEAL
 WORKER_PREF("dom.workers.options.gcZeal", LoadGCZealOptions)
 #endif
deleted file mode 100644
--- a/dom/workers/test/jsversion_worker.js
+++ /dev/null
@@ -1,14 +0,0 @@
-onmessage = function(evt) {
-  if (evt.data != 0) {
-    var worker = new Worker('jsversion_worker.js');
-    worker.onmessage = function(evt) {
-      postMessage(evt.data);
-    }
-
-    worker.postMessage(evt.data - 1);
-    return;
-  }
-
-  let foo = 'bar';
-  postMessage(true);
-}
--- a/dom/workers/test/mochitest.ini
+++ b/dom/workers/test/mochitest.ini
@@ -28,17 +28,16 @@ support-files =
   importScripts_mixedcontent.html
   importScripts_worker.js
   importScripts_worker_imported1.js
   importScripts_worker_imported2.js
   importScripts_worker_imported3.js
   importScripts_worker_imported4.js
   instanceof_worker.js
   json_worker.js
-  jsversion_worker.js
   loadEncoding_worker.js
   location_worker.js
   longThread_worker.js
   multi_sharedWorker_frame.html
   multi_sharedWorker_sharedWorker.js
   navigator_languages_worker.js
   navigator_worker.js
   newError_worker.js
@@ -159,17 +158,16 @@ skip-if = true # bug 1176225
 [test_errorwarning.html]
 [test_eventDispatch.html]
 [test_fibonacci.html]
 [test_importScripts.html]
 [test_importScripts_mixedcontent.html]
 tags = mcb
 [test_instanceof.html]
 [test_json.html]
-[test_jsversion.html]
 [test_loadEncoding.html]
 [test_loadError.html]
 [test_location.html]
 [test_longThread.html]
 [test_multi_sharedWorker.html]
 [test_multi_sharedWorker_lifetimes.html]
 [test_navigator.html]
 [test_navigator_languages.html]
deleted file mode 100644
--- a/dom/workers/test/test_jsversion.html
+++ /dev/null
@@ -1,68 +0,0 @@
-<!--
-  Any copyright is dedicated to the Public Domain.
-  http://creativecommons.org/publicdomain/zero/1.0/
--->
-<!DOCTYPE HTML>
-<html>
-<head>
-  <title>Test for JSVersion in workers - Bug 487070</title>
-  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <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">
-<script class="testbody" language="javascript">
-
-  var gExpectedError = false;
-
-  onerror = function(evt) {
-    ok(gExpectedError, "Error expected!");
-    runTest();
-  }
-
-  function doMagic() {
-    var worker = new Worker('jsversion_worker.js');
-    worker.onmessage = function(evt) {
-      ok(evt.data, 'All the tests passed');
-      runTest();
-    }
-    worker.postMessage(1);
-  }
-
-  var tests = [
-    // No custom version
-    function() {
-      gExpectedError = true;
-      SpecialPowers.pushPrefEnv({"set":[['dom.workers.latestJSVersion', false]]},
-                                function() { doMagic(true); });
-    },
-
-    // Enable latest JS Version
-    function() {
-      gExpectedError = false;
-      SpecialPowers.pushPrefEnv({"set":[['dom.workers.latestJSVersion', true]]},
-                                function() { doMagic(false); });
-    }
-  ];
-
-  function runTest() {
-    if (!tests.length) {
-      SimpleTest.finish();
-      return;
-    }
-
-    var test = tests.shift();
-    test();
-  }
-
-  SimpleTest.waitForExplicitFinish();
-  runTest();
-
-</script>
-</pre>
-</body>
-</html>