From 4ee44da9eb0f94bfa77001e8bcf16ede6050630e Mon Sep 17 00:00:00 2001 From: Domenic Denicola Date: Tue, 20 Nov 2018 14:46:07 -0500 Subject: [PATCH] Do not run FinishDynamicImport steps in parallel These steps do a variety of things that only make sense back on the main thread. The intention here was that fetching not block the main thread. However, that is already the case even without going in parallel, given the "async algorithm" framework of the script-fetching algorithms. (That framework is admittedly a bit unclear; see https://github.com/whatwg/infra/issues/181.) --- source | 80 +++++++++++++++++++++++++++------------------------------- 1 file changed, 37 insertions(+), 43 deletions(-) diff --git a/source b/source index 5578ad03f83..ee75ede27f7 100644 --- a/source +++ b/source @@ -88519,63 +88519,57 @@ import "https://example.com/foo/../module2.mjs";
  • Let referencing script be referencingScriptOrModule.[[HostDefined]].

  • +
  • Let url be the result of resolving a + module specifier given referencing script's base URL and specifier.

  • +
  • -

    Run the following steps in parallel:

    +

    If url is failure, then:

      -
    1. Let url be the result of resolving a - module specifier given referencing script's base URL and specifier.

    2. +
    3. Let completion be Completion { [[Type]]: throw, [[Value]]: a new + TypeError, [[Target]]: empty }.

    4. -
    5. -

      If url is failure, then:

      +
    6. Perform FinishDynamicImport(referencingScriptOrModule, + specifier, promiseCapability, completion).

    7. -
        -
      1. Let completion be Completion { [[Type]]: throw, [[Value]]: a new - TypeError, [[Target]]: empty }.

      2. - -
      3. Perform FinishDynamicImport(referencingScriptOrModule, - specifier, promiseCapability, completion).

      4. - -
      5. Return.

      6. -
      - +
    8. Return.

    9. +
    +
  • -
  • Let options be the descendant script fetch options for - referencing script's fetch - options.

  • +
  • Let options be the descendant script fetch options for + referencing script's fetch + options.

  • -
  • Fetch a module script graph given url, referencing - script's settings object, "script", and - options. Wait until the algorithm asynchronously completes with - result.

  • +
  • Fetch a module script graph given url, referencing + script's settings object, "script", and + options. Wait until the algorithm asynchronously completes with + result.

  • -
  • -

    If result is null, then:

    +
  • +

    If result is null, then:

    -
      -
    1. Let completion be Completion { [[Type]]: throw, [[Value]]: a new - TypeError, [[Target]]: empty }.

    2. +
        +
      1. Let completion be Completion { [[Type]]: throw, [[Value]]: a new + TypeError, [[Target]]: empty }.

      2. -
      3. Perform FinishDynamicImport(referencingScriptOrModule, - specifier, promiseCapability, completion).

      4. +
      5. Perform FinishDynamicImport(referencingScriptOrModule, + specifier, promiseCapability, completion).

      6. -
      7. Return.

      8. -
      - +
    3. Return.

    4. +
    +
  • -
  • Run the module script result, with - the rethrow errors boolean set to true.

  • +
  • Run the module script result, with + the rethrow errors boolean set to true.

  • -
  • If running the module script throws an exception, then perform - FinishDynamicImport(referencingScriptOrModule, specifier, - promiseCapability, the thrown exception completion).

  • +
  • If running the module script throws an exception, then perform + FinishDynamicImport(referencingScriptOrModule, specifier, + promiseCapability, the thrown exception completion).

  • -
  • Otherwise, perform - FinishDynamicImport(referencingScriptOrModule, specifier, - promiseCapability, NormalCompletion(undefined)).

  • - - +
  • Otherwise, perform + FinishDynamicImport(referencingScriptOrModule, specifier, + promiseCapability, NormalCompletion(undefined)).

  • Return undefined.