Skip to content

Commit

Permalink
Implement "owners" in dedicated workers
Browse files Browse the repository at this point in the history
  • Loading branch information
jrandolf-2 committed Dec 18, 2023
1 parent ffbf706 commit 7d7e876
Showing 1 changed file with 38 additions and 10 deletions.
48 changes: 38 additions & 10 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 = {
Expand Down Expand Up @@ -7074,6 +7077,26 @@ To <dfn>get the browsing context</dfn> with given |realm|:

1. Return |document|'s [=/browsing context=].

</div>
<div algorithm>
To <dfn>get the worker's owners</dfn> 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|["<code>id</code>"] to |owners|.

1. Return |owners|.

</div>

<div algorithm>
Expand Down Expand Up @@ -7119,21 +7142,26 @@ To <dfn>get the realm info</dfn> given |environment settings|:

<dt>|global object| is a {{DedicatedWorkerGlobalScope}} object
<dd>
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 <code>script.DedicatedWorkerRealmInfo</code> production,
with the <code>realm</code> field set to |realm id|, and the <code>origin</code> field
set to |origin|.
with the <code>realm</code> field set to |realm id|, the <code>origin</code> field
set to |origin|, and the <code>owners</code> field set to |owners|.

<dt>|global object| is a {{SharedWorkerGlobalScope}} object
<dd>
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 <code>script.SharedWorkerRealmInfo</code> production,
with the <code>realm</code> field set to |realm id|, and the <code>origin</code>
field set to |origin|.
with the <code>realm</code> field set to |realm id|, the <code>origin</code> field
set to |origin|, and the <code>owners</code> field set to |owners|.

<dt>|global object| is a {{ServiceWorkerGlobalScope}} object
<dd>
1. Let |owners| be the result of [=get the worker's owners=] given |global object|.
1. Let |realm info| be a [=/map=] matching the <code>script.ServiceWorkerRealmInfo</code> production,
with the <code>realm</code> field set to |realm id|, and the <code>origin</code> field
set to |origin|.
with the <code>realm</code> field set to |realm id|, the <code>origin</code> field
set to |origin|, and the <code>owners</code> field set to |owners|.

<dt>|global object| is a {{WorkerGlobalScope}} object
<dd>
Expand Down

0 comments on commit 7d7e876

Please sign in to comment.