Don't block setViewport

When window.innerWidth or window.innerHeight is not provided, allow Juggler's setViewport to still work.
This commit is contained in:
daijro 2024-11-03 01:38:44 -05:00
parent c70886fbcd
commit 8ed8a97ae9

View file

@ -383,11 +383,17 @@ class PageTarget {
this._tab = tab;
this._linkedBrowser = tab.linkedBrowser;
this._browserContext = browserContext;
this._viewportSize = undefined;
// Set the viewport size to Camoufox's default value.
this._viewportSize = {
width: ChromeUtils.camouGetInt("window.innerWidth") || 1280,
height: ChromeUtils.camouGetInt("window.innerHeight") || 720,
};;
if (
ChromeUtils.camouGetInt("window.innerWidth")
|| ChromeUtils.camouGetInt("window.innerHeight")
) {
this._viewportSize = {
width: ChromeUtils.camouGetInt("window.innerWidth") || 1280,
height: ChromeUtils.camouGetInt("window.innerHeight") || 720,
};
}
this._initialDPPX = this._linkedBrowser.browsingContext.overrideDPPX;
this._url = 'about:blank';
this._openerId = opener ? opener.id() : undefined;