Title: [89100] trunk
- Revision
- 89100
- Author
- [email protected]
- Date
- 2011-06-16 18:47:25 -0700 (Thu, 16 Jun 2011)
Log Message
https://bugs.webkit.org/show_bug.cgi?id=23611
Multiline _javascript_ comments cause incorrect parsing of following script.
Reviewed by Oliver Hunt.
>From the spec:
"A MultiLineComment [is] simply discarded if it contains no line terminator,
but if a MultiLineComment contains one or more line terminators, then it is
replaced with a single line terminator, which becomes part of the stream of
inputs for the syntactic grammar."
This may result in behavioural changes, due to automatic semicolon insertion.
Source/_javascript_Core:
* parser/Lexer.cpp:
(JSC::Lexer::parseMultilineComment):
- Set m_terminator is we see a line terminator in a multiline comment.
LayoutTests:
* fast/js/multiline-comment-newline-expected.txt: Added.
* fast/js/multiline-comment-newline.html: Added.
* fast/js/script-tests/multiline-comment-newline.js: Added.
(shouldBeUndefined):
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (89099 => 89100)
--- trunk/LayoutTests/ChangeLog 2011-06-17 01:39:53 UTC (rev 89099)
+++ trunk/LayoutTests/ChangeLog 2011-06-17 01:47:25 UTC (rev 89100)
@@ -1,3 +1,23 @@
+2011-06-16 Gavin Barraclough <[email protected]>
+
+ Reviewed by Oliver Hunt.
+
+ https://bugs.webkit.org/show_bug.cgi?id=23611
+ Multiline _javascript_ comments cause incorrect parsing of following script.
+
+ From the spec:
+ "A MultiLineComment [is] simply discarded if it contains no line terminator,
+ but if a MultiLineComment contains one or more line terminators, then it is
+ replaced with a single line terminator, which becomes part of the stream of
+ inputs for the syntactic grammar."
+
+ This may result in behavioural changes, due to automatic semicolon insertion.
+
+ * fast/js/multiline-comment-newline-expected.txt: Added.
+ * fast/js/multiline-comment-newline.html: Added.
+ * fast/js/script-tests/multiline-comment-newline.js: Added.
+ (shouldBeUndefined):
+
2011-06-16 Ryosuke Niwa <[email protected]>
Qt rebaselines after r89091.
Added: trunk/LayoutTests/fast/js/multiline-comment-newline-expected.txt (0 => 89100)
--- trunk/LayoutTests/fast/js/multiline-comment-newline-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/js/multiline-comment-newline-expected.txt 2011-06-17 01:47:25 UTC (rev 89100)
@@ -0,0 +1,10 @@
+This test checks that a multiline comment containing a newline is converted to a line terminator token.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS shouldBeUndefined is undefined
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/js/multiline-comment-newline.html (0 => 89100)
--- trunk/LayoutTests/fast/js/multiline-comment-newline.html (rev 0)
+++ trunk/LayoutTests/fast/js/multiline-comment-newline.html 2011-06-17 01:47:25 UTC (rev 89100)
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href=""
+<script src=""
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src=""
+<script src=""
+</body>
+</html>
Added: trunk/LayoutTests/fast/js/script-tests/multiline-comment-newline.js (0 => 89100)
--- trunk/LayoutTests/fast/js/script-tests/multiline-comment-newline.js (rev 0)
+++ trunk/LayoutTests/fast/js/script-tests/multiline-comment-newline.js 2011-06-17 01:47:25 UTC (rev 89100)
@@ -0,0 +1,12 @@
+description(
+"This test checks that a multiline comment containing a newline is converted to a line terminator token."
+);
+
+var shouldBeUndefined = (function(){
+ return/*
+ */1
+})();
+
+shouldBe('shouldBeUndefined', 'undefined');
+
+var successfullyParsed = true;
Modified: trunk/Source/_javascript_Core/ChangeLog (89099 => 89100)
--- trunk/Source/_javascript_Core/ChangeLog 2011-06-17 01:39:53 UTC (rev 89099)
+++ trunk/Source/_javascript_Core/ChangeLog 2011-06-17 01:47:25 UTC (rev 89100)
@@ -1,5 +1,24 @@
2011-06-16 Gavin Barraclough <[email protected]>
+ Reviewed by Oliver Hunt.
+
+ https://bugs.webkit.org/show_bug.cgi?id=23611
+ Multiline _javascript_ comments cause incorrect parsing of following script.
+
+ From the spec:
+ "A MultiLineComment [is] simply discarded if it contains no line terminator,
+ but if a MultiLineComment contains one or more line terminators, then it is
+ replaced with a single line terminator, which becomes part of the stream of
+ inputs for the syntactic grammar."
+
+ This may result in behavioural changes, due to automatic semicolon insertion.
+
+ * parser/Lexer.cpp:
+ (JSC::Lexer::parseMultilineComment):
+ - Set m_terminator is we see a line terminator in a multiline comment.
+
+2011-06-16 Gavin Barraclough <[email protected]>
+
Reviewed by Sam Weinig.
https://bugs.webkit.org/show_bug.cgi?id=62824
Modified: trunk/Source/_javascript_Core/parser/Lexer.cpp (89099 => 89100)
--- trunk/Source/_javascript_Core/parser/Lexer.cpp 2011-06-17 01:39:53 UTC (rev 89099)
+++ trunk/Source/_javascript_Core/parser/Lexer.cpp 2011-06-17 01:47:25 UTC (rev 89100)
@@ -736,9 +736,10 @@
if (UNLIKELY(m_current == -1))
return false;
- if (isLineTerminator(m_current))
+ if (isLineTerminator(m_current)) {
shiftLineTerminator();
- else
+ m_terminator = true;
+ } else
shift();
}
}
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes