Skip to content

Commit 7b837d2

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 c1e3c18 commit 7b837d2

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
@@ -1550,35 +1550,6 @@ bool ModuleLoaderBase::HasDynamicImport(
15501550
}
15511551
#endif
15521552

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

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

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

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