Repository navigation
Conversation
…mation Chrome 158 rejects Storage.clearDataForOrigin with the '*' origin, so TestRun.initialize() failed and the run hung on the idle page. Keep the wildcard for browsers that accept it; otherwise clear every origin seen by the request pipeline and the storage key of every iframe target. Co-authored-by: Tansu Akbay <28011463+TAkbay@users.noreply.github.com>
sam-yh
force-pushed
the
chrome-158-clear-storages
branch
from
November 19, 2026 07:41
d152c48 to
8be9f11
Compare
|
Thank you for your contribution to TestCafe. When a member of the TestCafe team becomes available, they will review this PR. |
This branch was successfully 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.
Purpose
Chrome 158 rejects
Storage.clearDataForOrigin({ origin: '*', storageTypes: 'all' })with* is not a valid URL. In native automation, TestCafe makes this call before every test (CdpStoragesProvider.clearStorages). The rejection propagates out ofTestRun.initialize(), the browser's/browser/statusrequest is never answered, and the run hangs on the idle page.The only comment on the issue suggests that
'*'was already a no-op on Chrome 157 and earlier, so the call could simply be skipped. That is not what I see. On Chromium 156.0.8078.4,clearDataForOrigin('*')removes localStorage, IndexedDB and cookies, including those of a cross-site iframe. Skipping the call would drop storage isolation between tests.Approach
clearStoragesstill tries the wildcard first, so browsers that accept it behave as before.is not a valid URLrejection triggers the fallback. Any other error is rethrown. The rejection is remembered per browser connection, so the wildcard is not retried before every test.Fetch.requestPausedhandler, withStorage.clearDataForOrigin;Storage.clearDataForStorageKey. The key is read withStorage.getStorageKeyonTarget.attachedToTargetand again onTarget.targetInfoChanged, because at attach time Chrome can still report the parent's key.clearDataForOrigin(<iframe origin>)leaves that partition in place, andclearDataForStorageKey(<key reported by Chrome>)clears it.cookieProvider.initialize()already runsNetwork.clearBrowserCookiesright before.src/native-automation/visited-storages.ts.Known limits of the fallback:
Tests:
test/server/cdp-storages-provider-test.js: unit tests for the wildcard path, the fallback, not retrying the wildcard after a rejection, and rethrowing other errors.test/functional/fixtures/driver: a native automation test that writes localStorage in a top page onlocalhost:3000and in a cross-site iframe on127.0.0.1:3001, then checks that both are empty in the next test. It reuses the existing driver test pages and ports. It only exercises the fallback on Chrome 158 or later. On older Chrome it goes through the wildcard path and acts as a regression guard. On Chrome 158 it fails if only per-origin clearing is used.Checked manually with a three-test fixture (write localStorage in the top page and in a cross-site iframe; assert the top page is clean; assert the iframe is clean). It passes with this change on Chrome 158 headless and headed and on Chromium 156. With per-origin clearing only, the iframe test fails on Chrome 158.
Cypress fixed the same Chrome change with per-origin clearing: cypress-io/cypress#35198
References
Closes #8573
Co-authored with @TAkbay, who wrote the original fix.
Pre-Merge TODO