Skip to content

Commit ec56413

Browse files
authored
inspector: initial support storage inspection
PR-URL: #61139 Reviewed-By: Chengzhong Wu <legendecas@gmail.com> Reviewed-By: Kohei Ueno <kohei.ueno119@gmail.com>
1 parent 5d39030 commit ec56413

22 files changed

+912
-88
lines changed

doc/api/cli.md

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

12711271
Use this flag to enable [ShadowRealm][] support.
12721272

1273+
### `--experimental-storage-inspection`
1274+
1275+
<!-- YAML
1276+
added:
1277+
- REPLACEME
1278+
-->
1279+
1280+
> Stability: 1.1 - Active Development
1281+
1282+
Enable experimental support for storage inspection
1283+
12731284
### `--experimental-test-coverage`
12741285

12751286
<!-- YAML

doc/api/inspector.md

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

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

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

687784
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
@@ -237,6 +237,10 @@ Enable the experimental QUIC support.
237237
.
238238
.It Fl -experimental-inspector-network-resource
239239
Enable experimental support for inspector network resources.
240+
241+
.It Fl -experimental-storage-inspection
242+
Enable experimental support for storage inspection.
243+
240244
.
241245
.It Fl -force-context-aware
242246
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)