Bug 1196514 - remove dom.messagechannel.enabled pref, r=smaug
authorAndrea Marchesini <amarchesini@mozilla.com>
Thu, 20 Aug 2015 08:34:38 +0100
changeset 258532 6c1d2577dcb305ca390917057343cafe404da7c5
parent 258531 8daef66bd87d37ca3eaf3bb0c60d7736e0344a80
child 258533 ffde34f25611ae50fdbe9aeb3fdee6b7931a059f
push id63954
push useramarchesini@mozilla.com
push dateThu, 20 Aug 2015 07:37:45 +0000
treeherdermozilla-inbound@6c1d2577dcb3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1196514
milestone43.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 1196514 - remove dom.messagechannel.enabled pref, r=smaug
dom/base/test/test_bug913761.html
dom/base/test/test_messagePort.html
dom/base/test/test_postMessages.html
dom/events/test/test_messageEvent.html
dom/media/tests/mochitest/head.js
dom/media/tests/mochitest/identity/test_fingerprints.html
dom/media/tests/mochitest/identity/test_idpproxy.html
dom/messagechannel/MessageChannel.cpp
dom/messagechannel/MessageChannel.h
dom/messagechannel/tests/mochitest.ini
dom/messagechannel/tests/test_messageChannel.html
dom/messagechannel/tests/test_messageChannel_any.html
dom/messagechannel/tests/test_messageChannel_bug1178076.html
dom/messagechannel/tests/test_messageChannel_cloning.html
dom/messagechannel/tests/test_messageChannel_forceClose.html
dom/messagechannel/tests/test_messageChannel_pingpong.html
dom/messagechannel/tests/test_messageChannel_post.html
dom/messagechannel/tests/test_messageChannel_pref.html
dom/messagechannel/tests/test_messageChannel_selfTransferring.html
dom/messagechannel/tests/test_messageChannel_sharedWorker.html
dom/messagechannel/tests/test_messageChannel_sharedWorker2.html
dom/messagechannel/tests/test_messageChannel_start.html
dom/messagechannel/tests/test_messageChannel_transferable.html
dom/messagechannel/tests/test_messageChannel_unshipped.html
dom/messagechannel/tests/test_messageChannel_worker.html
dom/webidl/MessageChannel.webidl
dom/workers/test/serviceworkers/test_installation_simple.html
modules/libpref/init/all.js
--- a/dom/base/test/test_bug913761.html
+++ b/dom/base/test/test_bug913761.html
@@ -9,35 +9,32 @@ https://bugzilla.mozilla.org/show_bug.cg
   <title>Test for Bug 913761 - basic support</title>
   <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
 </head>
 <body>
 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=913761">Mozilla Bug 913761</a>
 <script type="application/javascript">
 
-  function runTest() {
-    var transportChannel = new MessageChannel();
-    transportChannel.port1.onmessage = function (event) {
-      ok(true, 'Port Returned.');
-      var portToService = event.data.port;
-      portToService.onmessage = function (event) {
-        ok(true, "message received");
-        SimpleTest.finish();
-      };
-      portToService.postMessage('READY?');
-    }
-    
-    var serviceChannel = new MessageChannel();
-    serviceChannel.port1.onmessage = function (event) {
-      if (event.data == 'READY?') {
-        this.postMessage('READY!');
-      }
-    }
-    
-    transportChannel.port2.postMessage({ port: serviceChannel.port2}, [serviceChannel.port2]);
+  var transportChannel = new MessageChannel();
+  transportChannel.port1.onmessage = function (event) {
+    ok(true, 'Port Returned.');
+    var portToService = event.data.port;
+    portToService.onmessage = function (event) {
+      ok(true, "message received");
+      SimpleTest.finish();
+    };
+    portToService.postMessage('READY?');
   }
 
+  var serviceChannel = new MessageChannel();
+  serviceChannel.port1.onmessage = function (event) {
+    if (event.data == 'READY?') {
+      this.postMessage('READY!');
+    }
+  }
+
+  transportChannel.port2.postMessage({ port: serviceChannel.port2}, [serviceChannel.port2]);
+
   SimpleTest.waitForExplicitFinish();
-  SpecialPowers.pushPrefEnv({"set": [["dom.messageChannel.enabled", true]]}, runTest);
 </script>
 </body>
 </html>
--- a/dom/base/test/test_messagePort.html
+++ b/dom/base/test/test_messagePort.html
@@ -102,14 +102,14 @@ https://bugzilla.mozilla.org/show_bug.cg
       return;
     }
 
     var test = tests.shift();
     test();
   }
 
   SimpleTest.waitForExplicitFinish();
