- Revision
- 108742
- Author
- commit-qu...@webkit.org
- Date
- 2012-02-24 00:20:51 -0800 (Fri, 24 Feb 2012)
Log Message
`\u200c` and `\u200d` should be allowed in IdentifierPart, as per ES5
https://bugs.webkit.org/show_bug.cgi?id=78908
Source/_javascript_Core:
Add additional checks for zero-width non-joiner (0x200C) and
zero-width joiner (0x200D) characters.
Patch by Mathias Bynens <math...@qiwi.be> on 2012-02-24
Reviewed by Michael Saboff.
* parser/Lexer.cpp:
(JSC::isNonASCIIIdentPart)
* runtime/LiteralParser.cpp:
(JSC::::Lexer::lexIdentifier)
LayoutTests:
Patch by Mathias Bynens <math...@qiwi.be> on 2012-02-24
Reviewed by Michael Saboff.
* fast/js/var-declarations-zero-width-expected.txt: Added.
* fast/js/var-declarations-zero-width.html: Added.
* fast/js/removing-Cf-characters-expected.txt: Removed the ZWJ test.
* fast/js/script-tests/removing-Cf-characters.js: Removed the ZWJ test.
* fast/js/script-tests/var-declarations-zero-width.js: Added.
* platform/chromium/test_expectations.txt: Disable the new test in Chromium, for now.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (108741 => 108742)
--- trunk/LayoutTests/ChangeLog 2012-02-24 08:17:11 UTC (rev 108741)
+++ trunk/LayoutTests/ChangeLog 2012-02-24 08:20:51 UTC (rev 108742)
@@ -1,3 +1,17 @@
+2012-02-24 Mathias Bynens <math...@qiwi.be>
+
+ `\u200c` and `\u200d` should be allowed in IdentifierPart, as per ES5
+ https://bugs.webkit.org/show_bug.cgi?id=78908
+
+ Reviewed by Michael Saboff.
+
+ * fast/js/var-declarations-zero-width-expected.txt: Added.
+ * fast/js/var-declarations-zero-width.html: Added.
+ * fast/js/removing-Cf-characters-expected.txt: Removed the ZWJ test.
+ * fast/js/script-tests/removing-Cf-characters.js: Removed the ZWJ test.
+ * fast/js/script-tests/var-declarations-zero-width.js: Added.
+ * platform/chromium/test_expectations.txt: Disable the new test in Chromium, for now.
+
2012-02-24 Yuzo Fujishima <y...@google.com>
[chromium] Unreviewed test expectation change.
Modified: trunk/LayoutTests/fast/js/removing-Cf-characters-expected.txt (108741 => 108742)
--- trunk/LayoutTests/fast/js/removing-Cf-characters-expected.txt 2012-02-24 08:17:11 UTC (rev 108741)
+++ trunk/LayoutTests/fast/js/removing-Cf-characters-expected.txt 2012-02-24 08:20:51 UTC (rev 108742)
@@ -9,7 +9,6 @@
PASS eval('""').length is 1
PASS eval('""').charCodeAt(0) is 0xFEFF
PASS ++1 /* BOM between the +'s */ is 1
-PASS var ZWJ_Inside; threw exception SyntaxError: Invalid character '\u8205'.
PASS successfullyParsed is true
TEST COMPLETE
Modified: trunk/LayoutTests/fast/js/script-tests/removing-Cf-characters.js (108741 => 108742)
--- trunk/LayoutTests/fast/js/script-tests/removing-Cf-characters.js 2012-02-24 08:17:11 UTC (rev 108741)
+++ trunk/LayoutTests/fast/js/script-tests/removing-Cf-characters.js 2012-02-24 08:20:51 UTC (rev 108742)
@@ -25,4 +25,3 @@
shouldBe('eval(\'"\uFEFF"\').charCodeAt(0)', '0xFEFF');
shouldBe('+'+eval("\"\uFEFF\"")+'+1 /* BOM between the +\'s */', '1');
-shouldThrow('var ZWJ_Inside;');
Added: trunk/LayoutTests/fast/js/script-tests/var-declarations-zero-width.js (0 => 108742)
--- trunk/LayoutTests/fast/js/script-tests/var-declarations-zero-width.js (rev 0)
+++ trunk/LayoutTests/fast/js/script-tests/var-declarations-zero-width.js 2012-02-24 08:20:51 UTC (rev 108742)
@@ -0,0 +1,5 @@
+description("This page tests if U+200C and U+200D are allowed as part of an identifier.");
+
+shouldBe("var x\u200c = 42; x\u200c", "42");
+shouldBe("var x\u200d = 43; x\u200d", "43");
+shouldBe("var x\u200c\u200d = 44; x\u200c\u200d", "44");
\ No newline at end of file
Added: trunk/LayoutTests/fast/js/var-declarations-zero-width-expected.txt (0 => 108742)
--- trunk/LayoutTests/fast/js/var-declarations-zero-width-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/js/var-declarations-zero-width-expected.txt 2012-02-24 08:20:51 UTC (rev 108742)
@@ -0,0 +1,12 @@
+This page tests if U+200C and U+200D are allowed as part of an identifier.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS var x = 42; x is 42
+PASS var x = 43; x is 43
+PASS var x = 44; x is 44
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/js/var-declarations-zero-width.html (0 => 108742)
--- trunk/LayoutTests/fast/js/var-declarations-zero-width.html (rev 0)
+++ trunk/LayoutTests/fast/js/var-declarations-zero-width.html 2012-02-24 08:20:51 UTC (rev 108742)
@@ -0,0 +1,4 @@
+<!DOCTYPE html>
+<script src=""
+<script src=""
+<script src=""
Modified: trunk/LayoutTests/platform/chromium/test_expectations.txt (108741 => 108742)
--- trunk/LayoutTests/platform/chromium/test_expectations.txt 2012-02-24 08:17:11 UTC (rev 108741)
+++ trunk/LayoutTests/platform/chromium/test_expectations.txt 2012-02-24 08:20:51 UTC (rev 108742)
@@ -909,6 +909,9 @@
// what the resolution was.
BUGCR10279 : fast/js/var-declarations-shadowing.html = FAIL
+// FIXME: Enable this test when V8 r10800 has rolled into WebKit.
+BUGWK79361 : fast/js/var-declarations-zero-width.html = FAIL
+
// Implement full JSON support in V8
BUGCR14885 SLOW : fast/js/JSON-parse.html = FAIL
BUGCR14885 SLOW : fast/js/JSON-stringify.html = CRASH FAIL
Modified: trunk/Source/_javascript_Core/ChangeLog (108741 => 108742)
--- trunk/Source/_javascript_Core/ChangeLog 2012-02-24 08:17:11 UTC (rev 108741)
+++ trunk/Source/_javascript_Core/ChangeLog 2012-02-24 08:20:51 UTC (rev 108742)
@@ -1,3 +1,18 @@
+2012-02-24 Mathias Bynens <math...@qiwi.be>
+
+ `\u200c` and `\u200d` should be allowed in IdentifierPart, as per ES5
+ https://bugs.webkit.org/show_bug.cgi?id=78908
+
+ Add additional checks for zero-width non-joiner (0x200C) and
+ zero-width joiner (0x200D) characters.
+
+ Reviewed by Michael Saboff.
+
+ * parser/Lexer.cpp:
+ (JSC::isNonASCIIIdentPart)
+ * runtime/LiteralParser.cpp:
+ (JSC::::Lexer::lexIdentifier)
+
2012-02-23 Kenichi Ishibashi <ba...@chromium.org>
Adding WebSocket per-frame DEFLATE extension
Modified: trunk/Source/_javascript_Core/parser/Lexer.cpp (108741 => 108742)
--- trunk/Source/_javascript_Core/parser/Lexer.cpp 2012-02-24 08:17:11 UTC (rev 108741)
+++ trunk/Source/_javascript_Core/parser/Lexer.cpp 2012-02-24 08:20:51 UTC (rev 108742)
@@ -3,6 +3,7 @@
* Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All Rights Reserved.
* Copyright (C) 2007 Cameron Zwarich (cwzwar...@uwaterloo.ca)
* Copyright (C) 2010 Zoltan Herczeg (zherc...@inf.u-szeged.hu)
+ * Copyright (C) 2012 Mathias Bynens (math...@qiwi.be)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -379,8 +380,8 @@
static NEVER_INLINE bool isNonASCIIIdentPart(int c)
{
- return category(c) & (Letter_Uppercase | Letter_Lowercase | Letter_Titlecase | Letter_Modifier | Letter_Other
- | Mark_NonSpacing | Mark_SpacingCombining | Number_DecimalDigit | Punctuation_Connector);
+ return (category(c) & (Letter_Uppercase | Letter_Lowercase | Letter_Titlecase | Letter_Modifier | Letter_Other
+ | Mark_NonSpacing | Mark_SpacingCombining | Number_DecimalDigit | Punctuation_Connector)) || c == 0x200C || c == 0x200D;
}
static ALWAYS_INLINE bool isIdentPart(int c)
Modified: trunk/Source/_javascript_Core/runtime/LiteralParser.cpp (108741 => 108742)
--- trunk/Source/_javascript_Core/runtime/LiteralParser.cpp 2012-02-24 08:17:11 UTC (rev 108741)
+++ trunk/Source/_javascript_Core/runtime/LiteralParser.cpp 2012-02-24 08:20:51 UTC (rev 108742)
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2012 Mathias Bynens (math...@qiwi.be)
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -294,7 +295,7 @@
template <>
ALWAYS_INLINE TokenType LiteralParser<UChar>::Lexer::lexIdentifier(LiteralParserToken<UChar>& token)
{
- while (m_ptr < m_end && (isASCIIAlphanumeric(*m_ptr) || *m_ptr == '_' || *m_ptr == '$'))
+ while (m_ptr < m_end && (isASCIIAlphanumeric(*m_ptr) || *m_ptr == '_' || *m_ptr == '$' || *m_ptr == 0x200C || *m_ptr == 0x200D))
m_ptr++;
token.stringIs8Bit = 0;
token.stringToken16 = token.start;