mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
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:
@@ -825,8 +825,11 @@ void ProxyingURLLoaderFactory::CreateLoaderAndStart(
|
||||
return;
|
||||
}
|
||||
|
||||
// Intercept file:// protocol to support asar archives.
|
||||
if (request.url.SchemeIsFile()) {
|
||||
// The loader of ServiceWorker forbids loading scripts from file:// URLs, and
|
||||
// Chromium does not provide a way to override this behavior. So in order to
|
||||
// make ServiceWorker work with file:// URLs, we have to intercept its
|
||||
// requests here.
|
||||
if (IsForServiceWorkerScript() && request.url.SchemeIsFile()) {
|
||||
asar::CreateAsarURLLoader(request, std::move(loader), std::move(client),
|
||||
new net::HttpResponseHeaders(""));
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user