@@ -3143,6 +3143,9 @@ A [=remote end=] has a <dfn>timezone overrides map</dfn> which is a weak map bet
31433143A [=remote end=] has an <dfn>unhandled prompt behavior overrides map</dfn> which is a
31443144weak map between [=user contexts=] and [=unhandled prompt behavior struct=] .
31453145
3146+ A [=remote end=] has a <dfn>scripting enabled overrides map</dfn> which is a weak
3147+ map between [=navigables=] or [=user contexts=] and boolean or null.
3148+
31463149### Types ### {#module-browsingcontext-types}
31473150
31483151#### The browsingContext.BrowsingContext Type #### {#type-browsingContext-Browsingcontext}
@@ -5823,6 +5826,7 @@ EmulationCommand = (
58235826 emulation.SetGeolocationOverride //
58245827 emulation.SetLocaleOverride //
58255828 emulation.SetScreenOrientationOverride //
5829+ emulation.SetScriptingEnabled //
58265830 emulation.SetTimezoneOverride
58275831)
58285832</pre>
@@ -6273,6 +6277,110 @@ The [=remote end steps=] with |command parameters| are:
62736277
62746278</div>
62756279
6280+ #### The emulation.setScriptingEnabled Command #### {#command-emulation-setScriptingEnabled}
6281+
6282+ The <dfn export for=commands>emulation.setScriptingEnabled</dfn> command emulates
6283+ disabling JavaScript on web pages.
6284+
6285+ <dl>
6286+ <dt> Command Type</dt>
6287+ <dd>
6288+ <pre class="cddl" data-cddl-module="remote-cddl">
6289+ emulation.SetScriptingEnabled = (
6290+ method: "emulation.setScriptingEnabled",
6291+ params: emulation.SetScriptingEnabledParameters
6292+ )
6293+
6294+ emulation.SetScriptingEnabledParameters = {
6295+ enabled: false / null,
6296+ ? contexts: [+browsingContext.BrowsingContext] ,
6297+ ? userContexts: [+browser.UserContext] ,
6298+ }
6299+ </pre>
6300+ </dd>
6301+ <dt> Result Type</dt>
6302+ <dd>
6303+ <code>
6304+ EmptyResult
6305+ </code>
6306+ </dd>
6307+ </dl>
6308+
6309+ Note: only emulation of disabled Javascript is supported.
6310+
6311+ <div algorithm>
6312+ The <dfn export>WebDriver BiDi scripting is enabled</dfn> steps given
6313+ [=environment settings object=] |settings| are:
6314+
6315+ 1. Let |navigable| be |settings|'s [=relevant global object=]' s
6316+ <a>associated <code>Document</code></a> 's [=/node navigable=] .
6317+
6318+ 1. Let |top-level traversable| be |navigable|’s [=navigable/top-level traversable=] .
6319+
6320+ 1. If [=scripting enabled overrides map=] contains |top-level traversable|:
6321+
6322+ 1. If [=scripting enabled overrides map=] [|top-level traversable|] is false,
6323+ return false.
6324+
6325+ 1. Return true.
6326+
6327+ 1. Let |user context| be |top-level traversable|'s [=associated user context=] .
6328+
6329+ 1. If [=scripting enabled overrides map=] contains |user context|, return
6330+ [=scripting enabled overrides map=] [|user context|] .
6331+
6332+ 1. If [=scripting enabled overrides map=] [|user context|] is false, return false.
6333+
6334+ 1. Return true.
6335+
6336+ 1. Return true.
6337+
6338+ </div>
6339+
6340+ <div algorithm="remote end steps for emulation.setScriptingEnabled">
6341+
6342+ The [=remote end steps=] with |command parameters| are:
6343+
6344+ 1. If |command parameters| [=map/contains=] "<code> userContexts</code> "
6345+ and |command parameters| [=map/contains=] "<code> context</code> ",
6346+ return [=error=] with [=error code=] [=invalid argument=] .
6347+
6348+ 1. If |command parameters| doesn't [=map/contain=] "<code> userContexts</code> "
6349+ and |command parameters| doesn't [=map/contain=] "<code> context</code> ",
6350+ return [=error=] with [=error code=] [=invalid argument=] .
6351+
6352+ 1. Let |emulated scripting enabled status| be null.
6353+
6354+ 1. If |command parameters| [=map/contains=] "<code> enabled</code> ":
6355+
6356+ 1. Set |emulated scripting enabled status| to
6357+ |command parameters|["<code>enabled</code>"] .
6358+
6359+ 1. If the <code> contexts</code> field of |command parameters| is present:
6360+
6361+ 1. Let |navigables| be the result of [=trying=] to
6362+ [=get valid top-level traversables by ids=] with
6363+ |command parameters|["<code>contexts</code>"] .
6364+
6365+ 1. For each |navigable| of |navigables|:
6366+
6367+ 1. [=map/Set=] [=scripting enabled overrides map=] [|navigable|] to
6368+ |emulated scripting enabled status|.
6369+
6370+ 1. If the <code> userContexts</code> field of |command parameters| is present:
6371+
6372+ 1. Let |user contexts| be the result of [=trying=] to [=get valid user contexts=]
6373+ with |command parameters|["<code>userContexts</code>"] .
6374+
6375+ 1. For each |user context| of |user contexts|:
6376+
6377+ 1. [=map/Set=] [=scripting enabled overrides map=] [|user context|] to
6378+ |emulated scripting enabled status|.
6379+
6380+ 1. Return [=success=] with data null.
6381+
6382+ </div>
6383+
62766384#### The emulation.setTimezoneOverride Command #### {#command-emulation-setTimezoneOverride}
62776385
62786386The <dfn export for=commands>emulation.setTimezoneOverride</dfn> command modifies
@@ -11791,11 +11899,14 @@ To <dfn>evaluate function body</dfn> given |function declaration|,
1179111899
1179211900Note: the |function declaration| is parenthesized and evaluated.
1179311901
11902+ 1. Let |bypassDisabledScripting| be true.
11903+
11794119041. Let |parenthesized function declaration| be [=concatenate=]
1179511905 «"<code> (</code> ", |function declaration|, "<code> )</code> "»
1179611906
11797119071. Let |function script| be the result of [=create a classic script=] with
11798- |parenthesized function declaration|, |environment settings|, |base URL|, and |options|.
11908+ |parenthesized function declaration|, |environment settings|, |base URL|,
11909+ |options| and |bypassDisabledScripting|.
1179911910
11800119111. [=Prepare to run script=] with |environment settings|.
1180111912
@@ -11981,8 +12092,10 @@ The [=remote end steps=] given |session| and |command parameters| are:
1198112092
11982120931. Let |base URL| be the [=API base URL=] of |environment settings|.
1198312094
12095+ 1. Let |bypassDisabledScripting| be true.
12096+
11984120971. Let |script| be the result of [=create a classic script=] with |source|,
11985- |environment settings|, |base URL|, and |options |.
12098+ |environment settings|, |base URL|, |options| and |bypassDisabledScripting |.
1198612099
11987121001. If |command parameters|["<code>userActivation</code>"] is true, run [=activation notification=] steps.
1198812101
0 commit comments