From 7d7e876e00e173f2cec405ea2cbe9cf0b8905950 Mon Sep 17 00:00:00 2001 From: Randolf Jung Date: Mon, 18 Dec 2023 12:24:15 +0100 Subject: [PATCH] Implement "owners" in dedicated workers --- index.bs | 48 ++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 38 insertions(+), 10 deletions(-) diff --git a/index.bs b/index.bs index 4a16ada26..bc70b9fb8 100644 --- a/index.bs +++ b/index.bs @@ -191,17 +191,17 @@ spec: HTML; urlPrefix: https://html.spec.whatwg.org/multipage/ text: report an error; url: webappapis.html#report-the-error text: run the animation frame callbacks; url: imagebitmap-and-animations.html#run-the-animation-frame-callbacks text: same origin domain; url: browsers.html#same-origin-domain - text: session history; url: history.html#session-history text: session history entry; url: browsing-the-web.html#session-history-entry text: session history traversal queue; url: document-sequences.html#tn-session-history-traversal-queue + text: session history; url: history.html#session-history text: set up a window environment settings object; url: window-object.html#set-up-a-window-environment-settings-object text: set up a worker environment settings object; url: workers.html#set-up-a-worker-environment-settings-object text: set up a worklet environment settings object; url: worklets.html#set-up-a-worklet-environment-settings-object text: shared worker; url: workers.html#shared-workers text: system visibility state; url: document-sequences.html#system-visibility-state text: traversable navigable; url:document-sequences.html#traversable-navigable - text: visible; url: document-sequences.html#system-visibility-state text: traverse the history by a delta; url: browsing-the-web.html#traverse-the-history-by-a-delta + text: visible; url: document-sequences.html#system-visibility-state text: window open steps; url: window-object.html#window-open-steps text: worker event loop; url: webappapis.html#worker-event-loop-2 text: worklet global scopes; url:worklets.html#concept-document-worklet-global-scopes @@ -7021,17 +7021,20 @@ script.WindowRealmInfo = { script.DedicatedWorkerRealmInfo = { script.BaseRealmInfo, - type: "dedicated-worker" + type: "dedicated-worker", + owners: [script.Realm] } script.SharedWorkerRealmInfo = { script.BaseRealmInfo, - type: "shared-worker" + type: "shared-worker", + owners: [+script.Realm] } script.ServiceWorkerRealmInfo = { script.BaseRealmInfo, type: "service-worker" + owners: [*script.Realm] } script.WorkerRealmInfo = { @@ -7074,6 +7077,26 @@ To get the browsing context with given |realm|: 1. Return |document|'s [=/browsing context=]. + +
+To get the worker's owners with given |global object|: + +1. Assert: |global object| is a {{WorkerGlobalScope}} object. + +1. Let |owners| be an empty [=/list=]. + +1. For each |owner| in the |global object|'s associated [=owner set=]: + + 1. Let |owner environment settings| be the [=environment settings object=] + whose [=relevant global object=] is |owner|. + + 1. Let |owner realm info| be the result of [=get the realm info=] given + |owner environment settings|. + + 1. Append |owner realm info|["id"] to |owners|. + +1. Return |owners|. +
@@ -7119,21 +7142,26 @@ To get the realm info given |environment settings|:
|global object| is a {{DedicatedWorkerGlobalScope}} object
+ 1. Let |owners| be the result of [=get the worker's owners=] given |global object|. + 1. Assert: |owners| has precisely one item. 1. Let |realm info| be a [=/map=] matching the script.DedicatedWorkerRealmInfo production, - with the realm field set to |realm id|, and the origin field - set to |origin|. + with the realm field set to |realm id|, the origin field + set to |origin|, and the owners field set to |owners|.
|global object| is a {{SharedWorkerGlobalScope}} object
+ 1. Let |owners| be the result of [=get the worker's owners=] given |global object|. + 1. Assert: |owners| has at least one item. 1. Let |realm info| be a [=/map=] matching the script.SharedWorkerRealmInfo production, - with the realm field set to |realm id|, and the origin - field set to |origin|. + with the realm field set to |realm id|, the origin field + set to |origin|, and the owners field set to |owners|.
|global object| is a {{ServiceWorkerGlobalScope}} object
+ 1. Let |owners| be the result of [=get the worker's owners=] given |global object|. 1. Let |realm info| be a [=/map=] matching the script.ServiceWorkerRealmInfo production, - with the realm field set to |realm id|, and the origin field - set to |origin|. + with the realm field set to |realm id|, the origin field + set to |origin|, and the owners field set to |owners|.
|global object| is a {{WorkerGlobalScope}} object