Repository navigation
Conversation
Clearing a profile's cookies already removed local storage, IndexedDB and service workers, but left the page's Cache API store behind. Electron's clearCache() only empties the HTTP cache, so "Clear data" and profile removal kept Cache Storage entries in the profile's partition. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — This narrowly scoped fix adds Cache Storage to the existing browser-profile data-clearing operation and updates its focused test. It preserves partition selection and all other clearing behavior, with no new settings, schema changes, or static-analysis suppressions. You can add or adjust custom eligibility rules. Learn more. |
Contributor
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
In the desktop app, Settings → Integrations → Browser profiles → Clear cookies and cache reports "Cleared 's cookies and cache", and removing a profile runs the same clear. Neither removes the page's Cache Storage (
caches/ Cache API). After the clear, a site's cached responses are still there the next time the profile opens it.BrowserSession.clearCookiespassescookies,localstorage,indexdbandserviceworkerstosession.clearStorageData, then the clear action callssession.clearCache(). Electron'sclearCache()only empties the HTTP cache. Cache Storage is its ownclearStorageDatatype,cachestorage, and nothing passes it.Steps: open a page in a profile's browser tab, run
caches.open("demo-cache").then((c) => c.put("/x", new Response("x"))), clear the profile's data from Settings, reload the tab.caches.keys()still returns["demo-cache"]. localStorage from the same page is gone.Change
Adds
"cachestorage"to the storages list inBrowserSession.clearCookies. Partition selection is unchanged, so a clear still touches only the partitions it touched before.Cache Storage goes with the site data that call already clears (local storage, IndexedDB, service workers), not with the HTTP cache, the same grouping Chromium uses in Clear browsing data. The tab menu's Clear cookies item uses the same call, so it now also removes Cache Storage for that profile, as it already does for IndexedDB and service workers.
Scope and approval
No issue. I'm submitting this under the small obvious-fix exception in CONTRIBUTING.md: the action says it clears the profile's cookies and cache, and it already clears cookies, local storage, IndexedDB and service workers, but not Cache Storage. It's a one-line production change with no new setting or default.
Prior PRs: none fix this. #8256 was closed for missing prior approval because it moved preview storage to per-project partitions. This PR doesn't change partitions or which profiles a clear touches.
Verification
Real app, desktop dev build on Linux (Electron 44.4.5), Default profile, local page that reads Cache Storage on load. I seeded one Cache Storage entry and one localStorage key from the tab, ran Settings → Integrations → Default → Clear cookies and cache → Clear data, then reloaded the tab.
main: localStorage is cleared, Cache Storage still holds
demo-cachewith 1 entry.This branch:
caches.keys()is[], 0 entries.Both runs used the same app session. Between them I swapped only
BrowserSession.ts, and the rebuilt bundle showed the matching storages list each time.Focused test:
vp test run src/preview/BrowserSession.test.tsinapps/desktop, 8/8 pass. #22557 deleted the test that pinned the storages list, so this PR no longer edits a test. Restored outside the PR, that test fails with main'sBrowserSession.tsand passes on this branch. The screenshot is from the earlier head, before #22557.Partition isolation, plain Electron 44.4.5 with two
persist:partitions shaped like profile partitions: seed both, clear profile A with the same two calls the clear action makes, restart, read both. With main's list profile A keeps its Cache Storage. With this list it's empty. Profile B keeps its data in both runs.Also ran
tsc-rs --noEmitforapps/desktop, plusvp lintandvp fmt --checkon the changed file. All passed.Not checked:
clearBrowserProfileDataas the clear button, which I did run.Production fix, PR description and images written with Claude Opus 5.5 in T3 Code Nightly.
🤖 Generated with Claude Opus 5.5 in T3 Code Nightly