Unreviewed, rolling out r219024.
authorjlewis3@apple.com <jlewis3@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 3 Jul 2017 16:57:25 +0000 (16:57 +0000)
committerjlewis3@apple.com <jlewis3@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 3 Jul 2017 16:57:25 +0000 (16:57 +0000)
This patch cause 3 didferent test to fail.

Reverted changeset:

"REGRESSION(r215096) Queries of URLs with non-special schemes
should not percent-encode single quotes"
https://bugs.webkit.org/show_bug.cgi?id=174051
http://trac.webkit.org/changeset/219024

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@219073 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/URLParser.cpp
Tools/ChangeLog
Tools/TestWebKitAPI/Tests/WebCore/URLParser.cpp

index 68f6750..5cc6c75 100644 (file)
@@ -1,3 +1,16 @@
+2017-07-03  Matt Lewis  <jlewis3@apple.com>
+
+        Unreviewed, rolling out r219024.
+
+        This patch cause 3 didferent test to fail.
+
+        Reverted changeset:
+
+        "REGRESSION(r215096) Queries of URLs with non-special schemes
+        should not percent-encode single quotes"
+        https://bugs.webkit.org/show_bug.cgi?id=174051
+        http://trac.webkit.org/changeset/219024
+
 2017-07-03  Wenson Hsieh  <wenson_hsieh@apple.com>
 
         Pasting single words copied to UIPasteboard inserts URLs in editable areas
index 1e3d465..377ef22 100644 (file)
@@ -191,7 +191,7 @@ static const uint8_t characterClassTable[256] = {
     0, // '$'
     ForbiddenHost, // '%'
     0, // '&'
-    0, // '''
+    QueryPercent, // '''
     0, // '('
     0, // ')'
     0, // '*'
@@ -420,14 +420,7 @@ template<typename CharacterType> ALWAYS_INLINE static bool isPercentOrNonASCII(C
 template<typename CharacterType> ALWAYS_INLINE static bool isSlashQuestionOrHash(CharacterType character) { return character <= '\\' && characterClassTable[character] & SlashQuestionOrHash; }
 template<typename CharacterType> ALWAYS_INLINE static bool isValidSchemeCharacter(CharacterType character) { return character <= 'z' && characterClassTable[character] & ValidScheme; }
 template<typename CharacterType> ALWAYS_INLINE static bool isForbiddenHostCodePoint(CharacterType character) { return character <= ']' && characterClassTable[character] & ForbiddenHost; }
-ALWAYS_INLINE static bool shouldPercentEncodeQueryByte(uint8_t byte, const bool& urlIsSpecial)
-{
-    if (characterClassTable[byte] & QueryPercent)
-        return true;
-    if (byte == '\'' && urlIsSpecial)
-        return true;
-    return false;
-}
+static bool shouldPercentEncodeQueryByte(uint8_t byte) { return characterClassTable[byte] & QueryPercent; }
 
 template<typename CharacterType, URLParser::ReportSyntaxViolation reportSyntaxViolation>
 ALWAYS_INLINE void URLParser::advance(CodePointIterator<CharacterType>& iterator, const CodePointIterator<CharacterType>& iteratorForSyntaxViolationPosition)
@@ -585,7 +578,7 @@ ALWAYS_INLINE void URLParser::utf8QueryEncode(const CodePointIterator<CharacterT
     ASSERT(!iterator.atEnd());
     UChar32 codePoint = *iterator;
     if (LIKELY(isASCII(codePoint))) {
-        if (UNLIKELY(shouldPercentEncodeQueryByte(codePoint, m_urlIsSpecial))) {
+        if (UNLIKELY(shouldPercentEncodeQueryByte(codePoint))) {
             syntaxViolation(iterator);
             percentEncodeByte(codePoint);
         } else
@@ -605,7 +598,7 @@ ALWAYS_INLINE void URLParser::utf8QueryEncode(const CodePointIterator<CharacterT
     U8_APPEND_UNSAFE(buffer, offset, codePoint);
     for (int32_t i = 0; i < offset; ++i) {
         auto byte = buffer[i];
-        if (shouldPercentEncodeQueryByte(byte, m_urlIsSpecial))
+        if (shouldPercentEncodeQueryByte(byte))
             percentEncodeByte(byte);
         else
             appendToASCIIBuffer(byte);
@@ -633,7 +626,7 @@ void URLParser::encodeQuery(const Vector<UChar>& source, const TextEncoding& enc
             syntaxViolation(iterator);
             break;
         }
-        if (UNLIKELY(shouldPercentEncodeQueryByte(byte, m_urlIsSpecial))) {
+        if (UNLIKELY(shouldPercentEncodeQueryByte(byte))) {
             syntaxViolation(iterator);
             break;
         }
@@ -646,7 +639,7 @@ void URLParser::encodeQuery(const Vector<UChar>& source, const TextEncoding& enc
     for (; i < length; ++i) {
         ASSERT(m_didSeeSyntaxViolation);
         uint8_t byte = data[i];
-        if (shouldPercentEncodeQueryByte(byte, m_urlIsSpecial))
+        if (shouldPercentEncodeQueryByte(byte))
             percentEncodeByte(byte);
         else
             appendToASCIIBuffer(byte);
index 45c84a5..300ed20 100644 (file)
@@ -1,3 +1,16 @@
+2017-07-03  Matt Lewis  <jlewis3@apple.com>
+
+        Unreviewed, rolling out r219024.
+
+        This patch cause 3 didferent test to fail.
+
+        Reverted changeset:
+
+        "REGRESSION(r215096) Queries of URLs with non-special schemes
+        should not percent-encode single quotes"
+        https://bugs.webkit.org/show_bug.cgi?id=174051
+        http://trac.webkit.org/changeset/219024
+
 2017-07-03  Chris Dumez  <cdumez@apple.com>
 
         Drop ResourceLoadStatisticsStore's statisticsLock
index 01383a4..043e9c2 100644 (file)
@@ -1298,8 +1298,6 @@ TEST_F(URLParserTest, QueryEncoding)
     checkURL(makeString("gopher://host/path?", withUmlauts, "#fragment"), "asdf://example.com/?doesntmatter", iso88591, {"gopher", "", "", "host", 0, "/path", "%DC%26%231072%3B%26%231105%3B", "fragment", "gopher://host/path?%DC%26%231072%3B%26%231105%3B#fragment"});
     checkURL(makeString("asdf://host/path?", withUmlauts, "#fragment"), "http://example.com/?doesntmatter", iso88591, {"asdf", "", "", "host", 0, "/path", "%C3%9C%D0%B0%D1%91", "fragment", "asdf://host/path?%C3%9C%D0%B0%D1%91#fragment"});
 
-    checkURL("http://host/pa'th?qu'ery#fr'agment", UTF8Encoding(), {"http", "", "", "host", 0, "/pa'th", "qu%27ery", "fr'agment", "http://host/pa'th?qu%27ery#fr'agment"});
-    checkURL("asdf://host/pa'th?qu'ery#fr'agment", UTF8Encoding(), {"asdf", "", "", "host", 0, "/pa'th", "qu'ery", "fr'agment", "asdf://host/pa'th?qu'ery#fr'agment"});
     checkURL("http://host/?query=foo'bar", UTF8Encoding(), {"http", "", "", "host", 0, "/", "query=foo%27bar", "", "http://host/?query=foo%27bar"});
     // FIXME: Add more tests with other encodings and things like non-ascii characters, emoji and unmatched surrogate pairs.
 }