Skip to content

Commit

Permalink
Revert "Rebase on top of the current TLA draft"
Browse files Browse the repository at this point in the history
This reverts commit 8415c83.

tc39/proposal-top-level-await#74 restores the
property of Evaluate() that it always returns a Promise, saving some
complexity in HTML.
  • Loading branch information
littledan committed May 19, 2019
1 parent 2204867 commit 4ed3b12
Showing 1 changed file with 40 additions and 61 deletions.
101 changes: 40 additions & 61 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -3058,7 +3058,6 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
<li>The <dfn data-x-href="https://tc39.github.io/ecma262/#sec-isconstructor">IsConstructor</dfn> abstract operation</li>
<li>The <dfn data-x-href="https://tc39.github.io/ecma262/#sec-isdatadescriptor">IsDataDescriptor</dfn> abstract operation</li>
<li>The <dfn data-x-href="https://tc39.github.io/ecma262/#sec-isdetachedbuffer">IsDetachedBuffer</dfn> abstract operation</li>
<li>The <dfn data-x-href="https://tc39.github.io/ecma262/#sec-ispromise">IsPromise</dfn> abstract operation</li>
<li>The <dfn data-x-href="https://tc39.github.io/ecma262/#sec-issharedarraybuffer">IsSharedArrayBuffer</dfn> abstract operation</li>
<li>The <dfn data-x="js-NewObjectEnvironment" data-x-href="https://tc39.github.io/ecma262/#sec-newobjectenvironment">NewObjectEnvironment</dfn> abstract operation</li>
<li>The <dfn data-x-href="https://tc39.github.io/ecma262/#sec-normalcompletion">NormalCompletion</dfn> abstract operation</li>
Expand Down Expand Up @@ -3118,9 +3117,12 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
<p>User agents that support JavaScript must also implement the <cite>BigInt</cite> proposal. <ref
spec=JSBIGINT></p>

<p>User agents that support JavaScript must also implement the <cite>top-level await</cite>
proposal: <ref spec=JSTLA></p>
<p>User agents that support JavaScript must also implement the <cite>top-level await</cite> proposal.
The following terms are defined there, and used in this specification: <ref spec=JSTLA></p>

<ul class="brief">
<li><dfn data-x="js-FlushJobs" data-x-href="https://tc39.github.io/proposal-top-level-await/#sec-flushjobs"><code>FlushJobs</code></dfn></li>
</ul>
</dd>


