Skip to content

fix: deliver extension events to service workers - #55146

Merged
samuelmaddock merged 1 commit into
mainfrom
fix/extension-service-worker-events
Oct 21, 2026
Merged

samuelmaddock merged 1 commit into
mainfrom
fix/extension-service-worker-events

Conversation

@samuelmaddock

Copy link
Copy Markdown
Member

Description of Change

Extension service workers register their event listeners with the browser over the extensions EventRouter interface, which was only bound for frames. Listeners added in a worker were never registered, so events such as storage.onChanged and alarms.onAlarm never reached it.

Checklist

Release Notes

Notes: Fixed MV3 extension events not arriving to background service workers.

Extension service workers register their event listeners with the
browser over the extensions EventRouter interface, which was only bound
for frames. Listeners added in a worker were never registered, so events
such as storage.onChanged and alarms.onAlarm never reached it.
@samuelmaddock samuelmaddock added semver/patch backwards-compatible bug fixes target/43-x-y PR should also be added to the "43-x-y" branch. target/44-x-y PR should also be added to the "44-x-y" branch. target/45-x-y PR should also be added to the "45-x-y" branch. labels Oct 20, 2026
@samuelmaddock
samuelmaddock merged commit 30db518 into main Oct 21, 2026
99 checks passed
@samuelmaddock
samuelmaddock deleted the fix/extension-service-worker-events branch October 21, 2026 00:53
@release-clerk

release-clerk Bot commented Oct 21, 2026

Copy link
Copy Markdown

Release Notes Persisted

Fixed MV3 extension events not arriving to background service workers.

@trop

trop Bot commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

I have automatically backported this PR to "44-x-y", please check out #55152

@trop

trop Bot commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

I have automatically backported this PR to "43-x-y", please check out #55153

@trop trop Bot added in-flight/43-x-y and removed target/44-x-y PR should also be added to the "44-x-y" branch. labels Oct 21, 2026
@trop

trop Bot commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

I have automatically backported this PR to "45-x-y", please check out #55154

@trop trop Bot added in-flight/45-x-y merged/43-x-y PR was merged to the "43-x-y" branch. merged/44-x-y PR was merged to the "44-x-y" branch. merged/45-x-y PR was merged to the "45-x-y" branch. and removed target/43-x-y PR should also be added to the "43-x-y" branch. target/45-x-y PR should also be added to the "45-x-y" branch. in-flight/43-x-y in-flight/44-x-y in-flight/45-x-y labels Oct 21, 2026
saenzramiro added a commit to ramboxapp/electron-browser-shell that referenced this pull request Nov 5, 2026
…es across a reload, and document what Electron 44 costs.

- chrome-webRequest-spec.ts: new describe "from an MV3 service worker" that checks whether webRequest events registered at the top of an MV3 worker (fixture rpc-mv3) arrive. Red on Electron 44.5.1 and 44.9.3, green on stock 44.10.0 (it carries the backport of electron/electron#55146, "deliver extension events to service workers"), skipped on 43, which has no such events. The suite only measured MV2, which is why 44 looked fixed.
- chrome-declarativeNetRequest-spec.ts: new case "keeps a dynamic rule across an unload and a reload of the extension" (green on 43 and 44; the fixture is small and does not trigger the real failure, the comment says so), and the wait of the static rulesets case goes from 2 s to 10 s.
- src/renderer/index.ts: comment only, on the block that enables the static rulesets when the worker starts. It now documents the cost measured on Electron 44 (44.5.1, 44.9.3, 44.10.0): any updateEnabledRulesets, this one or the extension's own, leaves the extension without dynamic rules for the session, and without the call 44 does not restore the static ones on a second start either. Two variants (skip it by prefs, defer it 4 s) were tried and reverted because they change nothing. The code stays as it was.

Verified: fork suite 313/313 (Electron 43) and the smoke of the 21 catalog extensions 21/21 with the 21 workers running.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

46-x-y merged/43-x-y PR was merged to the "43-x-y" branch. merged/44-x-y PR was merged to the "44-x-y" branch. merged/45-x-y PR was merged to the "45-x-y" branch. semver/patch backwards-compatible bug fixes

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants