From d5d77136842da0fc9667fb05a43ce7d243e2e5da Mon Sep 17 00:00:00 2001 From: Aleksandr <39612809+MaestroOfAutomation@users.noreply.github.com> Date: Tue, 18 Mar 2025 22:53:17 +0200 Subject: [PATCH] fix: add allow_addon_new_tab launch option --- pythonlib/camoufox/utils.py | 7 +++++++ settings/camoucfg.jvv | 1 + settings/properties.json | 1 + 3 files changed, 9 insertions(+) diff --git a/pythonlib/camoufox/utils.py b/pythonlib/camoufox/utils.py index d87c73d..836bd9e 100644 --- a/pythonlib/camoufox/utils.py +++ b/pythonlib/camoufox/utils.py @@ -486,6 +486,7 @@ def launch_options( ff_version: Optional[int] = None, headless: Optional[bool] = None, main_world_eval: Optional[bool] = None, + allow_addon_new_tab: Optional[bool] = None, executable_path: Optional[Union[str, Path]] = None, browser: Optional[str] = None, firefox_user_prefs: Optional[Dict[str, Any]] = None, @@ -562,6 +563,8 @@ def launch_options( main_world_eval (Optional[bool]): Whether to enable running scripts in the main world. To use this, prepend "mw:" to the script: page.evaluate("mw:" + script). + allow_addon_new_tab (Optional[bool]): + Whether to allow addon open new tabs. Defaults to False. executable_path (Optional[Union[str, Path]]): Custom Camoufox browser executable path. browser (Optional[str]): @@ -803,6 +806,10 @@ def launch_options( if main_world_eval: set_into(config, 'allowMainWorld', True) + # Allow addon open new tabs + if allow_addon_new_tab: + set_into(config, 'allowAddonNewtab', True) + # Set Firefox user preferences if block_images: LeakWarning.warn('block_images', i_know_what_im_doing) diff --git a/settings/camoucfg.jvv b/settings/camoucfg.jvv index aa4223d..d00e6c1 100644 --- a/settings/camoucfg.jvv +++ b/settings/camoucfg.jvv @@ -299,6 +299,7 @@ "showcursor": "bool", "allowMainWorld": "bool", + "allowAddonNewtab": "bool", "forceScopeAccess": "bool", "disableTheming": "bool", diff --git a/settings/properties.json b/settings/properties.json index 02e97f4..7ae6599 100644 --- a/settings/properties.json +++ b/settings/properties.json @@ -98,6 +98,7 @@ { "property": "mediaDevices:speakers", "type": "uint" }, { "property": "mediaDevices:enabled", "type": "bool" }, { "property": "allowMainWorld", "type": "bool" }, + { "property": "allowAddonNewtab", "type": "bool" }, { "property": "forceScopeAccess", "type": "bool" }, { "property": "disableTheming", "type": "bool" },