Open Bug 1223846 Opened 9 years ago Updated 2 years ago

Fuzz ES6 modules

Categories

(Core :: JavaScript Engine, defect)

defect

Tracking

()

People

(Reporter: jonco, Unassigned)

References

(Blocks 1 open bug)

Details

This bug is to request fuzzing of ES6 modules, which are now available (minus a full module loader) in the shell.

To run a script as a module, use the -m/--module option rather than -f/--file option, passing the script filename.

It would be useful to test that executing standard JS code as a module doesn't cause anything to blow up.

Even better would be to exercise imports/exports between modules, but that would be more difficult and require some awareness in the fuzzers to create a coherent (or incoherent) set of modules to test.
Flags: needinfo?(gary)
Flags: needinfo?(choller)
Flags: needinfo?(jruderman)
Can this be tested somehow from within the JS shell, rather than using -m? LangFuzz does not load files using -f but using load() inside a driver that is loaded with -f instead. Can we somehow load/evaluate as a module? Support in evaluate() would be sufficient and actually more useful than loading a file directly (since it helps reduction to be able to inline the code).
Flags: needinfo?(choller) → needinfo?(jcoppeard)
Yes, the shell function parseModule() parses source text as a module and returns a module object.
Flags: needinfo?(jcoppeard)
(In reply to Jon Coppeard (:jonco) from comment #2)
Actually there is a bit more to it that.  To get the full effect of loading a module you will need to call declarationInstantation() and then evaluation() on the module object returned from parseModule(), e.g. like in this test code:

https://dxr.mozilla.org/mozilla-central/source/js/src/jit-test/tests/modules/import-namespace.js#15
Jesse would be a better person to move this forward, but we are likely packed with stuff till at least the end of the quarter.
Flags: needinfo?(gary)
Depends on: 1233158
Depends on: 1233117
Depends on: 1198673
Depends on: 1233179
Flags: needinfo?(jruderman)
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.