Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

browser(firefox): fix screencast start event for popups (#3834)

Yury Semikhatsky25b199b40ab8
diff --git a/browser_patches/firefox/BUILD_NUMBER b/browser_patches/firefox/BUILD_NUMBER
index 7986d28c50..0a468d3fd9 100644
--- a/browser_patches/firefox/BUILD_NUMBER
+++ b/browser_patches/firefox/BUILD_NUMBER
@@ -1,2 +1,2 @@
-1172
-Changed: [email protected] Wed Sep 9 23:06:13 PDT 2020
+1173
+Changed: [email protected] Thu Sep 10 12:35:25 PDT 2020
diff --git a/browser_patches/firefox/juggler/TargetRegistry.js b/browser_patches/firefox/juggler/TargetRegistry.js
index d0b06334d9..b205d6da2a 100644
--- a/browser_patches/firefox/juggler/TargetRegistry.js
+++ b/browser_patches/firefox/juggler/TargetRegistry.js
@@ -196,11 +196,6 @@ class TargetRegistry {
const browserContext = this._userContextIdToBrowserContext.get(userContextId);
if (browserContext && browserContext.defaultViewportSize)
setViewportSizeForBrowser(browserContext.defaultViewportSize, tab.linkedBrowser, window);
-
- const linkedBrowser = tab.linkedBrowser;
- const target = this._browserToTarget.get(linkedBrowser);
- if (target)
- target._pageWindowReadyCallback();
};
const onTabCloseListener = event => {
@@ -325,7 +320,6 @@ class TargetRegistry {
});
if (browserContext && browserContext.defaultViewportSize)
setViewportSizeForBrowser(browserContext.defaultViewportSize, browser, window);
- target._pageWindowReadyCallback();
browser.focus();
if (browserContext.settings.timezoneId) {
if (await target.hasFailedToOverrideTimezone())
@@ -382,7 +376,10 @@ class PageTarget {
browserContext._firstPageCallback();
this._registry._browserToTarget.set(this._linkedBrowser, this);
this._registry._browserBrowsingContextToTarget.set(this._linkedBrowser.browsingContext, this);
- this._pageWindowReady = new Promise(r => this._pageWindowReadyCallback = r);
+ }
+
+ async windowReady() {
+ await waitForWindowReady(this._window);
}
linkedBrowser() {
diff --git a/browser_patches/firefox/juggler/protocol/PageHandler.js b/browser_patches/firefox/juggler/protocol/PageHandler.js
index 816ffc2630..e5222d40a1 100644
--- a/browser_patches/firefox/juggler/protocol/PageHandler.js
+++ b/browser_patches/firefox/juggler/protocol/PageHandler.js
@@ -140,7 +140,7 @@ class PageHandler {
// On Mac the window may not yet be visible when TargetCreated and its
// NSWindow.windowNumber may be -1, so we wait until the window is known
// to be initialized and visible.
- await this._pageTarget._pageWindowReady;
+ await this._pageTarget.windowReady();
await this.startVideoRecording(Object.assign({file}, options));
}
}