Modules sometimes don't have filenames
Categories
(Core :: JavaScript Engine, task)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox125 | --- | fixed |
People
(Reporter: jonco, Assigned: jonco)
References
Details
Attachments
(1 external file)
It would be helpful for error reporting if we could assume that all modules have a filename.
The filename comes from the script source associated with the script source object associated with the module's script. This is usually set from the CompileOptions supplied when compiling the script.
Adding an assert in ModuleObject::initScriptSlots shows that the filename is not always present.
| Assignee | ||
Comment 1•2 years ago
|
||
| Assignee | ||
Comment 2•2 years ago
|
||
The above patch sets a default filename in the compile options in a couple of places in the shell where we create modules and then asserts that a filename is present during module initialisation.
This passes browser module tests but fails some shell tests:
parser/compile-script.js
parser/stencil-laziness-validate.js
xdr/module-exports.js
xdr/module-imports.js
xdr/module-oom.js
xdr/module.js
Looking at the parser/compile-script.js failure it seems that InstantiateModuleStencil has input containing the filename but this is not transferred to the module created by CompilationStencil::instantiateStencils.
arai would you know what's going on here?
Comment 3•2 years ago
|
||
The filename is set during compilation.
The JS::CompileOptions created inside InstantiateModuleStencil is used as JS::InstantiateOptions, which is very small subset of JS::CompileOptions.
If module needs filename, it should be set while compilation:
OffThreadCompileModuleToStencil already sets the filename, so this doesn't need fix I think.
Updated•2 years ago
|
Comment 5•2 years ago
|
||
| bugherder | ||
Description
•