fix: webRequest module should work with file:// protocol (#22903)

* fix: override file:// instead of intercepting

* test: webRequest module should work with file://

* fix: service work with file:// url

* fix: original_response_headers can be null

* fix: only register file:// when necessary
This commit is contained in:
Cheng Zhao 2020-04-01 16:38:40 +09:00 committed by GitHub
parent bac1c7f532
commit e6f2605ad0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 101 additions and 7 deletions

View file

@ -1176,7 +1176,8 @@ void ElectronBrowserClient::RegisterNonNetworkNavigationURLLoaderFactories(
context, false /* we don't support extensions::WebViewGuest */));
#endif
auto* protocol_registry = ProtocolRegistry::FromBrowserContext(context);
protocol_registry->RegisterURLLoaderFactories(factories);
protocol_registry->RegisterURLLoaderFactories(
URLLoaderFactoryType::kNavigation, factories);
}
#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
@ -1236,7 +1237,8 @@ void ElectronBrowserClient::RegisterNonNetworkSubresourceURLLoaderFactories(
if (web_contents) {
ProtocolRegistry::FromBrowserContext(web_contents->GetBrowserContext())
->RegisterURLLoaderFactories(factories);
->RegisterURLLoaderFactories(URLLoaderFactoryType::kDocumentSubResource,
factories);
}
#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
auto factory = extensions::CreateExtensionURLLoaderFactory(render_process_id,