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): do not crash when browser window is minimized (#9951)

Yury Semikhatskyddda507ccdb2
diff --git a/browser_patches/firefox-beta/BUILD_NUMBER b/browser_patches/firefox-beta/BUILD_NUMBER
index 3bd255f39d..9e1a310b4e 100644
--- a/browser_patches/firefox-beta/BUILD_NUMBER
+++ b/browser_patches/firefox-beta/BUILD_NUMBER
@@ -1,2 +1,2 @@
-1301
-Changed: [email protected] Mon 1 Nov 2021 16:28:05 CET
+1302
+Changed: [email protected] Mon 01 Nov 2021 05:04:30 PM PDT
diff --git a/browser_patches/firefox-beta/juggler/screencast/nsScreencastService.cpp b/browser_patches/firefox-beta/juggler/screencast/nsScreencastService.cpp
index c7c76ee3c7..a91450d797 100644
--- a/browser_patches/firefox-beta/juggler/screencast/nsScreencastService.cpp
+++ b/browser_patches/firefox-beta/juggler/screencast/nsScreencastService.cpp
@@ -159,6 +159,9 @@ class nsScreencastService::Session : public rtc::VideoSinkInterface<webrtc::Vide
void OnRawFrame(uint8_t* videoFrame, size_t videoFrameStride, const webrtc::VideoCaptureCapability& frameInfo) override {
int pageWidth = frameInfo.width - mMargin.LeftRight();
int pageHeight = frameInfo.height - mMargin.TopBottom();
+ // Frame size is 1x1 when browser window is minimized.
+ if (pageWidth <= 1 || pageHeight <= 1)
+ return;
// Headed Firefox brings sizes in sync slowly.
if (mViewportWidth && pageWidth > mViewportWidth)
pageWidth = mViewportWidth;
diff --git a/browser_patches/firefox/BUILD_NUMBER b/browser_patches/firefox/BUILD_NUMBER
index 0f0bd7f455..5b7ee61244 100644
--- a/browser_patches/firefox/BUILD_NUMBER
+++ b/browser_patches/firefox/BUILD_NUMBER
@@ -1,2 +1,2 @@
-1299
-Changed: [email protected] Mon 1 Nov 2021 16:28:05 CET
+1300
+Changed: [email protected] Mon 01 Nov 2021 05:00:33 PM PDT
diff --git a/browser_patches/firefox/juggler/screencast/nsScreencastService.cpp b/browser_patches/firefox/juggler/screencast/nsScreencastService.cpp
index c7c76ee3c7..a91450d797 100644
--- a/browser_patches/firefox/juggler/screencast/nsScreencastService.cpp
+++ b/browser_patches/firefox/juggler/screencast/nsScreencastService.cpp
@@ -159,6 +159,9 @@ class nsScreencastService::Session : public rtc::VideoSinkInterface<webrtc::Vide
void OnRawFrame(uint8_t* videoFrame, size_t videoFrameStride, const webrtc::VideoCaptureCapability& frameInfo) override {
int pageWidth = frameInfo.width - mMargin.LeftRight();
int pageHeight = frameInfo.height - mMargin.TopBottom();
+ // Frame size is 1x1 when browser window is minimized.
+ if (pageWidth <= 1 || pageHeight <= 1)
+ return;
// Headed Firefox brings sizes in sync slowly.
if (mViewportWidth && pageWidth > mViewportWidth)
pageWidth = mViewportWidth;