Fix viewport hijacking beta.9

Fixes Playwright's setDefaultViewport overriding Camoufox viewport data.
This commit is contained in:
daijro 2024-09-30 00:38:47 -05:00
parent 110eb970c9
commit 752a36c9c2
2 changed files with 7 additions and 7 deletions

View file

@ -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;

View file

@ -1,2 +1,2 @@
version=130.0.1
release=beta.8
release=beta.9