Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

browser(firefox): fix screencast in first window on mac headful #3826

Merged
merged 2 commits into from
Sep 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions browser_patches/firefox/BUILD_NUMBER
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
1171
Changed: aslushnikov@gmail.com Wed Sep 9 09:33:56 PDT 2020
1172
Changed: yurys@chromium.org Wed Sep 9 23:06:13 PDT 2020
7 changes: 7 additions & 0 deletions browser_patches/firefox/juggler/TargetRegistry.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,11 @@ 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 => {
Expand Down Expand Up @@ -320,6 +325,7 @@ class TargetRegistry {
});
if (browserContext && browserContext.defaultViewportSize)
setViewportSizeForBrowser(browserContext.defaultViewportSize, browser, window);
target._pageWindowReadyCallback();
browser.focus();
if (browserContext.settings.timezoneId) {
if (await target.hasFailedToOverrideTimezone())
Expand Down Expand Up @@ -376,6 +382,7 @@ 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);
}

linkedBrowser() {
Expand Down
4 changes: 4 additions & 0 deletions browser_patches/firefox/juggler/protocol/PageHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,10 @@ class PageHandler {
const options = this._pageTarget.browserContext().screencastOptions;
if (options) {
const file = OS.Path.join(options.dir, helper.generateId() + '.webm');
// 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.startVideoRecording(Object.assign({file}, options));
}
}
Expand Down