@@ -2654,6 +2654,8 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
2654
2654
sequence of Unicode scalar values</dfn></li>
2655
2655
<li><dfn data-x-href="https://heycam.github.io/webidl/#dfn-overload-resolution-algorithm">overload resolution algorithm</dfn></li>
2656
2656
<li><dfn data-x="idl-exposed" data-x-href="https://heycam.github.io/webidl/#dfn-exposed">exposed</dfn></li>
2657
+ <li><dfn data-x-href="https://heycam.github.io/webidl/#a-promise-rejected-with">a promise rejected with</dfn></li>
2658
+ <li><dfn data-x-href="https://heycam.github.io/webidl/#upon-rejection">upon rejection</dfn></li>
2657
2659
<li><dfn data-x="LegacyFactoryFunction" data-x-href="https://heycam.github.io/webidl/#LegacyFactoryFunction"><code>[LegacyFactoryFunction]</code></dfn></li>
2658
2660
<li><dfn data-x="LegacyLenientThis" data-x-href="https://heycam.github.io/webidl/#LegacyLenientThis"><code>[LegacyLenientThis]</code></dfn></li>
2659
2661
<li><dfn data-x="LegacyNullToEmptyString" data-x-href="https://heycam.github.io/webidl/#LegacyNullToEmptyString"><code>[LegacyNullToEmptyString]</code></dfn></li>
@@ -2867,6 +2869,9 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
2867
2869
2868
2870
<p>Users agents that support JavaScript must also implement <cite>ECMAScript
2869
2871
Internationalization API</cite>. <ref spec=JSINTL></p>
2872
+
2873
+ <p>User agents that support JavaScript must also implement the <cite>Top-Level Await</cite>
2874
+ proposal. <ref spec=JSTLA></p>
2870
2875
</dd>
2871
2876
2872
2877
@@ -89007,11 +89012,9 @@ document.querySelector("button").addEventListener("click", bound);
89007
89012
<h5 id="calling-scripts">Calling scripts</h5>
89008
89013
89009
89014
<p>To <dfn export>run a classic script</dfn> given a <span>classic script</span> <var>script</var>
89010
- and an optional <var>rethrow errors</var> boolean :</p>
89015
+ and an optional boolean <var>rethrow errors</var> (default false) :</p>
89011
89016
89012
89017
<ol>
89013
- <li><p>If <var>rethrow errors</var> is not given, let it be false.</p></li>
89014
-
89015
89018
<li><p>Let <var>settings</var> be the <span>settings object</span> of <var>script</var>.</p></li>
89016
89019
89017
89020
<li><p><span>Check if we can run script</span> with <var>settings</var>. If this returns "do
@@ -89088,25 +89091,23 @@ document.querySelector("button").addEventListener("click", bound);
89088
89091
</p></li>
89089
89092
</ol>
89090
89093
89091
- <p>To <dfn export>run a module script</dfn> given a <span>module script</span> <var>script</var>,
89092
- with an optional <var>rethrow errors </var> boolean :</p>
89094
+ <p>To <dfn export>run a module script</dfn> given a <span>module script</span> <var>script</var>
89095
+ and an optional boolean <var>preventErrorReporting </var> (default false) :</p>
89093
89096
89094
89097
<ol>
89095
- <li><p>If <var>rethrow errors</var> is not given, let it be false.</p></li>
89096
-
89097
89098
<li><p>Let <var>settings</var> be the <span>settings object</span> of <var>script</var>.</p></li>
89098
89099
89099
89100
<li><p><span>Check if we can run script</span> with <var>settings</var>. If this returns "do
89100
- not run" then return <span>NormalCompletion</span>(empty) .</p></li>
89101
+ not run", then return a promise resolved with undefined .</p></li>
89101
89102
89102
89103
<li><p><span>Prepare to run script</span> given <var>settings</var>.</p></li>
89103
89104
89104
- <li><p>Let <var>evaluationStatus </var> be null.</p></li>
89105
+ <li><p>Let <var>evaluationPromise </var> be null.</p></li>
89105
89106
89106
89107
<li><p>If <var>script</var>'s <span data-x="concept-script-error-to-rethrow">error to
89107
- rethrow</span> is not null, then set <var>evaluationStatus </var> to Completion { [[Type]]: throw,
89108
- [[Value]]: <var>script</var>'s <span data-x="concept-script-error-to-rethrow">error to
89109
- rethrow</span>, [[Target]]: empty } .</p></li>
89108
+ rethrow</span> is not null, then set <var>evaluationPromise </var> to <span>a promise rejected
89109
+ with</span> <var>script</var>'s <span data-x="concept-script-error-to-rethrow">error to
89110
+ rethrow</span>.</p></li>
89110
89111
89111
89112
<li>
89112
89113
<p>Otherwise:</p>
@@ -89116,35 +89117,26 @@ document.querySelector("button").addEventListener("click", bound);
89116
89117
data-x="concept-script-record">record</span>.</p>
89117
89118
89118
89119
<li>
89119
- <p>Set <var>evaluationStatus </var> to <var>record</var>.<span
89120
+ <p>Set <var>evaluationPromise </var> to <var>record</var>.<span
89120
89121
data-x="js-Evaluate">Evaluate</span>().</p>
89121
89122
89122
89123
<p class="note">This step will recursively evaluate all of the module's dependencies.</p>
89123
89124
89124
89125
<p>If <span data-x="js-Evaluate">Evaluate</span> fails to complete as a result of the user agent
89125
89126
<span data-x="abort a running script">aborting the running script</span>, then set
89126
- <var>evaluationStatus</var> to Completion { [[Type]]: throw, [[Value]]: a new
89127
- <span>"<code>QuotaExceededError</code>"</span> <code>DOMException</code>, [[Target]]: empty
89128
- }.</p>
89127
+ <var>evaluationPromise</var> to <span>a promise rejected with</span> a new
89128
+ <span>"<code>QuotaExceededError</code>"</span> <code>DOMException</code>.</p>
89129
89129
</li>
89130
89130
</ol>
89131
89131
</li>
89132
89132
89133
- <li>
89134
- <p>If <var>evaluationStatus</var> is an <span>abrupt completion</span>, then:</p>
89135
-
89136
- <ol>
89137
- <li><p>If <var>rethrow errors</var> is true, rethrow the exception given by
89138
- <var>evaluationStatus</var>.[[Value]].</p></li>
89139
-
89140
- <li><p>Otherwise, <span>report the exception</span> given by
89141
- <var>evaluationStatus</var>.[[Value]] for <var>script</var>.</p></li>
89142
- </ol>
89143
- </li>
89133
+ <li><p>If <var>preventErrorReporting</var> is false, then <span>upon rejection</span> of
89134
+ <var>evaluationPromise</var> with <var>reason</var>, <span>report the exception</span> given by
89135
+ <var>reason</var> for <var>script</var>.</p></li>
89144
89136
89145
89137
<li><p><span>Clean up after running script</span> with <var>settings</var>.</p></li>
89146
89138
89147
- <li><p>Return <var>evaluationStatus </var>.</p></li>
89139
+ <li><p>Return <var>evaluationPromise </var>.</p></li>
89148
89140
</ol>
89149
89141
89150
89142
<p>The steps to <dfn>check if we can run script</dfn> with an <span>environment settings
@@ -89912,30 +89904,16 @@ import "https://example.com/foo/../module2.mjs";</code></pre>
89912
89904
URL</var>, <var>settings object</var>, and <var>fetch options</var>. Wait until the algorithm
89913
89905
asynchronously completes with <var>result</var>.</p></li>
89914
89906
89915
- <li>
89916
- <p>If <var>result</var> is null, then:</p>
89917
-
89918
- <ol>
89919
- <li><p>Let <var>completion</var> be Completion { [[Type]]: throw, [[Value]]: a new
89920
- <code>TypeError</code>, [[Target]]: empty }.</p></li>
89921
-
89922
- <li><p>Perform <span>FinishDynamicImport</span>(<var>referencingScriptOrModule</var>,
89923
- <var>specifier</var>, <var>promiseCapability</var>, <var>completion</var>).</p></li>
89907
+ <li><p>Let <var>promise</var> be null.
89924
89908
89925
- <li><p>Return.</p></li>
89926
- </ol>
89927
- </li>
89928
-
89929
- <li><p><span data-x="run a module script">Run the module script</span> <var>result</var>, with
89930
- the rethrow errors boolean set to true.</p></li>
89909
+ <li><p>If <var>result</var> is null, then set <var>promise</var> to <span>a promise rejected
89910
+ with</span> a new <code>TypeError</code>.</p></li>
89931
89911
89932
- <li><p>If running the module script throws an exception, then perform
89933
- <span>FinishDynamicImport</span>(<var>referencingScriptOrModule</var>, <var>specifier</var>,
89934
- <var>promiseCapability</var>, the thrown exception completion).</p></li>
89912
+ <li><p>Otherwise, set <var>promise</var> to the result of <span data-x="run a module
89913
+ script">running a module script</span> given <var>result</var> and true.</p></li>
89935
89914
89936
- <li><p>Otherwise, perform
89937
- <span>FinishDynamicImport</span>(<var>referencingScriptOrModule</var>, <var>specifier</var>,
89938
- <var>promiseCapability</var>, <span>NormalCompletion</span>(undefined)).</p></li>
89915
+ <li><p>Perform <span>FinishDynamicImport</span>(<var>referencingScriptOrModule</var>,
89916
+ <var>specifier</var>, <var>promiseCapability</var>, <var>promise</var>).</p></li>
89939
89917
89940
89918
<li><p>Return undefined.</p></li>
89941
89919
</ol>
@@ -122588,6 +122566,9 @@ INSERT INTERFACES HERE
122588
122566
<dt id="refsJSINTL">[JSINTL]</dt>
122589
122567
<dd><cite><a href="https://tc39.es/ecma402/">ECMAScript Internationalization API Specification</a></cite>. Ecma International.</dd>
122590
122568
122569
+ <dt id="refsJSTLA">[JSTLA]</dt>
122570
+ <dd><cite><a href="https://tc39.es/proposal-top-level-await/">Top-Level Await</a></cite>. Ecma International.</dd>
122571
+
122591
122572
<dt id="refsJSON">[JSON]</dt>
122592
122573
<dd><cite><a href="https://tools.ietf.org/html/rfc7159">The JavaScript Object Notation (JSON) Data Interchange Format</a></cite>, T. Bray. IETF.</dd>
122593
122574
0 commit comments