зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1331154 - 4. Don't use deck for user-visible tabs order. r=JanH,sebastian
Every way I've tried to move a browser in the deck results in the browser being reset (it loses its docShell and contentDocument). So now we treat deck.children as a set of browsers instead of a list, and make BrowserApp._tabs the sole keeper of the user visible tabs list order. That means deck.selectedIndex should no longer be used to get the user visible index of the currently selected tab (deck.selectedPanel is still valid), and that all additions to deck can be appends. Note if this gets reverted at some later date: there's currently a bug, which this change renders moot, where we reinsert a close-undo tab correctly in the _tabs list, but incorrectly append it to the deck instead of inserting it. MozReview-Commit-ID: Id7FR1p1nfN --HG-- extra : rebase_source : 1506f513e653c67d066601fb9038bee098be9479
This commit is contained in:
Родитель
f892b6de0a
Коммит
8494bb4923
|
@ -371,6 +371,9 @@ var BrowserApp = {
|
|||
return this.isOnLowMemoryPlatform = memory.isLowMemoryPlatform();
|
||||
},
|
||||
|
||||
// Note that the deck list order does not necessarily reflect the user visible tab order (see
|
||||
// bug 1331154 for the reason), so deck.selectedIndex should not be used (though
|
||||
// deck.selectedPanel is still valid) - use selectedTabIndex instead.
|
||||
deck: null,
|
||||
|
||||
startup: function startup() {
|
||||
|
@ -1173,6 +1176,11 @@ var BrowserApp = {
|
|||
return null;
|
||||
},
|
||||
|
||||
// Use this instead of deck.selectedIndex (which is invalid for this purpose).
|
||||
get selectedTabIndex() {
|
||||
return this._tabs.indexOf(this._selectedTab);
|
||||
},
|
||||
|
||||
loadURI: function loadURI(aURI, aBrowser, aParams) {
|
||||
aBrowser = aBrowser || this.selectedBrowser;
|
||||
if (!aBrowser)
|
||||
|
@ -3505,7 +3513,7 @@ Tab.prototype = {
|
|||
// Make sure the previously selected panel remains selected. The selected panel of a deck is
|
||||
// not stable when panels are added.
|
||||
let selectedPanel = BrowserApp.deck.selectedPanel;
|
||||
BrowserApp.deck.insertBefore(this.browser, aParams.sibling || null);
|
||||
BrowserApp.deck.appendChild(this.browser);
|
||||
BrowserApp.deck.selectedPanel = selectedPanel;
|
||||
|
||||
let attrs = {};
|
||||
|
@ -3777,14 +3785,13 @@ Tab.prototype = {
|
|||
let evt = new UIEvent("TabPreZombify", {"bubbles":true, "cancelable":false, "view":window});
|
||||
browser.dispatchEvent(evt);
|
||||
|
||||
// We need this data to correctly create and position the new browser
|
||||
// We need this data to correctly create the new browser
|
||||
// If this browser is already a zombie, fallback to the session data
|
||||
let currentURL = browser.__SS_restore ? data.entries[0].url : browser.currentURI.spec;
|
||||
let sibling = browser.nextSibling;
|
||||
let isPrivate = PrivateBrowsingUtils.isBrowserPrivate(browser);
|
||||
|
||||
this.destroy();
|
||||
this.create(currentURL, { sibling: sibling, zombifying: true, delayLoad: true, isPrivate: isPrivate });
|
||||
this.create(currentURL, { zombifying: true, delayLoad: true, isPrivate: isPrivate });
|
||||
|
||||
// Reattach session store data and flag this browser so it is restored on select
|
||||
browser = this.browser;
|
||||
|
|
|
@ -784,8 +784,7 @@ SessionStore.prototype = {
|
|||
return;
|
||||
}
|
||||
|
||||
let browsers = aWindow.document.getElementById("browsers");
|
||||
let index = browsers.selectedIndex;
|
||||
let index = aWindow.BrowserApp.selectedTabIndex;
|
||||
this._windows[aWindow.__SSID].selected = parseInt(index) + 1; // 1-based
|
||||
|
||||
let tab = aWindow.BrowserApp.getTabForBrowser(aBrowser);
|
||||
|
@ -1111,8 +1110,7 @@ SessionStore.prototype = {
|
|||
let winData = this._windows[aWindow.__SSID];
|
||||
winData.tabs = [];
|
||||
|
||||
let browsers = aWindow.document.getElementById("browsers");
|
||||
let index = browsers.selectedIndex;
|
||||
let index = aWindow.BrowserApp.selectedTabIndex;
|
||||
winData.selected = parseInt(index) + 1; // 1-based
|
||||
|
||||
let tabs = aWindow.BrowserApp.tabs;
|
||||
|
|
Загрузка…
Ссылка в новой задаче