From 2699091371934f5a97fddcf68faf24b2c5e9da45 Mon Sep 17 00:00:00 2001 From: Maksim Sadym Date: Tue, 4 Nov 2025 13:20:57 +0100 Subject: [PATCH 1/2] [WebDriver BiDi] enable and disable scripting via BiDi Based on https://github.com/whatwg/html/pull/11441. The bare minimal required changes. # Conflicts: # source --- source | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/source b/source index 6a8ff6c9eab..6c93ba4e251 100644 --- a/source +++ b/source @@ -4698,6 +4698,7 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
  • WebDriver BiDi user prompt opened
  • WebDriver BiDi file dialog opened
  • WebDriver BiDi emulated language
  • +
  • WebDriver BiDi scripting is enabled
  • @@ -115946,6 +115947,9 @@ document.querySelector("button").addEventListener("click", bound); associated Document's active sandboxing flag set does not have its sandboxed scripts browsing context flag set. + +
  • The result of WebDriver BiDi scripting is + enabled with settings is true.
  • @@ -117187,8 +117191,15 @@ document.querySelector("button").addEventListener("click", bound);

    To create a classic script, given a string source, an environment settings object settings, a URL baseURL, a script fetch options - options, an optional boolean mutedErrors (default false), and an optional - URL-or-null sourceURLForWindowScripts (default null):

    + options, an optional boolean mutedErrors (default false), an optional + URL-or-null sourceURLForWindowScripts (default null) and an optional + boolean bypassDisabledScripting (default false):

    + +

    The bypassDisabledScripting parameter is intended to be used for + running scripts even if scripting is disabled. + This is required for some automation scenarios, e.g. for WebDriver BiDi command "script.evaluate". +

    1. @@ -117202,7 +117213,8 @@ document.querySelector("button").addEventListener("click", bound);
    2. If scripting is disabled for - settings, then set source to the empty string.

    3. + settings and bypassDisabledScripting is false, then set + source to the empty string.

    4. Let script be a new classic script that this algorithm will subsequently initialize.

    5. From e0454fe91f21380ee861b3cb01290b392b4d2ea3 Mon Sep 17 00:00:00 2001 From: Maksim Sadym Date: Thu, 20 Nov 2025 10:06:11 +0100 Subject: [PATCH 2/2] Address PR comments --- source | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/source b/source index 6c93ba4e251..976bc1dbe60 100644 --- a/source +++ b/source @@ -117187,18 +117187,26 @@ document.querySelector("button").addEventListener("click", bound);
      Creating scripts
      +

      This standard refers to the following concepts defined there:

      + +
        +
      • WebDriver BiDi + command "script.evaluate"
      • +
      +

      To create a classic script, given a string source, an environment settings object settings, a URL baseURL, a script fetch options options, an optional boolean mutedErrors (default false), an optional - URL-or-null sourceURLForWindowScripts (default null) and an optional + URL-or-null sourceURLForWindowScripts (default null), and an optional boolean bypassDisabledScripting (default false):

      The bypassDisabledScripting parameter is intended to be used for running scripts even if scripting is disabled. - This is required for some automation scenarios, e.g. for WebDriver BiDi command "script.evaluate". + This is required for some automation scenarios, e.g., for WebDriver BiDi command "script.evaluate".