Bug 1229259 - Always initialise new tabs with basic session store data. r=margaret

When opening a new tab, there is a small window between tab creation and the DOMTitleChanged event firing where the tab - if it is not created as a delay loaded zombie tab right away - won't have any session store data. However a number of functions (tab zombification and restoring of zombified tabs, undo close tabs) depend on the session store data always being available, so things can fall apart if e.g. a zombification is triggered immediately after opening a new tab.
This also means that a tab which is zombfied immediately after its creation (e.g. when a number of tabs are opened through tab queues on startup) is not included in a session save and will therefore get lost if Firefox is killed.

Therefore, we now always intialise new tabs with some basic session store data.

MozReview-Commit-ID: 9248jJFUaq5

--HG--
extra : transplant_source : %BC%7Ci%20%82%1E7%29%9E%0E7%87%ED-%0B%E0%84%86R%F9
This commit is contained in:
Jan Henning 2016-04-07 22:02:05 +02:00
Родитель 843dc034d5
Коммит d80f435b5a
1 изменённых файлов: 12 добавлений и 9 удалений

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

@ -3473,16 +3473,19 @@ Tab.prototype = {
Services.obs.addObserver(this, "before-first-paint", false);
// Always intialise new tabs with basic session store data to avoid
// problems with functions that always expect it to be present
this.browser.__SS_data = {
entries: [{
url: aURL,
title: truncate(title, MAX_TITLE_LENGTH)
}],
index: 1
};
if (aParams.delayLoad) {
// If this is a zombie tab, attach restore data so the tab will be
// restored when selected
this.browser.__SS_data = {
entries: [{
url: aURL,
title: truncate(title, MAX_TITLE_LENGTH)
}],
index: 1
};
// If this is a zombie tab, mark the browser for delay loading, which will
// restore the tab when selected using the session data added above
this.browser.__SS_restore = true;
} else {
let flags = "flags" in aParams ? aParams.flags : Ci.nsIWebNavigation.LOAD_FLAGS_NONE;