Debugger.Source.text is reporting "[no source]" for worker modules loaded via ChromeUtils helpers
Categories
(Core :: JavaScript Engine, task, P3)
Tracking
()
Tracking | Status | |
---|---|---|
firefox131 | --- | fixed |
People
(Reporter: ochameau, Assigned: arai)
References
(Blocks 1 open bug)
Details
Attachments
(2 files)
Debugger's Source text
attribute is returning "[no source]" for worker modules loaded via ChromeUtils.importESModule/defineESModuleGetters, at least when using { global: "current" }
argument.
Note that it works fine when loading the modules via static imports.
I'll provide a mochitest.
Reporter | ||
Comment 1•2 months ago
|
||
Comment 2•2 months ago
|
||
Perhaps something to put on your backlog?
Comment 3•2 months ago
|
||
I recall something like that being made on purpose, as we expected that none of Firefox functions should rely on the source, with no consideration for debugging. However I would have expected it to be the same independently of workers.
Arai, Yulia, Ted, any insight into what might be happening here?
Assignee | ||
Comment 4•2 months ago
|
||
(In reply to Nicolas B. Pierron [:nbp] from comment #3)
I recall something like that being made on purpose, as we expected that none of Firefox functions should rely on the source, with no consideration for debugging. However I would have expected it to be the same independently of workers.
For system principal, we had been discarding the source, but it doesn't apply here.
What happening here is that the the source is marked "retrievable", but the runtime doesn't have the source hook:
class ScriptSource::LoadSourceMatcher {
...
template <typename Unit>
bool operator()(const Retrievable<Unit>&) {
if (!cx_->runtime()->sourceHook.ref()) {
*loaded_ = false;
This is caused by setSourceIsLazy
, which expects the runtime to have the XPCJSSourceHook
, but the worker runtime doesn't have it.
nsresult mozJSModuleLoader::LoadSingleModuleScriptOnWorker(
SyncModuleLoader* aModuleLoader, JSContext* aCx,
JS::loader::ModuleLoadRequest* aRequest, MutableHandleScript aScriptOut) {
...
CompileOptions options(aCx);
ScriptPreloader::FillCompileOptionsForCachedStencil(options);
void ScriptPreloader::FillCompileOptionsForCachedStencil(
JS::CompileOptions& options) {
...
options.setSourceIsLazy(true);
mozilla::UniquePtr<XPCJSSourceHook> hook(new XPCJSSourceHook);
js::SetSourceHook(cx, std::move(hook));
So the solution would be to skip the setSourceIsLazy
for worker case.
Assignee | ||
Updated•2 months ago
|
Updated•2 months ago
|
Assignee | ||
Comment 5•2 months ago
|
||
Description
•