Skip to content

fix(extensions): crash when using chrome.system.storage - #55624

Merged
MarshallOfSound merged 2 commits into
46-x-yfrom
trop/46-x-y-bp-fix-extensions-crash-when-using-chrome-system-storage-1793898970776
Nov 5, 2026
Merged

MarshallOfSound merged 2 commits into
46-x-yfrom
trop/46-x-y-bp-fix-extensions-crash-when-using-chrome-system-storage-1793898970776

Conversation

@trop

@trop trop Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Backport of #55612

See that PR for details.

Notes: Fixed a crash when extensions access chrome.system.storage APIs.

trop Bot and others added 2 commits November 5, 2026 17:17
Electron never created the global StorageMonitor that the API dereferences without a null check. Create it like Chrome does, and destroy it after browser contexts are gone.

Co-Authored-By: Claude <noreply@anthropic.com>

Co-authored-by: Samuel Maddock <samuel.maddock@gmail.com>
Co-Authored-By: Claude <noreply@anthropic.com>

Co-authored-by: Samuel Maddock <samuel.maddock@gmail.com>
@trop
trop Bot requested a review from samuelmaddock November 5, 2026 17:18
@trop trop Bot added 46-x-y backport This is a backport PR semver/patch backwards-compatible bug fixes labels Nov 5, 2026

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I reviewed this backport and didn't find any bugs. It changes C++ startup and shutdown order in the browser process and leaves a known Linux DCHECK path in place, so a human look would still be worthwhile.

What was reviewed:

  • Shutdown order: ElectronBrowserMainParts::PostMainMessageLoopRun calls ElectronBrowserContext::DestroyAllContexts() (electron_browser_main_parts.cc:724) before fake_browser_process_->PostMainMessageLoopRun() (:726). So StorageMonitor::Destroy() runs after the contexts are gone, as the new comment says.
  • StorageMonitor::Create(), Destroy(), the include and the //components/storage_monitor dep are all inside ENABLE_ELECTRON_EXTENSIONS guards. The BUILD.gn dep is at line 948.
  • The new suite is skipped on Linux because device scanning hits DCHECK(!unique_id.empty()). Debug builds on Linux can still reach that DCHECK, yet docs/api/extensions.md:162 says all features of the API are supported.
Extended reasoning...

This backport adds a //components/storage_monitor dep, creates and destroys the global StorageMonitor in shell/browser/browser_process_impl.cc under the extensions buildflag, adds a docs section and adds a 3-test spec suite that is skipped on Linux. There is no IPC, permission or webPreferences change, so the security-sensitive surface is limited to which extensions can use the new API. I confirmed the teardown order claim from electron_browser_main_parts.cc. This is a standalone clone, so I couldn't check upstream StorageMonitor behavior, and that is part of why I deferred. The other reason is the Linux DCHECK path that the spec skip works around rather than fixes.

@MarshallOfSound
MarshallOfSound enabled auto-merge (squash) November 5, 2026 17:50
@MarshallOfSound
MarshallOfSound merged commit 39f1f52 into 46-x-y Nov 5, 2026
92 checks passed
@MarshallOfSound
MarshallOfSound deleted the trop/46-x-y-bp-fix-extensions-crash-when-using-chrome-system-storage-1793898970776 branch November 5, 2026 18:12
@release-clerk

release-clerk Bot commented Nov 5, 2026

Copy link
Copy Markdown

Release Notes Persisted

Fixed a crash when extensions access chrome.system.storage APIs.

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

Labels

46-x-y backport This is a backport PR semver/patch backwards-compatible bug fixes

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

1 participant