-  SpecialPowers.pushPrefEnv({"set": [["dom.messageChannel.enabled", true]]}, runTest);
+  runTest();
 
 </script>
 </body>
 </html>
 
--- a/dom/base/test/test_postMessages.html
+++ b/dom/base/test/test_postMessages.html
@@ -380,12 +380,12 @@ function next() {
     return;
   }
 
   var test = tests.shift();
   test();
 }
 
 SimpleTest.waitForExplicitFinish();
-SpecialPowers.pushPrefEnv({"set": [["dom.messageChannel.enabled", true]]}, next);
+next();
 </script>
 </body>
 </html>
--- a/dom/events/test/test_messageEvent.html
+++ b/dom/events/test/test_messageEvent.html
@@ -55,12 +55,12 @@ https://bugzilla.mozilla.org/show_bug.cg
     } catch(e) {
       ok(true, "Source has to be a window or a port");
     }
 
     SimpleTest.finish();
   }
 
   SimpleTest.waitForExplicitFinish();
-  SpecialPowers.pushPrefEnv({"set": [["dom.messageChannel.enabled", true]]}, runTest);
+  runTest();
   </script>
 </body>
 </html>
--- a/dom/media/tests/mochitest/head.js
+++ b/dom/media/tests/mochitest/head.js
@@ -230,17 +230,16 @@ function setupEnvironment() {
   }
 
   // Running as a Mochitest.
   SimpleTest.requestFlakyTimeout("WebRTC inherently depends on timeouts");
   window.finish = () => SimpleTest.finish();
   SpecialPowers.pushPrefEnv({
     'set': [
       ['canvas.capturestream.enabled', true],
-      ['dom.messageChannel.enabled', true],
       ['media.peerconnection.enabled', true],
       ['media.peerconnection.identity.enabled', true],
       ['media.peerconnection.identity.timeout', 120000],
       ['media.peerconnection.ice.stun_client_maximum_transmits', 14],
       ['media.peerconnection.ice.trickle_grace_period', 30000],
       ['media.navigator.permission.disabled', true],
       ['media.navigator.streams.fake', FAKE_ENABLED],
       ['media.getusermedia.screensharing.enabled', true],
--- a/dom/media/tests/mochitest/identity/test_fingerprints.html
+++ b/dom/media/tests/mochitest/identity/test_fingerprints.html
@@ -100,14 +100,13 @@ function testMultipleFingerprints() {
       pcStrict.close();
       pcDouble.close();
       SimpleTest.finish();
     });
 }
 
 SimpleTest.waitForExplicitFinish();
 SpecialPowers.pushPrefEnv({
-  set: [ [ 'dom.messageChannel.enabled', true ],
-         [ 'media.peerconnection.identity.enabled', true ] ]
+  set: [ [ 'media.peerconnection.identity.enabled', true ] ]
 }, testMultipleFingerprints);
 </script>
   </body>
 </html>
--- a/dom/media/tests/mochitest/identity/test_idpproxy.html
+++ b/dom/media/tests/mochitest/identity/test_idpproxy.html
@@ -157,14 +157,12 @@ function run_all_tests() {
       .catch(e => ok(false, test.name + ' failed: ' +
                      SpecialPowers.wrap(e).message + '\n' +
                      SpecialPowers.wrap(e).stack));
   }, Promise.resolve())
     .then(() => SimpleTest.finish());
 }
 
 SimpleTest.waitForExplicitFinish();
