Skip to content

Commit cdbb5b5

Browse files
committed
[worklets] Update agent and realm allocation
Follows whatwg/html#5411. Also includes a top-level origin, introduced in whatwg/html#4966.
1 parent deec884 commit cdbb5b5

File tree

1 file changed

+16
-20
lines changed

1 file changed

+16
-20
lines changed

worklets/Overview.bs

+16-20
Original file line numberDiff line numberDiff line change
@@ -219,17 +219,17 @@ Note:
219219
When a user agent is to <dfn export>create a WorkletGlobalScope</dfn>, given |workletGlobalScopeType|,
220220
|moduleResponsesMap|, and |outsideSettings|, it <em>must</em> run the following steps:
221221

222-
1. Create the <a>worklet global scope execution environment</a> and run the rest of these steps
223-
in that context.
222+
1. Let |agent| be the result of [=obtain a worklet agent|obtaining a worklet agent=] given
223+
|outsideSettings|. This agent corresponds to the a <a>worklet global scope execution
224+
environment</a>. Run the rest of these steps in that context.
224225

225-
2. Call the JavaScript <a>InitializeHostDefinedRealm</a> abstract operation with the following
226-
customizations:
226+
2. Let |realmExecutionContext| be the result of
227+
[=create a new JavaScript realm|creating a new JavaScript realm=] given |agent| and
228+
the following customizations:
227229

228230
- For the global object, create a new |workletGlobalScopeType| object. Let
229231
|workletGlobalScope| be the created object.
230232

231-
- Let |realmExecutionContext| be the created JavaScript execution context.
232-
233233
3. Let |insideSettings| be the result of <a>set up a worklet environment settings object</a>
234234
given |realmExecutionContext|, and |outsideSettings|.
235235

@@ -275,13 +275,11 @@ When a user agent is to <dfn export>set up a worklet environment settings object
275275

276276
5. Let |inheritedReferrerPolicy| be |outsideSettings|'s <a>referrer policy</a>.
277277

278-
6. Let |workletEventLoop| be a newly created <a>event loop</a>.
279-
280-
7. Let |realm| be the value of |executionContext|'s Realm component.
278+
6. Let |realm| be the value of |executionContext|'s Realm component.
281279

282-
8. Let |workletGlobalScope| be |realm|'s <a>global object</a>.
280+
7. Let |workletGlobalScope| be |realm|'s <a>global object</a>.
283281

284-
9. Let |settingsObject| be a new <a>environment settings object</a> whose algorithms are defined
282+
8. Let |settingsObject| be a new <a>environment settings object</a> whose algorithms are defined
285283
as follows:
286284

287285
: The <a>realm execution context</a>
@@ -293,12 +291,8 @@ When a user agent is to <dfn export>set up a worklet environment settings object
293291
: The <a>responsible browsing context</a>
294292
:: Return |inheritedResponsibleBrowsingContext|.
295293

296-
: The <a>responsible event loop</a>
297-
:: Return |workletEventLoop|.
298-
299294
: The <a>responsible document</a>
300-
:: Not applicable (the <a>responsible event loop</a> is not a <a>browsing context</a>
301-
<a>event loop</a>).
295+
:: Not applicable (the <a>responsible event loop</a> is not a <a>window event loop</a>).
302296

303297
: The <a>API URL character encoding</a>
304298
:: Return <a>UTF-8</a>.
@@ -309,19 +303,22 @@ When a user agent is to <dfn export>set up a worklet environment settings object
309303
: The <a for="environment settings object">origin</a>
310304
:: Return |origin|.
311305

306+
: The <a for="environment settings object">top-level origin</a>
307+
:: Return |outsideSettings|'s <a for="environment settings object">top-level origin</a>.
308+
312309
: The <a>HTTPS state</a>
313310
:: Return |inheritedHTTPSState|.
314311

315312
: The <a>referrer policy</a>
316313
:: Return |inheritedReferrerPolicy|.
317314

318-
10. Set |settingsObject|'s <a>id</a> to a new unique opaque string, |settingsObject|'s
315+
9. Set |settingsObject|'s <a>id</a> to a new unique opaque string, |settingsObject|'s
319316
<a>creation URL</a> to |inheritedAPIBaseURL|, |settingsObject|'s <a>target browsing
320317
context</a> to null, and |settingsObject|'s <a>active service worker</a> to null.
321318

322-
11. Set |realm|'s \[[HostDefined]] field to |settingsObject|.
319+
10. Set |realm|'s \[[HostDefined]] field to |settingsObject|.
323320

324-
12. Return |settingsObject|.
321+
11. Return |settingsObject|.
325322
</div>
326323

327324
Issue: Merge this with https://html.spec.whatwg.org/multipage/workers.html#set-up-a-worker-environment-settings-object
@@ -641,4 +638,3 @@ could follow the following steps:
641638
Arguments=["true"]).
642639

643640
5. Return |result|.
644-

0 commit comments

Comments
 (0)