@@ -3143,6 +3143,9 @@ A [=remote end=] has a <dfn>timezone overrides map</dfn> which is a weak map bet
3143
3143
A [=remote end=] has an <dfn>unhandled prompt behavior overrides map</dfn> which is a
3144
3144
weak map between [=user contexts=] and [=unhandled prompt behavior struct=] .
3145
3145
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
+
3146
3149
### Types ### {#module-browsingcontext-types}
3147
3150
3148
3151
#### The browsingContext.BrowsingContext Type #### {#type-browsingContext-Browsingcontext}
@@ -5823,6 +5826,7 @@ EmulationCommand = (
5823
5826
emulation.SetGeolocationOverride //
5824
5827
emulation.SetLocaleOverride //
5825
5828
emulation.SetScreenOrientationOverride //
5829
+ emulation.SetScriptingEnabled //
5826
5830
emulation.SetTimezoneOverride
5827
5831
)
5828
5832
</pre>
@@ -6273,6 +6277,110 @@ The [=remote end steps=] with |command parameters| are:
6273
6277
6274
6278
</div>
6275
6279
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
+
6276
6384
#### The emulation.setTimezoneOverride Command #### {#command-emulation-setTimezoneOverride}
6277
6385
6278
6386
The <dfn export for=commands>emulation.setTimezoneOverride</dfn> command modifies
@@ -11791,11 +11899,14 @@ To <dfn>evaluate function body</dfn> given |function declaration|,
11791
11899
11792
11900
Note: the |function declaration| is parenthesized and evaluated.
11793
11901
11902
+ 1. Let |bypassDisabledScripting| be true.
11903
+
11794
11904
1. Let |parenthesized function declaration| be [=concatenate=]
11795
11905
«"<code> (</code> ", |function declaration|, "<code> )</code> "»
11796
11906
11797
11907
1. 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|.
11799
11910
11800
11911
1. [=Prepare to run script=] with |environment settings|.
11801
11912
@@ -11981,8 +12092,10 @@ The [=remote end steps=] given |session| and |command parameters| are:
11981
12092
11982
12093
1. Let |base URL| be the [=API base URL=] of |environment settings|.
11983
12094
12095
+ 1. Let |bypassDisabledScripting| be true.
12096
+
11984
12097
1. 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 |.
11986
12099
11987
12100
1. If |command parameters|["<code>userActivation</code>"] is true, run [=activation notification=] steps.
11988
12101
0 commit comments