diff --git a/tools/wptrunner/wptrunner/browsers/chrome.py b/tools/wptrunner/wptrunner/browsers/chrome.py index 4669ec402e5488..06f3d34f3f0ac3 100644 --- a/tools/wptrunner/wptrunner/browsers/chrome.py +++ b/tools/wptrunner/wptrunner/browsers/chrome.py @@ -139,19 +139,17 @@ def executor_kwargs(logger, test_type, test_environment, run_info_data, if kwargs["enable_experimental"]: chrome_options["args"].extend(["--enable-experimental-web-platform-features"]) - new_headless_mode = ("--headless=new" in kwargs.get("binary_args", [])) - - # Pass the --headless flag to Chrome if WPT's own --headless flag was set - # or if we're running print reftests because of crbug.com/753118 - if ((kwargs["headless"] or test_type == "print-reftest") and - "--headless" not in chrome_options["args"] and not new_headless_mode): - chrome_options["args"].append("--headless") - # Copy over any other flags that were passed in via `--binary-arg` for arg in kwargs.get("binary_args", []): if arg not in chrome_options["args"]: chrome_options["args"].append(arg) + # Pass the --headless=new flag to Chrome if WPT's own --headless flag was + # set. '--headless' should always mean the new headless mode, as the old + # headless mode is not used anyway. + if kwargs["headless"] and "--headless=new" not in chrome_options["args"]: + chrome_options["args"].append("--headless=new") + if test_type == "wdspec": executor_kwargs["binary_args"] = chrome_options["args"]