Changeset 225699 in webkit
- Timestamp:
- Dec 8, 2017 2:05:07 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WTF/wtf/JSONValues.cpp
r225231 r225699 537 537 const UChar* tokenEnd; 538 538 auto result = buildValue(start, end, &tokenEnd, 0); 539 if (!result || tokenEnd != end) 540 return false; 539 if (!result) 540 return false; 541 542 for (const UChar* valueEnd = tokenEnd; valueEnd < end; ++valueEnd) { 543 if (!isSpaceOrNewline(*valueEnd)) 544 return false; 545 } 541 546 542 547 output = WTFMove(result); -
trunk/Source/WebCore/ChangeLog
r225696 r225699 1 2017-12-08 David Quesada <david_quesada@apple.com> 2 3 ApplicationManifestParser should strip whitespace from the raw input 4 https://bugs.webkit.org/show_bug.cgi?id=180539 5 rdar://problem/35915075 6 7 Reviewed by Joseph Pecoraro. 8 9 * Modules/applicationmanifest/ApplicationManifestParser.cpp: 10 (WebCore::ApplicationManifestParser::parseManifest): 11 1 12 2017-12-08 Eric Carlson <eric.carlson@apple.com> 2 13 -
trunk/Tools/ChangeLog
r225698 r225699 1 2017-12-08 David Quesada <david_quesada@apple.com> 2 3 ApplicationManifestParser should strip whitespace from the raw input 4 https://bugs.webkit.org/show_bug.cgi?id=180539 5 rdar://problem/35915075 6 7 Reviewed by Joseph Pecoraro. 8 9 Added an API test for parsing manifests with surrounding whitespace. 10 11 Also drive-by fix ApplicationManifestParserTest.Display. Earlier versions of the 12 manifest spec explicitly stated that the "display" value should be treated as if 13 it were run through String.prototype.trim(), which allowed for the really weird 14 edge case of an array containing one string. This behavior was lost when I changed 15 ApplicationManifestParser's JSON parsing from using JavaScriptCore to WTF's JSON 16 parsing. Update the unit test accordingly. 17 18 * TestWebKitAPI/Tests/WebCore/ApplicationManifestParser.cpp: 19 (TEST_F): 20 1 21 2017-12-08 Konstantin Tokarev <annulen@yandex.ru> 2 22 -
trunk/Tools/TestWebKitAPI/Tests/WTF/JSONValue.cpp
r225425 r225699 636 636 EXPECT_FALSE(JSON::Value::parseJSON("[{\"foo\":{\"baz\":false}]", value)); 637 637 } 638 639 { 640 RefPtr<JSON::Value> value; 641 EXPECT_TRUE(JSON::Value::parseJSON(" \"foo\" \n", value)); 642 String stringValue; 643 EXPECT_TRUE(value->asString(stringValue)); 644 EXPECT_EQ("foo", stringValue); 645 } 646 647 { 648 RefPtr<JSON::Value> value; 649 EXPECT_TRUE(JSON::Value::parseJSON(" 1", value)); 650 EXPECT_TRUE(JSON::Value::parseJSON("\t1", value)); 651 EXPECT_TRUE(JSON::Value::parseJSON("\n1", value)); 652 EXPECT_TRUE(JSON::Value::parseJSON("1 ", value)); 653 EXPECT_TRUE(JSON::Value::parseJSON("1\t", value)); 654 EXPECT_TRUE(JSON::Value::parseJSON("1\n", value)); 655 EXPECT_TRUE(JSON::Value::parseJSON(" 1 ", value)); 656 EXPECT_TRUE(JSON::Value::parseJSON(" {} ", value)); 657 EXPECT_TRUE(JSON::Value::parseJSON(" [] ", value)); 658 659 EXPECT_FALSE(JSON::Value::parseJSON("1 1", value)); 660 EXPECT_FALSE(JSON::Value::parseJSON("{} {}", value)); 661 EXPECT_FALSE(JSON::Value::parseJSON("[] []", value)); 662 } 638 663 } 639 664 -
trunk/Tools/TestWebKitAPI/Tests/WebCore/ApplicationManifestParser.cpp
r225639 r225699 207 207 testDisplay("\"minimal-ui\"", ApplicationManifest::Display::MinimalUI); 208 208 testDisplay("\"fullscreen\"", ApplicationManifest::Display::Fullscreen); 209 210 testDisplay("[\"\\tMINIMAL-ui\\t\"]", ApplicationManifest::Display::MinimalUI); 209 testDisplay("\"\t\nMINIMAL-UI \"", ApplicationManifest::Display::MinimalUI); 211 210 } 212 211 … … 287 286 } 288 287 288 TEST_F(ApplicationManifestParserTest, Whitespace) 289 { 290 auto manifest = parseString(ASCIILiteral(" { \"name\": \"PASS\" }\n")); 291 292 EXPECT_STREQ("PASS", manifest.name.utf8().data()); 293 } 294 289 295 #endif
Note: See TracChangeset
for help on using the changeset viewer.