mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-30 00:01:50 +00:00
Bug 1478112 - Get rid of preselect tabbox workaround, and adjust focus after changing visible tab right away. r=dao
The "select" event handler workaround was originally added in bug 1379270 to make it possible to focus and select the URL bar a little bit later. This ugly hack was to workaround an issue with WebExtensions that override about:newtab with the chrome_url_overrides property (the issue would be that the URL bar would not be properly focused and selected if about:newtab was overridden). Back in the day, this was necessary because the overriding URL was fully displayed in the URL bar (moz-webextension://...). These days, when about:newtab is overridden, the URL bar is still empty - we just end up showing the information about the WebExtension overriding about:newtab to the left of the URL bar. So I think we can remove the old workaround. Differential Revision: https://phabricator.services.mozilla.com/D3447 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
8225a95bbd
commit
bda8a0dccd
@ -874,10 +874,16 @@ window._gBrowser = {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!aForceUpdate) {
|
||||
document.commandDispatcher.lock();
|
||||
let newTab = this.getTabForBrowser(newBrowser);
|
||||
|
||||
if (!aForceUpdate) {
|
||||
TelemetryStopwatch.start("FX_TAB_SWITCH_UPDATE_MS");
|
||||
|
||||
if (gMultiProcessBrowser) {
|
||||
this._getSwitcher().requestTab(newTab);
|
||||
}
|
||||
|
||||
document.commandDispatcher.lock();
|
||||
}
|
||||
|
||||
let oldTab = this.selectedTab;
|
||||
@ -904,7 +910,6 @@ window._gBrowser = {
|
||||
!window.isFullyOccluded);
|
||||
}
|
||||
|
||||
let newTab = this.getTabForBrowser(newBrowser);
|
||||
this._selectedBrowser = newBrowser;
|
||||
this._selectedTab = newTab;
|
||||
this.showTab(newTab);
|
||||
@ -4352,12 +4357,6 @@ window._gBrowser = {
|
||||
}
|
||||
});
|
||||
|
||||
this.tabpanels.addEventListener("preselect", event => {
|
||||
if (gMultiProcessBrowser) {
|
||||
this._getSwitcher().requestTab(event.detail);
|
||||
}
|
||||
});
|
||||
|
||||
this.addEventListener("DOMWindowClose", (event) => {
|
||||
if (!event.isTrusted)
|
||||
return;
|
||||
|
@ -438,21 +438,7 @@ class AsyncTabSwitcher {
|
||||
TelemetryStopwatch.cancel("FX_TAB_SWITCH_COMPOSITE_E10S_MS", this.window);
|
||||
}
|
||||
|
||||
if (this._requestingTab) {
|
||||
/*
|
||||
* If _requestingTab is set, that means that we're switching the
|
||||
* visibility of the tab synchronously, and we need to wait for
|
||||
* the "select" event before shifting focus so that
|
||||
* _adjustFocusAfterTabSwitch runs with the right information for
|
||||
* the tab switch.
|
||||
*/
|
||||
this.tabbrowser.addEventListener("select", () => {
|
||||
this.tabbrowser._adjustFocusAfterTabSwitch(showTab);
|
||||
}, { once: true });
|
||||
} else {
|
||||
this.tabbrowser._adjustFocusAfterTabSwitch(showTab);
|
||||
}
|
||||
|
||||
this.tabbrowser._adjustFocusAfterTabSwitch(showTab);
|
||||
this.maybeActivateDocShell(this.requestedTab);
|
||||
}
|
||||
}
|
||||
@ -1006,7 +992,6 @@ class AsyncTabSwitcher {
|
||||
.add(warmingState);
|
||||
}
|
||||
|
||||
this._requestingTab = true;
|
||||
this.logState("requestTab " + this.tinfo(tab));
|
||||
this.startTabSwitch();
|
||||
|
||||
@ -1025,7 +1010,6 @@ class AsyncTabSwitcher {
|
||||
this.lastPrimaryTab = tab;
|
||||
|
||||
this.queueUnload(this.UNLOAD_DELAY);
|
||||
this._requestingTab = false;
|
||||
}
|
||||
|
||||
queueUnload(unloadTimeout) {
|
||||
|
@ -614,11 +614,6 @@
|
||||
if (val < 0 || val >= this.children.length)
|
||||
return val;
|
||||
|
||||
// Give the tabbrowser a chance to run logic regardless of
|
||||
// whether the panel is going to change:
|
||||
this.dispatchEvent(new CustomEvent("preselect",
|
||||
{ detail: this.getRelatedElement(this.children[val]) }));
|
||||
|
||||
var panel = this._selectedPanel;
|
||||
this._selectedPanel = this.children[val];
|
||||
this.setAttribute("selectedIndex", val);
|
||||
|
Loading…
Reference in New Issue
Block a user