зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1262766 - Storage Inspector breaks down when Cache Storage throws a DOM security error. r=mratcliffe
This commit is contained in:
Родитель
e5a08515d2
Коммит
8eb506fa5f
|
@ -2,6 +2,7 @@
|
||||||
tags = devtools
|
tags = devtools
|
||||||
subsuite = devtools
|
subsuite = devtools
|
||||||
support-files =
|
support-files =
|
||||||
|
storage-cache-error.html
|
||||||
storage-complex-values.html
|
storage-complex-values.html
|
||||||
storage-cookies.html
|
storage-cookies.html
|
||||||
storage-listings.html
|
storage-listings.html
|
||||||
|
@ -15,6 +16,7 @@ support-files =
|
||||||
head.js
|
head.js
|
||||||
|
|
||||||
[browser_storage_basic.js]
|
[browser_storage_basic.js]
|
||||||
|
[browser_storage_cache_error.js]
|
||||||
[browser_storage_cookies_delete_all.js]
|
[browser_storage_cookies_delete_all.js]
|
||||||
[browser_storage_cookies_edit.js]
|
[browser_storage_cookies_edit.js]
|
||||||
[browser_storage_cookies_edit_keyboard.js]
|
[browser_storage_cookies_edit_keyboard.js]
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
/* 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";
|
||||||
|
|
||||||
|
// Test handling errors in CacheStorage
|
||||||
|
|
||||||
|
add_task(function* () {
|
||||||
|
yield openTabAndSetupStorage(MAIN_DOMAIN + "storage-cache-error.html");
|
||||||
|
|
||||||
|
const cacheItemId = ["Cache", "javascript:parent.frameContent"];
|
||||||
|
|
||||||
|
gUI.tree.selectedItem = cacheItemId;
|
||||||
|
ok(gUI.tree.isSelected(cacheItemId),
|
||||||
|
`The item ${cacheItemId.join(" > ")} is present in the tree`);
|
||||||
|
|
||||||
|
yield finishTests();
|
||||||
|
});
|
|
@ -0,0 +1,20 @@
|
||||||
|
<!DOCTYPE HTML>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>Storage inspector test for handling errors in CacheStorage</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<script type="application/javascript;version=1.7">
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
// Create an iframe with a javascript: source URL. Such iframes are
|
||||||
|
// considered untrusted by the CacheStorage.
|
||||||
|
let frameEl = document.createElement("iframe");
|
||||||
|
document.body.appendChild(frameEl);
|
||||||
|
|
||||||
|
window.frameContent = 'Hello World';
|
||||||
|
frameEl.contentWindow.location.href = "javascript:parent.frameContent";
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -352,8 +352,10 @@ StorageActors.defaults = function(typeName, observationTopic, storeObjectType) {
|
||||||
// We only acquire principal when the type of the storage is indexedDB
|
// We only acquire principal when the type of the storage is indexedDB
|
||||||
// because the principal only matters the indexedDB.
|
// because the principal only matters the indexedDB.
|
||||||
let win = this.storageActor.getWindowFromHost(host);
|
let win = this.storageActor.getWindowFromHost(host);
|
||||||
|
if (win) {
|
||||||
principal = win.document.nodePrincipal;
|
principal = win.document.nodePrincipal;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (names) {
|
if (names) {
|
||||||
for (let name of names) {
|
for (let name of names) {
|
||||||
|
@ -1345,9 +1347,13 @@ StorageActors.createActor({
|
||||||
populateStoresForHost: Task.async(function*(host) {
|
populateStoresForHost: Task.async(function*(host) {
|
||||||
let storeMap = new Map();
|
let storeMap = new Map();
|
||||||
let caches = yield this.getCachesForHost(host);
|
let caches = yield this.getCachesForHost(host);
|
||||||
|
try {
|
||||||
for (let name of (yield caches.keys())) {
|
for (let name of (yield caches.keys())) {
|
||||||
storeMap.set(name, (yield caches.open(name)));
|
storeMap.set(name, (yield caches.open(name)));
|
||||||
}
|
}
|
||||||
|
} catch (ex) {
|
||||||
|
console.error(`Failed to enumerate CacheStorage for host ${host}:`, ex);
|
||||||
|
}
|
||||||
this.hostVsStores.set(host, storeMap);
|
this.hostVsStores.set(host, storeMap);
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
@ -1606,6 +1612,7 @@ StorageActors.createActor({
|
||||||
let storeMap = new Map();
|
let storeMap = new Map();
|
||||||
let {names} = yield this.getDBNamesForHost(host);
|
let {names} = yield this.getDBNamesForHost(host);
|
||||||
let win = this.storageActor.getWindowFromHost(host);
|
let win = this.storageActor.getWindowFromHost(host);
|
||||||
|
if (win) {
|
||||||
let principal = win.document.nodePrincipal;
|
let principal = win.document.nodePrincipal;
|
||||||
|
|
||||||
for (let name of names) {
|
for (let name of names) {
|
||||||
|
@ -1614,6 +1621,7 @@ StorageActors.createActor({
|
||||||
metadata = indexedDBHelpers.patchMetadataMapsAndProtos(metadata);
|
metadata = indexedDBHelpers.patchMetadataMapsAndProtos(metadata);
|
||||||
storeMap.set(name, metadata);
|
storeMap.set(name, metadata);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.hostVsStores.set(host, storeMap);
|
this.hostVsStores.set(host, storeMap);
|
||||||
}),
|
}),
|
||||||
|
|
Загрузка…
Ссылка в новой задаче