-SpecialPowers.pushPrefEnv({
-  set: [ [ 'dom.messageChannel.enabled', true ] ]
-}, run_all_tests);
+run_all_tests();
 </script>
   </body>
 </html>
--- a/dom/messagechannel/MessageChannel.cpp
+++ b/dom/messagechannel/MessageChannel.cpp
@@ -1,17 +1,16 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* 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/. */
 
 #include "MessageChannel.h"
 
-#include "mozilla/Preferences.h"
 #include "mozilla/dom/MessageChannelBinding.h"
 #include "mozilla/dom/MessagePort.h"
 #include "mozilla/dom/Navigator.h"
 #include "mozilla/dom/WorkerPrivate.h"
 #include "mozilla/dom/WorkerRunnable.h"
 #include "nsContentUtils.h"
 #include "nsIDocument.h"
 #include "nsIPrincipal.h"
@@ -25,159 +24,16 @@ NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(Me
 NS_IMPL_CYCLE_COLLECTING_ADDREF(MessageChannel)
 NS_IMPL_CYCLE_COLLECTING_RELEASE(MessageChannel)
 
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(MessageChannel)
   NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
   NS_INTERFACE_MAP_ENTRY(nsISupports)
 NS_INTERFACE_MAP_END
 
-namespace {
-bool gPrefInitialized = false;
-bool gPrefEnabled = false;
-
-bool
-CheckPermission(nsIPrincipal* aPrincipal, bool aCallerChrome)
-{
-  MOZ_ASSERT(NS_IsMainThread());
-
-  if (!gPrefInitialized) {
-    Preferences::AddBoolVarCache(&gPrefEnabled, "dom.messageChannel.enabled");
-    gPrefInitialized = true;
-  }
-
-  // Enabled by pref
-  if (gPrefEnabled) {
-    return true;
-  }
-
-  // Chrome callers are allowed.
-  if (aCallerChrome) {
-    return true;
-  }
-
-  nsCOMPtr<nsIURI> uri;
-  if (NS_FAILED(aPrincipal->GetURI(getter_AddRefs(uri))) || !uri) {
-    return false;
-  }
-
-  bool isResource = false;
-  if (NS_FAILED(uri->SchemeIs("resource", &isResource))) {
-    return false;
-  }
-
-  return isResource;
-}
-
-nsIPrincipal*
-GetPrincipalFromWorkerPrivate(workers::WorkerPrivate* aWorkerPrivate)
-{
-  MOZ_ASSERT(NS_IsMainThread());
-
-  nsIPrincipal* principal = aWorkerPrivate->GetPrincipal();
-  if (principal) {
-    return principal;
-  }
-
-  // Walk up to our containing page
-  workers::WorkerPrivate* wp = aWorkerPrivate;
-  while (wp->GetParent()) {
-    wp = wp->GetParent();
-  }
-
-  nsPIDOMWindow* window = wp->GetWindow();
-  if (!window) {
-    return nullptr;
-  }
-
-  nsIDocument* doc = window->GetExtantDoc();
-  if (!doc) {
-    return nullptr;
-  }
-
-  return doc->NodePrincipal();
-}
-
-// A WorkerMainThreadRunnable to synchronously dispatch the call of
-// CheckPermission() from the worker thread to the main thread.
-class CheckPermissionRunnable final : public workers::WorkerMainThreadRunnable
-{
-public:
-  bool mResult;
-  bool mCallerChrome;
-
-  explicit CheckPermissionRunnable(workers::WorkerPrivate* aWorkerPrivate)
-    : workers::WorkerMainThreadRunnable(aWorkerPrivate)
-    , mResult(false)
-    , mCallerChrome(false)
-  {
-    MOZ_ASSERT(aWorkerPrivate);
-    aWorkerPrivate->AssertIsOnWorkerThread();
-    mCallerChrome = aWorkerPrivate->UsesSystemPrincipal();
-  }
-
-protected:
-  virtual bool
-  MainThreadRun() override
-  {
-    MOZ_ASSERT(NS_IsMainThread());
-
-    nsIPrincipal* principal = GetPrincipalFromWorkerPrivate(mWorkerPrivate);
-    if (!principal) {
-      return true;
-    }
-
-    bool isNullPrincipal;
-    nsresult rv = principal->GetIsNullPrincipal(&isNullPrincipal);
-    if (NS_WARN_IF(NS_FAILED(rv))) {
-       return true;
-    }
-
-    if (NS_WARN_IF(isNullPrincipal)) {
-      return true;
-    }
-
-    mResult = CheckPermission(principal, mCallerChrome);
-    return true;
-  }
-};
-
-} // namespace
-
-/* static */ bool
-MessageChannel::Enabled(JSContext* aCx, JSObject* aGlobal)
-{
-  if (NS_IsMainThread()) {
-    JS::Rooted<JSObject*> global(aCx, aGlobal);
-
-    nsCOMPtr<nsPIDOMWindow> win = Navigator::GetWindowFromGlobal(global);
-    if (!win) {
-      return false;
-    }
-
-    nsIDocument* doc = win->GetExtantDoc();
-    if (!doc) {
-      return false;
-    }
-
-    return CheckPermission(doc->NodePrincipal(),
-                           nsContentUtils::IsCallerChrome());
-  }
-
-  workers::WorkerPrivate* workerPrivate =
-    workers::GetWorkerPrivateFromContext(aCx);
-  workerPrivate->AssertIsOnWorkerThread();
-
-  nsRefPtr<CheckPermissionRunnable> runnable =
-    new CheckPermissionRunnable(workerPrivate);
-  runnable->Dispatch(aCx);
-
-  return runnable->mResult;
-}
-
 MessageChannel::MessageChannel(nsPIDOMWindow* aWindow)
   : mWindow(aWindow)
 {
 }
 
 MessageChannel::~MessageChannel()
 {
 }
--- a/dom/messagechannel/MessageChannel.h
+++ b/dom/messagechannel/MessageChannel.h
@@ -23,19 +23,16 @@ class MessagePort;
 
 class MessageChannel final : public nsISupports
                            , public nsWrapperCache
 {
 public:
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
   NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(MessageChannel)
 
-  static bool Enabled(JSContext* aCx, JSObject* aGlobal);
-
-public:
   nsPIDOMWindow*
   GetParentObject() const
   {
     return mWindow;
   }
 
   virtual JSObject*
   WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
--- a/dom/messagechannel/tests/mochitest.ini
+++ b/dom/messagechannel/tests/mochitest.ini
@@ -9,17 +9,16 @@ support-files =
   sharedWorker_messageChannel.js
   sharedWorker2_messageChannel.js
   iframe_messageChannel_sharedWorker2.html
 
 [test_messageChannel.html]
 [test_messageChannel_cloning.html]
 [test_messageChannel_pingpong.html]
 [test_messageChannel_post.html]
-[test_messageChannel_pref.html]
 [test_messageChannel_start.html]
 [test_messageChannel_transferable.html]
 [test_messageChannel_unshipped.html]
 [test_messageChannel_worker.html]
 [test_messageChannel_selfTransferring.html]
 [test_messageChannel_sharedWorker.html]
 [test_messageChannel_sharedWorker2.html]
 [test_messageChannel_any.html]
--- a/dom/messagechannel/tests/test_messageChannel.html
+++ b/dom/messagechannel/tests/test_messageChannel.html
@@ -16,34 +16,28 @@ https://bugzilla.mozilla.org/show_bug.cg
 <div id="content" style="display: none">
   <iframe name="x" id="x"></iframe>
   <iframe name="y" id="y"></iframe>
 </div>
 <pre id="test">
 </pre>
   <script type="application/javascript">
 
-  function runTest() {
-    /** Test for Bug 677638 **/
-    var a = new MessageChannel();
-    ok(a, "MessageChannel created");
+  /** Test for Bug 677638 **/
+  var a = new MessageChannel();
+  ok(a, "MessageChannel created");
 
-    var port1 = a.port1;
-    ok(port1, "MessageChannel.port1 exists");
-    is(port1, a.port1, "MessageChannel.port1 is port1");
+  var port1 = a.port1;
+  ok(port1, "MessageChannel.port1 exists");
+  is(port1, a.port1, "MessageChannel.port1 is port1");
 
-    var port2 = a.port2;
-    ok(port2, "MessageChannel.port1 exists");
-    is(port2, a.port2, "MessageChannel.port2 is port2");
+  var port2 = a.port2;
+  ok(port2, "MessageChannel.port1 exists");
+  is(port2, a.port2, "MessageChannel.port2 is port2");
 
-    [ 'postMessage', 'start', 'close' ].forEach(function(e) {
-      ok(e in port1, "MessagePort1." + e + " exists");
-      ok(e in port2, "MessagePort2." + e + " exists");
-    });
+  [ 'postMessage', 'start', 'close' ].forEach(function(e) {
+    ok(e in port1, "MessagePort1." + e + " exists");
+    ok(e in port2, "MessagePort2." + e + " exists");
+  });
 
-    SimpleTest.finish();
-  }
-
-  SimpleTest.waitForExplicitFinish();
-  SpecialPowers.pushPrefEnv({"set": [["dom.messageChannel.enabled", true]]}, runTest);
   </script>
 </body>
 </html>
--- a/dom/messagechannel/tests/test_messageChannel_any.html
+++ b/dom/messagechannel/tests/test_messageChannel_any.html
@@ -104,12 +104,12 @@ function runTest() {
       next();
     }
   };
 
   worker.postMessage(mc.port2, [mc.port2]);
 }
 
 SimpleTest.waitForExplicitFinish();
