sync the *latest* 10 back-button entries per tab (not the earliest ones)

This commit is contained in:
Dan Mills 2008-07-29 15:37:59 -07:00
Родитель 3cc3c36b0b
Коммит 856921abd1
1 изменённых файлов: 4 добавлений и 5 удалений

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

@ -409,16 +409,15 @@ TabStore.prototype = {
let tabID = currentEntry.url; let tabID = currentEntry.url;
this._log.trace("_wrapRealTabs: tab " + tabID); this._log.trace("_wrapRealTabs: tab " + tabID);
// Only sync up to 10 back-button entries, otherwise we can end up with
// some insanely large snapshots.
tab.entries = tab.entries.slice(tab.entries.length - 10);
// The ID property of each entry in the tab, which I think contains // The ID property of each entry in the tab, which I think contains
// nsISHEntry::ID, changes every time session store restores the tab, // nsISHEntry::ID, changes every time session store restores the tab,
// so we can't sync them, or we would generate edit commands on every // so we can't sync them, or we would generate edit commands on every
// restart (even though nothing has actually changed). // restart (even though nothing has actually changed).
// Also, only sync up to 10 entries, otherwise we can end up with some
// insanely large snapshots.
for (let k = 0; k < tab.entries.length; k++) { for (let k = 0; k < tab.entries.length; k++) {
if (k > 10)
delete tab.entries[k];
else
delete tab.entries[k].ID; delete tab.entries[k].ID;
} }