From bc62de4fc776c76f7fe61ff1bd944c94fd05f318 Mon Sep 17 00:00:00 2001 From: Weizhong Xia <77710146+WeizhongX@users.noreply.github.com> Date: Tue, 10 Dec 2024 09:41:23 -0800 Subject: [PATCH] Enable site isolation for headless shell (#49605) * Defaultly enable SiteIsolation in headless shell This turns on SiteIsolation in headless shell by default, if that is not explicitly disabled through flag specific config or VTS. Bug: None * fix function call * fix lint --- .../wptrunner/wptrunner/browsers/headless_shell.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/tools/wptrunner/wptrunner/browsers/headless_shell.py b/tools/wptrunner/wptrunner/browsers/headless_shell.py index 7fd11fecbe0e70..c20d4011eeb551 100644 --- a/tools/wptrunner/wptrunner/browsers/headless_shell.py +++ b/tools/wptrunner/wptrunner/browsers/headless_shell.py @@ -2,7 +2,8 @@ from .base import require_arg from .base import get_timeout_multiplier # noqa: F401 -from .chrome import ChromeBrowser, debug_args, executor_kwargs # noqa: F401 +from .chrome import ChromeBrowser, debug_args # noqa: F401 +from .chrome import executor_kwargs as chrome_executor_kwargs from ..executors.base import WdspecExecutor # noqa: F401 from ..executors.executorchrome import ( # noqa: F401 ChromeDriverCrashTestExecutor, @@ -41,6 +42,17 @@ def browser_kwargs(logger, test_type, run_info_data, config, **kwargs): "debug_info": kwargs["debug_info"]} +def executor_kwargs(logger, test_type, test_environment, run_info_data, subsuite, + **kwargs): + executor_kwargs = chrome_executor_kwargs(logger, test_type, test_environment, run_info_data, + subsuite, **kwargs) + chrome_options = executor_kwargs["capabilities"]["goog:chromeOptions"] + # Defaultly enable SiteIsolation in headless shell + if "--disable-site-isolation-trials" not in chrome_options["args"]: + chrome_options["args"].append("--site-per-process") + return executor_kwargs + + def env_extras(**kwargs): return []