From 5dc6a5db301ac5965618671e7152d76ef2c7210a Mon Sep 17 00:00:00 2001 From: "commit-queue@webkit.org" Date: Wed, 29 Dec 2010 09:32:12 +0000 Subject: [PATCH] 2010-12-29 Helder Correia Reviewed by Eric Seidel. and are not valid JSON whitespace characters https://bugs.webkit.org/show_bug.cgi?id=51671 Vertical Tab and Form Feed are not allowed white spaces by the JSON RFC 4627: http://www.ietf.org/rfc/rfc4627.txt (2. JSON Grammar). Tests: ietestcenter/Javascript/15.12.1.1-0-2.html ietestcenter/Javascript/15.12.1.1-0-3.html * runtime/LiteralParser.cpp: (JSC::isJSONWhiteSpace): (JSC::LiteralParser::Lexer::lex): 2010-12-29 Helder Correia Reviewed by Eric Seidel. and are not valid JSON whitespace characters https://bugs.webkit.org/show_bug.cgi?id=51671 Vertical Tab and Form Feed are not allowed white spaces by the JSON RFC 4627: http://www.ietf.org/rfc/rfc4627.txt (2. JSON Grammar). * ietestcenter/Javascript/15.12.1.1-0-2-expected.txt: * ietestcenter/Javascript/15.12.1.1-0-3-expected.txt: git-svn-id: http://svn.webkit.org/repository/webkit/trunk@74737 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- JavaScriptCore/ChangeLog | 17 +++++++++++++++++ JavaScriptCore/runtime/LiteralParser.cpp | 9 ++++++++- LayoutTests/ChangeLog | 13 +++++++++++++ .../ietestcenter/Javascript/15.12.1.1-0-2-expected.txt | 2 +- .../ietestcenter/Javascript/15.12.1.1-0-3-expected.txt | 2 +- 5 files changed, 40 insertions(+), 3 deletions(-) diff --git a/JavaScriptCore/ChangeLog b/JavaScriptCore/ChangeLog index e25bd50..c868f29 100644 --- a/JavaScriptCore/ChangeLog +++ b/JavaScriptCore/ChangeLog @@ -1,3 +1,20 @@ +2010-12-29 Helder Correia + + Reviewed by Eric Seidel. + + and are not valid JSON whitespace characters + https://bugs.webkit.org/show_bug.cgi?id=51671 + + Vertical Tab and Form Feed are not allowed white spaces by the JSON + RFC 4627: http://www.ietf.org/rfc/rfc4627.txt (2. JSON Grammar). + + Tests: ietestcenter/Javascript/15.12.1.1-0-2.html + ietestcenter/Javascript/15.12.1.1-0-3.html + + * runtime/LiteralParser.cpp: + (JSC::isJSONWhiteSpace): + (JSC::LiteralParser::Lexer::lex): + 2010-12-28 Helder Correia Reviewed by Eric Seidel. diff --git a/JavaScriptCore/runtime/LiteralParser.cpp b/JavaScriptCore/runtime/LiteralParser.cpp index ed69f4d..df87e7f 100644 --- a/JavaScriptCore/runtime/LiteralParser.cpp +++ b/JavaScriptCore/runtime/LiteralParser.cpp @@ -35,9 +35,16 @@ namespace JSC { +static inline bool isJSONWhiteSpace(const UChar& c) +{ + // The JSON RFC 4627 defines a list of allowed characters to be considered + // insignificant white space: http://www.ietf.org/rfc/rfc4627.txt (2. JSON Grammar). + return c == ' ' || c == 0x9 || c == 0xA || c == 0xD; +} + LiteralParser::TokenType LiteralParser::Lexer::lex(LiteralParserToken& token) { - while (m_ptr < m_end && isASCIISpace(*m_ptr)) + while (m_ptr < m_end && isJSONWhiteSpace(*m_ptr)) ++m_ptr; ASSERT(m_ptr <= m_end); diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog index d929cd9..87c16b3 100644 --- a/LayoutTests/ChangeLog +++ b/LayoutTests/ChangeLog @@ -1,3 +1,16 @@ +2010-12-29 Helder Correia + + Reviewed by Eric Seidel. + + and are not valid JSON whitespace characters + https://bugs.webkit.org/show_bug.cgi?id=51671 + + Vertical Tab and Form Feed are not allowed white spaces by the JSON + RFC 4627: http://www.ietf.org/rfc/rfc4627.txt (2. JSON Grammar). + + * ietestcenter/Javascript/15.12.1.1-0-2-expected.txt: + * ietestcenter/Javascript/15.12.1.1-0-3-expected.txt: + 2010-12-29 Philippe Normand Unreviewed, skip flaky test on GTK. diff --git a/LayoutTests/ietestcenter/Javascript/15.12.1.1-0-2-expected.txt b/LayoutTests/ietestcenter/Javascript/15.12.1.1-0-2-expected.txt index 495920d..0042770 100644 --- a/LayoutTests/ietestcenter/Javascript/15.12.1.1-0-2-expected.txt +++ b/LayoutTests/ietestcenter/Javascript/15.12.1.1-0-2-expected.txt @@ -4,7 +4,7 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE PASS ES5Harness.preconditionPassed is true -FAIL ES5Harness.testPassed should be true (of type boolean). Was undefined (of type undefined). +PASS ES5Harness.testPassed is true PASS successfullyParsed is true TEST COMPLETE diff --git a/LayoutTests/ietestcenter/Javascript/15.12.1.1-0-3-expected.txt b/LayoutTests/ietestcenter/Javascript/15.12.1.1-0-3-expected.txt index 4d0f6fc..669046c 100644 --- a/LayoutTests/ietestcenter/Javascript/15.12.1.1-0-3-expected.txt +++ b/LayoutTests/ietestcenter/Javascript/15.12.1.1-0-3-expected.txt @@ -4,7 +4,7 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE PASS ES5Harness.preconditionPassed is true -FAIL ES5Harness.testPassed should be true (of type boolean). Was undefined (of type undefined). +PASS ES5Harness.testPassed is true PASS successfullyParsed is true TEST COMPLETE -- 2.7.4