-SpecialPowers.pushPrefEnv({"set": [["dom.messageChannel.enabled", true]]}, runTest);
+runTest();
   </script>
 </body>
 </html>
--- a/dom/messagechannel/tests/test_messageChannel_bug1178076.html
+++ b/dom/messagechannel/tests/test_messageChannel_bug1178076.html
@@ -27,12 +27,12 @@ https://bugzilla.mozilla.org/show_bug.cg
     // In this test we want to see if we leak a neutered port closing port1
     // and sending port2 to the same window. This operation doesn't involve IPC.
     var mc = new MessageChannel();
     mc.port1.close();
     postMessage(42, '*', [mc.port2]);
   }
 
   SimpleTest.waitForExplicitFinish();
-  SpecialPowers.pushPrefEnv({"set": [["dom.messageChannel.enabled", true]]}, runTest);
+  runTest();
   </script>
 </body>
 </html>
--- a/dom/messagechannel/tests/test_messageChannel_cloning.html
+++ b/dom/messagechannel/tests/test_messageChannel_cloning.html
@@ -59,12 +59,12 @@ https://bugzilla.mozilla.org/show_bug.cg
       return;
     }
 
     var test = tests.shift();
     test();
   }
 
   SimpleTest.waitForExplicitFinish();
-  SpecialPowers.pushPrefEnv({"set": [["dom.messageChannel.enabled", true]]}, runTest);
+  runTest();
   </script>
 </body>
 </html>
