diff --git a/source b/source index 1da48e1da84..346abeebf4c 100644 --- a/source +++ b/source @@ -8328,6 +8328,16 @@ interface DOMStringList { +
  • +

    Otherwise, if value has [[ModuleBlockBody]] internal slot, then:

    + +
      +
    1. Set serialized to { [[Type]]: "ModuleBlock", + [[ModuleBlockBody]]: value.[[ModuleBlockBody]], + [[HostDefined]]: value.[[HostDefined]] }.

    2. +
    +
  • +
  • Otherwise, if value has an [[ErrorData]] internal slot and value is not a platform object, then:

    @@ -8722,6 +8732,17 @@ o.myself = o;
  • +
  • +

    Otherwise, if serialized.[[Type]] is "ModuleBlock", then:

    + +
      +
    1. Set value to a new ModuleBlock object in targetRealm + whose [[ModuleBlockBody]] internal slot value is value.[[ModuleBlockBody]] + and whose [[HostDefined]] internal slot value is value.[[HostDefined]].

    2. + +
    +
  • +
  • Otherwise, if serialized.[[Type]] is "Array", then:

    @@ -90909,43 +90930,52 @@ document.querySelector("button").addEventListener("click", bound); script (on success).

      -
    1. Let url be the result of resolving a +

    2. Let specifier be the result of resolving a module specifier given base URL and moduleRequest.[[Specifier]].

    3. -
    4. If url is failure, then asynchronously complete this algorithm with null, and - return.

    5. +
    6. +

      If specifier is a module block, then:

      +
        +
      1. Let source text be specifier.[[ModuleBlockBody]].

      2. -
      3. Assert: moduleRequest.[[Assertions]] does not contain any Record - entry such that entry.[[Key]] is not "type", because - we only asked for "type" assertions in - HostGetSupportedImportAssertions.

      4. +
      5. Let module block base URL be specifier.[[HostDefined]].

      6. -
      7. If moduleRequest.[[Assertions]] has a Record entry - such that entry.[[Key]] is "type", then let module - type be entry.[[Value]]. Otherwise let module type be "javascript".

      8. +
      9. Let result be the result of creating a module script using + source text, settings object, module block base URL, and + options.

      10. -
      11. If module type is not "javascript", "css", or "json", then asynchronously complete this - algorithm with null, and return.

      12. +
      13. Set moduleMap[specifier] to module script.

      14. +
      +

      else:

      +
        +
      1. Assert: moduleRequest.[[Assertions]] does not contain any Record + entry such that entry.[[Key]] is not "type", because + we only asked for "type" assertions in + HostGetSupportedImportAssertions.

      2. -
      3. Fetch a single module script given url, settings - object, "script", options, settings object, - "client", moduleRequest, and with the - top-level module fetch flag set. If the caller of this algorithm specified custom - perform the fetch steps, pass those along as - well. Wait until the algorithm asynchronously completes with result.

      4. +
      5. If moduleRequest.[[Assertions]] has a Record entry + such that entry.[[Key]] is "type", then let module + type be entry.[[Value]]. Otherwise let module type be "javascript".

      6. -
      7. If result is null, asynchronously complete this algorithm with null, and - return.

      8. +
      9. If module type is not "javascript", "css", or "json", then asynchronously complete this + algorithm with null, and return.

      10. -
      11. Let visited set be « (url, module type) ».

      12. +
      13. Fetch a single module script given url, settings + object, "script", options, settings object, + "client", moduleRequest, and with the + top-level module fetch flag set. If the caller of this algorithm specified custom + perform the fetch steps, pass those along as + well. Wait until the algorithm asynchronously completes with result.

      14. +
      -
    7. Fetch the - descendants of and link result given settings object, - destination, and visited set. When this asynchronously completes with - final result, asynchronously complete this algorithm with final - result.

    8. +
    9. Let visited set be « (url, module type) ».

    10. +
    11. Fetch the + descendants of and link result given settings object, + destination, and visited set. When this asynchronously completes with + final result, asynchronously complete this algorithm with final + result.

    To fetch a modulepreload module script graph given a url, a @@ -92626,15 +92656,25 @@ dictionary PromiseRejectionEventInit : EventInit

    A module map is a map keyed by tuples consisting of a URL record and a string. - The URL record is the request URL at which - the module was fetched, and the string indicates the type of the module (e.g. "javascript"). The module map's values are either a module - script, null (used to represent failed fetches), or a placeholder value "fetching". Module maps are used to ensure - that imported module scripts are only fetched, parsed, and evaluated once per + data-x="tuple">tuples. The tuple consists of:

    + +
      +
    1. A URL record or a module block.

    2. +
    3. A string.

    4. +
    + +

    The URL record is the request URL + at which the module was fetched, and the string indicates the type of the module + (e.g. "javascript"). The module map's values are either a + module script, null (used to represent failed fetches), or a placeholder value + "fetching". Module maps are used + to ensure that imported module scripts are only fetched, parsed, and evaluated once per Document or worker.

    +

    The module map is a weak map. The entries where tuple key has a module block are weakly held, + but tuple keys with the URL record keys are strongly held. This is because module block + instances may be collected throughout the lifetime of a realm.

    +

    Since module maps are keyed by (URL, module type), the following code will create three separate entries in the module map, since it @@ -92951,6 +92991,26 @@ import "https://example.com/foo/../module2.mjs";

  • Return resolved module script's record.

  • +
    HostIntializeModuleBlock(moduleBlock)
    + +

    JavaScript contains an implementation-defined HostIntializeModuleBlock abstract operation. User + agents must use the following implementation:

    + +
      +
    1. Let urlString be null.

    2. +

      If active script is not null, then:

      +
        +
      1. If active script's base URL is not null, then:

      2. +
          +
        1. Let urlString be active script's base URL, serialized.

        2. +
        +
      + +
    3. Set the moduleBlock.[[HostDefined]] to urlString.

    4. +
    HostGetSupportedImportAssertions()