Closed Bug 1965620 Opened 1 year ago Closed 1 year ago

JSON Import Crash

Categories

(Core :: JavaScript Engine, defect)

Firefox 138
defect

Tracking

()

RESOLVED FIXED
140 Branch
Tracking Status
firefox-esr128 --- unaffected
firefox138 --- wontfix
firefox139 --- fixed
firefox140 --- fixed

People

(Reporter: guybedford, Assigned: jon4t4n)

References

(Regression)

Details

(Keywords: crash, regression)

Crash Data

Attachments

(2 files)

Steps to reproduce:

Import the following module in Firefox:

main.js

import { m } from './dep.js';
console.log(m);

dep.js

import json from './json.json' with { type: 'json' }
export { json as m }

Actual results:

The browser window crashes. Note that adding any execution lines into the dep.js avoids the issue, eg:

import json from './json.json' with { type: 'json' }
let p;
export { json as m }

Expected results:

This should not crash

Component: General → JavaScript Engine

Correction to the workaround above, is to write:

import json from './json.json' with { type: 'json' };
let foo = json;
export { foo as m }

Confirmed.

Bisection nightly:

Bisection with javascript.options.experimental.import_attributes = True

Blocks: 1950836
Status: UNCONFIRMED → NEW
Crash Signature: [@ mozilla::Vector<T>::begin | JS::GCVector<T>::begin ]
Ever confirmed: true
Keywords: crash, regression
Regressed by: 1877792

just open the HTML file directly in the browser, or save locally and directly open.

AR: Crash

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

:jon4t4n, since you are the author of the regressor, bug 1877792, could you take a look?

For more information, please visit BugBot documentation.

Flags: needinfo?(jonatan.r.klemets)

I think the problem is that we end up calling CyclicModuleResolveExport, but we need to check the module type and call SyntheticModuleResolveExport. If we refactor the code to call ModuleResolveExport then this is automatically handled.

Try run with a quick fix: https://treeherder.mozilla.org/jobs?repo=try&revision=9580b106a21a8708f2fbe4e4dbe4e495d5d81da7

Indirect export entries can contain synthetic modules, so we need to
check the type and call the correct method for resolving exports.

Assignee: nobody → jonatan.r.klemets
Status: NEW → ASSIGNED
Flags: needinfo?(jonatan.r.klemets)
Pushed by jonatan.r.klemets@gmail.com: https://hg.mozilla.org/integration/autoland/rev/30d174015838 Fix synthetic module handling in CyclicModuleResolveExport r=spidermonkey-reviewers,jonco
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 140 Branch

The patch landed in nightly and beta is affected.
:jon4t4n, is this bug important enough to require an uplift?

For more information, please visit BugBot documentation.

Flags: needinfo?(jonatan.r.klemets)
Flags: needinfo?(jcoppeard)

Comment on attachment 9486753 [details]
Bug 1965620 - Fix synthetic module handling in CyclicModuleResolveExport r=#spidermonkey-reviewers

Beta/Release Uplift Approval Request

  • User impact if declined/Reason for urgency: Possible crashes when sites use JSON modules.
  • Is this code covered by automated tests?: Yes
  • Has the fix been verified in Nightly?: Yes
  • Needs manual test from QE?: No
  • If yes, steps to reproduce:
  • List of other uplifts needed: None
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): This is a simple fix and has been on central for a week.
  • String changes made/needed: None
  • Is Android affected?: Yes
Flags: needinfo?(jcoppeard)
Attachment #9486753 - Flags: approval-mozilla-beta?
Flags: needinfo?(jonatan.r.klemets)
Attachment #9486753 - Flags: approval-mozilla-beta? → approval-mozilla-release?

Comment on attachment 9486753 [details]
Bug 1965620 - Fix synthetic module handling in CyclicModuleResolveExport r=#spidermonkey-reviewers

Approved for 139.0rc2.

Attachment #9486753 - Flags: approval-mozilla-release? → approval-mozilla-release+
No longer blocks: 1950836
Depends on: 1950836
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: