Bug 1235657 - Session storage needs to handle origin attributes correctly - part 2 - SessionStorageInternal::restore, r=huseby

This commit is contained in:
Andrea Marchesini 2016-01-06 10:09:04 +00:00
parent a365470b87
commit 0641add434

View File

@ -104,7 +104,18 @@ var SessionStorageInternal = {
restore: function (aDocShell, aStorageData) { restore: function (aDocShell, aStorageData) {
for (let origin of Object.keys(aStorageData)) { for (let origin of Object.keys(aStorageData)) {
let data = aStorageData[origin]; let data = aStorageData[origin];
let principal = Services.scriptSecurityManager.createCodebasePrincipalFromOrigin(origin);
let principal;
try {
let attrs = ChromeUtils.createOriginAttributesWithUserContextId(origin, aDocShell.userContextId);
let originURI = Services.io.newURI(origin, null, null);
principal = Services.scriptSecurityManager.createCodebasePrincipal(originURI, attrs);
} catch (e) {
console.error(e);
continue;
}
let storageManager = aDocShell.QueryInterface(Ci.nsIDOMStorageManager); let storageManager = aDocShell.QueryInterface(Ci.nsIDOMStorageManager);
let window = aDocShell.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindow); let window = aDocShell.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindow);