Skip to content

Commit 3f3075d

Browse files
Allow for global setting + use struct
1 parent 56e6e63 commit 3f3075d

File tree

1 file changed

+37
-16
lines changed

1 file changed

+37
-16
lines changed

index.bs

Lines changed: 37 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1545,9 +1545,15 @@ An <dfn>emulated network conditions struct</dfn> is a [=struct=] with:
15451545
* [=struct/item=] named <dfn id="emulated-network-conditions-struct-offline"
15461546
for="emulated-network-conditions-struct">offline</dfn> which is a boolean or null.
15471547

1548-
A [=BiDi session=] has an <dfn>emulated network conditions map</dfn>, which is a weak
1549-
map between [=navigables=] or [=user contexts=] and
1550-
[=emulated network conditions struct=] or null.
1548+
A [=BiDi session=] has a <dfn for=session>emulated network conditions</dfn> which is
1549+
a [=struct=] with an [=struct/item=] named <dfn
1550+
for="emulated network conditions">default network conditions</dfn>, which is an
1551+
[=emulated network conditions struct=] or null, an [=struct/item=] named
1552+
<dfn for="emulated network conditions">user context network conditions</dfn>, which
1553+
is a weak map between [=user contexts=] and [=emulated network conditions struct=],
1554+
and a [=struct/item=] named
1555+
<dfn for="emulated network conditions">navigable network conditions</dfn>, which is a
1556+
weak map between [=navigables=] and [=emulated network conditions struct=].
15511557

15521558
When a [=user context=] is [=set/remove|removed=] from the
15531559
[=set of user contexts=], [=remove user context subscriptions=].
@@ -6200,16 +6206,12 @@ context.
62006206

62016207
<div algorithm="remote end steps for emulation.setNetworkConditions">
62026208

6203-
The [=remote end steps=] with |command parameters| are:
6209+
The [=remote end steps=] with |command parameters| and |session| are:
62046210

62056211
1. If |command parameters| [=map/contains=] "<code>userContexts</code>"
62066212
and |command parameters| [=map/contains=] "<code>context</code>",
62076213
return [=error=] with [=error code=] [=invalid argument=].
62086214

6209-
1. If |command parameters| doesn't [=map/contain=] "<code>userContexts</code>"
6210-
and |command parameters| doesn't [=map/contain=] "<code>context</code>",
6211-
return [=error=] with [=error code=] [=invalid argument=].
6212-
62136215
1. Let |emulated network conditions| be null.
62146216

62156217
1. If |command parameters|["<code>networkConditions</code>"] is not null and
@@ -6226,7 +6228,8 @@ The [=remote end steps=] with |command parameters| are:
62266228

62276229
1. For each |navigable| of |navigables|:
62286230

6229-
1. [=map/Set=] [=emulated network conditions map=][|navigable|] to
6231+
1. [=map/Set=] |session|'s [=emulated network conditions=]'s
6232+
[=emulated network conditions/navigable network conditions=][|navigable|] to
62306233
|emulated network conditions|.
62316234

62326235
1. If the <code>userContexts</code> field of |command parameters| is present:
@@ -6236,7 +6239,15 @@ The [=remote end steps=] with |command parameters| are:
62366239

62376240
1. For each |user context| of |user contexts|:
62386241

6239-
1. [=map/Set=] [=emulated network conditions map=][|user context|] to |emulated network conditions|.
6242+
1. [=map/Set=] |session|'s [=emulated network conditions=]'s
6243+
[=emulated network conditions/user context network conditions=][|user context|]
6244+
to |emulated network conditions|.
6245+
6246+
1. If |command parameters| doesn't [=map/contain=] "<code>userContexts</code>"
6247+
and |command parameters| doesn't [=map/contain=] "<code>context</code>",
6248+
[=map/set=] |session|'s [=emulated network conditions=]'s
6249+
[=emulated network conditions/default network conditions=][|user context|] to
6250+
|emulated network conditions|.
62406251

62416252
1. Return [=success=] with data null.
62426253

@@ -9484,12 +9495,22 @@ are:
94849495

94859496
1. For each |session| in [=active BiDI sessions=]:
94869497

9487-
1. If |session|'s [=emulated network conditions map=] [=map/contains=]
9488-
|top-level traversable|, return
9489-
[=emulated network conditions map=][|top-level traversable|].
9490-
9491-
1. If |session|'s [=emulated network conditions map=] [=map/contains=]
9492-
|user context|, return [=emulated network conditions map=][|user context|].
9498+
1. If |session|'s [=emulated network conditions=]'s
9499+
[=emulated network conditions/navigable network conditions=]
9500+
[=map/contains=] |top-level traversable|, return |session|'s
9501+
[=emulated network conditions=]'s
9502+
[=emulated network conditions/navigable network conditions=][|top-level traversable|].
9503+
9504+
1. If |session|'s [=emulated network conditions=]'s
9505+
[=emulated network conditions/user context network conditions=]
9506+
[=map/contains=] |user context|, return |session|'s
9507+
[=emulated network conditions=]'s
9508+
[=emulated network conditions/user context network conditions=][|user context|].
9509+
9510+
1. If |session|'s [=emulated network conditions=]'s
9511+
[=emulated network conditions/default network conditions=] is not null,
9512+
return |session|'s [=emulated network conditions=]'s
9513+
[=emulated network conditions/default network conditions=].
94939514

94949515
1. Return null.
94959516

0 commit comments

Comments
 (0)