Bug 1331154 - 6. Notify session store when a tab is moved. r=JanH

MozReview-Commit-ID: 66PqTqMiy0T

--HG--
extra : rebase_source : 99fa467f136a8ba7d2a970fc5f416c0bf952f9a3
This commit is contained in:
Tom Klein 2017-02-02 21:32:26 -06:00
Родитель 9994c5b150
Коммит c68bc06849
2 изменённых файлов: 22 добавлений и 0 удалений

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

@ -1331,6 +1331,9 @@ var BrowserApp = {
this._tabs[i] = this._tabs[i + step];
}
this._tabs[toPosition] = movedTab;
let evt = new UIEvent("TabMove", {"bubbles":true, "cancellable":false, "view":window, "detail":fromPosition});
this.tabs[toPosition].browser.dispatchEvent(evt);
},
// Use this method to select a tab from JS. This method sends a message

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

@ -453,6 +453,12 @@ SessionStore.prototype = {
this.onTabSelect(window, browser);
break;
}
case "TabMove": {
let browser = aEvent.target;
log("TabMove for tab " + window.BrowserApp.getTabForBrowser(browser).id);
this.onTabMove();
break;
}
case "DOMTitleChanged": {
// Use DOMTitleChanged to detect page loads over alternatives.
// onLocationChange happens too early, so we don't have the page title
@ -570,6 +576,7 @@ SessionStore.prototype = {
browsers.addEventListener("TabOpen", this, true);
browsers.addEventListener("TabClose", this, true);
browsers.addEventListener("TabSelect", this, true);
browsers.addEventListener("TabMove", this, true);
browsers.addEventListener("TabPreZombify", this, true);
browsers.addEventListener("TabPostZombify", this, true);
},
@ -584,6 +591,7 @@ SessionStore.prototype = {
browsers.removeEventListener("TabOpen", this, true);
browsers.removeEventListener("TabClose", this, true);
browsers.removeEventListener("TabSelect", this, true);
browsers.removeEventListener("TabMove", this, true);
browsers.removeEventListener("TabPreZombify", this, true);
browsers.removeEventListener("TabPostZombify", this, true);
@ -825,6 +833,17 @@ SessionStore.prototype = {
log("restoring zombie tab " + aTab.id);
},
onTabMove: function ss_onTabMove() {
if (this._loadState != STATE_RUNNING) {
return;
}
// The long press that initiated the move canceled any close undo option that may have been
// present.
this._lastClosedTabIndex = -1;
this.saveStateDelayed();
},
onTabInput: function ss_onTabInput(aWindow, aBrowser) {
// If this browser belongs to a zombie tab or the initial restore hasn't yet finished,
// skip any session save activity.