browser(firefox): fix racy browser.newPage() method (#15251)
It looks like the tabopen callback is async, so we must make sure it is called when opening new pages.
This commit is contained in:
Родитель
35720e2fcd
Коммит
458c9b2207
|
@ -1,2 +1,2 @@
|
|||
1331
|
||||
Changed: lushnikov@chromium.org Wed Jun 29 23:40:49 MSK 2022
|
||||
1332
|
||||
Changed: lushnikov@chromium.org Thu Jun 30 02:06:47 MSK 2022
|
||||
|
|
|
@ -323,7 +323,11 @@ class TargetRegistry {
|
|||
if (window.gBrowser.browsers.length !== 1)
|
||||
throw new Error(`Unexpected number of tabs in the new window: ${window.gBrowser.browsers.length}`);
|
||||
const browser = window.gBrowser.browsers[0];
|
||||
const target = this._browserToTarget.get(browser);
|
||||
let target = this._browserToTarget.get(browser);
|
||||
while (!target) {
|
||||
await helper.awaitEvent(this, TargetRegistry.Events.TargetCreated);
|
||||
target = this._browserToTarget.get(browser);
|
||||
}
|
||||
browser.focus();
|
||||
if (browserContext.settings.timezoneId) {
|
||||
if (await target.hasFailedToOverrideTimezone())
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
1330
|
||||
Changed: lushnikov@chromium.org Wed Jun 29 23:40:12 MSK 2022
|
||||
1331
|
||||
Changed: lushnikov@chromium.org Thu Jun 30 02:09:30 MSK 2022
|
||||
|
|
|
@ -323,7 +323,11 @@ class TargetRegistry {
|
|||
if (window.gBrowser.browsers.length !== 1)
|
||||
throw new Error(`Unexpected number of tabs in the new window: ${window.gBrowser.browsers.length}`);
|
||||
const browser = window.gBrowser.browsers[0];
|
||||
const target = this._browserToTarget.get(browser);
|
||||
let target = this._browserToTarget.get(browser);
|
||||
while (!target) {
|
||||
await helper.awaitEvent(this, TargetRegistry.Events.TargetCreated);
|
||||
target = this._browserToTarget.get(browser);
|
||||
}
|
||||
browser.focus();
|
||||
if (browserContext.settings.timezoneId) {
|
||||
if (await target.hasFailedToOverrideTimezone())
|
||||
|
|
Загрузка…
Ссылка в новой задаче