diff options
Diffstat (limited to 'devtools')
-rw-r--r-- | devtools/client/storage/test/browser.ini | 1 | ||||
-rw-r--r-- | devtools/client/storage/test/browser_storage_dom_cache_disabled.js | 37 | ||||
-rw-r--r-- | devtools/client/storage/test/head.js | 10 | ||||
-rw-r--r-- | devtools/client/storage/test/storage-listings.html | 11 | ||||
-rw-r--r-- | devtools/server/actors/storage.js | 5 |
5 files changed, 57 insertions, 7 deletions
diff --git a/devtools/client/storage/test/browser.ini b/devtools/client/storage/test/browser.ini index 08ee7f176..c13b9d0ec 100644 --- a/devtools/client/storage/test/browser.ini +++ b/devtools/client/storage/test/browser.ini @@ -30,6 +30,7 @@ support-files = [browser_storage_delete.js] [browser_storage_delete_all.js] [browser_storage_delete_tree.js] +[browser_storage_dom_cache_disabled.js] [browser_storage_dynamic_updates_cookies.js] [browser_storage_dynamic_updates_localStorage.js] [browser_storage_dynamic_updates_sessionStorage.js] diff --git a/devtools/client/storage/test/browser_storage_dom_cache_disabled.js b/devtools/client/storage/test/browser_storage_dom_cache_disabled.js new file mode 100644 index 000000000..db0aca392 --- /dev/null +++ b/devtools/client/storage/test/browser_storage_dom_cache_disabled.js @@ -0,0 +1,37 @@ +/* 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 ../../framework/test/shared-head.js */ + +"use strict"; + +// Test the storage inspector when dom.caches.enabled=false. + +add_task(function* () { + // Disable the DOM cache + Services.prefs.setBoolPref(DOM_CACHE, false); + + yield openTabAndSetupStorage(MAIN_DOMAIN + "storage-listings.html"); + + const state = [ + [["localStorage", "http://test1.example.org"], + ["ls1", "ls2"]], + [["localStorage", "http://sectest1.example.org"], + ["iframe-u-ls1"]], + [["localStorage", "https://sectest1.example.org"], + ["iframe-s-ls1"]], + [["sessionStorage", "http://test1.example.org"], + ["ss1"]], + [["sessionStorage", "http://sectest1.example.org"], + ["iframe-u-ss1", "iframe-u-ss2"]], + [["sessionStorage", "https://sectest1.example.org"], + ["iframe-s-ss1"]], + [["indexedDB", "http://test1.example.org", "idb1 (default)", "obj1"], + [1, 2, 3]], + ]; + + yield checkState(state); + + yield finishTests(); +}); diff --git a/devtools/client/storage/test/head.js b/devtools/client/storage/test/head.js index 0d7d13e17..07a66120e 100644 --- a/devtools/client/storage/test/head.js +++ b/devtools/client/storage/test/head.js @@ -15,6 +15,7 @@ Services.scriptloader.loadSubScript( const {TableWidget} = require("devtools/client/shared/widgets/TableWidget"); const SPLIT_CONSOLE_PREF = "devtools.toolbox.splitconsoleEnabled"; const STORAGE_PREF = "devtools.storage.enabled"; +const DOM_CACHE = "dom.caches.enabled"; const DUMPEMIT_PREF = "devtools.dump.emit"; const DEBUGGERLOG_PREF = "devtools.debugger.log"; // Allows Cache API to be working on usage `http` test page @@ -38,11 +39,12 @@ Services.prefs.setBoolPref(STORAGE_PREF, true); Services.prefs.setBoolPref(CACHES_ON_HTTP_PREF, true); registerCleanupFunction(() => { gToolbox = gPanelWindow = gWindow = gUI = null; - Services.prefs.clearUserPref(STORAGE_PREF); - Services.prefs.clearUserPref(SPLIT_CONSOLE_PREF); - Services.prefs.clearUserPref(DUMPEMIT_PREF); - Services.prefs.clearUserPref(DEBUGGERLOG_PREF); Services.prefs.clearUserPref(CACHES_ON_HTTP_PREF); + Services.prefs.clearUserPref(DEBUGGERLOG_PREF); + Services.prefs.clearUserPref(DOM_CACHE); + Services.prefs.clearUserPref(DUMPEMIT_PREF); + Services.prefs.clearUserPref(SPLIT_CONSOLE_PREF); + Services.prefs.clearUserPref(STORAGE_PREF); }); /** diff --git a/devtools/client/storage/test/storage-listings.html b/devtools/client/storage/test/storage-listings.html index de3054d3a..89ae5a332 100644 --- a/devtools/client/storage/test/storage-listings.html +++ b/devtools/client/storage/test/storage-listings.html @@ -1,4 +1,4 @@ -<!DOCTYPE HTML> +<!DOCTYPE HTML> <html> <!-- Bug 970517 - Storage inspector front end - tests @@ -110,14 +110,19 @@ let cacheGenerator = function*() { window.setup = function*() { yield idbGenerator(); - yield cacheGenerator(); + + if (window.caches) { + yield cacheGenerator(); + } }; window.clear = function*() { yield deleteDB("idb1"); yield deleteDB("idb2"); - yield caches.delete("plop"); + if (window.caches) { + yield caches.delete("plop"); + } dump("removed indexedDB and cache data from " + document.location + "\n"); }; diff --git a/devtools/server/actors/storage.js b/devtools/server/actors/storage.js index 497051e57..6d069939d 100644 --- a/devtools/server/actors/storage.js +++ b/devtools/server/actors/storage.js @@ -1187,6 +1187,11 @@ StorageActors.createActor({ // The |chrome| cache is the cache implicitely cached by the platform, // hosting the source file of the service worker. let { CacheStorage } = this.storageActor.window; + + if (!CacheStorage) { + return []; + } + let cache = new CacheStorage("content", principal); return cache; }), |