Skip to content

fix: run webRequest handlers for URLs handled by ElectronURLLoaderFactory - #45915

Merged
jkleinsc merged 11 commits into
electron:mainfrom
BrandonXLF:main
Mar 10, 2026
Merged

jkleinsc merged 11 commits into
electron:mainfrom
BrandonXLF:main

Conversation

@BrandonXLF

@BrandonXLF BrandonXLF commented Mar 7, 2025 •

Copy link
Copy Markdown
Contributor

Description of Change

Fixes instances where ElectronURLLoaderFactory is used without an intercepting ProxyingURLLoaderFactory, leading to webRequest handlers not being called. This occurs in SimpleURLLoaderWrapper::GetURLLoaderFactoryForURL where the special URL loaders are not built with ElectronBrowserClient::WillCreateURLLoaderFactory, and in ProxyingURLLoaderFactory::CreateLoaderAndStart where intercepted URLs cause the ProxyingURLLoaderFactory to be left early.

Resolves #45865.
Resolves #45903.

Checklist

Release Notes

Notes: Fixed webRequest handlers not being called for intercepted protocols and special net.fetch URLs.

@electron-cation electron-cation Bot added the new-pr 🌱 PR opened recently label Mar 7, 2025
@electron-cation electron-cation Bot removed the new-pr 🌱 PR opened recently label Mar 14, 2025
@jkleinsc jkleinsc added semver/patch backwards-compatible bug fixes no-backport labels Nov 11, 2025

@jkleinsc jkleinsc left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM; asking @deepak1556 to take a look as well.

@deepak1556 deepak1556 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM overall, sorry for the delayed review. Minor nit to avoid unnecessary clone operations.

@BrandonXLF

Copy link
Copy Markdown
Contributor Author

@deepak1556 @jkleinsc I've removed the unnecessary clones as suggested.

I also made a tiny change so file:// service workers also trigger webRequest handlers, just like their non-file:// counterparts. They were the last request type that bypassed webRequest handlers in ProxyingURLLoaderFactory.

Comment thread spec/file-service-workers-spec.ts Resolved

@deepak1556 deepak1556 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@nikwen

nikwen commented Mar 5, 2026 •

Copy link
Copy Markdown
Member

Should we label this a feature or potentially even a breaking change in terms of backport policy? It has a pretty big surface area.

EDIT: Ah, I see we have no-backport already. Great!

@jkleinsc jkleinsc changed the title fix: run webRequest handlers for URLs handled by ElectronURLLoaderFactory fix: run webRequest handlers for URLs handled by ElectronURLLoaderFactor Mar 10, 2026
@jkleinsc jkleinsc changed the title fix: run webRequest handlers for URLs handled by ElectronURLLoaderFactor fix: run webRequest handlers for URLs handled by ElectronURLLoaderFactory Mar 10, 2026
@jkleinsc

Copy link
Copy Markdown
Member

Merging as CI failures are unrelated.

@jkleinsc
jkleinsc merged commit 44b12fb into electron:main Mar 10, 2026
533 of 564 checks passed
@release-clerk

release-clerk Bot commented Mar 10, 2026

Copy link
Copy Markdown

Release Notes Persisted

Fixed webRequest handlers not being called for intercepted protocols and special net.fetch URLs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-backport semver/patch backwards-compatible bug fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

webRequest handlers do not run when session.fetch is used to load a file URL webRequest handlers do not run for intercepted protocols

5 participants