Bug 1788532 - Block dynamic module load processing during sync XHR r=smaug
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. Differential Revision: https://phabricator.services.mozilla.com/D157218
This commit is contained in:
@@ -130,10 +130,9 @@ void ModuleLoader::OnModuleLoadComplete(ModuleLoadRequest* aRequest) {
|
||||
MOZ_ASSERT(aRequest->IsReadyToRun());
|
||||
|
||||
if (aRequest->IsTopLevel()) {
|
||||
if (aRequest->IsDynamicImport() ||
|
||||
(aRequest->GetScriptLoadContext()->mIsInline &&
|
||||
aRequest->GetScriptLoadContext()->GetParserCreated() ==
|
||||
NOT_FROM_PARSER)) {
|
||||
if (aRequest->GetScriptLoadContext()->mIsInline &&
|
||||
aRequest->GetScriptLoadContext()->GetParserCreated() ==
|
||||
NOT_FROM_PARSER) {
|
||||
GetScriptLoader()->RunScriptWhenSafe(aRequest);
|
||||
} else {
|
||||
GetScriptLoader()->MaybeMoveToLoadedList(aRequest);
|
||||
|
||||
Reference in New Issue
Block a user