--- a/dom/messagechannel/tests/test_messageChannel_forceClose.html
+++ b/dom/messagechannel/tests/test_messageChannel_forceClose.html
@@ -11,26 +11,20 @@ https://bugzilla.mozilla.org/show_bug.cg
 </head>
 <body>
 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1176034">Mozilla Bug 1176034</a>
 <div id="content"></div>
 <pre id="test">
 </pre>
   <script type="application/javascript">
 
-  function runTests() {
-    var mc = new MessageChannel();
+  var mc = new MessageChannel();
 
-    try {
-      postMessage(42, "*", [ mc.port1, window ]);
-      ok(false, "Something went wrong.");
-    } catch(e) {
-      ok(true, "PostMessage should fail and we should not leak.");
-    }
-
-    SimpleTest.finish();
+  try {
+    postMessage(42, "*", [ mc.port1, window ]);
+    ok(false, "Something went wrong.");
+  } catch(e) {
+    ok(true, "PostMessage should fail and we should not leak.");
   }
 
-  SimpleTest.waitForExplicitFinish();
-  SpecialPowers.pushPrefEnv({"set": [["dom.messageChannel.enabled", true]]}, runTests);
   </script>
 </body>
 </html>
--- a/dom/messagechannel/tests/test_messageChannel_pingpong.html
+++ b/dom/messagechannel/tests/test_messageChannel_pingpong.html
@@ -66,12 +66,12 @@ https://bugzilla.mozilla.org/show_bug.cg
     div.appendChild(ifr);
 
     function iframeLoaded() {
       ifr.contentWindow.postMessage({ type: 'PORT', port: a.port2 }, '*', [a.port2]);
     }
   }
 
   SimpleTest.waitForExplicitFinish();