Expand Down Expand Up @@ -88621,12 +88623,9 @@ interface <dfn>ApplicationCache</dfn> : <span>EventTarget</span> {

<li><p><span>Prepare to run script</span> given <var>settings</var>.</p></li>

<li><p>Let <var>evaluationStatus</var> be null.</p></li>

<li><p>If <var>script</var>'s <span data-x="concept-script-error-to-rethrow">error to
rethrow</span> is not null, then set <var>evaluationStatus</var> to Completion { [[Type]]: throw,
[[Value]]: <var>script</var>'s <span data-x="concept-script-error-to-rethrow">error to
rethrow</span>, [[Target]]: empty }.</p></li>
rethrow</span> is not null, then let <var>evaluationPromise</var> be a promise rejected with <var>script</var>'s <span data-x="concept-script-error-to-rethrow">error to
rethrow</span>.</p></li>

<li>
<p>Otherwise:</p>
Expand All @@ -88636,44 +88635,26 @@ interface <dfn>ApplicationCache</dfn> : <span>EventTarget</span> {
data-x="concept-script-record">record</span>.</p>

<li>
<p>Set <var>evaluationStatus</var> to <var>record</var>.<span
<p>Let <var>evaluationPromise</var> be <var>record</var>.<span
data-x="js-Evaluate">Evaluate</span>().</p>

<p class="note">This step will recursively evaluate all of the module's dependencies.</p>

<p>If <span data-x="js-Evaluate">Evaluate</span> fails to complete as a result of the user agent
<span data-x="abort a running script">aborting the running script</span>, then set
<var>evaluationStatus</var> to Completion { [[Type]]: throw, [[Value]]: a new
<span>"<code>QuotaExceededError</code>"</span> <code>DOMException</code>, [[Target]]: empty
}.</p>
<span data-x="abort a running script">aborting the running script</span>, then let
<var>evaluationPromise</var> be a promise rejected with a new
<span>"<code>QuotaExceededError</code>"</span> <code>DOMException</code>.</p>
</li>
</ol>
</li>

<li>
<p>If <var>evaluationStatus</var> is an <span>abrupt completion</span>, then:</p>

<ol>
<li><p>If <var>rethrow errors</var> is true, rethrow the exception given by
<var>evaluationStatus</var>.[[Value]].</p></li>

<li><p>Otherwise, <span>report the exception</span> given by
<li><p>If <var>rethrow errors</var> is false, then upon rejection of
<var>evaluationPromise</var>, <span>report the exception</span> given by
<var>evaluationStatus</var>.[[Value]] for <var>script</var>.</p></li>
</ol>
</li>

<li>
<p>If <span>IsPromise</span>(<var>evaluationStatus</var>) is true, then:</p>

<ol>
<li><p>Upon rejection of <var>evaluationStatus</var> with <var>reason</var>,
<span>report the exception</span> given by <var>reason</var> for <var>script</var>.</p></li>
</ol>
</li>

<li><p><span>Clean up after running script</span> with <var>settings</var>.</p></li>

<li><p>Return <var>evaluationStatus</var>.</p></li>
<li><p>Return <var>evaluationPromise</var>.</p></li>
</ol>

<p>The steps to <dfn>check if we can run script</dfn> with an <span>environment settings
Expand Down Expand Up @@ -89454,6 +89435,24 @@ document.querySelector("button").addEventListener("click", bound);
</li>
</ol>

<h6><dfn>FlushJobs</dfn>()</h6>

<p>When the JavaScript specification says to call the FlushJobs abstract operation, the
following algorithm must be used in place of JavaScript's <span
data-x="js-FlushJobs">FlushJobs</span>:</p>

<ol>
<li><p>Assert: the <span>JavaScript execution context stack</span> is empty</p></li>

<li>
<p><span>Perform a microtask checkpoint</span>.</p>

<p class="&#x0058;&#x0058;&#x0058;">Rather than simply a microtask checkpoint,
this algorithm may yield to the event loop before continuing; see discussion in <a
href="https://github.com/whatwg/html/issues/4400">issue #4400</a>.</p>
</li>

</ol>
</div>

<h5>Integration with the JavaScript module system</h5>
Expand Down Expand Up @@ -89730,11 +89729,10 @@ import "https://example.com/foo/../module2.mjs";</code></pre>
<p>If <var>url</var> is failure, then:</p>

<ol>
<li><p>Let <var>completion</var> be Completion { [[Type]]: throw, [[Value]]: a new
<code>TypeError</code>, [[Target]]: empty }.</p></li>
<li><p>Let <var>promise</var> be a promise rejected with a new <code>TypeError</code>.</p></li>

<li><p>Perform <span>FinishDynamicImport</span>(<var>referencingScriptOrModule</var>,
<var>specifier</var>, <var>promiseCapability</var>, <var>completion</var>).</p></li>
<var>specifier</var>, <var>promiseCapability</var>, <var>promise</var>).</p></li>

<li><p>Return.</p></li>
</ol>
Expand All @@ -89748,42 +89746,23 @@ import "https://example.com/foo/../module2.mjs";</code></pre>
<p>If <var>result</var> is null, then:</p>

<ol>
<li><p>Let <var>completion</var> be Completion { [[Type]]: throw, [[Value]]: a new
<code>TypeError</code>, [[Target]]: empty }.</p></li>
<li><p>Let <var>promise</var> be a promise rejected with a new <code>TypeError</code>.</p></li>

<li><p>Perform <span>FinishDynamicImport</span>(<var>referencingScriptOrModule</var>,
<var>specifier</var>, <var>promiseCapability</var>, <var>completion</var>).</p></li>
<var>specifier</var>, <var>promiseCapability</var>, <var>promise</var>).</p></li>

<li><p>Return.</p></li>
</ol>
</li>

<li><p><span data-x="run a module script">Run the module script</span> <var>result</var>, with
the rethrow errors boolean set to true, and let the result be <var>status</var>.</p></li>
the rethrow errors boolean set to true, and let the result be <var>promise</var>.</p></li>

<li><p>If running the module script throws an exception, then perform
<li><p>Perform
<span>FinishDynamicImport</span>(<var>referencingScriptOrModule</var>, <var>specifier</var>,
<var>promiseCapability</var>, the thrown exception completion).</p></li>
<var>promiseCapability</var>, <var>promise</var>).</p></li>

<li>
<p>If <span>IsPromise</span>(<var>status</var>) is true, then:</p>

<ol>
<li>Upon fulfillment of <var>status</var> with <var>value</var>, perform
<span>FinishDynamicImport</span>(<var>referencingScriptOrModule</var>, <var>specifier</var>,
<var>promiseCapability</var>, <var>value</var>).</li>

<li>Upon rejection of <var>status</var> with <var>reason</var>, perform
<span>FinishDynamicImport</span>(<var>referencingScriptOrModule</var>, <var>specifier</var>,
<var>promiseCapability</var>, Completion{ [[Type]]: throw, [[Value]]: <var>reason</var> }).</li>
</ol>
</li>

<li><p>Otherwise, perform
<span>FinishDynamicImport</span>(<var>referencingScriptOrModule</var>, <var>specifier</var>,
<var>promiseCapability</var>, <span>NormalCompletion</span>(undefined)).</p></li>

<li><p>Return undefined.</p></li>
<li><p>Return.</p></li>
</ol>

<h6
Expand Down

0 comments on commit 4ed3b12

Please sign in to comment.