mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 445461 - restore MRU tab order when restoring a session. r=ttaubert
This commit is contained in:
parent
4e6998a884
commit
acbbcb8605
@ -223,7 +223,7 @@ var ctrlTab = {
|
|||||||
if (!this._recentlyUsedTabs) {
|
if (!this._recentlyUsedTabs) {
|
||||||
tabPreviews.init();
|
tabPreviews.init();
|
||||||
|
|
||||||
this._recentlyUsedTabs = [gBrowser.selectedTab];
|
this._initRecentlyUsedTabs();
|
||||||
this._init(true);
|
this._init(true);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -495,6 +495,9 @@ var ctrlTab = {
|
|||||||
|
|
||||||
handleEvent: function ctrlTab_handleEvent(event) {
|
handleEvent: function ctrlTab_handleEvent(event) {
|
||||||
switch (event.type) {
|
switch (event.type) {
|
||||||
|
case "SSWindowStateReady":
|
||||||
|
this._initRecentlyUsedTabs();
|
||||||
|
break;
|
||||||
case "TabAttrModified":
|
case "TabAttrModified":
|
||||||
// tab attribute modified (e.g. label, crop, busy, image, selected)
|
// tab attribute modified (e.g. label, crop, busy, image, selected)
|
||||||
for (let i = this.previews.length - 1; i >= 0; i--) {
|
for (let i = this.previews.length - 1; i >= 0; i--) {
|
||||||
@ -530,9 +533,17 @@ var ctrlTab = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_initRecentlyUsedTabs: function () {
|
||||||
|
this._recentlyUsedTabs =
|
||||||
|
Array.filter(gBrowser.tabs, tab => !tab.closing)
|
||||||
|
.sort((tab1, tab2) => tab2.lastAccessed - tab1.lastAccessed);
|
||||||
|
},
|
||||||
|
|
||||||
_init: function ctrlTab__init(enable) {
|
_init: function ctrlTab__init(enable) {
|
||||||
var toggleEventListener = enable ? "addEventListener" : "removeEventListener";
|
var toggleEventListener = enable ? "addEventListener" : "removeEventListener";
|
||||||
|
|
||||||
|
window[toggleEventListener]("SSWindowStateReady", this, false);
|
||||||
|
|
||||||
var tabContainer = gBrowser.tabContainer;
|
var tabContainer = gBrowser.tabContainer;
|
||||||
tabContainer[toggleEventListener]("TabOpen", this, false);
|
tabContainer[toggleEventListener]("TabOpen", this, false);
|
||||||
tabContainer[toggleEventListener]("TabAttrModified", this, false);
|
tabContainer[toggleEventListener]("TabAttrModified", this, false);
|
||||||
|
@ -2521,6 +2521,10 @@ let SessionStoreInternal = {
|
|||||||
else
|
else
|
||||||
tabbrowser.showTab(tab);
|
tabbrowser.showTab(tab);
|
||||||
|
|
||||||
|
if (tabData.lastAccessed) {
|
||||||
|
tab.lastAccessed = tabData.lastAccessed;
|
||||||
|
}
|
||||||
|
|
||||||
if ("attributes" in tabData) {
|
if ("attributes" in tabData) {
|
||||||
// Ensure that we persist tab attributes restored from previous sessions.
|
// Ensure that we persist tab attributes restored from previous sessions.
|
||||||
Object.keys(tabData.attributes).forEach(a => TabAttributes.persist(a));
|
Object.keys(tabData.attributes).forEach(a => TabAttributes.persist(a));
|
||||||
|
Loading…
Reference in New Issue
Block a user