diff --git a/devtools/client/storage/test/browser.ini b/devtools/client/storage/test/browser.ini
index 8f2e6bd84049..de7a017e0b84 100644
--- a/devtools/client/storage/test/browser.ini
+++ b/devtools/client/storage/test/browser.ini
@@ -3,6 +3,8 @@ tags = devtools
subsuite = devtools
support-files =
storage-blank.html
+ storage-cache-basic-iframe.html
+ storage-cache-basic.html
storage-cache-error.html
storage-complex-values.html
storage-cookies.html
@@ -70,6 +72,7 @@ tags = usercontextid
[browser_storage_dynamic_updates_sessionStorage.js]
[browser_storage_empty_objectstores.js]
[browser_storage_file_url.js]
+[browser_storage_fission_cache.js]
[browser_storage_fission_hide_aboutblank.js]
[browser_storage_fission_local_storage.js]
[browser_storage_fission_session_storage.js]
diff --git a/devtools/client/storage/test/browser_storage_cache_navigation.js b/devtools/client/storage/test/browser_storage_cache_navigation.js
index 82142b054d2b..8f1bed49494c 100644
--- a/devtools/client/storage/test/browser_storage_cache_navigation.js
+++ b/devtools/client/storage/test/browser_storage_cache_navigation.js
@@ -64,6 +64,6 @@ function checkCacheData(url, status) {
is(
gUI.table.items.get(url)?.status,
status,
- `Table row has an entry for: ${name} with status: ${status}`
+ `Table row has an entry for: ${url} with status: ${status}`
);
}
diff --git a/devtools/client/storage/test/browser_storage_fission_cache.js b/devtools/client/storage/test/browser_storage_fission_cache.js
new file mode 100644
index 000000000000..798d3609166e
--- /dev/null
+++ b/devtools/client/storage/test/browser_storage_fission_cache.js
@@ -0,0 +1,32 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+/* import-globals-from head.js */
+
+"use strict";
+
+add_task(async function() {
+ // open tab
+ const URL = URL_ROOT_COM + "storage-cache-basic.html";
+ await openTabAndSetupStorage(URL);
+ const doc = gPanelWindow.document;
+
+ // check that host appears in the storage tree
+ checkTree(doc, ["Cache", "http://example.com", "lorem"]);
+ checkTree(doc, ["Cache", "http://example.net", "foo"]);
+ // Check top level page
+ await selectTreeItem(["Cache", "http://example.com", "lorem"]);
+ checkCacheData(URL_ROOT_COM + "storage-blank.html", "OK");
+ // Check iframe
+ await selectTreeItem(["Cache", "http://example.net", "foo"]);
+ checkCacheData(URL_ROOT_NET + "storage-blank.html", "OK");
+});
+
+function checkCacheData(url, status) {
+ is(
+ gUI.table.items.get(url)?.status,
+ status,
+ `Table row has an entry for: ${url} with status: ${status}`
+ );
+}
diff --git a/devtools/client/storage/test/storage-cache-basic-iframe.html b/devtools/client/storage/test/storage-cache-basic-iframe.html
new file mode 100644
index 000000000000..75d58328e939
--- /dev/null
+++ b/devtools/client/storage/test/storage-cache-basic-iframe.html
@@ -0,0 +1,22 @@
+
+
+
+
+ Storage inspector test for Cache
+
+
+ Cache (iframe)
+
+
+
+
diff --git a/devtools/client/storage/test/storage-cache-basic.html b/devtools/client/storage/test/storage-cache-basic.html
new file mode 100644
index 000000000000..328304746df8
--- /dev/null
+++ b/devtools/client/storage/test/storage-cache-basic.html
@@ -0,0 +1,23 @@
+
+
+
+
+ Storage inspector test for Cache
+
+
+ Cache
+
+
+
+
+
diff --git a/devtools/server/actors/resources/index.js b/devtools/server/actors/resources/index.js
index 509907d84aab..abecaf1ad373 100644
--- a/devtools/server/actors/resources/index.js
+++ b/devtools/server/actors/resources/index.js
@@ -12,14 +12,16 @@ const TYPES = {
CSS_MESSAGE: "css-message",
DOCUMENT_EVENT: "document-event",
ERROR_MESSAGE: "error-message",
- LOCAL_STORAGE: "local-storage",
PLATFORM_MESSAGE: "platform-message",
NETWORK_EVENT: "network-event",
- SESSION_STORAGE: "session-storage",
STYLESHEET: "stylesheet",
NETWORK_EVENT_STACKTRACE: "network-event-stacktrace",
SOURCE: "source",
THREAD_STATE: "thread-state",
+ // storage types
+ CACHE_STORAGE: "Cache",
+ LOCAL_STORAGE: "local-storage",
+ SESSION_STORAGE: "session-storage",
};
exports.TYPES = TYPES;
@@ -33,6 +35,9 @@ exports.TYPES = TYPES;
// Each module exports a Resource Watcher class.
// These lists are specific for the parent process and each target type.
const FrameTargetResources = augmentResourceDictionary({
+ [TYPES.CACHE_STORAGE]: {
+ path: "devtools/server/actors/resources/storage-cache",
+ },
[TYPES.CONSOLE_MESSAGE]: {
path: "devtools/server/actors/resources/console-messages",
},
diff --git a/devtools/server/actors/resources/moz.build b/devtools/server/actors/resources/moz.build
index d1a7cd212a14..7ee2078282fe 100644
--- a/devtools/server/actors/resources/moz.build
+++ b/devtools/server/actors/resources/moz.build
@@ -19,6 +19,7 @@ DevToolsModules(
"network-events.js",
"platform-messages.js",
"sources.js",
+ "storage-cache.js",
"storage-local-storage.js",
"storage-session-storage.js",
"stylesheets.js",
diff --git a/devtools/server/actors/resources/storage-cache.js b/devtools/server/actors/resources/storage-cache.js
new file mode 100644
index 000000000000..7510305afd0d
--- /dev/null
+++ b/devtools/server/actors/resources/storage-cache.js
@@ -0,0 +1,19 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ + * License, v. 2.0. If a copy of the MPL was not distributed with this
+ + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+"use strict";
+
+const {
+ TYPES: { CACHE_STORAGE },
+} = require("devtools/server/actors/resources/index");
+
+const ContentProcessStorage = require("devtools/server/actors/resources/utils/content-process-storage");
+
+class CacheWatcher extends ContentProcessStorage {
+ constructor() {
+ super("Cache", CACHE_STORAGE);
+ }
+}
+
+module.exports = CacheWatcher;
diff --git a/devtools/server/actors/resources/utils/content-process-storage.js b/devtools/server/actors/resources/utils/content-process-storage.js
index 9ee9e22f2fea..a24365d25db9 100644
--- a/devtools/server/actors/resources/utils/content-process-storage.js
+++ b/devtools/server/actors/resources/utils/content-process-storage.js
@@ -47,6 +47,11 @@ class ContentProcessStorage {
this.storageActor = storageActor;
this.actor = new ActorConstructor(storageActor);
+ // Some storage types require to prelist their stores
+ if (typeof this.actor.preListStores === "function") {
+ await this.actor.preListStores();
+ }
+
// We have to manage the actor manually, because ResourceWatcher doesn't
// use the protocol.js specification.
// resource-available-form is typed as "json"
diff --git a/devtools/server/actors/storage.js b/devtools/server/actors/storage.js
index 29720465120b..47efd07131e7 100644
--- a/devtools/server/actors/storage.js
+++ b/devtools/server/actors/storage.js
@@ -3429,6 +3429,7 @@ const StorageActor = protocol.ActorClassWithSpec(specs.storageSpec, {
false
);
const resourcesInWatcher = {
+ Cache: isWatcherEnabled,
localStorage: isWatcherEnabled,
sessionStorage: isWatcherEnabled,
};
diff --git a/devtools/server/actors/watcher.js b/devtools/server/actors/watcher.js
index 1e1c911aeaca..e2f556c617be 100644
--- a/devtools/server/actors/watcher.js
+++ b/devtools/server/actors/watcher.js
@@ -147,6 +147,7 @@ exports.WatcherActor = protocol.ActorClassWithSpec(watcherSpec, {
[Resources.TYPES.CSS_CHANGE]: hasBrowserElement,
[Resources.TYPES.CSS_MESSAGE]: hasBrowserElement,
[Resources.TYPES.DOCUMENT_EVENT]: hasBrowserElement,
+ [Resources.TYPES.CACHE_STORAGE]: hasBrowserElement,
[Resources.TYPES.ERROR_MESSAGE]: hasBrowserElement,
[Resources.TYPES.LOCAL_STORAGE]: hasBrowserElement,
[Resources.TYPES.SESSION_STORAGE]: hasBrowserElement,
diff --git a/devtools/shared/resources/resource-watcher.js b/devtools/shared/resources/resource-watcher.js
index e3d58191adb0..574bad4bab46 100644
--- a/devtools/shared/resources/resource-watcher.js
+++ b/devtools/shared/resources/resource-watcher.js
@@ -975,12 +975,12 @@ const LegacyListeners = {
.WEBSOCKET]: require("devtools/shared/resources/legacy-listeners/websocket"),
[ResourceWatcher.TYPES
.COOKIE]: require("devtools/shared/resources/legacy-listeners/cookie"),
+ [ResourceWatcher.TYPES
+ .CACHE_STORAGE]: require("devtools/shared/resources/legacy-listeners/cache-storage"),
[ResourceWatcher.TYPES
.LOCAL_STORAGE]: require("devtools/shared/resources/legacy-listeners/local-storage"),
[ResourceWatcher.TYPES
.SESSION_STORAGE]: require("devtools/shared/resources/legacy-listeners/session-storage"),
- [ResourceWatcher.TYPES
- .CACHE_STORAGE]: require("devtools/shared/resources/legacy-listeners/cache-storage"),
[ResourceWatcher.TYPES
.EXTENSION_STORAGE]: require("devtools/shared/resources/legacy-listeners/extension-storage"),
[ResourceWatcher.TYPES
@@ -1004,6 +1004,8 @@ const ResourceTransformers = {
.CONSOLE_MESSAGE]: require("devtools/shared/resources/transformers/console-messages"),
[ResourceWatcher.TYPES
.ERROR_MESSAGE]: require("devtools/shared/resources/transformers/error-messages"),
+ [ResourceWatcher.TYPES
+ .CACHE_STORAGE]: require("devtools/shared/resources/transformers/storage-cache.js"),
[ResourceWatcher.TYPES
.LOCAL_STORAGE]: require("devtools/shared/resources/transformers/storage-local-storage.js"),
[ResourceWatcher.TYPES
diff --git a/devtools/shared/resources/transformers/moz.build b/devtools/shared/resources/transformers/moz.build
index 34c061143dad..69814377a310 100644
--- a/devtools/shared/resources/transformers/moz.build
+++ b/devtools/shared/resources/transformers/moz.build
@@ -6,6 +6,7 @@ DevToolsModules(
"console-messages.js",
"error-messages.js",
"network-events.js",
+ "storage-cache.js",
"storage-local-storage.js",
"storage-session-storage.js",
"thread-states.js",
diff --git a/devtools/shared/resources/transformers/storage-cache.js b/devtools/shared/resources/transformers/storage-cache.js
new file mode 100644
index 000000000000..bb3ebed9324a
--- /dev/null
+++ b/devtools/shared/resources/transformers/storage-cache.js
@@ -0,0 +1,23 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+"use strict";
+
+const {
+ TYPES: { CACHE_STORAGE },
+} = require("devtools/shared/resources/resource-watcher");
+
+const { Front, types } = require("devtools/shared/protocol.js");
+
+module.exports = function({ resource, watcherFront, targetFront }) {
+ if (!(resource instanceof Front) && watcherFront) {
+ // instantiate front for local storage
+ resource = types.getType("Cache").read(resource, targetFront);
+ resource.resourceType = CACHE_STORAGE;
+ resource.resourceId = CACHE_STORAGE;
+ resource.resourceKey = "Cache";
+ }
+
+ return resource;
+};