Backed out changeset daeba572395d (bug 1541339) for xpcshell failures on test_dns_proxy_bypass.
authorCosmin Sabou <csabou@mozilla.com>
Fri, 26 Apr 2019 21:26:21 +0300
changeset 530382 c74119d8621b12139fa867595600e0c6e9d6af0c
parent 530381 db876eab4bf0644ebdc5cae9bf726a6695cdeea0
child 530383 38a860da33822840712ea52dc1fe2c07eab05287
push id11265
push userffxbld-merge
push dateMon, 13 May 2019 10:53:39 +0000
treeherdermozilla-beta@77e0fe8dbdd3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1541339
milestone68.0a1
backs outdaeba572395db4aa51076a85d1b908405152d50a
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
Backed out changeset daeba572395d (bug 1541339) for xpcshell failures on test_dns_proxy_bypass.
dom/push/PushServiceWebSocket.jsm
dom/websocket/WebSocket.cpp
netwerk/protocol/websocket/BaseWebSocketChannel.cpp
netwerk/protocol/websocket/BaseWebSocketChannel.h
netwerk/protocol/websocket/nsIWebSocketChannel.idl
netwerk/test/unit/test_dns_proxy_bypass.js
netwerk/test/unit/test_websocket_offline.js
--- a/dom/push/PushServiceWebSocket.jsm
+++ b/dom/push/PushServiceWebSocket.jsm
@@ -465,17 +465,16 @@ var PushServiceWebSocket = {
     let contractId = uri.scheme == "ws" ?
                      "@mozilla.org/network/protocol;1?name=ws" :
                      "@mozilla.org/network/protocol;1?name=wss";
     let socket = Cc[contractId].createInstance(Ci.nsIWebSocketChannel);
 
     socket.initLoadInfo(null, // aLoadingNode
                         Services.scriptSecurityManager.getSystemPrincipal(),
                         null, // aTriggeringPrincipal
-                        null, // aCookieSettings
                         Ci.nsILoadInfo.SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL,
                         Ci.nsIContentPolicy.TYPE_WEBSOCKET);
 
     return socket;
   },
 
   _beginWSSetup() {
     console.debug("beginWSSetup()");
--- a/dom/websocket/WebSocket.cpp
+++ b/dom/websocket/WebSocket.cpp
@@ -27,17 +27,16 @@
 #include "nsGlobalWindow.h"
 #include "nsIScriptGlobalObject.h"
 #include "nsIDOMWindow.h"
 #include "mozilla/dom/Document.h"
 #include "nsXPCOM.h"
 #include "nsIXPConnect.h"
 #include "nsContentUtils.h"
 #include "nsError.h"
-#include "nsICookieSettings.h"
 #include "nsIScriptObjectPrincipal.h"
 #include "nsIURL.h"
 #include "nsThreadUtils.h"
 #include "nsIPromptFactory.h"
 #include "nsIWindowWatcher.h"
 #include "nsIPrompt.h"
 #include "nsIStringBundle.h"
 #include "nsIConsoleService.h"
@@ -122,18 +121,17 @@ class WebSocketImpl final : public nsIIn
                 const nsACString& aScriptFile, uint32_t aScriptLine,
                 uint32_t aScriptColumn);
 
   nsresult AsyncOpen(nsIPrincipal* aPrincipal, uint64_t aInnerWindowID,
                      nsITransportProvider* aTransportProvider,
                      const nsACString& aNegotiatedExtensions);
 
   nsresult ParseURL(const nsAString& aURL);
-  nsresult InitializeConnection(nsIPrincipal* aPrincipal,
-                                nsICookieSettings* aCookieSettings);
+  nsresult InitializeConnection(nsIPrincipal* aPrincipal);
 
   // These methods when called can release the WebSocket object
   void FailConnection(uint16_t reasonCode,
                       const nsACString& aReasonString = EmptyCString());
   nsresult CloseConnection(uint16_t reasonCode,
                            const nsACString& aReasonString = EmptyCString());
   void Disconnect();
   void DisconnectInternal();
@@ -1090,28 +1088,27 @@ class ConnectRunnable final : public Web
 
  protected:
   virtual bool InitWithWindow(nsPIDOMWindowInner* aWindow) override {
     Document* doc = aWindow->GetExtantDoc();
     if (!doc) {
       return true;
     }
 
-    mConnectionFailed = NS_FAILED(mImpl->InitializeConnection(
-        doc->NodePrincipal(), mWorkerPrivate->CookieSettings()));
+    mConnectionFailed =
+        NS_FAILED(mImpl->InitializeConnection(doc->NodePrincipal()));
     return true;
   }
 
   virtual bool InitWindowless(WorkerPrivate* aTopLevelWorkerPrivate) override {
     MOZ_ASSERT(NS_IsMainThread());
     MOZ_ASSERT(aTopLevelWorkerPrivate && !aTopLevelWorkerPrivate->GetWindow());
 
     mConnectionFailed = NS_FAILED(
-        mImpl->InitializeConnection(aTopLevelWorkerPrivate->GetPrincipal(),
-                                    mWorkerPrivate->CookieSettings()));
+        mImpl->InitializeConnection(aTopLevelWorkerPrivate->GetPrincipal()));
     return true;
   }
 
   // Raw pointer. This worker runnable runs synchronously.
   WebSocketImpl* mImpl;
 
   bool mConnectionFailed;
 };
