fix: checks in extensions webRequest when using net.fetch

Several DCHECKs require `frame_host` data to proceed with proxying.
https://source.chromium.org/chromium/chromium/src/+/main:extensions/browser/api/web_request/web_request_api.cc;l=446-450;drc=f5e280b6c11f41545154266cd2317d3c730e9b30

Note that even if our URLLoader is updated to not use `content::ContentBrowserClient::URLLoaderFactoryType::kNavigation`, further checks are still thrown.
dc74092a09/shell/browser/electron_browser_context.cc (L547)
This commit is contained in:
Sam Maddock
2024-12-17 00:05:53 -05:00
committed by GitHub
parent dc74092a09
commit 4e0acd65e0

View File

@@ -1310,7 +1310,11 @@ void ElectronBrowserClient::WillCreateURLLoaderFactory(
DCHECK(web_request.get());
#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
if (!web_request->HasListener()) {
// If Electron's webRequest API has no listeners, proxy requests using
// chrome.webRequest extension APIs.
// Note that Electron's net.fetch and protocol.handle APIs do not include the
// frame host which is required for proxying requests.
if (!web_request->HasListener() && frame_host) {
auto* web_request_api = extensions::BrowserContextKeyedAPIFactory<
extensions::WebRequestAPI>::Get(browser_context);