From a3db8af185e681b51db8dca91fd47af04724e5bd Mon Sep 17 00:00:00 2001 From: Bogdan Tara Date: Fri, 20 Mar 2020 14:03:28 +0200 Subject: [PATCH] Backed out 3 changesets (bug 1602832) for assertion failing on IOInterposer.cpp CLOSED TREE Backed out changeset 9123faab0d42 (bug 1602832) Backed out changeset 4c3764b3d7bc (bug 1602832) Backed out changeset 9c955a99c95d (bug 1602832) --- browser/components/doh/test/unit/xpcshell.ini | 2 -- modules/libpref/init/StaticPrefList.yaml | 10 +------ modules/libpref/init/all.js | 5 ++++ netwerk/base/nsIOService.cpp | 28 +++++++++++++++---- netwerk/base/nsIOService.h | 5 ++-- netwerk/protocol/http/nsHttpHandler.cpp | 4 +-- netwerk/test/unit/xpcshell.ini | 15 ++-------- taskcluster/ci/config.yml | 1 - taskcluster/ci/test/xpcshell.yml | 2 +- taskcluster/taskgraph/transforms/tests.py | 15 +--------- testing/xpcshell/runxpcshelltests.py | 3 -- .../test/xpcshell/xpcshell-common.ini | 1 - .../mediasniffer/test/unit/xpcshell.ini | 1 - tools/profiler/tests/xpcshell/xpcshell.ini | 2 +- 14 files changed, 36 insertions(+), 58 deletions(-) diff --git a/browser/components/doh/test/unit/xpcshell.ini b/browser/components/doh/test/unit/xpcshell.ini index 6ffac1696da4..f86b521cae8c 100644 --- a/browser/components/doh/test/unit/xpcshell.ini +++ b/browser/components/doh/test/unit/xpcshell.ini @@ -7,6 +7,4 @@ support-files = [test_DNSLookup.js] skip-if = debug # Bug 1617845 [test_LookupAggregator.js] -skip-if = socketprocess_networking [test_TRRRacer.js] -skip-if = socketprocess_networking diff --git a/modules/libpref/init/StaticPrefList.yaml b/modules/libpref/init/StaticPrefList.yaml index f185740da999..4e4bc4847b56 100644 --- a/modules/libpref/init/StaticPrefList.yaml +++ b/modules/libpref/init/StaticPrefList.yaml @@ -7349,7 +7349,7 @@ # ("network.http.network_access_on_socket_process.enabled"). # Changing these prefs requires a restart. - name: network.process.enabled - type: RelaxedAtomicBool + type: bool mirror: always #ifdef ANDROID value: false @@ -7361,14 +7361,6 @@ #endif #endif -# Perform all network access on the socket process. -# The pref requires "network.process.enabled" to be true. -# Changing these prefs requires a restart. -- name: network.http.network_access_on_socket_process.enabled - type: RelaxedAtomicBool - mirror: always - value: false - # Telemetry of traffic categories. Whether or not to enable HttpTrafficAnalyzer. - name: network.traffic_analyzer.enabled type: RelaxedAtomicBool diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js index 80aab155a7d1..b911c1200c89 100644 --- a/modules/libpref/init/all.js +++ b/modules/libpref/init/all.js @@ -1579,6 +1579,11 @@ pref("network.sts.max_time_for_pr_close_during_shutdown", 5000); // The value is expected in seconds. pref("network.sts.pollable_event_timeout", 6); +// Perform all network access on the socket process. +// The pref requires "network.sts.socket_process.enable" to be true. +// Changing these prefs requires a restart. +pref("network.http.network_access_on_socket_process.enabled", false); + // Enable/disable sni encryption. pref("network.security.esni.enabled", false); diff --git a/netwerk/base/nsIOService.cpp b/netwerk/base/nsIOService.cpp index 28919a0ff034..fdfb3c29a01b 100644 --- a/netwerk/base/nsIOService.cpp +++ b/netwerk/base/nsIOService.cpp @@ -278,6 +278,7 @@ nsresult nsIOService::Init() { observerService->AddObserver(this, NS_NETWORK_LINK_TOPIC, true); observerService->AddObserver(this, NS_NETWORK_ID_CHANGED_TOPIC, true); observerService->AddObserver(this, NS_WIDGET_WAKE_OBSERVER_TOPIC, true); + observerService->AddObserver(this, NS_PREFSERVICE_READ_TOPIC_ID, true); } else NS_WARNING("failed to get observer service"); @@ -451,6 +452,11 @@ nsresult nsIOService::LaunchSocketProcess() { return NS_OK; } + if (!XRE_IsE10sParentProcess()) { + LOG(("nsIOService skipping LaunchSocketProcess because e10s is disabled")); + return NS_OK; + } + if (!Preferences::GetBool("network.process.enabled", true)) { LOG(("nsIOService skipping LaunchSocketProcess because of the pref")); return NS_OK; @@ -496,15 +502,15 @@ static bool sUseSocketProcess = false; static bool sUseSocketProcessChecked = false; // static -bool nsIOService::UseSocketProcess(bool aCheckAgain) { - if (sUseSocketProcessChecked && !aCheckAgain) { +bool nsIOService::UseSocketProcess() { + if (sUseSocketProcessChecked) { return sUseSocketProcess; } sUseSocketProcessChecked = true; - if (StaticPrefs::network_process_enabled()) { - sUseSocketProcess = - StaticPrefs::network_http_network_access_on_socket_process_enabled(); + if (Preferences::GetBool("network.process.enabled")) { + sUseSocketProcess = Preferences::GetBool( + "network.http.network_access_on_socket_process.enabled", true); } return sUseSocketProcess; } @@ -1534,7 +1540,10 @@ nsIOService::Observe(nsISupports* subject, const char* topic, SetOffline(false); } } else if (!strcmp(topic, kProfileDoChange)) { - if (data && NS_LITERAL_STRING("startup").Equals(data)) { + if (!data) { + return NS_OK; + } + if (NS_LITERAL_STRING("startup").Equals(data)) { // Lazy initialization of network link service (see bug 620472) InitializeNetworkLinkService(); // Set up the initilization flag regardless the actuall result. @@ -1549,6 +1558,9 @@ nsIOService::Observe(nsISupports* subject, const char* topic, // before something calls into the cookie service. nsCOMPtr cookieServ = do_GetService(NS_COOKIESERVICE_CONTRACTID); + } else if (NS_LITERAL_STRING("xpcshell-do-get-profile").Equals(data)) { + // xpcshell doesn't read user profile. + LaunchSocketProcess(); } } else if (!strcmp(topic, NS_XPCOM_SHUTDOWN_OBSERVER_ID)) { // Remember we passed XPCOM shutdown notification to prevent any @@ -1587,6 +1599,10 @@ nsIOService::Observe(nsISupports* subject, const char* topic, // https://bugzilla.mozilla.org/show_bug.cgi?id=1152048#c19 nsCOMPtr wakeupNotifier = new nsWakeupNotifier(this); NS_DispatchToMainThread(wakeupNotifier); + } else if (!strcmp(topic, NS_PREFSERVICE_READ_TOPIC_ID)) { + // Launch socket process after we load user's pref. This is to make sure + // that socket process can get the latest prefs. + LaunchSocketProcess(); } return NS_OK; diff --git a/netwerk/base/nsIOService.h b/netwerk/base/nsIOService.h index 2c38c144d87a..2661583f445f 100644 --- a/netwerk/base/nsIOService.h +++ b/netwerk/base/nsIOService.h @@ -124,7 +124,7 @@ class nsIOService final : public nsIIOService, bool SocketProcessReady(); static void NotifySocketProcessPrefsChanged(const char* aName, void* aSelf); void NotifySocketProcessPrefsChanged(const char* aName); - static bool UseSocketProcess(bool aCheckAgain = false); + static bool UseSocketProcess(); bool IsSocketProcessLaunchComplete(); @@ -141,8 +141,6 @@ class nsIOService final : public nsIIOService, static void OnTLSPrefChange(const char* aPref, void* aSelf); - nsresult LaunchSocketProcess(); - private: // These shouldn't be called directly: // - construct using GetInstance @@ -193,6 +191,7 @@ class nsIOService final : public nsIIOService, nsIInterfaceRequestor* aCallbacks, bool aAnonymous); + nsresult LaunchSocketProcess(); void DestroySocketProcess(); private: diff --git a/netwerk/protocol/http/nsHttpHandler.cpp b/netwerk/protocol/http/nsHttpHandler.cpp index 952e04207d8e..92d402865400 100644 --- a/netwerk/protocol/http/nsHttpHandler.cpp +++ b/netwerk/protocol/http/nsHttpHandler.cpp @@ -445,8 +445,6 @@ nsresult nsHttpHandler::Init() { mIOService = new nsMainThreadPtrHolder( "nsHttpHandler::mIOService", service); - gIOService->LaunchSocketProcess(); - if (IsNeckoChild()) NeckoChild::InitNeckoChild(); InitUserAgentComponents(); @@ -596,7 +594,7 @@ nsresult nsHttpHandler::InitConnectionMgr() { return NS_OK; } - if (nsIOService::UseSocketProcess(true) && XRE_IsParentProcess()) { + if (nsIOService::UseSocketProcess() && XRE_IsParentProcess()) { if (!gIOService->SocketProcessReady()) { gIOService->CallOrWaitForSocketProcess( []() { Unused << gHttpHandler->InitConnectionMgr(); }); diff --git a/netwerk/test/unit/xpcshell.ini b/netwerk/test/unit/xpcshell.ini index 3cee26032cee..01a2be0572cf 100644 --- a/netwerk/test/unit/xpcshell.ini +++ b/netwerk/test/unit/xpcshell.ini @@ -181,7 +181,6 @@ skip-if = bits != 32 [test_compressappend.js] [test_content_encoding_gzip.js] [test_content_sniffer.js] -skip-if = socketprocess_networking [test_cookie_header.js] [test_cookiejars.js] [test_cookiejars_safebrowsing.js] @@ -258,7 +257,6 @@ skip-if = os == "win" [test_nojsredir.js] [test_offline_status.js] [test_origin.js] -skip-if = socketprocess_networking [test_anonymous-coalescing.js] [test_original_sent_received_head.js] [test_parse_content_type.js] @@ -306,12 +304,9 @@ fail-if = os == "android" # http2 unit tests require us to have node available to run the spdy and http2 server [test_http2.js] run-sequentially = node server exceptions dont replay well -skip-if = socketprocess_networking [test_altsvc.js] run-sequentially = node server exceptions dont replay well -skip-if = socketprocess_networking [test_speculative_connect.js] -skip-if = socketprocess_networking [test_standardurl.js] [test_standardurl_default_port.js] [test_standardurl_port.js] @@ -333,14 +328,12 @@ run-sequentially = Hardcoded hash value includes port 4444. [test_unix_domain.js] [test_addr_in_use_error.js] [test_about_networking.js] -skip-if = socketprocess_networking [test_ping_aboutnetworking.js] skip-if = (verify && (os == 'mac')) [test_referrer.js] [test_referrer_cross_origin.js] [test_referrer_policy.js] [test_predictor.js] -skip-if = socketprocess_networking [test_signature_extraction.js] skip-if = os != "win" [test_synthesized_response.js] @@ -352,7 +345,6 @@ skip-if = os != "win" firefox-appdir = browser [test_be_conservative_error_handling.js] firefox-appdir = browser -skip-if = socketprocess_networking [test_tls_server.js] firefox-appdir = browser [test_tls_server_multiple_clients.js] @@ -381,7 +373,6 @@ skip-if = appname == "thunderbird" [test_throttlequeue.js] [test_throttlechannel.js] [test_throttling.js] -skip-if = socketprocess_networking [test_separate_connections.js] [test_trackingProtection_annotateChannels.js] [test_race_cache_with_network.js] @@ -400,16 +391,14 @@ skip-if = (verify && (os == 'linux')) || (os == "android" && processor == "x86_6 run-sequentially = node server exceptions dont replay well [test_trr.js] # test_trr.js is not working in Thunderbird due to bug 1608066. -skip-if = appname == "thunderbird" || socketprocess_networking +skip-if = appname == "thunderbird" [test_ioservice.js] [test_substituting_protocol_handler.js] [test_proxyconnect.js] -skip-if = tsan || socketprocess_networking # Bug 1614708 +skip-if = tsan # Bug 1614708 [test_captive_portal_service.js] run-sequentially = node server exceptions dont replay well -skip-if = socketprocess_networking [test_esni_dns_fetch.js] -skip-if = socketprocess_networking [test_network_connectivity_service.js] [test_suspend_channel_on_authRetry.js] [test_suspend_channel_on_examine_merged_response.js] diff --git a/taskcluster/ci/config.yml b/taskcluster/ci/config.yml index cb1c1ecc812f..8400f5f4ebc1 100644 --- a/taskcluster/ci/config.yml +++ b/taskcluster/ci/config.yml @@ -84,7 +84,6 @@ treeherder: 'X': 'Xpcshell tests' 'X-1proc': 'Xpcshell tests, without e10s' 'X-fis': 'Xpcshell tests with fission enabled' - 'X-spi-nw': 'Xpcshell tests with networking on socket process' 'L10n': 'Localised Repacks' 'L10n-Rpk': 'Localized Repackaged Repacks' 'BM': 'Beetmover' diff --git a/taskcluster/ci/test/xpcshell.yml b/taskcluster/ci/test/xpcshell.yml index 497b25bf5049..d25b7ed37590 100644 --- a/taskcluster/ci/test/xpcshell.yml +++ b/taskcluster/ci/test/xpcshell.yml @@ -6,7 +6,7 @@ job-defaults: suite: xpcshell variants: by-test-platform: - linux1804-64/debug: ['fission', 'socketprocess_networking'] + linux1804-64/debug: ['fission'] default: ['fission'] target: by-test-platform: diff --git a/taskcluster/taskgraph/transforms/tests.py b/taskcluster/taskgraph/transforms/tests.py index 8e12ccc5dd11..ee3edc65fac3 100644 --- a/taskcluster/taskgraph/transforms/tests.py +++ b/taskcluster/taskgraph/transforms/tests.py @@ -184,19 +184,6 @@ TEST_VARIANTS = { ], } } - }, - 'socketprocess_networking': { - 'description': "{description} with networking on socket process enabled", - 'suffix': 'spi-nw', - 'merge': { - 'mozharness': { - 'extra-options': [ - '--setpref=network.process.enabled=true', - '--setpref=network.http.network_access_on_socket_process.enabled=true', - '--setpref=network.ssl_tokens_cache_enabled=true', - ], - } - } } } @@ -1239,7 +1226,7 @@ def ensure_spi_disabled_on_all_but_spi(config, tests): 'junit' not in test['suite'] and 'raptor' not in test['suite']) - if has_setpref and variant != 'socketprocess' and variant != 'socketprocess_networking': + if has_setpref and variant != 'socketprocess': test['mozharness']['extra-options'].append( '--setpref=media.peerconnection.mtransport_process=false') test['mozharness']['extra-options'].append( diff --git a/testing/xpcshell/runxpcshelltests.py b/testing/xpcshell/runxpcshelltests.py index 68ca6a7f1b0f..b9fd8aa8f646 100755 --- a/testing/xpcshell/runxpcshelltests.py +++ b/testing/xpcshell/runxpcshelltests.py @@ -1235,9 +1235,6 @@ class XPCShellTests(object): self.mozInfo['verify'] = options.get('verify', False) self.mozInfo['webrender'] = self.enable_webrender - self.mozInfo['socketprocess_networking'] = prefs.get( - 'network.http.network_access_on_socket_process.enabled', False) - mozinfo.update(self.mozInfo) return True diff --git a/toolkit/components/extensions/test/xpcshell/xpcshell-common.ini b/toolkit/components/extensions/test/xpcshell/xpcshell-common.ini index 31f0651be91d..4f61f7dbb36e 100644 --- a/toolkit/components/extensions/test/xpcshell/xpcshell-common.ini +++ b/toolkit/components/extensions/test/xpcshell/xpcshell-common.ini @@ -179,7 +179,6 @@ skip-if = os == "android" && debug [test_ext_webRequest_permission.js] skip-if = os == "android" && debug [test_ext_webRequest_requestSize.js] -skip-if = socketprocess_networking [test_ext_webRequest_responseBody.js] skip-if = os == "android" && debug [test_ext_webRequest_set_cookie.js] diff --git a/toolkit/components/mediasniffer/test/unit/xpcshell.ini b/toolkit/components/mediasniffer/test/unit/xpcshell.ini index ca82dea1a260..fbeea084607b 100644 --- a/toolkit/components/mediasniffer/test/unit/xpcshell.ini +++ b/toolkit/components/mediasniffer/test/unit/xpcshell.ini @@ -15,5 +15,4 @@ support-files = data/notags.mp3 [test_mediasniffer.js] -skip-if = socketprocess_networking [test_mediasniffer_ext.js] diff --git a/tools/profiler/tests/xpcshell/xpcshell.ini b/tools/profiler/tests/xpcshell/xpcshell.ini index 01bde1de6eeb..6979565eb06b 100644 --- a/tools/profiler/tests/xpcshell/xpcshell.ini +++ b/tools/profiler/tests/xpcshell/xpcshell.ini @@ -2,7 +2,7 @@ head = head.js support-files = ../shared-head.js -skip-if = toolkit == 'android' || socketprocess_networking +skip-if = toolkit == 'android' [test_active_configuration.js] [test_start.js]