fix: make navigator.userAgentData non-empty (#34481)

This commit is contained in:
Jeremy Rose 2022-06-13 09:35:42 -07:00 committed by GitHub
parent 8157a01a42
commit 954fd72500
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 92 additions and 13 deletions

View file

@ -107,8 +107,6 @@ ElectronBrowserContext::ElectronBrowserContext(const std::string& partition,
protocol_registry_(base::WrapUnique(new ProtocolRegistry)),
in_memory_(in_memory),
ssl_config_(network::mojom::SSLConfig::New()) {
user_agent_ = ElectronBrowserClient::Get()->GetUserAgent();
// Read options.
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
use_cache_ = !command_line->HasSwitch(switches::kDisableHttpCache);
@ -305,6 +303,11 @@ ElectronBrowserContext::GetSpecialStoragePolicy() {
}
std::string ElectronBrowserContext::GetUserAgent() const {
return user_agent_.value_or(ElectronBrowserClient::Get()->GetUserAgent());
}
absl::optional<std::string> ElectronBrowserContext::GetUserAgentOverride()
const {
return user_agent_;
}