feat: migrate webRequest module to NetworkService (Part 9) (#19976)

* no need to get WebContents for URLLoaderFactory

* consult embedder for network_factory created in net module

* set disable_web_security to false

* re-enable webRequest tests in net module
This commit is contained in:
Cheng Zhao 2019-08-28 01:12:33 +09:00 committed by Robo
parent bdb20d53cb
commit 4eee71ffbf
3 changed files with 35 additions and 13 deletions

View file

@ -988,18 +988,11 @@ bool AtomBrowserClient::WillCreateURLLoaderFactory(
mojo::PendingReceiver<network::mojom::URLLoaderFactory>* factory_receiver,
network::mojom::TrustedURLLoaderHeaderClientPtrInfo* header_client,
bool* bypass_redirect_checks) {
content::WebContents* web_contents =
content::WebContents::FromRenderFrameHost(frame_host);
// For service workers there might be no WebContents.
if (!web_contents)
return false;
v8::Isolate* isolate = v8::Isolate::GetCurrent();
api::ProtocolNS* protocol = api::ProtocolNS::FromWrappedClass(
isolate, web_contents->GetBrowserContext());
api::ProtocolNS* protocol =
api::ProtocolNS::FromWrappedClass(isolate, browser_context);
DCHECK(protocol);
auto web_request = api::WebRequestNS::FromOrCreate(
isolate, web_contents->GetBrowserContext());
auto web_request = api::WebRequestNS::FromOrCreate(isolate, browser_context);
DCHECK(web_request.get());
auto proxied_receiver = std::move(*factory_receiver);