зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1774111 - Initialize AutoJAPI from the native global in the module loader r=yulia
We're getting a bunch of crashes related to initializing AutoJSAPI from a JSObject pointer that turns out to be null. That overload of Init() gets the native global from the JSObject and since we already have a native global in the module loader we can use the overload that takes that instead. This overload does a null check so we will catch the case where the global is null (although that should also not happen). This might just move crashes elsewhere but it's a reasonable tidyup. Differential Revision: https://phabricator.services.mozilla.com/D162386
This commit is contained in:
Родитель
9ac9619c3c
Коммит
71d7de8c4d
|
@ -750,7 +750,7 @@ nsresult ModuleLoaderBase::ResolveRequestedModules(
|
|||
ModuleScript* ms = aRequest->mModuleScript;
|
||||
|
||||
AutoJSAPI jsapi;
|
||||
if (!jsapi.Init(ms->ModuleRecord())) {
|
||||
if (!jsapi.Init(mGlobalObject)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
@ -925,7 +925,10 @@ void ModuleLoaderBase::FinishDynamicImportAndReject(ModuleLoadRequest* aRequest,
|
|||
nsresult aResult) {
|
||||
AutoJSAPI jsapi;
|
||||
MOZ_ASSERT(NS_FAILED(aResult));
|
||||
MOZ_ALWAYS_TRUE(jsapi.Init(aRequest->mDynamicPromise));
|
||||
if (!jsapi.Init(mGlobalObject)) {
|
||||
return;
|
||||
}
|
||||
|
||||
FinishDynamicImport(jsapi.cx(), aRequest, aResult, nullptr);
|
||||
}
|
||||
|
||||
|
@ -1074,7 +1077,7 @@ bool ModuleLoaderBase::InstantiateModuleGraph(ModuleLoadRequest* aRequest) {
|
|||
MOZ_ASSERT(moduleScript->ModuleRecord());
|
||||
|
||||
AutoJSAPI jsapi;
|
||||
if (NS_WARN_IF(!jsapi.Init(moduleScript->ModuleRecord()))) {
|
||||
if (NS_WARN_IF(!jsapi.Init(mGlobalObject))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -349,8 +349,8 @@ class ModuleLoaderBase : public nsISupports {
|
|||
JS::Value FindFirstParseError(ModuleLoadRequest* aRequest);
|
||||
static nsresult InitDebuggerDataForModuleGraph(JSContext* aCx,
|
||||
ModuleLoadRequest* aRequest);
|
||||
static nsresult ResolveRequestedModules(ModuleLoadRequest* aRequest,
|
||||
nsCOMArray<nsIURI>* aUrlsOut);
|
||||
nsresult ResolveRequestedModules(ModuleLoadRequest* aRequest,
|
||||
nsCOMArray<nsIURI>* aUrlsOut);
|
||||
|
||||
void SetModuleFetchFinishedAndResumeWaitingRequests(
|
||||
ModuleLoadRequest* aRequest, nsresult aResult);
|
||||
|
@ -371,8 +371,8 @@ class ModuleLoaderBase : public nsISupports {
|
|||
* The result of running ModuleEvaluate -- If this is successful, then
|
||||
* we can await the associated EvaluationPromise.
|
||||
*/
|
||||
static void FinishDynamicImportAndReject(ModuleLoadRequest* aRequest,
|
||||
nsresult aResult);
|
||||
void FinishDynamicImportAndReject(ModuleLoadRequest* aRequest,
|
||||
nsresult aResult);
|
||||
|
||||
/**
|
||||
* Wrapper for JSAPI FinishDynamicImport function. Takes an optional argument
|
||||
|
|
Загрузка…
Ссылка в новой задаче