Bug 459041 - jar: URLs break sss_serializeSessionStorage (and thus SessionStore)

This commit is contained in:
Simon Bünzli 2008-10-12 00:02:55 +03:30
Родитель e99145da14
Коммит 3e0581faaa
1 изменённых файлов: 12 добавлений и 11 удалений

Просмотреть файл

@ -1116,26 +1116,27 @@ SessionStoreService.prototype = {
let hasContent = false; let hasContent = false;
for (let i = 0; i < aHistory.count; i++) { for (let i = 0; i < aHistory.count; i++) {
let uri = aHistory.getEntryAtIndex(i, false).URI.clone(); let uri = aHistory.getEntryAtIndex(i, false).URI;
// sessionStorage is saved per domain (cf. nsDocShell::GetSessionStorageForURI) // sessionStorage is saved per domain (cf. nsDocShell::GetSessionStorageForURI)
if (uri instanceof Ci.nsIURL) let domain = uri.spec;
uri.path = ""; try {
if (storageData[uri.spec] || !(aFullData || this._checkPrivacyLevel(uri.schemeIs("https")))) if (uri.host)
domain = uri.prePath;
}
catch (ex) { /* this throws for host-less URIs (such as about: or jar:) */ }
if (storageData[domain] || !(aFullData || this._checkPrivacyLevel(uri.schemeIs("https"))))
continue; continue;
let storage, storageItemCount; let storage, storageItemCount = 0;
try { try {
storage = aDocShell.getSessionStorageForURI(uri); storage = aDocShell.getSessionStorageForURI(uri);
storageItemCount = storage.length; storageItemCount = storage.length;
if (storageItemCount == 0)
continue;
} }
catch (ex) { catch (ex) { /* sessionStorage might throw if it's turned off, see bug 458954 */ }
// sessionStorage might throw if it's turned off, see bug 458954 if (storageItemCount == 0)
continue; continue;
}
let data = storageData[uri.spec] = {}; let data = storageData[domain] = {};
for (let j = 0; j < storageItemCount; j++) { for (let j = 0; j < storageItemCount; j++) {
try { try {
let key = storage.key(j); let key = storage.key(j);