Bug 1269383 - Remove dom.server-events.enabled pref, r=smaug
authorAndrea Marchesini <amarchesini@mozilla.com>
Tue, 03 May 2016 10:21:54 +0200
changeset 295795 d7c74013b32fb3d1052dcde8604f1f8870eac08f
parent 295794 cc1443870a878e094751dbd0eee36c4cee8a23a4
child 295796 ba4bed3eebc703f0b910e860676a9eacedb9508a
push id76092
push useramarchesini@mozilla.com
push dateTue, 03 May 2016 08:22:31 +0000
treeherdermozilla-inbound@ac7cdaeb1967 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1269383
milestone49.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 1269383 - Remove dom.server-events.enabled pref, r=smaug
dom/base/EventSource.cpp
dom/base/EventSource.h
dom/base/test/test_EventSource_redirects.html
dom/base/test/test_bug338583.html
dom/webidl/EventSource.webidl
modules/libpref/init/all.js
--- a/dom/base/EventSource.cpp
+++ b/dom/base/EventSource.cpp
@@ -180,17 +180,17 @@ EventSource::Close()
   mReadyState = CLOSED;
 }
 
 nsresult
 EventSource::Init(nsISupports* aOwner,
                   const nsAString& aURL,
                   bool aWithCredentials)
 {
-  if (mReadyState != CONNECTING || !PrefEnabled()) {
+  if (mReadyState != CONNECTING) {
     return NS_ERROR_DOM_SECURITY_ERR;
   }
 
   nsCOMPtr<nsIScriptGlobalObject> sgo = do_QueryInterface(aOwner);
   NS_ENSURE_STATE(sgo);
   // XXXbz why are we checking this?  This doesn't match anything in the spec.
   nsCOMPtr<nsIScriptContext> scriptContext = sgo->GetContext();
   NS_ENSURE_STATE(scriptContext);
@@ -567,23 +567,16 @@ EventSource::GetInterface(const nsIID & 
     }
 
     return wwatch->GetPrompt(window, aIID, aResult);
   }
 
   return QueryInterface(aIID, aResult);
 }
 
-// static
-bool
-EventSource::PrefEnabled(JSContext* aCx, JSObject* aGlobal)
-{
-  return Preferences::GetBool("dom.server-events.enabled", false);
-}
-
 nsresult
 EventSource::GetBaseURI(nsIURI **aBaseURI)
 {
   NS_ENSURE_ARG_POINTER(aBaseURI);
 
   *aBaseURI = nullptr;
 
   nsCOMPtr<nsIURI> baseURI;
--- a/dom/base/EventSource.h
+++ b/dom/base/EventSource.h
@@ -88,19 +88,16 @@ public:
     return mReadyState;
   }
 
   IMPL_EVENT_HANDLER(open)
   IMPL_EVENT_HANDLER(message)
   IMPL_EVENT_HANDLER(error)
   void Close();
 
-  // Determine if preferences allow EventSource
-  static bool PrefEnabled(JSContext* aCx = nullptr, JSObject* aGlobal = nullptr);
-
   virtual void DisconnectFromOwner() override;
 
 protected:
   virtual ~EventSource();
 
   nsresult Init(nsISupports* aOwner,
                 const nsAString& aURL,
                 bool aWithCredentials);
--- a/dom/base/test/test_EventSource_redirects.html
+++ b/dom/base/test/test_EventSource_redirects.html
@@ -16,19 +16,16 @@ https://bugzilla.mozilla.org/show_bug.cg
 <p id="display"></p>
 <div id="content" style="display: none">
 
 </div>
 <pre id="test">
 <script class="testbody" type="text/javascript">
 
   function doTest(test_id) {
-    oldPrefVal = SpecialPowers.getBoolPref("dom.server-events.enabled");
-    ok(true, "here we go");
-
     source = new EventSource("eventsource_redirect.resource");
     ok(source.url == "http://mochi.test:8888/tests/dom/base/test/eventsource_redirect.resource", "Test failed.");
     ok(source.readyState == 0 || source.readyState == 1, "Test failed.");
 
     source.onopen = function (event) {
       ok(true, "opened");
     };
 
@@ -42,17 +39,15 @@ https://bugzilla.mozilla.org/show_bug.cg
       ok(false, "received onError: " + event);
       source.close();
       SimpleTest.finish();
     };
 
   }
 
   SimpleTest.waitForExplicitFinish();
-  addLoadEvent(function() {
-    SpecialPowers.pushPrefEnv({"set": [['dom.server-events.enabled', true]]}, doTest);
-  });
+  addLoadEvent(doTest);
 </script>
 </pre>
 
 </body>
 </html>
 
--- a/dom/base/test/test_bug338583.html
+++ b/dom/base/test/test_bug338583.html
@@ -616,17 +616,21 @@ https://bugzilla.mozilla.org/show_bug.cg
       document.getElementById('waitSpan').innerHTML = '';
       setTestHasFinished(test_id);
     }, parseInt(8000*stress_factor));
   }
 
   function doTest()
   {
     // Allow all cookies, then run the actual test
-    SpecialPowers.pushPrefEnv({"set": [["network.cookie.cookieBehavior", 0], ["dom.server-events.enabled", true]]}, function() { SpecialPowers.pushPermissions([{'type': 'systemXHR', 'allow': true, 'context': document}], doTestCallback);});
+    SpecialPowers.pushPrefEnv({"set": [["network.cookie.cookieBehavior", 0]]},
+    function() {
+      SpecialPowers.pushPermissions([{'type': 'systemXHR', 'allow': true, 'context': document}],
+        doTestCallback);
+    });
   }
 
   function doTestCallback()
   {
 
     // we get a good stress_factor by testing 10 setTimeouts and some float
     // arithmetic taking my machine as stress_factor==1 (time=589)
 
--- a/dom/webidl/EventSource.webidl
+++ b/dom/webidl/EventSource.webidl
@@ -6,18 +6,17 @@
  * The origin of this IDL file is
  * https://html.spec.whatwg.org/multipage/comms.html#the-eventsource-interface
  *
  * © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and
  * Opera Software ASA. You are granted a license to use, reproduce
  * and create derivative works of this document.
  */
 
-[Constructor(USVString url, optional EventSourceInit eventSourceInitDict),
- Func="mozilla::dom::EventSource::PrefEnabled"]
+[Constructor(USVString url, optional EventSourceInit eventSourceInitDict)]
 interface EventSource : EventTarget {
   [Constant]
   readonly attribute DOMString url;
   [Constant]
   readonly attribute boolean withCredentials;
 
   // ready state
   const unsigned short CONNECTING = 0;
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -1560,18 +1560,16 @@ pref("network.websocket.allowInsecureFro
 
 // by default we delay websocket reconnects to same host/port if previous
 // connection failed, per RFC 6455 section 7.2.3
 pref("network.websocket.delay-failed-reconnects", true);
 
 // </ws>
 
 // Server-Sent Events
-
-pref("dom.server-events.enabled", true);
 // Equal to the DEFAULT_RECONNECTION_TIME_VALUE value in nsEventSource.cpp
 pref("dom.server-events.default-reconnection-time", 5000); // in milliseconds
 
 // If false, remote JAR files that are served with a content type other than
 // application/java-archive or application/x-jar will not be opened
 // by the jar channel.
 pref("network.jar.open-unsafe-types", false);
 // If true, loading remote JAR files using the jar: protocol will be prevented.