mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-27 06:43:32 +00:00
Bug 1877792 - Part 14: Return early in ModuleLoaderBase::ResolveRequestedModules for synthetic modules r=spidermonkey-reviewers,jonco
Synthetic modules do not have any dependencies, so calling `GetRequestedModulesCount` results in cash. This patch fixes this by making `ResolveRequestedModules` return early for synthetic modules. Differential Revision: https://phabricator.services.mozilla.com/D218561
This commit is contained in:
parent
8abf56a6f1
commit
e31a8b4afd
@ -816,6 +816,8 @@ ResolveResult ModuleLoaderBase::ResolveModuleSpecifier(
|
||||
|
||||
nsresult ModuleLoaderBase::ResolveRequestedModules(
|
||||
ModuleLoadRequest* aRequest, nsTArray<ModuleMapKey>* aRequestedModulesOut) {
|
||||
MOZ_ASSERT_IF(aRequestedModulesOut, aRequestedModulesOut->IsEmpty());
|
||||
|
||||
ModuleScript* ms = aRequest->mModuleScript;
|
||||
|
||||
AutoJSAPI jsapi;
|
||||
@ -825,6 +827,11 @@ nsresult ModuleLoaderBase::ResolveRequestedModules(
|
||||
|
||||
JSContext* cx = jsapi.cx();
|
||||
JS::Rooted<JSObject*> moduleRecord(cx, ms->ModuleRecord());
|
||||
|
||||
if (!JS::IsCyclicModule(moduleRecord)) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
uint32_t length = JS::GetRequestedModulesCount(cx, moduleRecord);
|
||||
|
||||
for (uint32_t i = 0; i < length; i++) {
|
||||
|
Loading…
Reference in New Issue
Block a user