Skip to content

inspector: report an error when DOM storage is unavailable - #65897

Closed
lazerg wants to merge 1 commit into
nodejs:mainfrom
lazerg:fix/issue-65895-dom-storage-unavailable
Closed

inspector: report an error when DOM storage is unavailable#65897
lazerg wants to merge 1 commit into
nodejs:mainfrom
lazerg:fix/issue-65895-dom-storage-unavailable

Conversation

@lazerg

@lazerg lazerg commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

DOMStorage.getDOMStorageItems falls back to reading the live Storage object when its cached map is empty, but when getWebStorage() cannot produce one it skips the fallback and still answers with Success and an empty entries array. getWebStorage() returns nothing whenever globalThis.localStorage is missing or is not an object, which is the case for any process started without --localstorage-file, so a frontend cannot tell an empty store from a store it has no access to.

It now returns a Could not read DOM storage items protocol error in that case, alongside the DOMStorage domain is not enabled error the same function already produces. This does change what a DevTools frontend sees for a process with no --localstorage-file: the localStorage panel gets an error rather than an empty table. The cached map registered through DOMStorage.registerStorage still short-circuits ahead of the check, so registering an empty map reads as an empty store.

Tests: test/parallel/test-inspector-dom-storage-unavailable.js posts DOMStorage.getDOMStorageItems without --localstorage-file; it resolves with an empty result before this change and rejects with ERR_INSPECTOR_COMMAND after.

Fixes: #65895

Signed-off-by: Lazizbek Ergashev <lazerg2@gmail.com>
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/inspector

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. labels Sep 8, 2026
@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Caution

AgentScan found account activity patterns that may be consistent with automation. This is a heuristic, not proof that this pull request was opened by an agent or violates policy. AI-assisted contributions are permitted, but automated tooling must not open pull requests without advance approval, and contributors must personally understand, test, verify, and take responsibility for every submitted change. See the AgentScan analysis, AI use policy, and automation policy for additional context.

@lazerg lazerg closed this Sep 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agentscan:community-flagged c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

inspector: getDOMStorageItems reports unavailable storage as empty

2 participants