@@ -1553,7 +1553,7 @@ explicitly test that scripts running in sandboxes work in all implementations.
15531553
15541554## Sandbox Realms ## {#sandbox-realm}
15551555
1556- Each sandbox is a unique ECMAScript [=Realm=]. However the sandbox realm
1556+ Each sandbox is a unique ECMAScript [=/ Realm=]. However the sandbox realm
15571557provides access to platform objects in an existing {{Window}} realm via
15581558{{SandboxProxy}} objects.
15591559
@@ -7739,7 +7739,7 @@ a <code>io.Stream</code> and [=stream settings=].
77397739
77407740<dfn>Stream settings</dfn> is a [=struct=] with
77417741an [=struct/item=] named <dfn for="stream settings">stream</dfn>, which is a [=readable stream=],
7742- an [=struct/item=] named <dfn for="stream settings">navigable </dfn>, which is a <code>browsingContext.BrowsingContext </code> or null.
7742+ an [=struct/item=] named <dfn for="stream settings">realm </dfn>, which is a <code>script.Realm </code> or null.
77437743
77447744<div class="algorithm">
77457745
@@ -7824,16 +7824,15 @@ The [=remote end steps=] given |session| and |command parameters| are:
78247824
782578251. Let |stream| be |stream settings|[[=stream settings/stream=]].
78267826
7827- 1. Let |navigable id| be |stream settings|[[=stream settings/navigable =]].
7827+ 1. Let |realm id| be |stream settings|[[=stream settings/realm =]].
78287828
782978291. If |command parameters| [=map/contains=] "<code>reason</code>", let |reason|
78307830 be |command parameters|["<code>reason</code>"]. Otherwise let |reason| be
78317831 undefined.
78327832
7833- 1. If |navigable id| is not null:
7833+ 1. If |realm id| is not null:
78347834
7835- 1. Let |realm| be the result of [=trying=] to [=get a realm from a navigable=]
7836- with |navigable id| and null.
7835+ 1. Let |realm| be the result of [=trying=] to [=get a realm=] with |realm id|.
78377836
78387837 1. Let |environment settings| be the [=environment settings object=] whose
78397838 [=realm execution context=]'s Realm component is |realm|.
@@ -7843,23 +7842,21 @@ The [=remote end steps=] given |session| and |command parameters| are:
78437842 1. Let |promise| be the result of [=ReadableStream/cancel=] |stream| with
78447843 |reason|.
78457844
7845+ 1. [=Clean up after running script=] with |environment settings|.
7846+
78467847 1. [=React=] to |promise|:
78477848
78487849 1. If |promise| was rejected, then:
78497850
7850- 1. [=Clean up after running script=] with |environment settings|.
7851-
78527851 1. Return [=error=] with [=error code=] [=stream closed=].
78537852
78547853 1. If |promise| was fulfilled, then:
78557854
7856- 1. [=Clean up after running script=] with |environment settings|.
7857-
78587855 1. Return [=success=] with data null.
78597856
786078571. Otherwise, return error with [=error code=] [=unsupported operation=].
78617858
7862- TODO: Add support for streams that don't have an associated navigable .
7859+ TODO: Add support for streams that don't have an associated realm .
78637860
78647861</div>
78657862
@@ -7899,21 +7896,33 @@ The [=remote end steps=] given |session| and |command parameters| are:
78997896
790078971. Let |stream| be |stream settings|[[=stream settings/stream=]].
79017898
7902- 1. Let |navigable id| be |stream settings|[[=stream settings/navigable =]].
7899+ 1. Let |realm id| be |stream settings|[[=stream settings/realm =]].
79037900
7904- 1. If |navigable id| is not null:
7901+ 1. If |realm id| is not null:
79057902
7906- 1. Let |realm| be the result of [=trying=] to [=get a realm from a navigable=]
7907- with |navigable id| and null.
7903+ 1. Let |realm| be the result of [=trying=] to [=get a realm=] with |realm id|.
79087904
79097905 1. Let |environment settings| be the [=environment settings object=] whose
79107906 [=realm execution context=]'s Realm component is |realm|.
79117907
79127908 1. [=Prepare to run script=] with |environment settings|.
79137909
7914- 1. Let |reader| be the result of [=ReadableStream/getting a reader=] for |stream|.
7910+ 1. Let |reader| be the result of [=trying=] to [= ReadableStream/getting a reader=] for |stream|.
79157911
7916- 1. Let |read result| be the result of calling {{ReadableStreamDefaultReader/read()}} for |reader|.
7912+ 1. Let |promise| be [=a new promise=].
7913+
7914+ 1. Let |read request| be a new [=read request=] with the following [=struct/items=]:
7915+
7916+ <dl>
7917+ <dt>[=read request/chunk steps=], given |chunk|
7918+ <dd>Resolve |promise| with «[ "value" → |chunk|, "done" → false ]».
7919+ <dt>[=read request/close steps=]
7920+ <dd>Resolve promise with «[ "value" → undefined, "done" → true ]».
7921+ <dt>[=read request/error steps=], given |e|
7922+ <dd>Reject |promise| with |e|.
7923+ </dl>
7924+
7925+ 1. Let |read request| be the result of [=ReadableStreamDefaultReader/read a chunk=] from |reader| given |read request|.
79177926
79187927 1. If |read result|.\[[Type]] is <code>normal</code>.:
79197928
@@ -7949,7 +7958,7 @@ The [=remote end steps=] given |session| and |command parameters| are:
79497958
795079591. Otherwise, return [=error=] with [=error code=] [=unsupported operation=].
79517960
7952- TODO: Add support for streams that don't have an associated navigable .
7961+ TODO: Add support for streams that don't have an associated realm .
79537962
79547963</div>
79557964
@@ -11568,9 +11577,9 @@ script.Handle = text;
1156811577</pre>
1156911578
1157011579The <code>script.Handle</code> type represents a handle to an object owned by
11571- the ECMAScript runtime. The handle is only valid in a specific [=Realm=].
11580+ the ECMAScript runtime. The handle is only valid in a specific [=/ Realm=].
1157211581
11573- Each ECMAScript [=Realm=] has a corresponding <dfn>handle object map</dfn>. This is a
11582+ Each ECMAScript [=/ Realm=] has a corresponding <dfn>handle object map</dfn>. This is a
1157411583strong [=/map=] from handle ids to their corresponding objects.
1157511584
1157611585#### The script.InternalId Type #### {#type-script-InternalId}
@@ -11806,7 +11815,7 @@ on realm creation.
1180611815script.Realm = text;
1180711816</pre>
1180811817
11809- Each [=realm=] has an associated <dfn export>realm id</dfn>, which is a string
11818+ Each [=/ realm=] has an associated <dfn export>realm id</dfn>, which is a string
1181011819uniquely identifying that realm. This is implicitly set when the realm is
1181111820created.
1181211821
@@ -11822,10 +11831,10 @@ To <dfn>get a realm</dfn> given |realm id|:
1182211831
11823118321. If |realm id| is null, return [=success=] with data null.
1182411833
11825- 1. If there is no [=realm=] with [=realm id|id=] |realm id| return
11834+ 1. If there is no [=/ realm=] with [=realm id|id=] |realm id| return
1182611835 [=error=] with [=error code=] [=no such frame=]
1182711836
11828- 1. Let |realm| be the [=realm=] with [=realm id|id=] |realm id|.
11837+ 1. Let |realm| be the [=/ realm=] with [=realm id|id=] |realm id|.
1182911838
11830118391. Return [=success=] with data |realm|
1183111840
@@ -12254,7 +12263,7 @@ script.RemoteObjectReference = {
1225412263
1225512264The <code><dfn>script.RemoteReference</dfn></code> type is either a
1225612265<code>script.RemoteObjectReference</code> representing a remote reference to an
12257- existing ECMAScript object in [=handle object map=] in the given [=Realm=], or
12266+ existing ECMAScript object in [=handle object map=] in the given [=/ Realm=], or
1225812267is a <code>script.SharedReference</code> representing a reference to a [=node=].
1225912268
1226012269Issue: handle "stale object reference" case.
@@ -12897,16 +12906,14 @@ an |ownership type|, a |serialization internal map|, a |realm| and a |session|:
1289712906 1. Let |stream realm| be |value|'s [=relevant settings object=]'s
1289812907 [=realm execution context=]'s Realm component.
1289912908
12900- 1. Let |navigable| be the result of [=get the navigable=] with |stream realm|.
12901-
12902- 1. If |navigable| is null, let |navigable id| be null. Otherwise, let
12903- |navigable id| be the [=navigable id=] for |navigable|.
12909+ 1. If |stream realm| is null, let |realm id| be null. Otherwise, let
12910+ |realm id| be the [=realm id=] for |stream realm|.
1290412911
1290512912 1. Let |stream id| be the string representation of a [[!RFC9562|UUID]].
1290612913
1290712914 1. Let |stream settings| be a [=stream settings=] struct with the
1290812915 [=stream settings/stream=] item set to |value| and the
12909- [=stream settings/navigable =] item set to |navigable id|.
12916+ [=stream settings/realm =] item set to |realm id|.
1291012917
1291112918 1. Set |session|'s [=readable stream settings map=][|stream id|] to
1291212919 |stream settings|.
@@ -13766,7 +13773,7 @@ The [=remote end steps=] given |session| and |command parameters| are:
1376613773#### The script.getRealms Command #### {#command-script-getRealms}
1376713774
1376813775The <dfn export for=commands>script.getRealms</dfn> command returns a list of
13769- all realms, optionally filtered to [=realms=] of a specific type, or to the
13776+ all realms, optionally filtered to [=/ realms=] of a specific type, or to the
1377013777realm associated with a [=/navigable=]'s [=active document=].
1377113778
1377213779<dl>
@@ -14097,6 +14104,13 @@ Define the following [=unloading document cleanup steps=] with |document|:
1409714104
14098141051. Let |realm id| be the [=realm id=] for |realm|.
1409914106
14107+ 1. For each |active session| in [=active sessions=]:
14108+
14109+ 1. For each |stream setting| in [=active sessions=]'s [=stream settings=]:
14110+
14111+ 1. If |stream setting|[[=stream settings/realm=]] equal |realm id|
14112+ [=map/remove=] |stream setting|.
14113+
14100141141. Let |params| be a [=/map=] matching the
1410114115 <code>script.RealmDestroyedParameters</code> production, with the
1410214116 <code>realm</code> field set to |realm id|.
@@ -14122,6 +14136,13 @@ worker=] algorithm:
1412214136
14123141371. Let |realm id| be the [=realm id=] for |realm|.
1412414138
14139+ 1. For each |active session| in [=active sessions=]:
14140+
14141+ 1. For each |stream setting| in [=active sessions=]'s [=stream settings=]:
14142+
14143+ 1. If |stream setting|[[=stream settings/realm=]] equal |realm id|
14144+ [=map/remove=] |stream setting|.
14145+
14125141461. Let |params| be a [=/map=] matching the <code>script.RealmDestroyedParameters</code>
1412614147 production, with the <code>realm</code> field set of |realm id|.
1412714148
0 commit comments