Closed Bug 1779878 Opened 2 years ago Closed 2 years ago

Bug in ModuleBuilderInitArray causes asserts from the previous import to be applied to the current import

Categories

(Core :: JavaScript Engine, defect, P1)

defect

Tracking

()

RESOLVED FIXED
104 Branch
Tracking Status
firefox-esr91 --- unaffected
firefox-esr102 --- disabled
firefox102 --- disabled
firefox103 --- disabled
firefox104 --- fixed

People

(Reporter: jon4t4n, Assigned: jon4t4n)

References

(Blocks 1 open bug, Regression)

Details

(Keywords: regression)

Attachments

(1 file)

The assertionArray variable is declared outside the loop (See ModuleBuilderInitArray), but we never reset the value inside the loop. Hence, we reuse the previous value if the current entry has no assertions.

This bug can be observed by having two imports. One import with an assert and the other import without an assert.

Working example:

import a from 'foo.js';
import b from 'bar.json' assert { type: 'json' };

If we now re-order the imports, the bug will appear:

import b from 'bar.json' assert { type: 'json' };
import a from 'foo.js';
Regressed by: 1736060

We need to reset the assertionArray variable if the current entry has no
assertions. Otherwise, the ModuleRequestObject will be created with the
assertions of the previous import.

Assignee: nobody → jonatan.r.klemets
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true

Set release status flags based on info from the regressing bug 1736060

Blocks: 1736059
Severity: -- → S3
Priority: -- → P1
Pushed by mgaudet@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/c4bfb83234c2
Reset assertionArray inside the loop of ModuleBuilderInitArray r=mgaudet
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 104 Branch

Is there a user-facing impact for this bug which would warrant ESR102 uplift consideration? Please nominate if so.

Flags: needinfo?(mgaudet)
Flags: in-testsuite+

No, import assertions are not, and will not be, enabled on 102. So this need not be uplifted.

Flags: needinfo?(mgaudet)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: