mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1059036 - [e10s] Undo Close Tab would not load tab contents. r=mconley
Update tab index after select event during tab switch -- the event may change array indices.
This commit is contained in:
parent
4dc63c7140
commit
62e533ef60
@ -5326,7 +5326,8 @@
|
||||
let switchPromise = gBrowser._prepareForTabSwitch(toTab, fromTab);
|
||||
|
||||
var panel = this._selectedPanel;
|
||||
this._selectedPanel = this.childNodes[val];
|
||||
var newPanel = this.childNodes[val];
|
||||
this._selectedPanel = newPanel;
|
||||
if (this._selectedPanel != panel) {
|
||||
var event = document.createEvent("Events");
|
||||
event.initEvent("select", true, true);
|
||||
@ -5336,8 +5337,16 @@
|
||||
this._selectedIndex = val;
|
||||
|
||||
switchPromise.then(() => {
|
||||
this.setAttribute("selectedIndex", val);
|
||||
// If we cannot find the tabpanel that we were trying to switch to, then
|
||||
// it must have been removed before our Promise could be resolved. In
|
||||
// that case, we just cancel the tab switch.
|
||||
var updatedTabIndex = Array.indexOf(this.childNodes, newPanel);
|
||||
if (updatedTabIndex == -1) {
|
||||
gBrowser._cancelTabSwitch(toTab);
|
||||
} else {
|
||||
this.setAttribute("selectedIndex", updatedTabIndex);
|
||||
gBrowser._finalizeTabSwitch(toTab, fromTab);
|
||||
}
|
||||
}, () => {
|
||||
// If the promise rejected, that means we don't want to actually
|
||||
// flip the deck, so we cancel the tab switch.
|
||||
|
Loading…
Reference in New Issue
Block a user