samuelmaddock

#55155: fix: extension code drift

Merged
Created: Oct 20, 2026, 8:31:15 PM
Merged: Oct 23, 2026, 12:41:54 PM
5 comments
Target: main

Description of Change

Over the years, Electron's extension code has slowly drifted from changes happening upstream. Most recently, Igalia has been moving more APIs from //chrome into //extensions (thank you!).

To modernize our codebase with these changes, I've had Claude take a pass at fixing this drift. The work is split up by commit which is the best way to review this PR. If folks would rather these be individual PRs, let me know!

I tried to keep these changes free of introducing any APIs for customizing extension behavior. I'd like to defer those to follow up PRs.

Checklist

Release Notes

Notes:

  • Fixed extension chrome.webRequest events reporting a tabId of -1 and chrome.declarativeNetRequest rules restricted to tabs never matching.
  • Fixed session.clearStorageData() unregistering the service workers of loaded extensions.
  • Fixed a crash when an extension called chrome.cookies.getAllCookieStores().
  • Fixed chrome.management methods and events being unavailable to extensions with the management permission.
  • Fixed __MSG_*__ placeholders not being localized in extension stylesheets.
  • Fixed extension service workers being stopped after 30 seconds while a WebSocket was active.
  • Fixed sandboxed extension pages being hosted in a process with extension API privileges.
  • Fixed navigator.clipboard being unavailable in extension service workers.
  • Fixed extension service workers running an outdated script after an app restart when the extension's files changed without a version change.
  • Fixed chrome.alarms and content scripts registered with persistAcrossSessions not persisting across app restarts.

Backports

45-x-y
In-flight
PR Number
#55283
Waiting to be merged
46-x-y
In-flight
PR Number
#55284
Waiting to be merged

Semver Impact

Major
Breaking changes
Minor
New features
Patch
Bug fixes
None
Docs, tests, etc.

Semantic Versioning helps users understand the impact of updates:

  • Major (X.y.z): Breaking changes that may require code modifications
  • Minor (x.Y.z): New features that maintain backward compatibility
  • Patch (x.y.Z): Bug fixes that don't change the API
  • None: Changes that don't affect using facing parts of Electron