Closed Bug 1777972 Opened 2 years ago Closed 2 years ago

Add evaluating-async module state to match the spec

Categories

(Core :: JavaScript Engine, task, P3)

task

Tracking

()

RESOLVED FIXED
104 Branch
Tracking Status
firefox104 --- fixed

People

(Reporter: jonco, Assigned: jonco)

References

()

Details

Attachments

(3 files)

Top level await added this new module state to the spec. It is purely editorial and has no function impact but it would be helpful to have it to make it clearer that our implementation matches the spec.

Severity: -- → N/A
Depends on: 1519100
Priority: -- → P3

I originally thought adding an extra status would allow for stronger assertions
but now I think it has made state checks more verbose and harder to compare
with the spec.

This patch makes ModuleObject::status return ModuleStatus::Evaluated when the
status is Evaluated_Error so that this method matches the spec's concept of the
value of the ModuleStatus field.

This turned up one place where we diverge from the spec. In ModuleEvaluate step
3 we don't get the cycle root if we are in the error state. This is currently
required otherwise some tests fail. This patch preserves the current behvaiour,
which is now explicit.

Assignee: nobody → jcoppeard
Status: NEW → ASSIGNED

This adds ModuleStatus::EvaluatingAsync, splitting it off from
ModuleStatus::Evaluated. This allows us to rewrite parts of the code to be
closer to the spec.

Depends on D151506

This refactors the extra check to make it clearer what's going on and adds a
simple test case for the issue.

Depends on D151507

Pushed by jcoppeard@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/a3211c84154b
Part 1: Hide Evaluated_Error module state r=yulia
https://hg.mozilla.org/integration/autoland/rev/8580c5c39eec
Part 2: Add evaluating-async module status r=yulia
https://hg.mozilla.org/integration/autoland/rev/2517efe4191b
Part 3: Refactor extra error check at the start of ModuleEvaluate r=yulia

(In reply to Jon Coppeard (:jonco) from comment #1)

This turned up one place where we diverge from the spec. In ModuleEvaluate step
3 we don't get the cycle root if we are in the error state. This is currently
required otherwise some tests fail. This patch preserves the current behvaiour,
which is now explicit.

I've filed a spec issue about this: https://github.com/tc39/ecma262/issues/2823

Flags: needinfo?(jcoppeard)
Pushed by jcoppeard@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/23e793db636d
Part 1: Hide Evaluated_Error module state r=yulia
https://hg.mozilla.org/integration/autoland/rev/2e18ce531c64
Part 2: Add evaluating-async module status r=yulia
https://hg.mozilla.org/integration/autoland/rev/17cdb35dc893
Part 3: Refactor extra error check at the start of ModuleEvaluate r=yulia
Blocks: 1779247
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 104 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: