Skip to content

Fix storageState IndexedDB falsy primitive round-tripping#41697

Closed
fallintoplace wants to merge 1 commit into
microsoft:mainfrom
fallintoplace:agent/fix-idb-falsy-storage-state
Closed

Fix storageState IndexedDB falsy primitive round-tripping#41697
fallintoplace wants to merge 1 commit into
microsoft:mainfrom
fallintoplace:agent/fix-idb-falsy-storage-state

Conversation

@fallintoplace

Copy link
Copy Markdown

Summary

  • preserve falsy primitive IndexedDB keys and values when collecting storageState
  • restore IndexedDB records by checking field presence instead of truthiness or nullish fallbacks
  • add regression coverage for top-level falsy primitive values and out-of-line falsy keys

Why

storageState({ indexedDB: true }) treated serialized "trivial" values as truthy in both the collect and restore paths. That dropped valid values like 0, false, '', and null, and could also lose valid out-of-line keys like 0 and ''.

Impact

IndexedDB-backed auth and app state now round-trip correctly when records contain falsy primitive values or falsy out-of-line keys.

Testing

  • npm test -- tests/library/browsercontext-storage-state.spec.ts --project=chromium-library --grep "should round-trip through the file|should round-trip top-level falsy IndexedDB primitives"
  • npx eslint packages/injected/src/storageScript.ts tests/library/browsercontext-storage-state.spec.ts

@yury-s

yury-s commented Jul 8, 2026

Copy link
Copy Markdown
Member

Please start with filing an issue. Also note that we are not accepting patches to this file, they should go into the browsers repo which is an open issue, #41551

@yury-s yury-s closed this Jul 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants