Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(645)

Unified Diff: third_party/WebKit/Source/core/css/CSSMarkup.cpp

Issue 1498473004: CSS.escape('\0') should not throw. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/css/CSSMarkup.cpp
diff --git a/third_party/WebKit/Source/core/css/CSSMarkup.cpp b/third_party/WebKit/Source/core/css/CSSMarkup.cpp
index 7c5e890579db48b3c997dffb425a2d0530aeaaf0..670f6d834ea941fe84000fd481fef549be59878a 100644
--- a/third_party/WebKit/Source/core/css/CSSMarkup.cpp
+++ b/third_party/WebKit/Source/core/css/CSSMarkup.cpp
@@ -211,14 +211,14 @@ bool serializeIdentifier(const String& identifier, StringBuilder& appendTo)
if (c == 0) {
// Check for lone surrogate which characterStartingAt does not return.
c = identifier[index];
- if (c == 0)
- return false;
Timothy Loh 2015/12/03 04:08:03 If this no longer returns false, we should just ma
ramya.v 2015/12/03 06:33:46 Done.
ramya.v 2015/12/03 06:33:46 Made changes to return type. RaisesException is us
Timothy Loh 2015/12/03 07:16:51 I checked and the code works without RaisesExcepti
}
index += U16_LENGTH(c);
if (c <= 0x1f || c == 0x7f || (0x30 <= c && c <= 0x39 && (isFirst || (isSecond && isFirstCharHyphen))))
serializeCharacterAsCodePoint(c, appendTo);
+ else if (c == 0)
Timothy Loh 2015/12/03 07:16:51 Your code is returning \0 because the previous if
+ serializeCharacterAsCodePoint(0xfffd, appendTo);
else if (c == 0x2d && isFirst && index == identifier.length())
serializeCharacter(c, appendTo);
else if (0x80 <= c || c == 0x2d || c == 0x5f || (0x30 <= c && c <= 0x39) || (0x41 <= c && c <= 0x5a) || (0x61 <= c && c <= 0x7a))

Powered by Google App Engine
This is Rietveld 408576698