Skip to content

Commit

Permalink
Provide standalone ParseScript wrapper
Browse files Browse the repository at this point in the history
For use by whatwg/fetch#1442.
  • Loading branch information
annevk committed May 31, 2022
1 parent 6712444 commit 4c05baf
Showing 1 changed file with 22 additions and 8 deletions.
30 changes: 22 additions & 8 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -94269,14 +94269,8 @@ document.querySelector("button").addEventListener("click", bound);
<li><p>Set <var>script</var>'s <span data-x="concept-script-parse-error">parse error</span> and
<span data-x="concept-script-error-to-rethrow">error to rethrow</span> to null.</p></li>

<li>
<p>Let <var>result</var> be <span data-x="js-ParseScript">ParseScript</span>(<var>source</var>,
<var>settings</var>'s <span data-x="environment settings object's Realm">Realm</span>,
<var>script</var>).</p>

<p class="note">Passing <var>script</var> as the last parameter here ensures
<var>result</var>.[[HostDefined]] will be <var>script</var>.</p>
</li>
<li><p>Let <var>result</var> be the result of <span>parsing a classic script</span> given
<var>source</var> and <var>script</var>.</p></li>

<li>
<p>If <var>result</var> is a <span>list</span> of errors, then:
Expand All @@ -94296,6 +94290,26 @@ document.querySelector("button").addEventListener("click", bound);
<li><p>Return <var>script</var>.</p></li>
</ol>

<p>To <dfn export data-x="parsing a classic script">parse a classic script</dfn>, given a
<span>string</span> <var>source</var> and an optional <span>classic script</span>
<var>script</var>:</p>

<ol>
<li><p>Let <var>realm</var> be undefined.</p></li>

<li><p>Let <var>hostDefined</var> be empty.</p></li>

<li><p>If <var>script</var> is given, then set <var>realm</var> to <var>script</var>'s
<span>settings object</span>'s <span data-x="environment settings object's Realm">Realm</span>
and <var>hostDefined</var> to <var>script</var>.</p></li>

<li><p>Return <span data-x="js-ParseScript">ParseScript</span>(<var>source</var>,
<var>realm</var>, <var>hostDefined</var>).</p></li>
</ol>

<p class="note"><cite>Fetch</cite> uses <span>parsing a classic script</span> as part of
opaque-response blocking. <ref spec=FETCH></p>

<p>To <dfn data-x="creating a JavaScript module script">create a JavaScript module script</dfn>,
given a <span>string</span> <var>source</var>, an <span>environment settings
object</span> <var>settings</var>, a <span>URL</span> <var>baseURL</var>, and some <span>script
Expand Down

0 comments on commit 4c05baf

Please sign in to comment.