From cec5fcca61595dbaab2235d24a1e4e8655e4569f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= A global object has an import map,
initially an empty import map. For now, only For now, only A global object has a resolved module set, a set
of specifier resolution records, initially
@@ -109215,12 +109216,9 @@ dictionary PromiseRejectionEventInit : EventInit
- Let importMap be an empty import map. If settingsObject's global
- object implements Let importMap be settingsObject's global object's import map. Let serializedBaseURL be baseURL, serialized. When a user agent is to run a worker for a script with Let is shared be true if worker is a Set worker global scope's import map to importMap. Append owner to worker global
scope's owner set. If worker URL is failure, then throw a " Let importMap be an empty import map. If options's If the current global object implements Else, throw a The current global object's import map could be modified, by merging it with a new import map. Such
+ updates will not be reflected in the cloned import map. Let worker be a new Let outside port be a new Run a worker given worker, worker URL, outside
- settings, outside port, and options.Window
global
- objects have their import map modified
- from the initial empty one. The import map is
- only accessed for the resolution of a root module script.Window
and DedicatedWorkerGlobalScope
+ global objects have their import map modified from the initial empty one. The
+ import map is only accessed for the resolution of
+ a root module script.Window
, then set importMap to
- settingsObject's global object's
- import map.Worker
or
SharedWorker
object worker, URL url,
environment settings object outside settings, MessagePort
- outside port, and a WorkerOptions
dictionary options, it must
- run the following steps.WorkerOptions
dictionary options, and an
+ import map importMap, it must run the following steps.
@@ -121137,10 +121165,15 @@ enum WorkerType { "classic", "module" };
SharedWorker
@@ -120591,6 +120589,9 @@ interface SharedWorkerGlobalScope : WorkerGlobalScope
data-x="concept-WorkerGlobalScope-name">name to the value of options's
name
member.
@@ -121108,6 +121115,27 @@ enum WorkerType { "classic", "module" };
[Exposed=(Window,DedicatedWorker,SharedWorker)]
interface Worker : EventTarget {
- constructor((
TrustedScriptURL
or USVString) scriptURL, optional WorkerOptions options = {});
+ constructor((TrustedScriptURL
or USVString) scriptURL, optional DedicatedWorkerOptions options = {});
undefined terminate();
@@ -121015,12 +121016,18 @@ interface Worker : EventTarget {
dictionary WorkerOptions {
WorkerType type = "classic";
- RequestCredentials credentials = "same-origin"; // credentials is only used if type is "module"
+ RequestCredentials credentials = "same-origin"; // credentials is only used if type is "module"
DOMString name = "";
};
+dictionary DedicatedWorkerOptions : WorkerOptions {
+ WorkerImportMapInheritance importMap = "none";
+};
+
enum WorkerType { "classic", "module" };
+enum WorkerImportMapInheritance { "none", "clone" };
+
Worker includes AbstractWorker;
Worker includes MessageEventTarget;SyntaxError
"
DOMException
.importMap
member is "clone
", then:
+
+
+ Window
or
+ DedicatedWorkerGlobalScope
, set importMap to a deep copy of the
+ current global object's import
+ map.TypeError
exception.Worker
object.MessagePort
in outside
@@ -121123,7 +121151,7 @@ enum WorkerType { "classic", "module" };
, outside port options, and importMap.[Exposed=Window]
interface SharedWorker : EventTarget {
- constructor((
TrustedScriptURL
or USVString) scriptURL, optional (DOMString or WorkerOptions) options = {});
+ constructor((TrustedScriptURL
or USVString) scriptURL, optional (DOMString or SharedWorkerOptions) options = {});
readonly attribute MessagePort port;
};
+
+dictionary SharedWorkerOptions : WorkerOptions {
+ any importMap; // used to prevent passing DedicatedWorkerOptions' importMap option
+};
+
SharedWorker includes AbstractWorker;
@@ -121193,7 +121226,7 @@ interface SharedWorker : EventTarget {
"
script
".
If options is a DOMString
, set
- options to a new WorkerOptions
dictionary whose options to a new
SharedWorkerOptions
dictionary whose name
member is set to the value of options and whose other members
are set to their default values.
If urlRecord is failure, then throw a "SyntaxError
"
DOMException
.
If options's importMap
member is not undefined, throw
+ a TypeError
exception.
Let worker be a new SharedWorker
object.
Let outside port be a new MessagePort
in outside
@@ -121338,8 +121374,8 @@ interface SharedWorker : EventTarget {
Otherwise, in parallel, run a worker given worker, - urlRecord, outside settings, outside port, and - options.
[LegacyUnenumerableNamedProperties]
[LegacyUnforgeable]
Web IDL also defines the following types that are used in Web IDL fragments in
@@ -109747,27 +109749,51 @@ dictionary PromiseRejectionEventInit : EventInit
To parse an import map string, given a string input and a
URL baseURL: Let parsed be the result of parsing a JSON string to an Infra value given input. Let jsVal be the result of parsing a JSON string to a JavaScript value given input. If jsVal is null or undefined, throw a Let parsed be jsVal converted to an Let importMap be the result of creating an
+ import map given parsed and baseURL. If parsed is not an ordered map, then throw a
- If jsVal.[[OwnPropertyKeys]]() contains any
+ items besides " This can help detect typos. It is not an error, because that would prevent any
+ future extensions from being added backward-compatibly. Return importMap. To create an import map, given an Let sortedAndNormalizedImports be an empty ordered map. If parsed[" If parsed[" If parsed[" Set sortedAndNormalizedImports to the result of sorting and
normalizing a module specifier map given parsed[" Let sortedAndNormalizedScopes be an empty ordered map. If parsed[" If parsed[" If parsed[" Set sortedAndNormalizedScopes to the result of sorting and normalizing
scopes given parsed[" Let normalizedIntegrity be an empty ordered map. If parsed[" If parsed[" If parsed[" Set normalizedIntegrity to the result of normalizing a module
integrity map given parsed[" If parsed's keys contains any items besides " This can help detect typos. It is not an error, because that would prevent any
- future extensions from being added backward-compatibly. Return an import map whose imports are sortedAndNormalizedImports,
whose scopes are
@@ -110197,8 +110202,8 @@ dictionary PromiseRejectionEventInit : EventInit
To sort and normalize a module
- specifier map, given an ordered map originalMap and a
- URL baseURL: Let normalized be an empty ordered map.
+
+
dictionary ImportMap {
+ record<DOMString, any> imports;
+ record<DOMString, record<DOMString, any>> scopes;
+ record<DOMString, any> integrity;
+ };
-
+
+ TypeError
indicating that
+ the top-level value needs to be a JSON object.ImportMap
.TypeError
indicating that the top-level value needs to be a JSON object.imports
", "scopes
", or "integrity
", then the user agent should report a warning to the
+ console indicating that an invalid top-level key was present in the import map.ImportMap
parsed and a
+ URL baseURL:
imports
"] exists, then:imports
"] is not undefined, then:
-
imports
"] is not an ordered
- map, then throw a TypeError
indicating that the value for the "imports
" top-level key needs to be a JSON object.imports
"] and baseURL.scopes
"] exists, then:scopes
"] is not undefined, then:
-
scopes
"] is not an ordered
- map, then throw a TypeError
indicating that the value for the "scopes
" top-level key needs to be a JSON object.scopes
"] and
baseURL.integrity
"] exists, then:integrity
"] is not undefined, then:
-
integrity
"] is not an ordered
- map, then throw a TypeError
indicating that the value for the "integrity
" top-level key needs to be a JSON object.integrity
"] and
baseURL.imports
", "scopes
", or "integrity
", then the user agent should
- report a warning to the console indicating that an invalid top-level key was
- present in the import map.record<DOMString, any>
+ originalMap and a URL baseURL:
To sort and normalize scopes, given an - ordered map originalMap and a URL baseURL:
+To sort and normalize scopes, given a record<DOMString, record<DOMString, any>>
originalMap and a
+ URL baseURL:
Let normalized be an empty ordered map.
If potentialSpecifierMap is not an ordered map, then throw a
- TypeError
indicating that the value of the scope with prefix
- scopePrefix needs to be a JSON object.
Let scopePrefixURL be the result of URL parsing scopePrefix with baseURL.
To normalize a module integrity map, - given an ordered map originalMap:
+ given arecord<DOMString, any>
originalMap:
Let normalized be an empty ordered map.
Else, if options's importMap
member is an
+ ImportMap
, set importMap to the result of creating an import map given options's importMap
+ member and TODO: which base URL? The worker's, or the
+ creator's?.
Let worker be a new Worker
object.
Let outside port be a new MessagePort
in outside