ported from UXP: Issue #1691 - Part 8: Fix --enable-debug builds and continue dynamic module import changes. M1342012 Support import from timeout handlers by associating the initiating script with the compiled JSScript. Fix error message that covers all import() failures that don't throw a JS exception. M1331662 Partial - Replace nsJSUtils::EvaluateString calls by ExecutionContext scopes. Left EvaluateString() in nsXBLProtoImplField.cpp until ExecutionContext errors can be fixed. (1109559a)

This commit is contained in:
2023-05-01 00:13:14 +08:00
parent 587bcc0be9
commit 4e03b175f8
20 changed files with 166 additions and 24 deletions
+10 -1
View File
@@ -1075,7 +1075,7 @@ void ScriptLoader::FinishDynamicImport(JSContext* aCx,
if (NS_FAILED(aResult)) {
MOZ_ASSERT(!JS_IsExceptionPending(aCx));
JS_ReportErrorNumberUC(aCx, js::GetErrorMessage, nullptr,
JSMSG_IMPORT_SCRIPT_NOT_FOUND);
JSMSG_DYNAMIC_IMPORT_FAILED);
}
JS::Rooted<JS::Value> referencingScript(aCx,
@@ -2393,6 +2393,15 @@ ScriptLoader::EvaluateScript(ScriptLoadRequest* aRequest)
return rv;
}
/* static */ LoadedScript* ScriptLoader::GetActiveScript(JSContext* aCx) {
JS::Value value = JS::GetScriptedCallerPrivate(aCx);
if (value.isUndefined()) {
return nullptr;
}
return static_cast<LoadedScript*>(value.toPrivate());
}
void
ScriptLoader::ProcessPendingRequestsAsync()
{