From 57372821cacdb1cdefdcaf8278c2f4159cd4e320 Mon Sep 17 00:00:00 2001
From: Domenic Denicola
A JavaScript value, which has meaning only if the record is null, indicating that the corresponding script + source text could not be parsed.
A JavaScript value representing an error that will prevent evaluation from succeeding. It will be re-thrown by any attempts to run the script.
There are two main categories of such errors: errors parsing the script's source - text, in which case the script's record will - be null; or more general errors in dependencies of a module script. This - distinction is used by the algorithm for finding the first parse error.
+ text (equal to the script's parse error), or + more general errors in dependencies of a module script.Since this exception value is provided by the JavaScript specification, we know that it is never null, so we use null to signal that no error has occurred.
@@ -86965,11 +86972,7 @@ interface NavigatorOnLine {Let parse error be the result of finding the first parse error given result.
If parse error is not null, then set result's error to parse error.
Otherwise:
+If parse error is null, then:
Let record be result's NavigatorOnLine {
Perform record.Instantiate(). This step will recursively call Instantiate
- on all of the module's uninstantiated dependencies. This step will recursively call Instantiate on all of the module's uninstantiated
+ dependencies. If this throws an exception, set result's error to that exception.
Otherwise, set result's error to + rethrow to parse error.
Asynchronously complete this algorithm with result.
Append moduleScript to discoveredSet.
If moduleScript's record is null, - then return moduleScript's error.
- -It's important that we check if moduleScript's record is null, and not simply check that - moduleScript's error is non-null. This - ensures we only catch errors from parsing moduleScript, and not instantiation errors - or errors from parsing its dependencies that were stored in the error field for later re-throwing.
-If moduleScript's record is null, + then return moduleScript's parse + error.
Let childSpecifiers be the value of moduleScript's record's [[RequestedModules]] internal slot.
Set script's muted errors to muted errors.
Set script's parse error and + error to rethrow to null.
Let result be ParseScript(source, settings's Realm, @@ -87078,11 +87080,12 @@ interface NavigatorOnLine { result.[[HostDefined]] will be script.
If result is a List of errors, then set script's error to result[0].
If result is a list of errors, then set script's parse error and its error to rethrow to result[0].
Otherwise, set script's record to - result and its error to null.
Return script.
Set script's settings object to settings.
Set script's parse error and + error to rethrow to null.
Let result be ParseModule(source, settings's Realm, @@ -87115,10 +87121,11 @@ interface NavigatorOnLine {
If result is a List of errors, then:
+If result is a list of errors, then:
Set script's error to +
Set script's parse error and + its error to rethrow to result[0].
Return script.
Let error be a new TypeError
exception.
Set script's error to +
Set script's parse error + and its error to rethrow to error.
Return script.
Set script's record to result.
Set script's error to null.
Set script's base URL to baseURL.
Let evaluationStatus be null.
If script's error is not - null, then set evaluationStatus to Completion { [[Type]]: throw, [[Value]]: - script's error, [[Target]]: empty - }.
If script's error to + rethrow is not null, then set evaluationStatus to Completion { [[Type]]: throw, + [[Value]]: script's error to + rethrow, [[Target]]: empty }.
Otherwise, set evaluationStatus to NavigatorOnLine {
Let evaluationStatus be null. If script's error is not
- null, then set evaluationStatus to Completion { [[Type]]: throw, [[Value]]:
- script's error, [[Target]]: empty
- }. If script's error to
+ rethrow is not null, then set evaluationStatus to Completion { [[Type]]: throw,
+ [[Value]]: script's error to
+ rethrow, [[Target]]: empty }. Otherwise: