Skip to content

Commit 665970f

Browse files
committed
Bug 1820594 - Part 26: Remove FindFirstParseError and check for parse error. r=jonco
The changes in [whatwg/html#8253](whatwg/html#8253) remove the "Find the first parse error" part. Differential Revision: https://phabricator.services.mozilla.com/D214579
1 parent 9037595 commit 665970f

File tree

2 files changed

+3
-39
lines changed

2 files changed

+3
-39
lines changed

js/loader/ModuleLoaderBase.cpp

Lines changed: 3 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1549,35 +1549,6 @@ bool ModuleLoaderBase::HasDynamicImport(
15491549
}
15501550
#endif
15511551

1552-
JS::Value ModuleLoaderBase::FindFirstParseError(JSContext* aCx,
1553-
ModuleLoadRequest* aRequest) {
1554-
MOZ_ASSERT(aRequest);
1555-
1556-
js::AutoCheckRecursionLimit recursion(aCx);
1557-
if (!recursion.check(aCx)) {
1558-
return JS::UndefinedValue();
1559-
}
1560-
1561-
ModuleScript* moduleScript = aRequest->mModuleScript;
1562-
MOZ_ASSERT(moduleScript);
1563-
1564-
if (moduleScript->HasParseError()) {
1565-
return moduleScript->ParseError();
1566-
}
1567-
1568-
for (ModuleLoadRequest* childRequest : aRequest->mImports) {
1569-
MOZ_DIAGNOSTIC_ASSERT(moduleScript->HadImportMap() ==
1570-
childRequest->mModuleScript->HadImportMap());
1571-
1572-
JS::Value error = FindFirstParseError(aCx, childRequest);
1573-
if (!error.isUndefined()) {
1574-
return error;
1575-
}
1576-
}
1577-
1578-
return JS::UndefinedValue();
1579-
}
1580-
15811552
bool ModuleLoaderBase::InstantiateModuleGraph(ModuleLoadRequest* aRequest) {
15821553
// Instantiate a top-level module and record any error.
15831554

@@ -1592,21 +1563,15 @@ bool ModuleLoaderBase::InstantiateModuleGraph(ModuleLoadRequest* aRequest) {
15921563
ModuleScript* moduleScript = aRequest->mModuleScript;
15931564
MOZ_ASSERT(moduleScript);
15941565

1566+
MOZ_ASSERT(!moduleScript->HasParseError());
1567+
MOZ_ASSERT(moduleScript->ModuleRecord());
1568+
15951569
AutoJSAPI jsapi;
15961570
if (NS_WARN_IF(!jsapi.Init(mGlobalObject))) {
15971571
return false;
15981572
}
15991573

16001574
JSContext* cx = jsapi.cx();
1601-
JS::Value parseError = FindFirstParseError(cx, aRequest);
1602-
if (!parseError.isUndefined()) {
1603-
moduleScript->SetErrorToRethrow(parseError);
1604-
LOG(("ScriptLoadRequest (%p): found parse error", aRequest));
1605-
return true;
1606-
}
1607-
1608-
MOZ_ASSERT(moduleScript->ModuleRecord());
1609-
16101575
JS::Rooted<JSObject*> module(cx, moduleScript->ModuleRecord());
16111576
if (!xpc::Scriptability::AllowedIfExists(module)) {
16121577
return true;

js/loader/ModuleLoaderBase.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,6 @@ class ModuleLoaderBase : public nsISupports {
497497
private:
498498
ModuleScript* GetFetchedModule(const ModuleMapKey& moduleMapKey) const;
499499

500-
JS::Value FindFirstParseError(JSContext* aCx, ModuleLoadRequest* aRequest);
501500
nsresult ResolveRequestedModules(
502501
ModuleLoadRequest* aRequest,
503502
nsTArray<ModuleMapKey>* aRequestedModulesOut);

0 commit comments

Comments
 (0)