mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Backed out 3 changesets (bug 1003860) for dt6//browser_storage_basic.js failure on win7-debug
Backed out changeset 824ccce70bcf (bug 1003860) Backed out changeset d1d1dbec6725 (bug 1003860) Backed out changeset a4fe93d921ad (bug 1003860)
This commit is contained in:
parent
32376cf74b
commit
4825a0c9e8
@ -54,7 +54,6 @@ tree.labels.cookies=Cookies
|
||||
tree.labels.localStorage=Local Storage
|
||||
tree.labels.sessionStorage=Session Storage
|
||||
tree.labels.indexedDB=Indexed DB
|
||||
tree.labels.Cache=Cache Storage
|
||||
|
||||
# LOCALIZATION NOTE (table.headers.*.*):
|
||||
# These strings are the header names of the columns in the Storage Table for
|
||||
@ -85,9 +84,6 @@ table.headers.localStorage.value=Value
|
||||
table.headers.sessionStorage.name=Key
|
||||
table.headers.sessionStorage.value=Value
|
||||
|
||||
table.headers.Cache.url=URL
|
||||
table.headers.Cache.status=Status
|
||||
|
||||
table.headers.indexedDB.name=Key
|
||||
table.headers.indexedDB.db=Database Name
|
||||
table.headers.indexedDB.objectStore=Object Store Name
|
||||
|
@ -57,10 +57,7 @@ StoragePanel.prototype = {
|
||||
this.emit("ready");
|
||||
|
||||
return this;
|
||||
}).catch(e => {
|
||||
console.log("error while opening storage panel", e);
|
||||
this.destroy();
|
||||
});
|
||||
}).catch(this.destroy);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -61,9 +61,6 @@ const testCases = [
|
||||
[6, 7]],
|
||||
[["indexedDB", "https://sectest1.example.org", "idb-s2", "obj-s2"],
|
||||
[16]],
|
||||
[["Cache", "http://test1.example.org", "plop"],
|
||||
[MAIN_DOMAIN + "404_cached_file.js", MAIN_DOMAIN + "browser_storage_basic.js"]],
|
||||
|
||||
];
|
||||
|
||||
/**
|
||||
|
@ -14,8 +14,6 @@ const SPLIT_CONSOLE_PREF = "devtools.toolbox.splitconsoleEnabled";
|
||||
const STORAGE_PREF = "devtools.storage.enabled";
|
||||
const DUMPEMIT_PREF = "devtools.dump.emit";
|
||||
const DEBUGGERLOG_PREF = "devtools.debugger.log";
|
||||
// Allows Cache API to be working on usage `http` test page
|
||||
const CACHES_ON_HTTP_PREF = "dom.caches.testing.enabled";
|
||||
const PATH = "browser/devtools/client/storage/test/";
|
||||
const MAIN_DOMAIN = "http://test1.example.org/" + PATH;
|
||||
const ALT_DOMAIN = "http://sectest1.example.org/" + PATH;
|
||||
@ -29,7 +27,6 @@ var gToolbox, gPanelWindow, gWindow, gUI;
|
||||
// Services.prefs.setBoolPref(DEBUGGERLOG_PREF, true);
|
||||
|
||||
Services.prefs.setBoolPref(STORAGE_PREF, true);
|
||||
Services.prefs.setBoolPref(CACHES_ON_HTTP_PREF, true);
|
||||
DevToolsUtils.testing = true;
|
||||
registerCleanupFunction(() => {
|
||||
gToolbox = gPanelWindow = gWindow = gUI = null;
|
||||
@ -37,7 +34,6 @@ registerCleanupFunction(() => {
|
||||
Services.prefs.clearUserPref(SPLIT_CONSOLE_PREF);
|
||||
Services.prefs.clearUserPref(DUMPEMIT_PREF);
|
||||
Services.prefs.clearUserPref(DEBUGGERLOG_PREF);
|
||||
Services.prefs.clearUserPref(CACHES_ON_HTTP_PREF);
|
||||
DevToolsUtils.testing = false;
|
||||
while (gBrowser.tabs.length > 1) {
|
||||
gBrowser.removeCurrentTab();
|
||||
@ -86,20 +82,35 @@ function addTab(url) {
|
||||
* @return {Promise} A promise that resolves after storage inspector is ready
|
||||
*/
|
||||
function* openTabAndSetupStorage(url) {
|
||||
/**
|
||||
* This method iterates over iframes in a window and setups the indexed db
|
||||
* required for this test.
|
||||
*/
|
||||
let setupIDBInFrames = (w, i, c) => {
|
||||
if (w[i] && w[i].idbGenerator) {
|
||||
w[i].setupIDB = w[i].idbGenerator(() => setupIDBInFrames(w, i + 1, c));
|
||||
w[i].setupIDB.next();
|
||||
} else if (w[i] && w[i + 1]) {
|
||||
setupIDBInFrames(w, i + 1, c);
|
||||
} else {
|
||||
c();
|
||||
}
|
||||
};
|
||||
|
||||
let content = yield addTab(url);
|
||||
|
||||
let def = promise.defer();
|
||||
// Setup the indexed db in main window.
|
||||
gWindow = content.wrappedJSObject;
|
||||
|
||||
// Setup the async storages in main window and for all its iframes
|
||||
let callSetup = function*(win) {
|
||||
if (typeof(win.setup) == "function") {
|
||||
yield win.setup();
|
||||
}
|
||||
for(var i = 0; i < win.frames.length; i++) {
|
||||
yield callSetup(win.frames[i]);
|
||||
}
|
||||
if (gWindow.idbGenerator) {
|
||||
gWindow.setupIDB = gWindow.idbGenerator(() => {
|
||||
setupIDBInFrames(gWindow, 0, () => {
|
||||
def.resolve();
|
||||
});
|
||||
});
|
||||
gWindow.setupIDB.next();
|
||||
yield def.promise;
|
||||
}
|
||||
yield callSetup(gWindow);
|
||||
|
||||
// open storage inspector
|
||||
return yield openStoragePanel();
|
||||
@ -487,7 +498,6 @@ function* selectTreeItem(ids) {
|
||||
|
||||
let selector = "[data-id='" + JSON.stringify(ids) + "'] > .tree-widget-item";
|
||||
let target = gPanelWindow.document.querySelector(selector);
|
||||
ok(target, "tree item found with ids " + JSON.stringify(ids));
|
||||
|
||||
let updated = gUI.once("store-objects-updated");
|
||||
|
||||
@ -504,7 +514,6 @@ function* selectTreeItem(ids) {
|
||||
function* selectTableItem(id) {
|
||||
let selector = ".table-widget-cell[data-id='" + id + "']";
|
||||
let target = gPanelWindow.document.querySelector(selector);
|
||||
ok(target, "table item found with ids " + id);
|
||||
|
||||
yield click(target);
|
||||
yield gUI.once("sidebar-updated");
|
||||
|
@ -34,63 +34,53 @@ sessionStorage.setItem("ss2", "This~is~another~array");
|
||||
sessionStorage.setItem("ss3", "this#is~an#object~foo#bar");
|
||||
console.log("added cookies and stuff from main page");
|
||||
|
||||
let idbGenerator = function*() {
|
||||
function success(event) {
|
||||
setupIDB.next(event);
|
||||
}
|
||||
|
||||
window.idbGenerator = function*(callback) {
|
||||
let request = indexedDB.open("idb1", 1);
|
||||
request.onupgradeneeded = success;
|
||||
request.onsuccess = success;
|
||||
request.onerror = function() {
|
||||
throw new Error("error opening db connection");
|
||||
};
|
||||
let db = yield new Promise(done => {
|
||||
request.onupgradeneeded = event => {
|
||||
let db = event.target.result;
|
||||
let store1 = db.createObjectStore("obj1", { keyPath: "id" });
|
||||
store1.createIndex("name", "name", { unique: false });
|
||||
store1.createIndex("email", "email", { unique: true });
|
||||
db.createObjectStore("obj2", { keyPath: "id2" });
|
||||
store1.transaction.oncomplete = () => {
|
||||
done(db);
|
||||
};
|
||||
};
|
||||
});
|
||||
let event = yield undefined;
|
||||
let db = event.target.result;
|
||||
let store1 = db.createObjectStore("obj1", { keyPath: "id" });
|
||||
store1.createIndex("name", "name", { unique: false });
|
||||
store1.createIndex("email", "email", { unique: true });
|
||||
let store2 = db.createObjectStore("obj2", { keyPath: "id2" });
|
||||
|
||||
// Prevents AbortError
|
||||
yield new Promise(done => {
|
||||
request.onsuccess = done;
|
||||
});
|
||||
|
||||
let transaction = db.transaction(["obj1", "obj2"], "readwrite");
|
||||
let store1 = transaction.objectStore("obj1");
|
||||
let store2 = transaction.objectStore("obj2");
|
||||
|
||||
store1.add({id: 1, name: "foo", email: "foo@bar.com"});
|
||||
store1.add({id: 2, name: "foo2", email: "foo2@bar.com"});
|
||||
store1.add({id: 3, name: "foo2", email: "foo3@bar.com"});
|
||||
store1.add({id: 1, name: "foo", email: "foo@bar.com"}).onsuccess = success;
|
||||
yield undefined;
|
||||
store1.add({id: 2, name: "foo2", email: "foo2@bar.com"}).onsuccess = success;
|
||||
yield undefined;
|
||||
store1.add({id: 3, name: "foo2", email: "foo3@bar.com"}).onsuccess = success;
|
||||
yield undefined;
|
||||
store2.add({
|
||||
id2: 1,
|
||||
name: "foo",
|
||||
email: "foo@bar.com",
|
||||
extra: "baz"});
|
||||
extra: "baz"}).onsuccess = success;
|
||||
yield undefined;
|
||||
|
||||
yield undefined;
|
||||
db.close();
|
||||
|
||||
request = indexedDB.open("idb2", 1);
|
||||
let db2 = yield new Promise(done => {
|
||||
request.onupgradeneeded = event => {
|
||||
let db2 = event.target.result;
|
||||
let store3 = db2.createObjectStore("obj3", { keyPath: "id3" });
|
||||
store3.createIndex("name2", "name2", { unique: true });
|
||||
store3.transaction.oncomplete = () => {
|
||||
done(db2);
|
||||
};
|
||||
};
|
||||
});
|
||||
request.onupgradeneeded = success;
|
||||
request.onsuccess = success;
|
||||
event = yield undefined;
|
||||
|
||||
// Prevents AbortError during close()
|
||||
yield new Promise(done => {
|
||||
request.onsuccess = done;
|
||||
});
|
||||
let db2 = event.target.result;
|
||||
let store3 = db2.createObjectStore("obj3", { keyPath: "id3" });
|
||||
store3.createIndex("name2", "name2", { unique: true });
|
||||
|
||||
yield undefined;
|
||||
db2.close();
|
||||
console.log("added cookies and stuff from main page");
|
||||
callback();
|
||||
};
|
||||
|
||||
function deleteDB(dbName) {
|
||||
@ -100,10 +90,6 @@ function deleteDB(dbName) {
|
||||
});
|
||||
}
|
||||
|
||||
window.setup = function*() {
|
||||
yield idbGenerator();
|
||||
};
|
||||
|
||||
window.clear = function*() {
|
||||
document.cookie = "c1=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/browser";
|
||||
document.cookie = "cs2=; expires=Thu, 01 Jan 1970 00:00:00 GMT";
|
||||
|
@ -28,66 +28,53 @@ localStorage.setItem("ls2", "foobar-2");
|
||||
sessionStorage.setItem("ss1", "foobar-3");
|
||||
dump("added cookies and stuff from main page\n");
|
||||
|
||||
let idbGenerator = function*() {
|
||||
function success(event) {
|
||||
setupIDB.next(event);
|
||||
}
|
||||
|
||||
window.idbGenerator = function*(callback) {
|
||||
let request = indexedDB.open("idb1", 1);
|
||||
request.onupgradeneeded = success;
|
||||
request.onsuccess = success;
|
||||
request.onerror = function() {
|
||||
throw new Error("error opening db connection");
|
||||
};
|
||||
let db = yield new Promise(done => {
|
||||
request.onupgradeneeded = event => {
|
||||
let db = event.target.result;
|
||||
let store1 = db.createObjectStore("obj1", { keyPath: "id" });
|
||||
store1.createIndex("name", "name", { unique: false });
|
||||
store1.createIndex("email", "email", { unique: true });
|
||||
let store2 = db.createObjectStore("obj2", { keyPath: "id2" });
|
||||
store1.transaction.oncomplete = () => {
|
||||
done(db);
|
||||
};
|
||||
};
|
||||
});
|
||||
let event = yield undefined;
|
||||
let db = event.target.result;
|
||||
let store1 = db.createObjectStore("obj1", { keyPath: "id" });
|
||||
store1.createIndex("name", "name", { unique: false });
|
||||
store1.createIndex("email", "email", { unique: true });
|
||||
let store2 = db.createObjectStore("obj2", { keyPath: "id2" });
|
||||
|
||||
// Prevents AbortError
|
||||
yield new Promise(done => {
|
||||
request.onsuccess = done;
|
||||
});
|
||||
|
||||
let transaction = db.transaction(["obj1", "obj2"], "readwrite");
|
||||
let store1 = transaction.objectStore("obj1");
|
||||
let store2 = transaction.objectStore("obj2");
|
||||
store1.add({id: 1, name: "foo", email: "foo@bar.com"});
|
||||
store1.add({id: 2, name: "foo2", email: "foo2@bar.com"});
|
||||
store1.add({id: 3, name: "foo2", email: "foo3@bar.com"});
|
||||
store1.add({id: 1, name: "foo", email: "foo@bar.com"}).onsuccess = success;
|
||||
yield undefined;
|
||||
store1.add({id: 2, name: "foo2", email: "foo2@bar.com"}).onsuccess = success;
|
||||
yield undefined;
|
||||
store1.add({id: 3, name: "foo2", email: "foo3@bar.com"}).onsuccess = success;
|
||||
yield undefined;
|
||||
store2.add({
|
||||
id2: 1,
|
||||
name: "foo",
|
||||
email: "foo@bar.com",
|
||||
extra: "baz"
|
||||
});
|
||||
// Prevents AbortError during close()
|
||||
yield new Promise(success => {
|
||||
transaction.oncomplete = success;
|
||||
});
|
||||
extra: "baz"}).onsuccess = success;
|
||||
yield undefined;
|
||||
|
||||
yield undefined;
|
||||
db.close();
|
||||
|
||||
request = indexedDB.open("idb2", 1);
|
||||
let db2 = yield new Promise(done => {
|
||||
request.onupgradeneeded = event => {
|
||||
let db2 = event.target.result;
|
||||
let store3 = db2.createObjectStore("obj3", { keyPath: "id3" });
|
||||
store3.createIndex("name2", "name2", { unique: true });
|
||||
store3.transaction.oncomplete = () => {
|
||||
done(db2);
|
||||
}
|
||||
};
|
||||
});
|
||||
// Prevents AbortError during close()
|
||||
yield new Promise(done => {
|
||||
request.onsuccess = done;
|
||||
});
|
||||
db2.close();
|
||||
request.onupgradeneeded = success;
|
||||
request.onsuccess = success;
|
||||
event = yield undefined;
|
||||
|
||||
let db2 = event.target.result;
|
||||
let store3 = db2.createObjectStore("obj3", { keyPath: "id3" });
|
||||
store3.createIndex("name2", "name2", { unique: true });
|
||||
|
||||
yield undefined;
|
||||
db2.close();
|
||||
dump("added cookies and stuff from main page\n");
|
||||
callback();
|
||||
};
|
||||
|
||||
function deleteDB(dbName) {
|
||||
@ -97,17 +84,6 @@ function deleteDB(dbName) {
|
||||
});
|
||||
}
|
||||
|
||||
let cacheGenerator = function*() {
|
||||
let cache = yield caches.open("plop");
|
||||
yield cache.add("404_cached_file.js");
|
||||
yield cache.add("browser_storage_basic.js");
|
||||
};
|
||||
|
||||
window.setup = function*() {
|
||||
yield idbGenerator();
|
||||
yield cacheGenerator();
|
||||
};
|
||||
|
||||
window.clear = function*() {
|
||||
document.cookie = "c1=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/browser";
|
||||
document.cookie =
|
||||
@ -122,8 +98,6 @@ window.clear = function*() {
|
||||
yield deleteDB("idb1");
|
||||
yield deleteDB("idb2");
|
||||
|
||||
yield caches.delete("plop");
|
||||
|
||||
dump("removed cookies, localStorage, sessionStorage and indexedDB data " +
|
||||
"from " + document.location + "\n");
|
||||
};
|
||||
|
@ -17,55 +17,41 @@ function success(event) {
|
||||
setupIDB.next(event);
|
||||
}
|
||||
|
||||
let idbGenerator = function*() {
|
||||
window.idbGenerator = function*(callback) {
|
||||
let request = indexedDB.open("idb-s1", 1);
|
||||
request.onupgradeneeded = success;
|
||||
request.onsuccess = success;
|
||||
request.onerror = function() {
|
||||
throw new Error("error opening db connection");
|
||||
};
|
||||
let db = yield new Promise(done => {
|
||||
request.onupgradeneeded = event => {
|
||||
let db = event.target.result;
|
||||
let store1 = db.createObjectStore("obj-s1", { keyPath: "id" });
|
||||
store1.add({id: 6, name: "foo", email: "foo@bar.com"});
|
||||
store1.add({id: 7, name: "foo2", email: "foo2@bar.com"});
|
||||
store1.transaction.oncomplete = () => {
|
||||
done(db);
|
||||
};
|
||||
};
|
||||
});
|
||||
yield new Promise(done => {
|
||||
request.onsuccess = done;
|
||||
});
|
||||
let event = yield undefined;
|
||||
let db = event.target.result;
|
||||
let store1 = db.createObjectStore("obj-s1", { keyPath: "id" });
|
||||
|
||||
store1.add({id: 6, name: "foo", email: "foo@bar.com"}).onsuccess = success;
|
||||
yield undefined;
|
||||
store1.add({id: 7, name: "foo2", email: "foo2@bar.com"}).onsuccess = success;
|
||||
yield undefined;
|
||||
|
||||
yield undefined;
|
||||
db.close();
|
||||
/*
|
||||
let transaction = db.transaction(["obj-s1"], "readwrite");
|
||||
let store1 = transaction.objectStore("obj-s1");
|
||||
store1.add({id: 6, name: "foo", email: "foo@bar.com"});
|
||||
store1.add({id: 7, name: "foo2", email: "foo2@bar.com"});
|
||||
yield new Promise(success => {
|
||||
transaction.oncomplete = success;
|
||||
});
|
||||
*/
|
||||
|
||||
request = indexedDB.open("idb-s2", 1);
|
||||
let db2 = yield new Promise(done => {
|
||||
request.onupgradeneeded = event => {
|
||||
let db2 = event.target.result;
|
||||
let store3 =
|
||||
db2.createObjectStore("obj-s2", { keyPath: "id3", autoIncrement: true });
|
||||
store3.createIndex("name2", "name2", { unique: true });
|
||||
store3.add({id3: 16, name2: "foo", email: "foo@bar.com"});
|
||||
store3.transaction.oncomplete = () => {
|
||||
done(db2);
|
||||
};
|
||||
};
|
||||
});
|
||||
yield new Promise(done => {
|
||||
request.onsuccess = done;
|
||||
});
|
||||
request.onupgradeneeded = success;
|
||||
request.onsuccess = success;
|
||||
event = yield undefined;
|
||||
|
||||
let db2 = event.target.result;
|
||||
let store3 =
|
||||
db2.createObjectStore("obj-s2", { keyPath: "id3", autoIncrement: true });
|
||||
store3.createIndex("name2", "name2", { unique: true });
|
||||
store3.add({id3: 16, name2: "foo", email: "foo@bar.com"}).onsuccess = success;
|
||||
yield undefined;
|
||||
|
||||
yield undefined;
|
||||
db2.close();
|
||||
dump("added cookies and stuff from secured iframe\n");
|
||||
callback();
|
||||
};
|
||||
|
||||
function deleteDB(dbName) {
|
||||
@ -75,10 +61,6 @@ function deleteDB(dbName) {
|
||||
});
|
||||
}
|
||||
|
||||
window.setup = function*() {
|
||||
yield idbGenerator();
|
||||
};
|
||||
|
||||
window.clear = function*() {
|
||||
document.cookie = "sc1=; expires=Thu, 01 Jan 1970 00:00:00 GMT";
|
||||
|
||||
|
@ -341,16 +341,11 @@ StorageUI.prototype = {
|
||||
populateStorageTree: function(storageTypes) {
|
||||
this.storageTypes = {};
|
||||
for (let type in storageTypes) {
|
||||
// Ignore `from` field, which is just a protocol.js implementation artifact
|
||||
if (type === "from") {
|
||||
continue;
|
||||
}
|
||||
let typeLabel = type;
|
||||
try {
|
||||
typeLabel = L10N.getStr("tree.labels." + type);
|
||||
} catch(e) {
|
||||
console.error("Unable to localize tree label type:" + type);
|
||||
}
|
||||
|
||||
let typeLabel = L10N.getStr("tree.labels." + type);
|
||||
this.tree.add([{id: type, label: typeLabel, type: "store"}]);
|
||||
if (!storageTypes[type].hosts) {
|
||||
continue;
|
||||
@ -573,12 +568,7 @@ StorageUI.prototype = {
|
||||
if (!uniqueKey) {
|
||||
this.table.uniqueId = uniqueKey = key;
|
||||
}
|
||||
columns[key] = key;
|
||||
try {
|
||||
columns[key] = L10N.getStr("table.headers." + type + "." + key);
|
||||
} catch(e) {
|
||||
console.error("Unable to localize table header type:" + type + " key:" + key);
|
||||
}
|
||||
columns[key] = L10N.getStr("table.headers." + type + "." + key);
|
||||
}
|
||||
this.table.setColumns(columns, null, HIDDEN_COLUMNS);
|
||||
this.shouldResetColumns = false;
|
||||
|
@ -922,131 +922,6 @@ StorageActors.createActor({
|
||||
storeObjectType: "storagestoreobject"
|
||||
}, getObjectForLocalOrSessionStorage("sessionStorage"));
|
||||
|
||||
|
||||
let CacheAttributes = [
|
||||
"url",
|
||||
"status",
|
||||
];
|
||||
types.addDictType("cacheobject", {
|
||||
"url": "string",
|
||||
"status": "string"
|
||||
});
|
||||
|
||||
// Array of Cache store objects
|
||||
types.addDictType("cachestoreobject", {
|
||||
total: "number",
|
||||
offset: "number",
|
||||
data: "array:nullable:cacheobject"
|
||||
});
|
||||
|
||||
StorageActors.createActor({
|
||||
typeName: "Cache",
|
||||
storeObjectType: "cachestoreobject"
|
||||
}, {
|
||||
getCachesForHost: Task.async(function*(host) {
|
||||
let uri = Services.io.newURI(host, null, null);
|
||||
let principal = Services.scriptSecurityManager.getNoAppCodebasePrincipal(uri);
|
||||
|
||||
// The first argument tells if you want to get |content| cache or |chrome| cache.
|
||||
// The |content| cache is the cache explicitely named by the web content
|
||||
// (service worker or web page).
|
||||
// The |chrome| cache is the cache implicitely cached by the platform, hosting the
|
||||
// source file of the service worker.
|
||||
let { CacheStorage } = this.storageActor.window;
|
||||
let cache = new CacheStorage("content", principal);
|
||||
return cache;
|
||||
}),
|
||||
|
||||
preListStores: Task.async(function*() {
|
||||
for (let host of this.hosts) {
|
||||
yield this.populateStoresForHost(host);
|
||||
}
|
||||
}),
|
||||
|
||||
form: function(form, detail) {
|
||||
if (detail === "actorid") {
|
||||
return this.actorID;
|
||||
}
|
||||
|
||||
let hosts = {};
|
||||
for (let host of this.hosts) {
|
||||
hosts[host] = this.getNamesForHost(host);
|
||||
}
|
||||
|
||||
return {
|
||||
actor: this.actorID,
|
||||
hosts: hosts
|
||||
};
|
||||
},
|
||||
|
||||
getNamesForHost: function(host) {
|
||||
// UI code expect each name to be a JSON string of an array :/
|
||||
return [...this.hostVsStores.get(host).keys()].map(a => JSON.stringify([a]));
|
||||
},
|
||||
|
||||
getValuesForHost: Task.async(function*(host, name) {
|
||||
if (!name) return [];
|
||||
// UI is weird and expect a JSON stringified array... and pass it back :/
|
||||
name = JSON.parse(name)[0];
|
||||
|
||||
let cache = this.hostVsStores.get(host).get(name);
|
||||
let requests = yield cache.keys();
|
||||
let results = [];
|
||||
for(let request of requests) {
|
||||
let response = yield cache.match(request);
|
||||
// Unwrap the response to get access to all its properties if the
|
||||
// response happen to be 'opaque', when it is a Cross Origin Request.
|
||||
response = response.cloneUnfiltered();
|
||||
results.push(yield this.processEntry(request, response));
|
||||
}
|
||||
return results;
|
||||
}),
|
||||
|
||||
processEntry: Task.async(function*(request, response) {
|
||||
return {
|
||||
url: String(request.url),
|
||||
status: String(response.statusText),
|
||||
};
|
||||
}),
|
||||
|
||||
getHostName: function(location) {
|
||||
if (!location.host) {
|
||||
return location.href;
|
||||
}
|
||||
return location.protocol + "//" + location.host;
|
||||
},
|
||||
|
||||
populateStoresForHost: Task.async(function*(host, window) {
|
||||
let storeMap = new Map();
|
||||
let caches = yield this.getCachesForHost(host);
|
||||
for (let name of (yield caches.keys())) {
|
||||
storeMap.set(name, (yield caches.open(name)));
|
||||
}
|
||||
this.hostVsStores.set(host, storeMap);
|
||||
}),
|
||||
|
||||
/**
|
||||
* This method is overriden and left blank as for Cache Storage, this
|
||||
* operation cannot be performed synchronously. Thus, the preListStores
|
||||
* method exists to do the same task asynchronously.
|
||||
*/
|
||||
populateStoresForHosts: function() {
|
||||
this.hostVsStores = new Map();
|
||||
},
|
||||
|
||||
/**
|
||||
* Given a url, correctly determine its protocol + hostname part.
|
||||
*/
|
||||
getSchemaAndHost: function(url) {
|
||||
let uri = Services.io.newURI(url, null, null);
|
||||
return uri.scheme + "://" + uri.hostPort;
|
||||
},
|
||||
|
||||
toStoreObject: function(item) {
|
||||
return item;
|
||||
},
|
||||
});
|
||||
|
||||
/**
|
||||
* Code related to the Indexed DB actor and front
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user