diff --git a/js/src/frontend/Parser.cpp b/js/src/frontend/Parser.cpp index aa835c93ae86..67855ef8cc81 100644 --- a/js/src/frontend/Parser.cpp +++ b/js/src/frontend/Parser.cpp @@ -10597,6 +10597,10 @@ Parser::importExpr(YieldHandling yieldHandling) MUST_MATCH_TOKEN_MOD(TokenKind::RightParen, TokenStream::Operand, JSMSG_PAREN_AFTER_ARGS); + if (!abortIfSyntaxParser()) { + return null(); + } + return handler.newCallImport(importHolder, arg); } else { error(JSMSG_UNEXPECTED_TOKEN_NO_EXPECT, TokenKindToDesc(next)); diff --git a/js/src/jit-test/tests/modules/dynamic-import-lazy.js b/js/src/jit-test/tests/modules/dynamic-import-lazy.js new file mode 100644 index 000000000000..f1b31b3608da --- /dev/null +++ b/js/src/jit-test/tests/modules/dynamic-import-lazy.js @@ -0,0 +1,6 @@ +// |jit-test| error: SyntaxError + +function lazyilyParsedFunction() +{ + return import("/module1.js"); +}