Skip to content

Commit e40ee59

Browse files
Allow for removing emulation (#1001)
### Step 1. Currently, passing emulation value of `null` behaves differently in different methods. This PR aligns the behavior to the following: passing `null` removes the emulation for the given scope. E.g. having pre-condition: NAVIGABLE locale emulation is set to NAVIGABLE_EMULATED_LOCALE and USER_CONTEXT locale emulation is set to USER_CONTEXT_EMULATED_LOCALE. * The emulated locale of NAVIGABLE is NAVIGABLE_EMULATED_LOCALE. * Call `emulation.setLocaleOverride(NAVIGABLE, null)` * The emulated locale of NAVIGABLE is USER_CONTEXT_EMULATED_LOCALE. * Call `emulation.setLocaleOverride(USER_CONTEXT, null)`. * The emulated locale of NAVIGABLE is the default one. Affected method: * emulation.SetLocaleOverride * emulation.SetScriptingEnabled * emulation.SetTimezoneOverride ### Out of scope The following methods require some extra effort, so it makes sense to get agreement on the approach and to land this PR first: * emulation.SetForcedColorsModeThemeOverride * emulation.SetGeolocationOverride * emulation.SetScreenOrientationOverride <!-- This comment and the below content is programmatically generated. You may add a comma-separated list of anchors you'd like a direct link to below (e.g. #idl-serializers, #idl-sequence): Don't remove this comment or modify anything below this line. If you don't want a preview generated for this pull request, just replace the whole of this comment's content by "no preview" and remove what's below. --> *** <a href="https://pr-preview.s3.amazonaws.com/w3c/webdriver-bidi/pull/1001.html" title="Last updated on Sep 12, 2025, 11:34 AM UTC (e6ac810)">Preview</a> | <a href="https://pr-preview.s3.amazonaws.com/w3c/webdriver-bidi/1001/ef4a35d...e6ac810.html" title="Last updated on Sep 12, 2025, 11:34 AM UTC (e6ac810)">Diff</a>
1 parent 9d2fe29 commit e40ee59

File tree

1 file changed

+46
-57
lines changed

1 file changed

+46
-57
lines changed

index.bs

Lines changed: 46 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -3062,16 +3062,16 @@ An <dfn>unhandled prompt behavior struct</dfn> is a [=struct=] with:
30623062
A [=remote end=] has a <dfn>viewport overrides map</dfn> which is a weak map between [=user contexts=] and [=viewport configuration=].
30633063

30643064
A [=remote end=] has a <dfn>locale overrides map</dfn> which is a weak map between
3065-
[=navigables=] or [=user contexts=] and string or null.
3065+
[=navigables=] or [=user contexts=] and string.
30663066

30673067
A [=remote end=] has a <dfn>timezone overrides map</dfn> which is a weak map between
3068-
[=navigables=] or [=user contexts=] and string or null.
3068+
[=navigables=] or [=user contexts=] and string.
30693069

30703070
A [=remote end=] has an <dfn>unhandled prompt behavior overrides map</dfn> which is a
30713071
weak map between [=user contexts=] and [=unhandled prompt behavior struct=].
30723072

30733073
A [=remote end=] has a <dfn>scripting enabled overrides map</dfn> which is a weak
3074-
map between [=navigables=] or [=user contexts=] and boolean or null.
3074+
map between [=navigables=] or [=user contexts=] and boolean.
30753075

30763076
### Types ### {#module-browsingcontext-types}
30773077

@@ -5938,11 +5938,11 @@ The [=remote end steps=] with |command parameters| are:
59385938
|command parameters|["<code>coordinates</code>"].
59395939

59405940
1. If |command parameters| [=map/contains=] "<code>userContexts</code>"
5941-
and |command parameters| [=map/contains=] "<code>context</code>",
5941+
and |command parameters| [=map/contains=] "<code>contexts</code>",
59425942
return [=error=] with [=error code=] [=invalid argument=].
59435943

59445944
1. If |command parameters| doesn't [=map/contain=] "<code>userContexts</code>"
5945-
and |command parameters| doesn't [=map/contain=] "<code>context</code>",
5945+
and |command parameters| doesn't [=map/contain=] "<code>contexts</code>",
59465946
return [=error=] with [=error code=] [=invalid argument=].
59475947

59485948
1. Let |navigables| be a [=/set=].
@@ -6005,8 +6005,6 @@ locale on the given top-level traversables or user contexts.
60056005
The [=DefaultLocale=] algorithm is implementation defined. A WebDriver-BiDi
60066006
[=remote end=] must have an implementation that runs the following steps:
60076007

6008-
1. Let |emulated locale| be null.
6009-
60106008
1. Let |realm| be [=current Realm Record=].
60116009

60126010
1. Let |environment settings| be the [=environment settings object=] whose
@@ -6022,15 +6020,12 @@ The [=DefaultLocale=] algorithm is implementation defined. A WebDriver-BiDi
60226020

60236021
1. Let |user context| be |top-level traversable|'s [=associated user context=].
60246022

6025-
1. If [=locale overrides map=] [=map/contains=] |top-level traversable|, set
6026-
|emulated locale| to [=locale overrides map=][|top-level traversable|].
6023+
1. If [=locale overrides map=] [=map/contains=] |top-level traversable|, return
6024+
[=locale overrides map=][|top-level traversable|].
60276025

6028-
1. Otherwise, if [=locale overrides map=] [=map/contains=]
6029-
|user context|, set |emulated locale| to
6026+
1. If [=locale overrides map=] [=map/contains=] |user context|, return
60306027
[=locale overrides map=][|user context|].
60316028

6032-
1. If |emulated locale| is not null, return |emulated locale|.
6033-
60346029
1. Return the result of implementation-defined steps in accordance with the
60356030
requirements of the [=DefaultLocale=] specification.
60366031

@@ -6041,21 +6036,17 @@ The [=DefaultLocale=] algorithm is implementation defined. A WebDriver-BiDi
60416036
The [=remote end steps=] with |command parameters| are:
60426037

60436038
1. If |command parameters| [=map/contains=] "<code>userContexts</code>"
6044-
and |command parameters| [=map/contains=] "<code>context</code>",
6039+
and |command parameters| [=map/contains=] "<code>contexts</code>",
60456040
return [=error=] with [=error code=] [=invalid argument=].
60466041

60476042
1. If |command parameters| doesn't [=map/contain=] "<code>userContexts</code>"
6048-
and |command parameters| doesn't [=map/contain=] "<code>context</code>",
6043+
and |command parameters| doesn't [=map/contain=] "<code>contexts</code>",
60496044
return [=error=] with [=error code=] [=invalid argument=].
60506045

6051-
1. Let |emulated locale| be null.
6046+
1. Let |emulated locale| be |command parameters|["<code>locale</code>"].
60526047

6053-
1. If |command parameters| [=map/contains=] "<code>locale</code>":
6054-
6055-
1. Set |emulated locale| to |command parameters|["<code>locale</code>"].
6056-
6057-
1. If [=IsStructurallyValidLanguageTag=](|emulated locale|) returns false,
6058-
return [=error=] with [=error code=] [=invalid argument=].
6048+
1. If |emulated locale| is not null and [=IsStructurallyValidLanguageTag=](|emulated locale|)
6049+
returns false, return [=error=] with [=error code=] [=invalid argument=].
60596050

60606051
1. Let |navigables| be a [=/set=].
60616052

@@ -6074,7 +6065,9 @@ The [=remote end steps=] with |command parameters| are:
60746065

60756066
1. For each |user context| of |user contexts|:
60766067

6077-
1. [=map/Set=] [=locale overrides map=][|user context|] to |emulated locale|.
6068+
1. If |emulated locale| is null, [=map/remove=] |user context| from [=locale overrides map=].
6069+
6070+
1. Otherwise, [=map/set=] [=locale overrides map=][|user context|] to |emulated locale|.
60786071

60796072
1. [=list/For each=] |top-level traversable| of the list of all
60806073
[=/top-level traversables=] whose [=associated user context=] is
@@ -6084,7 +6077,9 @@ The [=remote end steps=] with |command parameters| are:
60846077

60856078
1. For each |navigable| of |navigables|:
60866079

6087-
1. [=map/Set=] [=locale overrides map=][|navigable|] to |emulated locale|.
6080+
1. If |emulated locale| is null, [=map/remove=] |navigable| from [=locale overrides map=].
6081+
6082+
1. Otherwise, [=map/set=] [=locale overrides map=][|navigable|] to |emulated locale|.
60886083

60896084
1. Return [=success=] with data null.
60906085

@@ -6368,22 +6363,14 @@ The <dfn export>WebDriver BiDi scripting is enabled</dfn> steps given
63686363

63696364
1. Let |top-level traversable| be |navigable|’s [=navigable/top-level traversable=].
63706365

6371-
1. If [=scripting enabled overrides map=] contains |top-level traversable|:
6372-
6373-
1. If [=scripting enabled overrides map=][|top-level traversable|] is false,
6374-
return false.
6375-
6376-
1. Return true.
6366+
1. If [=scripting enabled overrides map=] contains |top-level traversable|, return
6367+
[=scripting enabled overrides map=][|top-level traversable|]
63776368

63786369
1. Let |user context| be |top-level traversable|'s [=associated user context=].
63796370

63806371
1. If [=scripting enabled overrides map=] contains |user context|, return
63816372
[=scripting enabled overrides map=][|user context|].
63826373

6383-
1. If [=scripting enabled overrides map=][|user context|] is false, return false.
6384-
6385-
1. Return true.
6386-
63876374
1. Return true.
63886375

63896376
</div>
@@ -6393,19 +6380,14 @@ The <dfn export>WebDriver BiDi scripting is enabled</dfn> steps given
63936380
The [=remote end steps=] with |command parameters| are:
63946381

63956382
1. If |command parameters| [=map/contains=] "<code>userContexts</code>"
6396-
and |command parameters| [=map/contains=] "<code>context</code>",
6383+
and |command parameters| [=map/contains=] "<code>contexts</code>",
63976384
return [=error=] with [=error code=] [=invalid argument=].
63986385

63996386
1. If |command parameters| doesn't [=map/contain=] "<code>userContexts</code>"
6400-
and |command parameters| doesn't [=map/contain=] "<code>context</code>",
6387+
and |command parameters| doesn't [=map/contain=] "<code>contexts</code>",
64016388
return [=error=] with [=error code=] [=invalid argument=].
64026389

6403-
1. Let |emulated scripting enabled status| be null.
6404-
6405-
1. If |command parameters| [=map/contains=] "<code>enabled</code>":
6406-
6407-
1. Set |emulated scripting enabled status| to
6408-
|command parameters|["<code>enabled</code>"].
6390+
1. Let |emulated scripting enabled status| be |command parameters|["<code>enabled</code>"].
64096391

64106392
1. If the <code>contexts</code> field of |command parameters| is present:
64116393

@@ -6415,7 +6397,10 @@ The [=remote end steps=] with |command parameters| are:
64156397

64166398
1. For each |navigable| of |navigables|:
64176399

6418-
1. [=map/Set=] [=scripting enabled overrides map=][|navigable|] to
6400+
1. If |emulated scripting enabled status| is null, [=map/remove=] |navigable| from
6401+
[=scripting enabled overrides map=].
6402+
6403+
1. Otherwise, [=map/set=] [=scripting enabled overrides map=][|navigable|] to
64196404
|emulated scripting enabled status|.
64206405

64216406
1. If the <code>userContexts</code> field of |command parameters| is present:
@@ -6425,7 +6410,10 @@ The [=remote end steps=] with |command parameters| are:
64256410

64266411
1. For each |user context| of |user contexts|:
64276412

6428-
1. [=map/Set=] [=scripting enabled overrides map=][|user context|] to
6413+
1. If |emulated scripting enabled status| is null, [=map/remove=] |user context| from
6414+
[=scripting enabled overrides map=].
6415+
6416+
1. Otherwise [=map/set=] [=scripting enabled overrides map=][|user context|] to
64296417
|emulated scripting enabled status|.
64306418

64316419
1. Return [=success=] with data null.
@@ -6502,22 +6490,19 @@ steps:
65026490
The [=remote end steps=] with |command parameters| are:
65036491

65046492
1. If |command parameters| [=map/contains=] "<code>userContexts</code>"
6505-
and |command parameters| [=map/contains=] "<code>context</code>",
6493+
and |command parameters| [=map/contains=] "<code>contexts</code>",
65066494
return [=error=] with [=error code=] [=invalid argument=].
65076495

65086496
1. If |command parameters| doesn't [=map/contain=] "<code>userContexts</code>"
6509-
and |command parameters| doesn't [=map/contain=] "<code>context</code>",
6497+
and |command parameters| doesn't [=map/contain=] "<code>contexts</code>",
65106498
return [=error=] with [=error code=] [=invalid argument=].
65116499

6512-
1. Let |emulated timezone| be null.
6513-
6514-
1. If |command parameters| [=map/contains=] "<code>timezone</code>":
6515-
6516-
1. Set |emulated timezone| to |command parameters|["<code>timezone</code>"].
6500+
1. Let |emulated timezone| be |command parameters|["<code>timezone</code>"].
65176501

6518-
1. If [=IsTimeZoneOffsetString=](|emulated timezone|) returns false and
6519-
[=AvailableNamedTimeZoneIdentifiers=] does not [=list/contain=]
6520-
|emulated timezone|, return [=error=] with [=error code=] [=invalid argument=].
6502+
1. If |emulated timezone| is not null and
6503+
[=IsTimeZoneOffsetString=](|emulated timezone|) returns false and
6504+
[=AvailableNamedTimeZoneIdentifiers=] does not [=list/contain=]
6505+
|emulated timezone|, return [=error=] with [=error code=] [=invalid argument=].
65216506

65226507
1. Let |navigables| be a [=/set=].
65236508

@@ -6536,8 +6521,10 @@ The [=remote end steps=] with |command parameters| are:
65366521

65376522
1. For each |user context| of |user contexts|:
65386523

6539-
1. [=map/Set=] [=timezone overrides map=][|user context|] to
6540-
|emulated timezone|.
6524+
1. If |emulated timezone| is null, [=map/remove=] |user context| from
6525+
[=timezone overrides map=].
6526+
6527+
1. Otherwise, [=map/set=] [=timezone overrides map=][|user context|] to |emulated timezone|.
65416528

65426529
1. [=list/For each=] |top-level traversable| of the list of all
65436530
[=/top-level traversables=] whose [=associated user context=] is
@@ -6547,7 +6534,9 @@ The [=remote end steps=] with |command parameters| are:
65476534

65486535
1. For each |navigable| of |navigables|:
65496536

6550-
1. [=map/Set=] [=timezone overrides map=][|navigable|] to |emulated timezone|.
6537+
1. If |emulated timezone| is null, [=map/remove=] |navigable| from [=timezone overrides map=].
6538+
6539+
1. Otherwise, [=map/set=] [=timezone overrides map=][|navigable|] to |emulated timezone|.
65516540

65526541
1. Return [=success=] with data null.
65536542

0 commit comments

Comments
 (0)