mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-23 12:51:06 +00:00
Backed out 3 changesets (bug 1925014) for causing xpcshell fails @ test_http3.js. CLOSED TREE
Backed out changeset e09635a1801e (bug 1925014) Backed out changeset 15c56a7463ec (bug 1925014) Backed out changeset 5df6b73dcb6c (bug 1925014)
This commit is contained in:
parent
1a63c3196f
commit
f890140948
@ -14008,19 +14008,6 @@
|
||||
mirror: always
|
||||
rust: true
|
||||
|
||||
# When true, HTTP/3 will be disabled when third party roots are found.
|
||||
- name: network.http.http3.disable_when_third_party_roots_found
|
||||
type: RelaxedAtomicBool
|
||||
value: true
|
||||
mirror: always
|
||||
|
||||
# Only used for testing purposes. In automation, this value is used to override
|
||||
# the result of third party roots check.
|
||||
- name: network.http.http3.has_third_party_roots_found_in_automation
|
||||
type: RelaxedAtomicBool
|
||||
value: false
|
||||
mirror: always
|
||||
|
||||
# When true, a http request will be upgraded to https when HTTPS RR is
|
||||
# available.
|
||||
- name: network.dns.upgrade_with_https_rr
|
||||
|
@ -2777,7 +2777,6 @@ void net_EnsurePSMInit() {
|
||||
|
||||
DebugOnly<bool> rv = EnsureNSSInitializedChromeOrContent();
|
||||
MOZ_ASSERT(rv);
|
||||
nsHttpHandler::CheckThirdPartyRoots();
|
||||
}
|
||||
|
||||
bool NS_IsAboutBlank(nsIURI* uri) {
|
||||
|
@ -212,8 +212,6 @@ child:
|
||||
async UnblockUntrustedModulesThread();
|
||||
#endif // defined(XP_WIN)
|
||||
|
||||
async HasThirdPartyRoots(bool aResult);
|
||||
|
||||
both:
|
||||
async PDNSRequest(nsCString hostName, nsCString trrServer, int32_t port,
|
||||
uint16_t type, OriginAttributes originAttributes,
|
||||
|
@ -835,11 +835,5 @@ SocketProcessChild::GetIPCClientCertsActor() {
|
||||
return actor.forget();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult SocketProcessChild::RecvHasThirdPartyRoots(
|
||||
const bool& aResult) {
|
||||
nsHttpHandler::SetHasThirdPartyRoots(aResult);
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
} // namespace net
|
||||
} // namespace mozilla
|
||||
|
@ -156,8 +156,6 @@ class SocketProcessChild final : public PSocketProcessChild {
|
||||
already_AddRefed<psm::IPCClientCertsChild> GetIPCClientCertsActor();
|
||||
void CloseIPCClientCertsActor();
|
||||
|
||||
mozilla::ipc::IPCResult RecvHasThirdPartyRoots(const bool& aResult);
|
||||
|
||||
protected:
|
||||
friend class SocketProcessImpl;
|
||||
~SocketProcessChild();
|
||||
|
@ -57,7 +57,6 @@
|
||||
#include "nsSocketTransportService2.h"
|
||||
#include "nsIOService.h"
|
||||
#include "nsISupportsPrimitives.h"
|
||||
#include "nsIX509CertDB.h"
|
||||
#include "nsIXULRuntime.h"
|
||||
#include "nsCharSeparatedTokenizer.h"
|
||||
#include "nsRFPService.h"
|
||||
@ -190,42 +189,6 @@ static bool IsRunningUnderUbuntuSnap() {
|
||||
|
||||
StaticRefPtr<nsHttpHandler> gHttpHandler;
|
||||
|
||||
// Assume we have third party roots. This will be updated after
|
||||
// CheckThirdPartyRoots() is called.
|
||||
static Atomic<bool, Relaxed> sHasThirdPartyRoots(true);
|
||||
static Atomic<bool, Relaxed> sHasThirdPartyRootsChecked(false);
|
||||
|
||||
class HasThirdPartyRootsCallback : public nsIAsyncBoolCallback {
|
||||
public:
|
||||
NS_DECL_THREADSAFE_ISUPPORTS
|
||||
NS_DECL_NSIASYNCBOOLCALLBACK
|
||||
|
||||
HasThirdPartyRootsCallback() = default;
|
||||
|
||||
private:
|
||||
virtual ~HasThirdPartyRootsCallback() = default;
|
||||
};
|
||||
|
||||
NS_IMPL_ISUPPORTS(HasThirdPartyRootsCallback, nsIAsyncBoolCallback)
|
||||
|
||||
NS_IMETHODIMP
|
||||
HasThirdPartyRootsCallback::OnResult(bool aResult) {
|
||||
sHasThirdPartyRoots =
|
||||
(xpc::IsInAutomation() || PR_GetEnv("XPCSHELL_TEST_PROFILE_DIR"))
|
||||
? StaticPrefs::
|
||||
network_http_http3_has_third_party_roots_found_in_automation()
|
||||
: aResult;
|
||||
LOG(("nsHttpHandler::sHasThirdPartyRoots:%d", (bool)sHasThirdPartyRoots));
|
||||
if (nsIOService::UseSocketProcess() && XRE_IsParentProcess()) {
|
||||
RefPtr<SocketProcessParent> socketParent =
|
||||
SocketProcessParent::GetSingleton();
|
||||
if (socketParent) {
|
||||
Unused << socketParent->SendHasThirdPartyRoots(sHasThirdPartyRoots);
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* static */
|
||||
already_AddRefed<nsHttpHandler> nsHttpHandler::GetInstance() {
|
||||
if (!gHttpHandler) {
|
||||
@ -534,8 +497,6 @@ nsresult nsHttpHandler::Init() {
|
||||
obsService->AddObserver(this, "browser-delayed-startup-finished", true);
|
||||
obsService->AddObserver(this, "network:reset-http3-excluded-list", true);
|
||||
obsService->AddObserver(this, "network:socket-process-crashed", true);
|
||||
obsService->AddObserver(this, "network:reset_third_party_roots_check",
|
||||
true);
|
||||
|
||||
if (!IsNeckoChild()) {
|
||||
obsService->AddObserver(this, "net:current-browser-id", true);
|
||||
@ -592,29 +553,6 @@ void nsHttpHandler::UpdateParentalControlsEnabled(bool waitForCompletion) {
|
||||
}
|
||||
}
|
||||
|
||||
// static
|
||||
void nsHttpHandler::CheckThirdPartyRoots() {
|
||||
if (!StaticPrefs::network_http_http3_disable_when_third_party_roots_found() ||
|
||||
sHasThirdPartyRootsChecked) {
|
||||
return;
|
||||
}
|
||||
|
||||
sHasThirdPartyRootsChecked = true;
|
||||
nsCOMPtr<nsIX509CertDB> certDB = do_GetService(NS_X509CERTDB_CONTRACTID);
|
||||
if (certDB) {
|
||||
Unused << certDB->AsyncHasThirdPartyRoots(new HasThirdPartyRootsCallback());
|
||||
}
|
||||
}
|
||||
|
||||
// static
|
||||
void nsHttpHandler::SetHasThirdPartyRoots(bool aResult) {
|
||||
LOG(("nsHttpHandler::SetHasThirdPartyRoots result=%d", aResult));
|
||||
MOZ_ASSERT(XRE_IsSocketProcess());
|
||||
|
||||
sHasThirdPartyRootsChecked = true;
|
||||
sHasThirdPartyRoots = aResult;
|
||||
}
|
||||
|
||||
const nsCString& nsHttpHandler::Http3QlogDir() {
|
||||
if (StaticPrefs::network_http_http3_enable_qlog()) {
|
||||
return mHttp3QlogDir;
|
||||
@ -2355,10 +2293,6 @@ nsHttpHandler::Observe(nsISupports* subject, const char* topic,
|
||||
ShutdownConnectionManager();
|
||||
mConnMgr = nullptr;
|
||||
Unused << InitConnectionMgr();
|
||||
} else if (!strcmp(topic, "network:reset_third_party_roots_check")) {
|
||||
sHasThirdPartyRoots = true;
|
||||
sHasThirdPartyRootsChecked = false;
|
||||
CheckThirdPartyRoots();
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
@ -2766,10 +2700,7 @@ bool nsHttpHandler::IsHttp3Enabled() {
|
||||
static const uint32_t TLS3_PREF_VALUE = 4;
|
||||
|
||||
return StaticPrefs::network_http_http3_enable() &&
|
||||
(StaticPrefs::security_tls_version_max() >= TLS3_PREF_VALUE) &&
|
||||
(StaticPrefs::network_http_http3_disable_when_third_party_roots_found()
|
||||
? !sHasThirdPartyRoots
|
||||
: true);
|
||||
(StaticPrefs::security_tls_version_max() >= TLS3_PREF_VALUE);
|
||||
}
|
||||
|
||||
bool nsHttpHandler::IsHttp3VersionSupported(const nsACString& version) {
|
||||
|
@ -506,8 +506,6 @@ class nsHttpHandler final : public nsIHttpProtocolHandler,
|
||||
|
||||
static bool GetParentalControlsEnabled() { return sParentalControlsEnabled; }
|
||||
static void UpdateParentalControlsEnabled(bool waitForCompletion);
|
||||
static void CheckThirdPartyRoots();
|
||||
static void SetHasThirdPartyRoots(bool aResult);
|
||||
|
||||
private:
|
||||
nsHttpHandler();
|
||||
|
@ -1,93 +0,0 @@
|
||||
/* 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/. */
|
||||
"use strict";
|
||||
|
||||
/* import-globals-from head_cache.js */
|
||||
/* import-globals-from head_cookies.js */
|
||||
/* import-globals-from head_channels.js */
|
||||
/* import-globals-from head_servers.js */
|
||||
|
||||
var { setTimeout } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/Timer.sys.mjs"
|
||||
);
|
||||
|
||||
function makeChan(url) {
|
||||
let chan = NetUtil.newChannel({
|
||||
uri: url,
|
||||
loadUsingSystemPrincipal: true,
|
||||
contentPolicyType: Ci.nsIContentPolicy.TYPE_DOCUMENT,
|
||||
}).QueryInterface(Ci.nsIHttpChannel);
|
||||
return chan;
|
||||
}
|
||||
|
||||
function channelOpenPromise(chan, flags) {
|
||||
return new Promise(resolve => {
|
||||
function finish(req, buffer) {
|
||||
resolve([req, buffer]);
|
||||
}
|
||||
chan.asyncOpen(new ChannelListener(finish, null, flags));
|
||||
});
|
||||
}
|
||||
|
||||
let h2Port;
|
||||
|
||||
add_setup(async function setup() {
|
||||
await http3_setup_tests("h3", true);
|
||||
Services.prefs.setBoolPref(
|
||||
"network.http.http3.disable_when_third_party_roots_found",
|
||||
true
|
||||
);
|
||||
|
||||
registerCleanupFunction(async () => {
|
||||
http3_clear_prefs();
|
||||
|
||||
Services.prefs.clearUserPref(
|
||||
"network.http.http3.disable_when_third_party_roots_found"
|
||||
);
|
||||
Services.prefs.clearUserPref(
|
||||
"network.http.http3.has_third_party_roots_found_in_automation"
|
||||
);
|
||||
Services.obs.notifyObservers(null, "network:reset_third_party_roots_check");
|
||||
});
|
||||
|
||||
h2Port = Services.env.get("MOZHTTP2_PORT");
|
||||
Assert.notEqual(h2Port, null);
|
||||
Assert.notEqual(h2Port, "");
|
||||
});
|
||||
|
||||
async function do_test(expectedVersion) {
|
||||
Services.obs.notifyObservers(null, "net:cancel-all-connections");
|
||||
// eslint-disable-next-line mozilla/no-arbitrary-setTimeout
|
||||
await new Promise(resolve => setTimeout(resolve, 1000));
|
||||
|
||||
let chan = makeChan(`https://foo.example.com:${h2Port}/`);
|
||||
let [req] = await channelOpenPromise(chan, CL_ALLOW_UNKNOWN_CL);
|
||||
Assert.equal(req.protocolVersion, expectedVersion);
|
||||
}
|
||||
|
||||
async function third_party_roots_check() {
|
||||
Services.obs.notifyObservers(null, "network:reset_third_party_roots_check");
|
||||
// eslint-disable-next-line mozilla/no-arbitrary-setTimeout
|
||||
await new Promise(resolve => setTimeout(resolve, 3000));
|
||||
}
|
||||
|
||||
add_task(async function test_http3_with_third_party_roots() {
|
||||
Services.prefs.setBoolPref(
|
||||
"network.http.http3.has_third_party_roots_found_in_automation",
|
||||
true
|
||||
);
|
||||
await third_party_roots_check();
|
||||
|
||||
await do_test("h2");
|
||||
});
|
||||
|
||||
add_task(async function test_http3_with_no_third_party_roots() {
|
||||
Services.prefs.setBoolPref(
|
||||
"network.http.http3.has_third_party_roots_found_in_automation",
|
||||
false
|
||||
);
|
||||
await third_party_roots_check();
|
||||
|
||||
await do_test("h3");
|
||||
});
|
@ -781,13 +781,6 @@ skip-if = [
|
||||
]
|
||||
run-sequentially = "node server exceptions dont replay well"
|
||||
|
||||
["test_http3_with_third_party_roots.js"]
|
||||
skip-if = [
|
||||
"os == 'win'",
|
||||
"socketprocess_networking",
|
||||
]
|
||||
run-sequentially = "node server exceptions dont replay well"
|
||||
|
||||
["test_httpResponseTimeout.js"]
|
||||
skip-if = ["os == 'win' && socketprocess_networking"]
|
||||
|
||||
|
@ -2164,19 +2164,6 @@ networking:
|
||||
branch: default
|
||||
pref: "network.cookie.chips.partitionLimitByteCapacity"
|
||||
|
||||
disableHttp3:
|
||||
description: "Whether HTTP/3 is disabled"
|
||||
owner: kershaw@mozilla.com
|
||||
hasExposure: false
|
||||
variables:
|
||||
withThirdPartyRoots:
|
||||
description: If third party roots are detected, disable HTTP/3
|
||||
type: boolean
|
||||
setPref:
|
||||
branch: default
|
||||
pref: "network.http.http3.disable_when_third_party_roots_found"
|
||||
|
||||
|
||||
networkPrioritization:
|
||||
description: "Network request prioritization"
|
||||
owner: vgosu@mozilla.com
|
||||
|
Loading…
Reference in New Issue
Block a user