From 30dc977e6a7108fd24c410177c3087b7a30ab1a0 Mon Sep 17 00:00:00 2001 From: Tim Huang Date: Tue, 24 Jan 2017 17:00:01 +0800 Subject: [PATCH] Bug 1263324 - Part 1: Fixing the cache storage inspector to obey originAttributes and indexedDB storage inspector to use correct database file name with originAttributes. r=miker --HG-- extra : rebase_source : c5da3ad94b70b9ff59b22dddcc3b0fd539e5d003 --- devtools/server/actors/storage.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/devtools/server/actors/storage.js b/devtools/server/actors/storage.js index 35fa2172e79f..fee79f07803a 100644 --- a/devtools/server/actors/storage.js +++ b/devtools/server/actors/storage.js @@ -1219,8 +1219,12 @@ StorageActors.createActor({ }, { getCachesForHost: Task.async(function* (host) { let uri = Services.io.newURI(host); + let attrs = this.storageActor + .document + .nodePrincipal + .originAttributes; let principal = - Services.scriptSecurityManager.getNoAppCodebasePrincipal(uri); + Services.scriptSecurityManager.createCodebasePrincipal(uri, attrs); // The first argument tells if you want to get |content| cache or |chrome| // cache. @@ -1664,11 +1668,11 @@ StorageActors.createActor({ populateStoresForHost: Task.async(function* (host) { let storeMap = new Map(); - let {names} = yield this.getDBNamesForHost(host); let win = this.storageActor.getWindowFromHost(host); if (win) { let principal = win.document.nodePrincipal; + let {names} = yield this.getDBNamesForHost(host, principal); for (let {name, storage} of names) { let metadata = yield this.getDBMetaData(host, principal, name, storage); @@ -2025,8 +2029,8 @@ var indexedDBHelpers = { /** * Fetches all the databases and their metadata for the given `host`. */ - getDBNamesForHost: Task.async(function* (host) { - let sanitizedHost = this.getSanitizedHost(host); + getDBNamesForHost: Task.async(function* (host, principal) { + let sanitizedHost = this.getSanitizedHost(host) + principal.originSuffix; let profileDir = OS.Constants.Path.profileDir; let files = []; let names = []; @@ -2363,8 +2367,8 @@ var indexedDBHelpers = { return indexedDBHelpers.splitNameAndStorage(name); } case "getDBNamesForHost": { - let [host] = args; - return indexedDBHelpers.getDBNamesForHost(host); + let [host, principal] = args; + return indexedDBHelpers.getDBNamesForHost(host, principal); } case "getValuesForHost": { let [host, name, options, hostVsStores, principal] = args;