From 6041076346d201157465010b4d334a43f72d8d01 Mon Sep 17 00:00:00 2001 From: Cosmin Sabou Date: Fri, 26 Apr 2019 21:26:21 +0300 Subject: [PATCH] Backed out changeset daeba572395d (bug 1541339) for xpcshell failures on test_dns_proxy_bypass. --- dom/push/PushServiceWebSocket.jsm | 1 - dom/websocket/WebSocket.cpp | 22 +++++++------------ .../websocket/BaseWebSocketChannel.cpp | 4 ---- .../protocol/websocket/BaseWebSocketChannel.h | 1 - .../websocket/nsIWebSocketChannel.idl | 3 --- netwerk/test/unit/test_dns_proxy_bypass.js | 1 - netwerk/test/unit/test_websocket_offline.js | 1 - 7 files changed, 8 insertions(+), 25 deletions(-) diff --git a/dom/push/PushServiceWebSocket.jsm b/dom/push/PushServiceWebSocket.jsm index 8f5d61d5085d..4e5e459dadeb 100644 --- a/dom/push/PushServiceWebSocket.jsm +++ b/dom/push/PushServiceWebSocket.jsm @@ -470,7 +470,6 @@ var PushServiceWebSocket = { socket.initLoadInfo(null, // aLoadingNode Services.scriptSecurityManager.getSystemPrincipal(), null, // aTriggeringPrincipal - null, // aCookieSettings Ci.nsILoadInfo.SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL, Ci.nsIContentPolicy.TYPE_WEBSOCKET); diff --git a/dom/websocket/WebSocket.cpp b/dom/websocket/WebSocket.cpp index ec80cec18339..e47b310362ad 100644 --- a/dom/websocket/WebSocket.cpp +++ b/dom/websocket/WebSocket.cpp @@ -32,7 +32,6 @@ #include "nsIXPConnect.h" #include "nsContentUtils.h" #include "nsError.h" -#include "nsICookieSettings.h" #include "nsIScriptObjectPrincipal.h" #include "nsIURL.h" #include "nsThreadUtils.h" @@ -127,8 +126,7 @@ class WebSocketImpl final : public nsIInterfaceRequestor, 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, @@ -1095,8 +1093,8 @@ class ConnectRunnable final : public WebSocketMainThreadRunnable { return true; } - mConnectionFailed = NS_FAILED(mImpl->InitializeConnection( - doc->NodePrincipal(), mWorkerPrivate->CookieSettings())); + mConnectionFailed = + NS_FAILED(mImpl->InitializeConnection(doc->NodePrincipal())); return true; } @@ -1105,8 +1103,7 @@ class ConnectRunnable final : public WebSocketMainThreadRunnable { MOZ_ASSERT(aTopLevelWorkerPrivate && !aTopLevelWorkerPrivate->GetWindow()); mConnectionFailed = NS_FAILED( - mImpl->InitializeConnection(aTopLevelWorkerPrivate->GetPrincipal(), - mWorkerPrivate->CookieSettings())); + mImpl->InitializeConnection(aTopLevelWorkerPrivate->GetPrincipal())); return true; } @@ -1261,13 +1258,11 @@ already_AddRefed WebSocket::ConstructorCommon( return nullptr; } - nsCOMPtr 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); @@ -1683,8 +1678,7 @@ class nsAutoCloseWS final { RefPtr mWebSocketImpl; }; -nsresult WebSocketImpl::InitializeConnection( - nsIPrincipal* aPrincipal, nsICookieSettings* aCookieSettings) { +nsresult WebSocketImpl::InitializeConnection(nsIPrincipal* aPrincipal) { AssertIsOnMainThread(); MOZ_ASSERT(!mChannel, "mChannel should be null"); @@ -1728,7 +1722,7 @@ nsresult WebSocketImpl::InitializeConnection( 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)); diff --git a/netwerk/protocol/websocket/BaseWebSocketChannel.cpp b/netwerk/protocol/websocket/BaseWebSocketChannel.cpp index 01d994dc9d6f..f11165e9055d 100644 --- a/netwerk/protocol/websocket/BaseWebSocketChannel.cpp +++ b/netwerk/protocol/websocket/BaseWebSocketChannel.cpp @@ -203,14 +203,10 @@ 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; } diff --git a/netwerk/protocol/websocket/BaseWebSocketChannel.h b/netwerk/protocol/websocket/BaseWebSocketChannel.h index 6de7e8c66584..f1adde12151c 100644 --- a/netwerk/protocol/websocket/BaseWebSocketChannel.h +++ b/netwerk/protocol/websocket/BaseWebSocketChannel.h @@ -56,7 +56,6 @@ class BaseWebSocketChannel : public nsIWebSocketChannel, 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; diff --git a/netwerk/protocol/websocket/nsIWebSocketChannel.idl b/netwerk/protocol/websocket/nsIWebSocketChannel.idl index 88f6dcf02a22..25b4688e97b4 100644 --- a/netwerk/protocol/websocket/nsIWebSocketChannel.idl +++ b/netwerk/protocol/websocket/nsIWebSocketChannel.idl @@ -4,7 +4,6 @@ * 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; @@ -77,7 +76,6 @@ interface nsIWebSocketChannel : nsISupports * @param aLoadingNode * @param aLoadingPrincipal * @param aTriggeringPrincipal - * @param aCookieSettings * @param aSecurityFlags * @param aContentPolicyType * These will be used as values for the nsILoadInfo object on the @@ -94,7 +92,6 @@ interface nsIWebSocketChannel : nsISupports [must_use] void initLoadInfo(in Node aLoadingNode, in nsIPrincipal aLoadingPrincipal, in nsIPrincipal aTriggeringPrincipal, - in nsICookieSettings aCookieSettings, in unsigned long aSecurityFlags, in unsigned long aContentPolicyType); diff --git a/netwerk/test/unit/test_dns_proxy_bypass.js b/netwerk/test/unit/test_dns_proxy_bypass.js index c1089e4015f2..38daee1e758d 100644 --- a/netwerk/test/unit/test_dns_proxy_bypass.js +++ b/netwerk/test/unit/test_dns_proxy_bypass.js @@ -65,7 +65,6 @@ function run_test() { chan.initLoadInfo(null, // aLoadingNode Services.scriptSecurityManager.getSystemPrincipal(), null, // aTriggeringPrincipal - null, // aCookieSettings Ci.nsILoadInfo.SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL, Ci.nsIContentPolicy.TYPE_WEBSOCKET); diff --git a/netwerk/test/unit/test_websocket_offline.js b/netwerk/test/unit/test_websocket_offline.js index 7cc35ef2dcd3..0460bde5215a 100644 --- a/netwerk/test/unit/test_websocket_offline.js +++ b/netwerk/test/unit/test_websocket_offline.js @@ -36,7 +36,6 @@ function run_test() { chan.initLoadInfo(null, // aLoadingNode Services.scriptSecurityManager.getSystemPrincipal(), null, // aTriggeringPrincipal - null, // aCookieSettings Ci.nsILoadInfo.SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL, Ci.nsIContentPolicy.TYPE_WEBSOCKET);