From 21e165d4327faf0f384da55a0a2dba0273292b6c Mon Sep 17 00:00:00 2001 From: Jon Coppeard Date: Tue, 18 Sep 2018 14:17:10 +0100 Subject: [PATCH] Bug 1492074 - Syntax parse of dynamic module import syntax should fail since this is not yet implemented r=jandem on a CLOSED TREE --HG-- extra : source : a73bc1d129c77dc783446a7a88854b087272ddf7 extra : amend_source : 35fb6ede6425136ba8549d3e8ea5c45615fb47c2 --- js/src/frontend/Parser.cpp | 4 ++++ js/src/jit-test/tests/modules/dynamic-import-lazy.js | 6 ++++++ .../dynamic-import/dynamic-imports-fetch-error.sub.html.ini | 5 ----- .../dynamic-import/dynamic-imports-script-error.html.ini | 5 ----- 4 files changed, 10 insertions(+), 10 deletions(-) create mode 100644 js/src/jit-test/tests/modules/dynamic-import-lazy.js diff --git a/js/src/frontend/Parser.cpp b/js/src/frontend/Parser.cpp index 2f1d4df20f24..9eb398c69879 100644 --- a/js/src/frontend/Parser.cpp +++ b/js/src/frontend/Parser.cpp @@ -10919,6 +10919,10 @@ GeneralParser::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"); +} diff --git a/testing/web-platform/meta/html/semantics/scripting-1/the-script-element/module/dynamic-import/dynamic-imports-fetch-error.sub.html.ini b/testing/web-platform/meta/html/semantics/scripting-1/the-script-element/module/dynamic-import/dynamic-imports-fetch-error.sub.html.ini index f359ff31deee..6193009d92b7 100644 --- a/testing/web-platform/meta/html/semantics/scripting-1/the-script-element/module/dynamic-import/dynamic-imports-fetch-error.sub.html.ini +++ b/testing/web-platform/meta/html/semantics/scripting-1/the-script-element/module/dynamic-import/dynamic-imports-fetch-error.sub.html.ini @@ -1,8 +1,3 @@ [dynamic-imports-fetch-error.sub.html] - expected: ERROR [import(): error cases occuring during fetching] expected: FAIL - - [import() must reject when there is a wrong MIME type] - expected: FAIL - diff --git a/testing/web-platform/meta/html/semantics/scripting-1/the-script-element/module/dynamic-import/dynamic-imports-script-error.html.ini b/testing/web-platform/meta/html/semantics/scripting-1/the-script-element/module/dynamic-import/dynamic-imports-script-error.html.ini index 299b4adaadfa..583778f32a41 100644 --- a/testing/web-platform/meta/html/semantics/scripting-1/the-script-element/module/dynamic-import/dynamic-imports-script-error.html.ini +++ b/testing/web-platform/meta/html/semantics/scripting-1/the-script-element/module/dynamic-import/dynamic-imports-script-error.html.ini @@ -1,8 +1,3 @@ [dynamic-imports-script-error.html] - expected: ERROR [import(): error cases caused by the imported module script] expected: FAIL - - [import() must reject when there is a parse error] - expected: FAIL -