Getting `InternalError: module record has unexpected status` during synchronous XMLHttpRequests
Categories
(Core :: JavaScript Engine, defect, P2)
Tracking
()
Tracking | Status | |
---|---|---|
firefox106 | --- | fixed |
People
(Reporter: twisniewski, Assigned: jonco)
References
(Blocks 1 open bug, )
Details
Attachments
(2 files)
When navigating between the tabs at the top-left on https://anjunar.github.io/simplicity/expert/meta/overview, the console will sometimes show this stack trace:
Uncaught (in promise) InternalError: module record has unexpected status
loader https://anjunar.github.io/simplicity/library/simplicity-core/processors/loader-processor.js:7
get template https://anjunar.github.io/simplicity/documentation/expert/meta/overview.js line 7 > srcScript:12
define https://anjunar.github.io/simplicity/library/simplicity-core/simplicity.js:31
define https://anjunar.github.io/simplicity/library/simplicity-core/simplicity.js:177
<anonymous> https://anjunar.github.io/simplicity/documentation/expert/meta/overview.js line 7 > srcScript:17
loader https://anjunar.github.io/simplicity/library/simplicity-core/processors/loader-processor.js:7
get template https://anjunar.github.io/simplicity/documentation/expert/index.js:25
define https://anjunar.github.io/simplicity/library/simplicity-core/simplicity.js:31
define https://anjunar.github.io/simplicity/library/simplicity-core/simplicity.js:177
<anonymous> https://anjunar.github.io/simplicity/documentation/expert/index.js:29
It is failing on the send
call of this synchronous XMLHttpRequest:
export function loader(url) {
let request = new XMLHttpRequest();
let newUrl = "./" + url;
request.open("GET", newUrl, false)
request.send(null)
return request.response;
}
On a local build, I added some simple printf-logging and found that the erorr is thrown from InnerModuleLinking in Modules.cpp.
This makes me suspect that maybe the JS module code doesn't work well with synchronous XMLHttpRequests, but I'm not well-versed in the topic, so I decided to file a bug here to try to make sense of this.
Assignee | ||
Comment 1•2 years ago
|
||
(In reply to Thomas Wisniewski [:twisniewski] from comment #0)
Thanks for the bug report!
Reproduced. Doesn't seem to be related to bug 1787926 which landed yesterday.
Updated•2 years ago
|
Reporter | ||
Comment 2•2 years ago
|
||
@jonco, although bug 1788882 landed, I'm still seeing "InternalError: module record has unexpected status: Evaluating" on this website in a nightly build from today. Is that expected?
Assignee | ||
Comment 3•2 years ago
|
||
(In reply to Thomas Wisniewski [:twisniewski] from comment #2)
@jonco, although bug 1788882 landed, I'm still seeing "InternalError: module record has unexpected status: Evaluating" on this website in a nightly build from today. Is that expected?
Yes. That patch wasn't a fix for the underlying issue, it makes it so it doesn't crash the browser (in debug builds) and the error is detected sooner.
Assignee | ||
Comment 4•2 years ago
|
||
The looks like it's a longstanding issue with synchronous XHR and an example of bug 978757.
Assignee | ||
Comment 5•2 years ago
|
||
The problem is that synchronous XMLHttpRequest requests can spin the event loop
and cause us to process dynamic module loads (by calling
JS::FinishDynamicModuleImport) when we are already inside JS::ModuleEvaluate.
The module algorithms assume that they are not reentrant.
The patch changes dyammic module load processing to happen in the same way as
async script loads (of both classic scripts and modules), which are blocked
during sync XHR by Document::SuppressEventHandling calling
ScriptLoader::AddExecuteBlocker.
Assignee | ||
Comment 6•2 years ago
|
||
Depends on D157218
Comment 8•2 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/c0269cec57bb
https://hg.mozilla.org/mozilla-central/rev/8197913e2534
Updated•2 years ago
|
Description
•