-  SpecialPowers.pushPrefEnv({"set": [["dom.messageChannel.enabled", true]]}, runTest);
+  runTest();
   </script>
 </body>
 </html>
--- a/dom/messagechannel/tests/test_messageChannel_post.html
+++ b/dom/messagechannel/tests/test_messageChannel_post.html
@@ -65,12 +65,12 @@ https://bugzilla.mozilla.org/show_bug.cg
         return;
       }
 
       a.port1.postMessage(tests[0]);
     }
   }
 
   SimpleTest.waitForExplicitFinish();
-  SpecialPowers.pushPrefEnv({"set": [["dom.messageChannel.enabled", true]]}, start);
+  start();
   </script>
 </body>
 </html>
deleted file mode 100644
--- a/dom/messagechannel/tests/test_messageChannel_pref.html
+++ /dev/null
@@ -1,42 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=677638
--->
-<head>
-  <meta charset="utf-8">
-  <title>Test for Bug 677638 - pref</title>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
-</head>
-<body>
-<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=677638">Mozilla Bug 677638</a>
-<div id="content"></div>
-<pre id="test">
-</pre>
-  <script type="application/javascript">
-
-  function runTest(what) {
-    var status;
-    try {
-      status = MessageChannel;
-      ok(what, "Should MessageChannel exist?");
-    } catch(e) {
-      ok(!what, "Should MessageChannel exist?");
-    }
-  }
-
-  SimpleTest.waitForExplicitFinish();
-
-  SpecialPowers.pushPrefEnv({"set": [["dom.messageChannel.enabled", false]]},
-  function() {
-    runTest(false);
-    SpecialPowers.pushPrefEnv({"set": [["dom.messageChannel.enabled", true]]},
-    function() {
-      runTest(true);
-      SimpleTest.finish();
-    });
-  });
-  </script>
-</body>
-</html>
--- a/dom/messagechannel/tests/test_messageChannel_selfTransferring.html
+++ b/dom/messagechannel/tests/test_messageChannel_selfTransferring.html
@@ -11,28 +11,23 @@ https://bugzilla.mozilla.org/show_bug.cg
 </head>
 <body>
 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=677638">Mozilla Bug 677638</a>
 <div id="content"></div>
 <pre id="test">
 </pre>
   <script type="application/javascript">
 
-function runTest() {
   var a = new MessageChannel();
 
   var status = false;
   try {
     a.port1.postMessage('foobar', [a.port1]);
   } catch(e) {
     status =true;
   }
 
   ok(status, "Transfering the same port should throw");
-  SimpleTest.finish();
-}
 
