Fix viewport hijacking

Do not allow Juggler to set its default viewport size if Camoufox set it first
This commit is contained in:
daijro 2024-08-17 00:24:50 -05:00
parent fcacf8106d
commit b9d1503487

View file

@ -530,6 +530,19 @@ class PageTarget {
// The "default size" (1) is only respected when the page is opened.
// Otherwise, explicitly set page viewport prevales over browser context
// default viewport.
// Do not allow default viewport size if Camoufox set it first
if (
!viewportSize &&
this._browserContext.defaultViewportSize && (
ChromeUtils.camouGetConfig("window.outerWidth") ||
ChromeUtils.camouGetConfig("window.outerHeight") ||
ChromeUtils.camouGetConfig("window.innerWidth") ||
ChromeUtils.camouGetConfig("window.innerHeight"))
) {
return;
}
const viewportSize = this._viewportSize || this._browserContext.defaultViewportSize;
if (viewportSize) {
const {width, height} = viewportSize;