Skip to content

Normative: Do not read from empty [[CycleRoot]] in GatherAvailableAncestors#3769

Open
nicolo-ribaudo wants to merge 2 commits into
tc39:mainfrom
nicolo-ribaudo:empty-cycle-root
Open

Normative: Do not read from empty [[CycleRoot]] in GatherAvailableAncestors#3769
nicolo-ribaudo wants to merge 2 commits into
tc39:mainfrom
nicolo-ribaudo:empty-cycle-root

Conversation

@nicolo-ribaudo
Copy link
Copy Markdown
Member

Fixes #3766. See #3766 (comment) for a more detailed analysis.

Marking this as normative as we did for #3583, but (same as for that PR) this is aligning the spec with the commitee's desired behavior and thus does not need explicit consensus.

I checked V8's ans SM's implementations after writing this patch, and it seems like SM does exactly what this spec change does. V8 has a different but equivalent approach (it checks that the [[CycleRoot]] is not empty, and asserts that it being empty implies that the module errored, cc @o-).

cc @heimskr for your WebKit module loader rewrite.

@nicolo-ribaudo nicolo-ribaudo added normative change Affects behavior required to correctly evaluate some ECMAScript source text spec bug labels Mar 18, 2026
@github-actions
Copy link
Copy Markdown

The rendered spec for this PR is available as a single page at https://tc39.es/ecma262/pr/3769 and as multiple pages at https://tc39.es/ecma262/pr/3769/multipage .

Comment thread spec.html Outdated
@nickie
Copy link
Copy Markdown

nickie commented May 7, 2026

For what it's worth, this spec change is indeed equivalent to my fix in V8.

@nicolo-ribaudo nicolo-ribaudo added editor call to be discussed in the next editor call and removed editor call to be discussed in the next editor call labels May 7, 2026
Copy link
Copy Markdown
Member

@linusg linusg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might want to make sure there's a test that catches this, otherwise LGTM.

Copy link
Copy Markdown
Contributor

@guybedford guybedford left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Read through carefully and I agree this correctly distinguishes early sync errors from the cycle root error handling.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

normative change Affects behavior required to correctly evaluate some ECMAScript source text spec bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

m.[[CycleRoot]] can be null in GatherAvailableAncestors

5 participants