@@ -1256,23 +1253,21 @@ already_AddRefed<WebSocket> WebSocket::C
     aRv = webSocketImpl->Init(aGlobal.Context(), loadingPrincipal, principal,
                               !!aTransportProvider, aUrl, protocolArray,
                               EmptyCString(), 0, 0);
 
     if (NS_WARN_IF(aRv.Failed())) {
       return nullptr;
     }
 
-    nsCOMPtr<Document> doc = webSocket->GetDocumentIfCurrent();
-
     // the constructor should throw a SYNTAX_ERROR only if it fails to parse the
     // url parameter, so don't throw if InitializeConnection fails, and call
     // onerror/onclose asynchronously
-    connectionFailed = NS_FAILED(webSocketImpl->InitializeConnection(
-        principal, doc ? doc->CookieSettings() : nullptr));
+    connectionFailed =
+        NS_FAILED(webSocketImpl->InitializeConnection(principal));
   } else {
     WorkerPrivate* workerPrivate = GetCurrentThreadWorkerPrivate();
     MOZ_ASSERT(workerPrivate);
 
     unsigned lineno, column;
     JS::AutoFilename file;
     if (!JS::DescribeScriptedCaller(aGlobal.Context(), &file, &lineno,
                                     &column)) {
@@ -1678,18 +1673,17 @@ class nsAutoCloseWS final {
           nsIWebSocketChannel::CLOSE_INTERNAL_ERROR);
     }
   }
 
  private:
   RefPtr<WebSocketImpl> mWebSocketImpl;
 };
 
