DOMStorage: how to obtain a list of all storageIds / security origins?

71 views
Skip to first unread message

Boris Okunskiy

unread,
Aug 13, 2019, 11:21:44 AM8/13/19
to chrome-debugging-protocol
Hi everyone,

In DOMStorage domain every method requires specifying `storageId` which is `securityOrigin` + `isLocalStorage`. I would like to retrieve all the items for all the storages, however, in order to do that I need to somehow obtain a full list of `securityOrigin`s that exist in Chrome.

I tried sniffing the protocol, but it seems to just "know" it, as it issues `DOMStorage.getStorageItems` separately for each origin. How does it know them? Is this merely an information derived from page's the frame/resource tree?

I also checked if `DOMStorage.enable` would cause some initial events to be emitted that can be caught and analysed (perhaps was expecting it to behave in a similar way to Runtime and executions contexts tracking), but it appears to not be the case.

Any help is much appreciated, and thank you for doing such amazing work on the protocol!

HAHA afwf

unread,
Aug 21, 2020, 1:50:15 PM8/21/20
to chrome-debugging-protocol
I'm having the same problem. I simply want to remove all storage, but it asks for security origin.

I have tried Storage.clearForOrigin, Network.clearCookies, Network.clearcache

Andrey Kosyakov

unread,
Aug 21, 2020, 2:19:09 PM8/21/20
to Boris Okunskiy, chrome-debugging-protocol
Hi Boris,

On Tue, Aug 13, 2019 at 8:21 AM Boris Okunskiy <boris.o...@ub.io> wrote:
In DOMStorage domain every method requires specifying `storageId` which is `securityOrigin` + `isLocalStorage`. I would like to retrieve all the items for all the storages, however, in order to do that I need to somehow obtain a full list of `securityOrigin`s that exist in Chrome.

I tried sniffing the protocol, but it seems to just "know" it, as it issues `DOMStorage.getStorageItems` separately for each origin. How does it know them? Is this merely an information derived from page's the frame/resource tree?
 
The current API design is motivated by the usage in the DevTools front-end, and, as you can see in the Application panel, the storage is rendered per-origin. In general, enumerating the frames in the frame tree, collecting all origins relevant for the page and then issuing DOMStorage.getStorageItems for each looks like a reasonable thing to do, if you want all storage items related to a given page. We do not currently support a way to enumerate the entire storage, though.

Best regards,
Andrey.

boris.o...@ub.io

unread,
Aug 21, 2020, 2:38:54 PM8/21/20
to chrome-debugging-protocol
Hi Andrey,

Many thanks for your reply, everything makes sense. For my application it was indeed possible to track all visited origins since the start of "browsing session", but in general it would be great if `DOMStorage.getStorageItems` would support `*` in the same way as `Storage.clearDataForOrigin` does.

Best regards,
Boris
Reply all
Reply to author
Forward
0 new messages