- Revision
- 215235
- Author
- [email protected]
- Date
- 2017-04-11 09:54:49 -0700 (Tue, 11 Apr 2017)
Log Message
test262: test262/test/annexB/language/comments/multi-line-html-close.js
https://bugs.webkit.org/show_bug.cgi?id=170648
Patch by Joseph Pecoraro <[email protected]> on 2017-04-11
Reviewed by Keith Miller.
JSTests:
* test262.yaml:
Source/_javascript_Core:
* parser/Lexer.cpp:
(JSC::Lexer<T>::lex):
A multi-line comment that contains a line terminator is itself treated
like a line terminator. An HTML Close Comment that comes after it can
therefore treat it like it is at the start of a line, because it was
immediately preceeded by the equivalent of a line terminator.
LayoutTests:
* js/parser-xml-close-comment-expected.txt:
* js/script-tests/parser-xml-close-comment.js:
Update test coverage for _javascript_ HTML comments.
Modified Paths
Diff
Modified: trunk/JSTests/ChangeLog (215234 => 215235)
--- trunk/JSTests/ChangeLog 2017-04-11 16:38:43 UTC (rev 215234)
+++ trunk/JSTests/ChangeLog 2017-04-11 16:54:49 UTC (rev 215235)
@@ -1,5 +1,14 @@
2017-04-11 Joseph Pecoraro <[email protected]>
+ test262: test262/test/annexB/language/comments/multi-line-html-close.js
+ https://bugs.webkit.org/show_bug.cgi?id=170648
+
+ Reviewed by Keith Miller.
+
+ * test262.yaml:
+
+2017-04-11 Joseph Pecoraro <[email protected]>
+
test262: test262/test/built-ins/Array/S15.4.3_A2.2.js
https://bugs.webkit.org/show_bug.cgi?id=170652
Modified: trunk/JSTests/test262.yaml (215234 => 215235)
--- trunk/JSTests/test262.yaml 2017-04-11 16:38:43 UTC (rev 215234)
+++ trunk/JSTests/test262.yaml 2017-04-11 16:54:49 UTC (rev 215235)
@@ -892,9 +892,9 @@
- path: test262/test/annexB/built-ins/unescape/two.js
cmd: runTest262 :normal, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js"], [:strict]
- path: test262/test/annexB/language/comments/multi-line-html-close.js
- cmd: runTest262 :fail, "Test262Error", ["../../../../harness/assert.js", "../../../../harness/sta.js"], []
+ cmd: runTest262 :normal, "Test262Error", ["../../../../harness/assert.js", "../../../../harness/sta.js"], []
- path: test262/test/annexB/language/comments/multi-line-html-close.js
- cmd: runTest262 :fail, "Test262Error", ["../../../../harness/assert.js", "../../../../harness/sta.js"], [:strict]
+ cmd: runTest262 :normal, "Test262Error", ["../../../../harness/assert.js", "../../../../harness/sta.js"], [:strict]
- path: test262/test/annexB/language/comments/single-line-html-close-asi.js
cmd: runTest262 :normal, "Test262Error", ["../../../../harness/assert.js", "../../../../harness/sta.js"], []
- path: test262/test/annexB/language/comments/single-line-html-close-asi.js
Modified: trunk/LayoutTests/ChangeLog (215234 => 215235)
--- trunk/LayoutTests/ChangeLog 2017-04-11 16:38:43 UTC (rev 215234)
+++ trunk/LayoutTests/ChangeLog 2017-04-11 16:54:49 UTC (rev 215235)
@@ -1,5 +1,16 @@
2017-04-11 Joseph Pecoraro <[email protected]>
+ test262: test262/test/annexB/language/comments/multi-line-html-close.js
+ https://bugs.webkit.org/show_bug.cgi?id=170648
+
+ Reviewed by Keith Miller.
+
+ * js/parser-xml-close-comment-expected.txt:
+ * js/script-tests/parser-xml-close-comment.js:
+ Update test coverage for _javascript_ HTML comments.
+
+2017-04-11 Joseph Pecoraro <[email protected]>
+
test262: test262/test/built-ins/Array/S15.4.3_A2.2.js
https://bugs.webkit.org/show_bug.cgi?id=170652
Modified: trunk/LayoutTests/js/parser-xml-close-comment-expected.txt (215234 => 215235)
--- trunk/LayoutTests/js/parser-xml-close-comment-expected.txt 2017-04-11 16:38:43 UTC (rev 215234)
+++ trunk/LayoutTests/js/parser-xml-close-comment-expected.txt 2017-04-11 16:54:49 UTC (rev 215235)
@@ -1,14 +1,25 @@
-Test to ensure correct handling of --> as a single line comment when at the beginning of a line
+Test to ensure correct handling of --> as a single line comment when at the beginning of a line or preceeded by a multi-line comment
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS 'should be a syntax error' --> threw exception SyntaxError: Unexpected end of script.
+PASS /**/ 1--> threw exception SyntaxError: Unexpected end of script.
PASS /**/ 1 --> threw exception SyntaxError: Unexpected end of script.
+PASS 1 /**/--> threw exception SyntaxError: Unexpected end of script.
PASS 1 /**/ --> threw exception SyntaxError: Unexpected end of script.
PASS 1/*
-*/--> threw exception SyntaxError: Unexpected token '>'.
+*/--> is 1
+PASS 1/*
+*/
+--> is 1
+PASS 2/*
+*/ --> is 2
+PASS 2/*
+*/
+ --> is 2
PASS --> is undefined.
+PASS --> is undefined.
PASS /**/--> is undefined.
PASS /*
*/--> is undefined.
Modified: trunk/LayoutTests/js/script-tests/parser-xml-close-comment.js (215234 => 215235)
--- trunk/LayoutTests/js/script-tests/parser-xml-close-comment.js 2017-04-11 16:38:43 UTC (rev 215234)
+++ trunk/LayoutTests/js/script-tests/parser-xml-close-comment.js 2017-04-11 16:54:49 UTC (rev 215235)
@@ -1,10 +1,17 @@
-description("Test to ensure correct handling of --> as a single line comment when at the beginning of a line");
+description("Test to ensure correct handling of --> as a single line comment when at the beginning of a line or preceeded by a multi-line comment");
shouldThrow("'should be a syntax error' -->");
+shouldThrow("/**/ 1-->");
shouldThrow("/**/ 1 -->");
+shouldThrow("1 /**/-->");
shouldThrow("1 /**/ -->");
-shouldThrow("1/*\n*/-->");
+shouldBe("1/*\n*/-->", `1`);
+shouldBe("1/*\n*/\n-->", `1`);
+shouldBe("2/*\n*/ -->", `2`);
+shouldBe("2/*\n*/\n -->", `2`);
+
shouldBeUndefined("-->");
+shouldBeUndefined(" -->");
shouldBeUndefined("/**/-->");
shouldBeUndefined("/*\n*/-->");
Modified: trunk/Source/_javascript_Core/ChangeLog (215234 => 215235)
--- trunk/Source/_javascript_Core/ChangeLog 2017-04-11 16:38:43 UTC (rev 215234)
+++ trunk/Source/_javascript_Core/ChangeLog 2017-04-11 16:54:49 UTC (rev 215235)
@@ -1,5 +1,19 @@
2017-04-11 Joseph Pecoraro <[email protected]>
+ test262: test262/test/annexB/language/comments/multi-line-html-close.js
+ https://bugs.webkit.org/show_bug.cgi?id=170648
+
+ Reviewed by Keith Miller.
+
+ * parser/Lexer.cpp:
+ (JSC::Lexer<T>::lex):
+ A multi-line comment that contains a line terminator is itself treated
+ like a line terminator. An HTML Close Comment that comes after it can
+ therefore treat it like it is at the start of a line, because it was
+ immediately preceeded by the equivalent of a line terminator.
+
+2017-04-11 Joseph Pecoraro <[email protected]>
+
test262: test262/test/built-ins/Array/S15.4.3_A2.2.js
https://bugs.webkit.org/show_bug.cgi?id=170652
Modified: trunk/Source/_javascript_Core/parser/Lexer.cpp (215234 => 215235)
--- trunk/Source/_javascript_Core/parser/Lexer.cpp 2017-04-11 16:38:43 UTC (rev 215234)
+++ trunk/Source/_javascript_Core/parser/Lexer.cpp 2017-04-11 16:54:49 UTC (rev 215235)
@@ -1991,7 +1991,7 @@
shift();
if (m_current == '-') {
shift();
- if (m_atLineStart && m_current == '>') {
+ if ((m_atLineStart || m_terminator) && m_current == '>') {
if (m_scriptMode == JSParserScriptMode::Classic) {
shift();
goto inSingleLineComment;