-nsresult WebSocketImpl::InitializeConnection(
-    nsIPrincipal* aPrincipal, nsICookieSettings* aCookieSettings) {
+nsresult WebSocketImpl::InitializeConnection(nsIPrincipal* aPrincipal) {
   AssertIsOnMainThread();
   MOZ_ASSERT(!mChannel, "mChannel should be null");
 
   nsCOMPtr<nsIWebSocketChannel> wsChannel;
   nsAutoCloseWS autoClose(this);
   nsresult rv;
 
   if (mSecure) {
@@ -1723,17 +1717,17 @@ nsresult WebSocketImpl::InitializeConnec
   mOriginDocument = nullptr;
 
   // The TriggeringPrincipal for websockets must always be a script.
   // Let's make sure that the doc's principal (if a doc exists)
   // and aPrincipal are same origin.
   MOZ_ASSERT(!doc || doc->NodePrincipal()->Equals(aPrincipal));
 
   rv = wsChannel->InitLoadInfo(doc, doc ? doc->NodePrincipal() : aPrincipal,
-                               aPrincipal, aCookieSettings,
+                               aPrincipal,
                                nsILoadInfo::SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL,
                                nsIContentPolicy::TYPE_WEBSOCKET);
   MOZ_ASSERT(NS_SUCCEEDED(rv));
 
   if (!mRequestedProtocolList.IsEmpty()) {
     rv = wsChannel->SetProtocol(mRequestedProtocolList);
     NS_ENSURE_SUCCESS(rv, rv);
   }
--- a/netwerk/protocol/websocket/BaseWebSocketChannel.cpp
+++ b/netwerk/protocol/websocket/BaseWebSocketChannel.cpp
@@ -198,24 +198,20 @@ BaseWebSocketChannel::SetPingTimeout(uin
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 BaseWebSocketChannel::InitLoadInfo(nsINode *aLoadingNode,
                                    nsIPrincipal *aLoadingPrincipal,
                                    nsIPrincipal *aTriggeringPrincipal,
-                                   nsICookieSettings* aCookieSettings,
                                    uint32_t aSecurityFlags,
                                    uint32_t aContentPolicyType) {
   mLoadInfo = new LoadInfo(aLoadingPrincipal, aTriggeringPrincipal,
                            aLoadingNode, aSecurityFlags, aContentPolicyType);
-  if (aCookieSettings) {
-    mLoadInfo->SetCookieSettings(aCookieSettings);
-  }
   return NS_OK;
 }
 
 NS_IMETHODIMP
 BaseWebSocketChannel::GetSerial(uint32_t *aSerial) {
   if (!aSerial) {
     return NS_ERROR_FAILURE;
   }
--- a/netwerk/protocol/websocket/BaseWebSocketChannel.h
+++ b/netwerk/protocol/websocket/BaseWebSocketChannel.h
@@ -51,17 +51,16 @@ class BaseWebSocketChannel : public nsIW
   NS_IMETHOD SetProtocol(const nsACString &aProtocol) override;
   NS_IMETHOD GetPingInterval(uint32_t *aSeconds) override;
   NS_IMETHOD SetPingInterval(uint32_t aSeconds) override;
   NS_IMETHOD GetPingTimeout(uint32_t *aSeconds) override;
   NS_IMETHOD SetPingTimeout(uint32_t aSeconds) override;
   NS_IMETHOD InitLoadInfo(nsINode *aLoadingNode,
                           nsIPrincipal *aLoadingPrincipal,
                           nsIPrincipal *aTriggeringPrincipal,
-                          nsICookieSettings* aCookieSettings,
                           uint32_t aSecurityFlags,
                           uint32_t aContentPolicyType) override;
   NS_IMETHOD GetSerial(uint32_t *aSerial) override;
   NS_IMETHOD SetSerial(uint32_t aSerial) override;
   NS_IMETHOD SetServerParameters(
       nsITransportProvider *aProvider,
       const nsACString &aNegotiatedExtensions) override;
 
--- a/netwerk/protocol/websocket/nsIWebSocketChannel.idl
+++ b/netwerk/protocol/websocket/nsIWebSocketChannel.idl
@@ -1,15 +1,14 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /* vim: set sw=4 ts=4 et 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/. */
 
-interface nsICookieSettings;
 interface nsIURI;
 interface nsIInterfaceRequestor;
 interface nsILoadGroup;
 interface nsIWebSocketListener;
 interface nsIInputStream;
 interface nsILoadInfo;
 interface nsIPrincipal;
 interface nsITransportProvider;
@@ -72,34 +71,32 @@ interface nsIWebSocketChannel : nsISuppo
      */
     [must_use] readonly attribute ACString extensions;
 
     /**
      * Init the WebSocketChannel with LoadInfo arguments.
      * @param aLoadingNode
      * @param aLoadingPrincipal
      * @param aTriggeringPrincipal
-     * @param aCookieSettings
      * @param aSecurityFlags
      * @param aContentPolicyType
      *        These will be used as values for the nsILoadInfo object on the
      *        created channel. For details, see nsILoadInfo in nsILoadInfo.idl
      * @return reference to the new nsIChannel object
      *
      * Keep in mind that URIs coming from a webpage should *never* use the
      * systemPrincipal as the loadingPrincipal.
      *
      * Please note, if you provide both a loadingNode and a loadingPrincipal,
      * then loadingPrincipal must be equal to loadingNode->NodePrincipal().
      * But less error prone is to just supply a loadingNode.
      */
      [must_use] void initLoadInfo(in Node aLoadingNode,
                                   in nsIPrincipal aLoadingPrincipal,
                                   in nsIPrincipal aTriggeringPrincipal,
-                                  in nsICookieSettings aCookieSettings,
                                   in unsigned long aSecurityFlags,
                                   in unsigned long aContentPolicyType);
 
     /**
      * Asynchronously open the websocket connection.  Received messages are fed
      * to the socket listener as they arrive.  The socket listener's methods
      * are called on the thread that calls asyncOpen and are not called until
      * after asyncOpen returns.  If asyncOpen returns successfully, the
--- a/netwerk/test/unit/test_dns_proxy_bypass.js
+++ b/netwerk/test/unit/test_dns_proxy_bypass.js
@@ -60,17 +60,16 @@ function run_test() {
   prefs.setIntPref("network.proxy.type", 1);
   prefs.setBoolPref("network.proxy.socks_remote_dns", true);
   var chan = Cc["@mozilla.org/network/protocol;1?name=ws"].
     createInstance(Ci.nsIWebSocketChannel);
 
   chan.initLoadInfo(null, // aLoadingNode
                     Services.scriptSecurityManager.getSystemPrincipal(),
                     null, // aTriggeringPrincipal
-                    null, // aCookieSettings
                     Ci.nsILoadInfo.SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL,
                     Ci.nsIContentPolicy.TYPE_WEBSOCKET);
 
   var uri = ioService.newURI(url);
   chan.asyncOpen(uri, url, 0, listener, null);
   do_test_pending();
 }
 
--- a/netwerk/test/unit/test_websocket_offline.js
+++ b/netwerk/test/unit/test_websocket_offline.js
@@ -31,17 +31,16 @@ function run_test() {
   Services.io.offline = true;
 
   try {
     chan = Cc["@mozilla.org/network/protocol;1?name=ws"].
       createInstance(Ci.nsIWebSocketChannel);
     chan.initLoadInfo(null, // aLoadingNode
                       Services.scriptSecurityManager.getSystemPrincipal(),
                       null, // aTriggeringPrincipal
-                      null, // aCookieSettings
                       Ci.nsILoadInfo.SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL,
                       Ci.nsIContentPolicy.TYPE_WEBSOCKET);
 
     var uri = Services.io.newURI(url);
     chan.asyncOpen(uri, url, 0, listener, null);
     do_test_pending();
   } catch (x) {
     dump("throwing " + x);