diff --git a/source b/source index c186fbd895a..c26da05bd40 100644 --- a/source +++ b/source @@ -84603,6 +84603,45 @@ interface NavigatorOnLine {
To fetch a classic worker script given a url, a referrer, a + settings object, and a boolean is shared, run these steps. The algorithm + will asynchronously complete with either null (on failure) or a new classic script + (on success).
+ +Let request be a new request whose
+ url is url, client is settings object, type is "script
", destination is "sharedworker
" if is shared is true and "worker
" otherwise, referrer is
+ referrer, mode is "same-origin
", credentials
+ mode is "same-origin
", and whose use-URL-credentials
+ flag is set.
Fetch request.
Return from this algorithm, and run the remaining steps as part of the fetch's + process response for the response + response.
If response's type is "error
", or response's status is not an ok status, asynchronously
+ complete this algorithm with null, and abort these steps.
Let source text be the result of UTF-8 + decoding response's body.
Let script be the result of creating a classic script using + source text and settings object.
To fetch a module script tree given a url, a credentials mode, and a settings object, run these steps. The algorithm will asynchronously complete with either null (on failure) or a new module script (on success).
@@ -93986,8 +94025,9 @@ interface WorkerGlobalScope : EventTarget {SharedWorker
object worker, URL url,
URL referrer, MessagePort
outside port,
list of relevant Document
objects to add docs, possible
- WorkerGlobalScope
parent worker global scope, and a boolean flag is
- shared, it must run the following steps:
+ WorkerGlobalScope
parent worker global scope, a boolean flag is
+ shared, and a WorkerOptions
dictionary options, it must run the
+ following steps:
Let request be a new request whose
- url is url, client is settings object, type is "script
", destination is "sharedworker
" if is shared is true and "worker
" otherwise, referrer is
- referrer, synchronous flag is set, mode is "same-origin
", credentials mode is "same-origin
", and whose use-URL-credentials flag is set.
Let response be the result of fetching request.
If response's status is an - ok status, then let source be the result of running the UTF-8 - decode algorithm on response's body.
- -As with script
elements, the MIME type of the script is ignored.
- Unlike with script
elements, there is no way to override the type. It's always
- assumed to be JavaScript.
Otherwise, queue a task to fire a simple event named
- error
at worker. Abort these steps.
Call the JavaScript WorkerGlobalScope : EventTarget {
Set up a worker environment settings object with realm execution
context, and let settings object be the result. Obtain script by switching on the value of options's Let credentials mode be determined by switching on the value of the
+ Fetch a module script tree given url, credentials
+ mode, and settings object. If the algorithm asynchronously completes with null, queue a task to fire
+ a simple event named Associate worker with worker global scope. Create a new Let script be the result of creating a classic script using
- source and settings object. Run the classic script script. Perform either the run a classic script or run a module script
+ algorithms on script, depending on whether it is a classic script or
+ module script. In addition to the usual possibilities of returning a value or failing due to
an exception, this could be prematurely aborted by the "kill a worker" or
@@ -94412,13 +94460,22 @@ interface AbstractWorker {
The When the When the Run a worker given worker, worker URL, the
incumbent settings object's creation URL, outside port,
- docs, parent worker global scope, and false.type
member:
+
+
+ classic
"module
"
+
+ crossOrigin
member of options:
+
+ omit
"anonymous
"same-origin
"use-credentials
"include
"error
at worker, and
+ abort these steps. Otherwise, continue the rest of these steps after the algorithm's
+ asynchronous completion, with script being the asynchronous completion value.MessagePort
object whose WorkerGlobalScope : EventTarget {
- Dedicated workers and the
- Worker
interface[Constructor(DOMString scriptURL), Exposed=(Window,Worker)]
+
[Constructor(DOMString scriptURL, optional WorkerOptions options), Exposed=(Window,Worker)]
interface Worker : EventTarget {
void terminate();
void postMessage(any message, optional sequence<Transferable> transfer);
attribute EventHandler onmessage;
};
+
+dictionary WorkerOptions {
+ WorkerType type = "classic";
+ WorkerCrossOriginMode? crossOrigin = null;
+};
+
+enum WorkerType { "classic", "module" };
+enum WorkerCrossOriginMode { "anonymous", "use-credentials" };
+
Worker implements AbstractWorker;
terminate()
method, when invoked, must
@@ -94459,8 +94516,9 @@ interface Worker : EventTarget {
- Worker(scriptURL)
constructor
- is invoked, the user agent must run the following steps:Worker(scriptURL,
+ options)
constructor is invoked, the user agent must run the following
+ steps:
@@ -94503,7 +94561,7 @@ interface Worker : EventTarget {
SharedWorker
interface[Constructor(DOMString scriptURL, optional DOMString name = ""), Exposed=(Window,Worker)] +[Constructor(DOMString scriptURL, optional DOMString name = "", optional WorkerOptions options), Exposed=(Window,Worker)] interface SharedWorker : EventTarget { readonly attribute MessagePort port; }; @@ -94521,8 +94579,9 @@ interface SharedWorker : EventTarget { it was assigned by the object's constructor. It represents theMessagePort
for communicating with the shared worker. -When the
+SharedWorker(scriptURL, name)
constructor is invoked, the user agent must run the following - steps:When the
SharedWorker(scriptURL, + name, options)
constructor is invoked, the user agent must run + the following steps:@@ -94661,7 +94720,7 @@ interface SharedWorker : EventTarget {
- + docs, parent worker global scope, true, and options.
Run a worker given worker, parsed scriptURL, the incumbent settings object's creation URL, outside port, - docs, parent worker global scope, and true.