зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1858758 - [remote] Focus a window if it has no focus when selecting a tab. r=webdriver-reviewers,whimboo
Differential Revision: https://phabricator.services.mozilla.com/D195099
This commit is contained in:
Родитель
7ba6eea8a0
Коммит
a8e3936c65
|
@ -406,7 +406,7 @@ class TabManagerClass {
|
|||
* @returns {Promise}
|
||||
* Promise that resolves when the given tab has been selected.
|
||||
*/
|
||||
selectTab(tab) {
|
||||
async selectTab(tab) {
|
||||
if (!tab) {
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
@ -420,7 +420,17 @@ class TabManagerClass {
|
|||
|
||||
const selected = new lazy.EventPromise(ownerWindow, "TabSelect");
|
||||
tabBrowser.selectedTab = tab;
|
||||
return selected;
|
||||
|
||||
await selected;
|
||||
|
||||
// Sometimes at that point window is not focused.
|
||||
if (Services.focus.activeWindow != ownerWindow) {
|
||||
const activated = new lazy.EventPromise(ownerWindow, "activate");
|
||||
ownerWindow.focus();
|
||||
return activated;
|
||||
}
|
||||
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
supportsTabs() {
|
||||
|
|
Загрузка…
Ссылка в новой задаче