Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose Worker and SharedWorker less #5601

Merged
merged 3 commits into from
Jun 3, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 15 additions & 12 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -97528,11 +97528,12 @@ worker.port.postMessage({ foo: 'structured', bar: ['data', 'also', 'possible']})

<h3>Infrastructure</h3>

<p>There are two kinds of workers; dedicated workers, and shared workers. Dedicated workers, once
created, are linked to their creator; but message ports can be used to communicate from a
dedicated worker to multiple other browsing contexts or workers. Shared workers, on the other
hand, are named, and once created any script running in the same <span>origin</span> can obtain a
reference to that worker and communicate with it.</p>
<p>This standard defines two kinds of workers; dedicated workers, and shared workers. Dedicated
annevk marked this conversation as resolved.
Show resolved Hide resolved
workers, once created, are linked to their creator; but message ports can be used to communicate
annevk marked this conversation as resolved.
Show resolved Hide resolved
from a dedicated worker to multiple other browsing contexts or workers. Shared workers, on the
other hand, are named, and once created any script running in the same <span>origin</span> can
obtain a reference to that worker and communicate with it. <cite>Service Workers</cite> defines a
third kind. <ref spec="SW"></p>


<h4>The global scope</h4>
Expand Down Expand Up @@ -97879,9 +97880,10 @@ interface <dfn>SharedWorkerGlobalScope</dfn> : <span>WorkerGlobalScope</span> {
the type of <span data-x="concept-settings-object-global">global object</span> specified by
<var>o</var>. If <var>o</var> specifies a <span data-x="concept-settings-object-global">global
object</span> that is a <code>WorkerGlobalScope</code> object (i.e., if we are creating a nested
worker), then the relevant owner is that global object. Otherwise, <var>o</var> specifies a <span
data-x="concept-settings-object-global">global object</span> that is a <code>Window</code> object,
and the relevant owner is the <span>responsible document</span> specified by <var>o</var>.</p>
dedicated worker), then the relevant owner is that global object. Otherwise, <var>o</var>
specifies a <span data-x="concept-settings-object-global">global object</span> that is a
<code>Window</code> object, and the relevant owner is the <span>responsible document</span>
specified by <var>o</var>.</p>

<hr>

Expand Down Expand Up @@ -97909,7 +97911,7 @@ interface <dfn>SharedWorkerGlobalScope</dfn> : <span>WorkerGlobalScope</span> {
<p>A worker is said to be a <dfn>protected worker</dfn> if it is an <span>active needed
worker</span> and either it has outstanding timers, database transactions, or network connections,
or its list of <span>the worker's ports</span> is not empty, or its <code>WorkerGlobalScope</code>
is actually a <code>SharedWorkerGlobalScope</code> object (i.e. the worker is a shared
is actually a <code>SharedWorkerGlobalScope</code> object (i.e., the worker is a shared
worker).</p>

<p>A worker is said to be a <dfn>suspendable worker</dfn> if it is not an <span>active needed
Expand All @@ -97934,7 +97936,8 @@ interface <dfn>SharedWorkerGlobalScope</dfn> : <span>WorkerGlobalScope</span> {
<li><p>Let <var>parent worker global scope</var> be null.</p>

<li><p>If <var>owner</var> is a <code>WorkerGlobalScope</code> object (i.e., we are creating a
nested worker), then set <var>parent worker global scope</var> to <var>owner</var>.</p></li>
nested dedicated worker), then set <var>parent worker global scope</var> to
<var>owner</var>.</p></li>

<li>
<p>Let <var>agent</var> be the result of <span data-x="obtain a dedicated/shared worker
Expand Down Expand Up @@ -98369,7 +98372,7 @@ interface <dfn>SharedWorkerGlobalScope</dfn> : <span>WorkerGlobalScope</span> {

<h5>Dedicated workers and the <code subdfn>Worker</code> interface</h5>

<pre><code class="idl" data-x="">[Exposed=(Window,Worker)]
<pre><code class="idl" data-x="">[Exposed=(Window,DedicatedWorker,SharedWorker)]
interface <dfn>Worker</dfn> : <span>EventTarget</span> {
<span data-x="dom-Worker">constructor</span>(USVString scriptURL, optional <span>WorkerOptions</span> options = {});

Expand Down Expand Up @@ -98516,7 +98519,7 @@ enum <dfn>WorkerType</dfn> { "classic", "module" };

<h5>Shared workers and the <code subdfn>SharedWorker</code> interface</h5>

<pre><code class="idl" data-x="">[Exposed=(Window,Worker)]
<pre><code class="idl" data-x="">[Exposed=Window]
interface <dfn>SharedWorker</dfn> : <span>EventTarget</span> {
<span data-x="dom-SharedWorker">constructor</span>(USVString scriptURL, optional (DOMString or <span>WorkerOptions</span>) options = {});

Expand Down