[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
oliver at apple.com
oliver at apple.com
Wed Dec 22 14:41:38 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 875add0c95e3dc8f53f7961102b669d75adecccf
Author: oliver at apple.com <oliver at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Sat Oct 16 01:50:16 2010 +0000
2010-10-15 Oliver Hunt <oliver at apple.com>
Reviewed by Sam Weinig.
Automatic Semicolon Insertion incorrectly inserts semicolon after break, continue, and return followed by a newline
https://bugs.webkit.org/show_bug.cgi?id=47762
The old YACC parser depended on the lexer for some classes of semicolon insertion.
The new parser handles ASI entirely on its own so when the lexer inserts a semicolon
on its own the net result is a spurious semicolon in the input stream. This can result
in incorrect parsing in some cases:
if (0)
break
;else {}
Would result in a parse failure as the output from the lexer is essentially
if (0)
break
;;else
So the second semicolon is interpreted as a empty statement, which terminates the if,
making the else an error.
* parser/JSParser.cpp:
(JSC::JSParser::parseThrowStatement):
Parsing of throw statement was wrong, and only worked due to the weird behaviour
in the lexer
* parser/Lexer.cpp:
(JSC::Lexer::lex):
Remove bogus semicolon insertion from the newline handling
2010-10-15 Oliver Hunt <oliver at apple.com>
Reviewed by Sam Weinig.
ASI incorrectly inserts semicolon after break, continue, and return followed by a newline
https://bugs.webkit.org/show_bug.cgi?id=47762
tests for correct ASI following break, continue, and return
* fast/js/break-ASI-expected.txt: Added.
* fast/js/break-ASI.html: Added.
* fast/js/script-tests/break-ASI.js: Added.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@69906 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/JavaScriptCore/ChangeLog b/JavaScriptCore/ChangeLog
index a718bdb..b7a4280 100644
--- a/JavaScriptCore/ChangeLog
+++ b/JavaScriptCore/ChangeLog
@@ -1,3 +1,37 @@
+2010-10-15 Oliver Hunt <oliver at apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Automatic Semicolon Insertion incorrectly inserts semicolon after break, continue, and return followed by a newline
+ https://bugs.webkit.org/show_bug.cgi?id=47762
+
+ The old YACC parser depended on the lexer for some classes of semicolon insertion.
+ The new parser handles ASI entirely on its own so when the lexer inserts a semicolon
+ on its own the net result is a spurious semicolon in the input stream. This can result
+ in incorrect parsing in some cases:
+
+ if (0)
+ break
+ ;else {}
+
+ Would result in a parse failure as the output from the lexer is essentially
+
+ if (0)
+ break
+ ;;else
+
+ So the second semicolon is interpreted as a empty statement, which terminates the if,
+ making the else an error.
+
+
+ * parser/JSParser.cpp:
+ (JSC::JSParser::parseThrowStatement):
+ Parsing of throw statement was wrong, and only worked due to the weird behaviour
+ in the lexer
+ * parser/Lexer.cpp:
+ (JSC::Lexer::lex):
+ Remove bogus semicolon insertion from the newline handling
+
2010-10-15 Nikolas Zimmermann <nzimmermann at rim.com>
Reviewed by Dirk Schulze.
diff --git a/JavaScriptCore/parser/JSParser.cpp b/JavaScriptCore/parser/JSParser.cpp
index 5ba2a0a..4b1009f 100644
--- a/JavaScriptCore/parser/JSParser.cpp
+++ b/JavaScriptCore/parser/JSParser.cpp
@@ -901,12 +901,13 @@ template <class TreeBuilder> TreeStatement JSParser::parseThrowStatement(TreeBui
int eStart = tokenStart();
int startLine = tokenLine();
next();
+
+ failIfTrue(autoSemiColon());
TreeExpression expr = parseExpression(context);
failIfFalse(expr);
int eEnd = lastTokenEnd();
int endLine = tokenLine();
- failIfFalse(autoSemiColon());
return context.createThrowStatement(expr, eStart, eEnd, startLine, endLine);
}
diff --git a/JavaScriptCore/parser/Lexer.cpp b/JavaScriptCore/parser/Lexer.cpp
index 239729e..b443561 100644
--- a/JavaScriptCore/parser/Lexer.cpp
+++ b/JavaScriptCore/parser/Lexer.cpp
@@ -1028,11 +1028,6 @@ inNumberAfterDecimalPoint:
shiftLineTerminator();
m_atLineStart = true;
m_terminator = true;
- if (lastTokenWasRestrKeyword()) {
- token = SEMICOLON;
- m_delimited = true;
- goto returnToken;
- }
goto start;
case CharacterInvalid:
goto returnError;
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index ebc9ae2..68ef425 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,16 @@
+2010-10-15 Oliver Hunt <oliver at apple.com>
+
+ Reviewed by Sam Weinig.
+
+ ASI incorrectly inserts semicolon after break, continue, and return followed by a newline
+ https://bugs.webkit.org/show_bug.cgi?id=47762
+
+ tests for correct ASI following break, continue, and return
+
+ * fast/js/break-ASI-expected.txt: Added.
+ * fast/js/break-ASI.html: Added.
+ * fast/js/script-tests/break-ASI.js: Added.
+
2010-10-15 Mihai Parparita <mihaip at chromium.org>
Reviewed by James Robinson.
diff --git a/LayoutTests/fast/js/break-ASI-expected.txt b/LayoutTests/fast/js/break-ASI-expected.txt
new file mode 100644
index 0000000..4a55b7b
--- /dev/null
+++ b/LayoutTests/fast/js/break-ASI-expected.txt
@@ -0,0 +1,17 @@
+Test to make sure we don't incorrectly insert a semi colon after a break statement
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS do { if(0) break
+;else true; } while (0) is true
+PASS do { if(0) continue
+;else true; } while (0) is true
+PASS (function(){if (0) return
+;else return true;})() is true
+PASS if (0) throw
+'Shouldn't have parsed this.'; threw exception SyntaxError: Parse error.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/js/break-ASI.html b/LayoutTests/fast/js/break-ASI.html
new file mode 100644
index 0000000..37856b9
--- /dev/null
+++ b/LayoutTests/fast/js/break-ASI.html
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="resources/js-test-style.css">
+<script src="resources/js-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="script-tests/break-ASI.js"></script>
+<script src="resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/js/script-tests/break-ASI.js b/LayoutTests/fast/js/script-tests/break-ASI.js
new file mode 100644
index 0000000..aa14381
--- /dev/null
+++ b/LayoutTests/fast/js/script-tests/break-ASI.js
@@ -0,0 +1,8 @@
+description("Test to make sure we don't incorrectly insert a semi colon after a break statement");
+
+shouldBeTrue("do { if(0) break\n;else true; } while (0)")
+shouldBeTrue("do { if(0) continue\n;else true; } while (0)")
+shouldBeTrue("(function(){if (0) return\n;else return true;})()")
+shouldThrow("if (0) throw\n'Shouldn\'t have parsed this.';")
+
+var successfullyParsed = true;
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list