Bug 1546847 - SessionStore _cachedObjs fixup code for backout r=Gijs

Depends on D121898

Differential Revision: https://phabricator.services.mozilla.com/D121899
This commit is contained in:
Doug Thayer
2021-08-05 18:34:57 +00:00
parent 422c3e0585
commit d2681b7dad

View File

@@ -255,6 +255,25 @@ var SessionFileInternal = {
let source = await OS.File.read(path, options);
let parsed = JSON.parse(source);
if (parsed._cachedObjs) {
try {
let cacheMap = new Map(parsed._cachedObjs);
for (let win of parsed.windows.concat(
parsed._closedWindows || []
)) {
for (let tab of win.tabs.concat(win._closedTabs || [])) {
tab.image = cacheMap.get(tab.image) || tab.image;
}
}
} catch (e) {
// This is temporary code to clean up after the backout of bug
// 1546847. Just in case there are problems in the format of
// the parsed data, continue on. Favicons might be broken, but
// the session will at least be recovered
Cu.reportError(e);
}
}
if (
!SessionStore.isFormatVersionCompatible(
parsed.version || [