From 752a36c9c2a52cccc9a980c45798624b7da80dbd Mon Sep 17 00:00:00 2001 From: daijro Date: Mon, 30 Sep 2024 00:38:47 -0500 Subject: [PATCH] Fix viewport hijacking beta.9 Fixes Playwright's setDefaultViewport overriding Camoufox viewport data. --- additions/juggler/TargetRegistry.js | 12 ++++++------ upstream.sh | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/additions/juggler/TargetRegistry.js b/additions/juggler/TargetRegistry.js index 64da225..18812ae 100644 --- a/additions/juggler/TargetRegistry.js +++ b/additions/juggler/TargetRegistry.js @@ -1,6 +1,6 @@ /* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +* License, v. 2.0. If a copy of the MPL was not distributed with this +* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ const {Helper} = ChromeUtils.import('chrome://juggler/content/Helper.js'); const {SimpleChannel} = ChromeUtils.import('chrome://juggler/content/SimpleChannel.js'); @@ -13,7 +13,7 @@ const Cr = Components.results; const helper = new Helper(); -const IDENTITY_NAME = 'JUGGLER '; +const IDENTITY_NAME = 'Camoufox '; const HUNDRED_YEARS = 60 * 60 * 24 * 365 * 100; const ALL_PERMISSIONS = [ @@ -571,10 +571,8 @@ class PageTarget { // default viewport. // Do not allow default viewport size if Camoufox set it first - const viewportSize = this._viewportSize || this._browserContext.defaultViewportSize; - if ( - !viewportSize && + !this._viewportSize && this._browserContext.defaultViewportSize && ( ChromeUtils.camouGetConfig("window.outerWidth") || ChromeUtils.camouGetConfig("window.outerHeight") || @@ -583,6 +581,8 @@ class PageTarget { ) { return; } + + const viewportSize = this._viewportSize || this._browserContext.defaultViewportSize; if (viewportSize) { const {width, height} = viewportSize; diff --git a/upstream.sh b/upstream.sh index d7683f2..0e8289b 100644 --- a/upstream.sh +++ b/upstream.sh @@ -1,2 +1,2 @@ version=130.0.1 -release=beta.8 +release=beta.9