-SimpleTest.waitForExplicitFinish();
-SpecialPowers.pushPrefEnv({"set": [["dom.messageChannel.enabled", true]]}, runTest);
   </script>
 </body>
 </html>
 
--- a/dom/messagechannel/tests/test_messageChannel_sharedWorker.html
+++ b/dom/messagechannel/tests/test_messageChannel_sharedWorker.html
@@ -15,25 +15,22 @@ https://bugzilla.mozilla.org/show_bug.cg
 <div id="content" style="display: none">
   <iframe name="x" id="x"></iframe>
   <iframe name="y" id="y"></iframe>
 </div>
 <pre id="test">
 </pre>
   <script type="application/javascript">
 
-  function runTest() {
-    var a = new SharedWorker('sharedWorker_messageChannel.js');
-    a.port.onmessage = function(evt) {
-      is(evt.ports.length, 1, "We received a port.");
-      evt.ports[0].onmessage = function(e) {
-        is(e.data, 42, "Message reiceved back!");
-        SimpleTest.finish();
-      }
-      evt.ports[0].postMessage(42);
+  var a = new SharedWorker('sharedWorker_messageChannel.js');
+  a.port.onmessage = function(evt) {
+    is(evt.ports.length, 1, "We received a port.");
+    evt.ports[0].onmessage = function(e) {
+      is(e.data, 42, "Message reiceved back!");
+      SimpleTest.finish();
     }
+    evt.ports[0].postMessage(42);
   }
 
-  SpecialPowers.pushPrefEnv({"set": [["dom.messageChannel.enabled", true]]}, runTest);
   SimpleTest.waitForExplicitFinish();
   </script>
 </body>
 </html>
--- a/dom/messagechannel/tests/test_messageChannel_sharedWorker2.html
+++ b/dom/messagechannel/tests/test_messageChannel_sharedWorker2.html
@@ -10,28 +10,25 @@ https://bugzilla.mozilla.org/show_bug.cg
   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
 </head>
 <body>
   <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=677638">Mozilla Bug 677638</a>
   <div id="content"></div>
 
   <script type="application/javascript">
 
-  function runTest() {
-    var iframe = document.createElement('iframe');
-    iframe.setAttribute('src', "iframe_messageChannel_sharedWorker2.html");
-    document.getElementById('content').appendChild(iframe);
+  var iframe = document.createElement('iframe');
+  iframe.setAttribute('src', "iframe_messageChannel_sharedWorker2.html");
+  document.getElementById('content').appendChild(iframe);
 
-    var a = new SharedWorker('sharedWorker2_messageChannel.js');
-    a.port.onmessage = function(evt) {
-      is(evt.ports.length, 1, "We received a port.");
-      evt.ports[0].onmessage = function(e) {
-        is(e.data, "Hello from the iframe!", "Message reiceved from the iframe!");
-        SimpleTest.finish();
-      }
+  var a = new SharedWorker('sharedWorker2_messageChannel.js');
+  a.port.onmessage = function(evt) {
+    is(evt.ports.length, 1, "We received a port.");
+    evt.ports[0].onmessage = function(e) {
+      is(e.data, "Hello from the iframe!", "Message reiceved from the iframe!");
+      SimpleTest.finish();
     }
   }
 
-  SpecialPowers.pushPrefEnv({"set": [["dom.messageChannel.enabled", true]]}, runTest);
   SimpleTest.waitForExplicitFinish();
   </script>
 </body>
 </html>
--- a/dom/messagechannel/tests/test_messageChannel_start.html
+++ b/dom/messagechannel/tests/test_messageChannel_start.html
@@ -224,12 +224,12 @@ https://bugzilla.mozilla.org/show_bug.cg
     testAddEventListener2AndStart,
     testTimer,
     testAddEventListenerAndStartWrongOrder,
     testOnMessageClone,
   ];
 
   SimpleTest.waitForExplicitFinish();
   SimpleTest.requestFlakyTimeout("untriaged");
-  SpecialPowers.pushPrefEnv({"set": [["dom.messageChannel.enabled", true]]}, runTests);
+  runTests();
   </script>
 </body>
 </html>
--- a/dom/messagechannel/tests/test_messageChannel_transferable.html
+++ b/dom/messagechannel/tests/test_messageChannel_transferable.html
@@ -100,12 +100,12 @@ https://bugzilla.mozilla.org/show_bug.cg
       return;
     }
 
     var t = tests.shift();
     t();
   }
 
   SimpleTest.waitForExplicitFinish();
-  SpecialPowers.pushPrefEnv({"set": [["dom.messageChannel.enabled", true]]}, runTests);
+  runTests();
   </script>
 </body>
 </html>
--- a/dom/messagechannel/tests/test_messageChannel_unshipped.html
+++ b/dom/messagechannel/tests/test_messageChannel_unshipped.html
@@ -112,12 +112,12 @@ https://bugzilla.mozilla.org/show_bug.cg
       return;
     }
 
     var test = tests.shift();
     test();
   }
 
   SimpleTest.waitForExplicitFinish();
