Skip to content

Commit 36cc041

Browse files
islandryuaduh95
authored andcommitted
inspector: initial support storage inspection
PR-URL: #61139 Backport-PR-URL: #63176 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
1 parent 8752b60 commit 36cc041

22 files changed

Lines changed: 913 additions & 88 deletions

doc/api/cli.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1172,6 +1172,17 @@ added:
11721172

11731173
Use this flag to enable [ShadowRealm][] support.
11741174

1175+
### `--experimental-storage-inspection`
1176+
1177+
<!-- YAML
1178+
added:
1179+
- REPLACEME
1180+
-->
1181+
1182+
> Stability: 1.1 - Active Development
1183+
1184+
Enable experimental support for storage inspection
1185+
11751186
### `--experimental-test-coverage`
11761187

11771188
<!-- YAML

doc/api/inspector.md

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -677,6 +677,103 @@ setNetworkResources().then(() => {
677677

678678
For more details, see the official CDP documentation: [Network.loadNetworkResource](https://chromedevtools.github.io/devtools-protocol/tot/Network/#method-loadNetworkResource)
679679

680+
### `inspector.DOMStorage.domStorageItemAdded`
681+
682+
<!-- YAML
683+
added:
684+
- REPLACEME
685+
-->
686+
687+
* `params` {Object}
688+
* `storageId` {Object}
689+
* `securityOrigin` {string}
690+
* `storageKey` {string}
691+
* `isLocalStorage` {boolean}
692+
* `key` {string}
693+
* `newValue` {string}
694+
695+
This feature is only available with the
696+
`--experimental-storage-inspection` flag enabled.
697+
698+
Broadcasts the `DOMStorage.domStorageItemAdded` event to connected frontends.
699+
This event indicates that a new item has been added to the storage.
700+
701+
### `inspector.DOMStorage.domStorageItemRemoved`
702+
703+
<!-- YAML
704+
added:
705+
- REPLACEME
706+
-->
707+
708+
* `params` {Object}
709+
* `storageId` {Object}
710+
* `securityOrigin` {string}
711+
* `storageKey` {string}
712+
* `isLocalStorage` {boolean}
713+
* `key` {string}
714+
715+
This feature is only available with the
716+
`--experimental-storage-inspection` flag enabled.
717+
718+
Broadcasts the `DOMStorage.domStorageItemRemoved` event to connected frontends.
719+
This event indicates that an item has been removed from the storage.
720+
721+
### `inspector.DOMStorage.domStorageItemUpdated`
722+
723+
<!-- YAML
724+
added:
725+
- REPLACEME
726+
-->
727+
728+
* `params` {Object}
729+
* `storageId` {Object}
730+
* `securityOrigin` {string}
731+
* `storageKey` {string}
732+
* `isLocalStorage` {boolean}
733+
* `key` {string}
734+
* `oldValue` {string}
735+
* `newValue` {string}
736+
737+
This feature is only available with the
738+
`--experimental-storage-inspection` flag enabled.
739+
740+
Broadcasts the `DOMStorage.domStorageItemUpdated` event to connected frontends.
741+
This event indicates that a storage item has been updated.
742+
743+
### `inspector.DOMStorage.domStorageItemsCleared`
744+
745+
<!-- YAML
746+
added:
747+
- REPLACEME
748+
-->
749+
750+
* `params` {Object}
751+
* `storageId` {Object}
752+
* `securityOrigin` {string}
753+
* `storageKey` {string}
754+
* `isLocalStorage` {boolean}
755+
756+
This feature is only available with the
757+
`--experimental-storage-inspection` flag enabled.
758+
759+
Broadcasts the `DOMStorage.domStorageItemsCleared` event to connected
760+
frontends. This event indicates that all items have been cleared from the
761+
storage.
762+
763+
### `inspector.DOMStorage.registerStorage`
764+
765+
<!-- YAML
766+
added:
767+
- REPLACEME
768+
-->
769+
770+
* `params` {Object}
771+
* `isLocalStorage` {boolean}
772+
* `storageMap` {Object}
773+
774+
This feature is only available with the
775+
`--experimental-storage-inspection` flag enabled.
776+
680777
## Support of breakpoints
681778

682779
The Chrome DevTools Protocol [`Debugger` domain][] allows an

doc/node.1

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,10 @@ Enable the experimental QUIC support.
231231
.
232232
.It Fl -experimental-inspector-network-resource
233233
Enable experimental support for inspector network resources.
234+
235+
.It Fl -experimental-storage-inspection
236+
Enable experimental support for storage inspection.
237+
234238
.
235239
.It Fl -force-context-aware
236240
Disable loading native addons that are not context-aware.

lib/inspector.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,16 @@ const NetworkResources = {
229229
put,
230230
};
231231

232+
const DOMStorage = {
233+
domStorageItemAdded: (params) => broadcastToFrontend('DOMStorage.domStorageItemAdded', params),
234+
domStorageItemRemoved: (params) => broadcastToFrontend('DOMStorage.domStorageItemRemoved', params),
235+
domStorageItemUpdated: (params) => broadcastToFrontend('DOMStorage.domStorageItemUpdated', params),
236+
domStorageItemsCleared: (params) => broadcastToFrontend('DOMStorage.domStorageItemsCleared', params),
237+
// Pseudo-event: not part of the CDP DOMStorage domain.
238+
// Call DOMStorageAgent::registerStorage in inspector/dom_storage_agent.cc.
239+
registerStorage: (params) => broadcastToFrontend('DOMStorage.registerStorage', params),
240+
};
241+
232242
module.exports = {
233243
open: inspectorOpen,
234244
close: _debugEnd,
@@ -238,4 +248,5 @@ module.exports = {
238248
Session,
239249
Network,
240250
NetworkResources,
251+
DOMStorage,
241252
};

0 commit comments

Comments
 (0)