feat: migrate protocol module to NetworkService (Part 5) (#18170)

* fix: always have head.headers available

* fix: use StringDataPipeProducer to write string

It can handle large strings correctly.

* fix: override RegisterNonNetworkSubresourceURLLoaderFactories

* fix: add dummy uninterceptProtocol implementation

* fix: jquery error handler can pass empty string

For some errors jquery would pass empty string in the error handler,
which makes tests pass when they should fail.

* chore: fix cpplint warnings

* fix: guard RegisterNonNetworkSubresourceURLLoaderFactories call

It may be called even when NetworkService is not enabled.

* test: disable protocol.interceptHttpProtocol test
This commit is contained in:
Cheng Zhao 2019-05-07 11:33:05 +09:00 committed by GitHub
parent a96b6e2c96
commit 237f74a01f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 107 additions and 48 deletions

View file

@ -940,6 +940,24 @@ void AtomBrowserClient::RegisterNonNetworkNavigationURLLoaderFactories(
protocol->RegisterURLLoaderFactories(factories);
}
void AtomBrowserClient::RegisterNonNetworkSubresourceURLLoaderFactories(
int render_process_id,
int render_frame_id,
NonNetworkURLLoaderFactoryMap* factories) {
// Chromium may call this even when NetworkService is not enabled.
if (!base::FeatureList::IsEnabled(network::features::kNetworkService))
return;
content::RenderFrameHost* frame_host =
content::RenderFrameHost::FromID(render_process_id, render_frame_id);
content::WebContents* web_contents =
content::WebContents::FromRenderFrameHost(frame_host);
api::ProtocolNS* protocol = api::ProtocolNS::FromWrappedClass(
v8::Isolate::GetCurrent(), web_contents->GetBrowserContext());
if (protocol)
protocol->RegisterURLLoaderFactories(factories);
}
std::string AtomBrowserClient::GetApplicationLocale() {
if (BrowserThread::CurrentlyOn(BrowserThread::IO))
return g_io_thread_application_locale.Get();