-  SpecialPowers.pushPrefEnv({"set": [["dom.messageChannel.enabled", true]]}, runTests);
+  runTests();
   </script>
 </body>
 </html>
--- a/dom/messagechannel/tests/test_messageChannel_worker.html
+++ b/dom/messagechannel/tests/test_messageChannel_worker.html
@@ -49,12 +49,12 @@ https://bugzilla.mozilla.org/show_bug.cg
         a.postMessage('a gift!', [ch.port2]);
       }
     }
 
     a.postMessage(tests.shift());
   }
 
   SimpleTest.waitForExplicitFinish();
-  SpecialPowers.pushPrefEnv({"set": [["dom.messageChannel.enabled", true]]}, runTests);
+  runTests();
   </script>
 </body>
 </html>
--- a/dom/webidl/MessageChannel.webidl
+++ b/dom/webidl/MessageChannel.webidl
@@ -2,14 +2,13 @@
 /* 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/.
  *
  * For more information on this interface, please see
  * http://www.whatwg.org/specs/web-apps/current-work/#channel-messaging
  */
 
-[Constructor, Func="MessageChannel::Enabled",
- Exposed=(Window,Worker)]
+[Constructor, Exposed=(Window,Worker)]
 interface MessageChannel {
   readonly attribute MessagePort port1;
   readonly attribute MessagePort port2;
 };
--- a/dom/workers/test/serviceworkers/test_installation_simple.html
+++ b/dom/workers/test/serviceworkers/test_installation_simple.html
@@ -197,17 +197,16 @@
         SimpleTest.finish();
       });
   }
 
   SimpleTest.waitForExplicitFinish();
   SpecialPowers.pushPrefEnv({"set": [
     ["dom.serviceWorkers.exemptFromPerDomainMax", true],
     ["dom.serviceWorkers.interception.enabled", true],
-    ["dom.messageChannel.enabled", true],
     ["dom.serviceWorkers.enabled", true],
     ["dom.serviceWorkers.testing.enabled", true],
     ["dom.caches.testing.enabled", true],
   ]}, runTest);
 </script>
 </pre>
 </body>
 </html>
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -4880,19 +4880,16 @@ pref("camera.control.low_memory_threshol
 
 // SystemUpdate API
 pref("dom.system_update.enabled", false);
 pref("dom.system_update.debug", false);
 
 // UDPSocket API
 pref("dom.udpsocket.enabled", false);
 
-// MessageChannel enabled by default.
-pref("dom.messageChannel.enabled", true);
-
 // Disable before keyboard events and after keyboard events by default.
 pref("dom.beforeAfterKeyboardEvent.enabled", false);
 
 // Presentation API
 pref("dom.presentation.enabled", false);
 pref("dom.presentation.tcp_server.debug", false);
 pref("dom.presentation.discovery.enabled", true);
 pref("dom.presentation.discoverable", false);