Roll out r205580 and r205582.
authorachristensen@apple.com <achristensen@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 8 Sep 2016 05:59:38 +0000 (05:59 +0000)
committerachristensen@apple.com <achristensen@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 8 Sep 2016 05:59:38 +0000 (05:59 +0000)
https://bugs.webkit.org/show_bug.cgi?id=161668

I need to figure out why this is failing on the bots before landing any more URLParser progress.

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

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

index 48c8dfc..f35b753 100644 (file)
@@ -1,3 +1,10 @@
+2016-09-07  Alex Christensen  <achristensen@webkit.org>
+
+        Roll out r205580 and r205582.
+        https://bugs.webkit.org/show_bug.cgi?id=161668
+
+        I need to figure out why this is failing on the bots before landing any more URLParser progress.
+
 2016-09-07  Yusuke Suzuki  <utatane.tea@gmail.com>
 
         Unreviewed, EFL build fix after r205581
index 8b04d3e..14c2511 100644 (file)
@@ -28,7 +28,6 @@
 
 #include "Logging.h"
 #include <array>
-#include <unicode/uidna.h>
 #include <wtf/HashMap.h>
 #include <wtf/NeverDestroyed.h>
 #include <wtf/text/StringBuilder.h>
@@ -451,8 +450,7 @@ URL URLParser::parse(const String& input, const URL& base, const TextEncoding& e
         case State::SchemeEndCheckForSlashes:
             LOG_STATE("SchemeEndCheckForSlashes");
             if (*c == '/') {
-                m_buffer.append("//");
-                m_url.m_userStart = m_buffer.length();
+                m_buffer.append('/');
                 state = State::PathOrAuthority;
                 ++c;
             } else {
@@ -517,13 +515,11 @@ URL URLParser::parse(const String& input, const URL& base, const TextEncoding& e
                 break;
             case '?':
                 copyURLPartsUntil(base, URLPart::PathEnd);
-                m_buffer.append('?');
                 state = State::Query;
                 ++c;
                 break;
             case '#':
                 copyURLPartsUntil(base, URLPart::QueryEnd);
-                m_buffer.append('#');
                 state = State::Fragment;
                 ++c;
                 break;
@@ -845,12 +841,6 @@ URL URLParser::parse(const String& input, const URL& base, const TextEncoding& e
         break;
     case State::RelativeSlash:
         LOG_FINAL_STATE("RelativeSlash");
-        copyURLPartsUntil(base, URLPart::PortEnd);
-        m_buffer.append('/');
-        m_url.m_pathAfterLastSlash = base.m_portEnd + 1;
-        m_url.m_pathEnd = m_url.m_pathAfterLastSlash;
-        m_url.m_queryEnd = m_url.m_pathAfterLastSlash;
-        m_url.m_fragmentEnd = m_url.m_pathAfterLastSlash;
         break;
     case State::SpecialAuthoritySlashes:
         LOG_FINAL_STATE("SpecialAuthoritySlashes");
@@ -1279,50 +1269,11 @@ static String percentDecode(const String& input)
     return output.toStringPreserveCapacity();
 }
 
-static bool containsOnlyASCII(const String& string)
-{
-    if (string.is8Bit())
-        return charactersAreAllASCII(string.characters8(), string.length());
-    return charactersAreAllASCII(string.characters16(), string.length());
-}
-
 static Optional<String> domainToASCII(const String& domain)
 {
-    const unsigned hostnameBufferLength = 2048;
-
-    if (containsOnlyASCII(domain)) {
-        if (domain.is8Bit())
-            return domain;
-        Vector<LChar, hostnameBufferLength> buffer;
-        size_t length = domain.length();
-        buffer.reserveInitialCapacity(length);
-        for (size_t i = 0; i < length; ++i)
-            buffer.append(domain[i]);
-        return String(buffer.data(), length);
-    }
-    
-    UChar hostnameBuffer[hostnameBufferLength];
-
-    // FIXME: This is slow, but it covers up a mysterious bug on the bots when logging is disabled.
-    // The URLParser should not be enabled until this bug is found and resolved.
-    // See https://bugs.webkit.org/show_bug.cgi?id=161668
-    memset(hostnameBuffer, 0, sizeof(hostnameBuffer));
-
-    UErrorCode error = U_ZERO_ERROR;
-    
-    int32_t numCharactersConverted = uidna_IDNToASCII(StringView(domain).upconvertedCharacters(), domain.length(), hostnameBuffer, hostnameBufferLength, UIDNA_ALLOW_UNASSIGNED, nullptr, &error);
-
-    if (error == U_ZERO_ERROR) {
-        LChar buffer[hostnameBufferLength];
-        for (int32_t i = 0; i < numCharactersConverted; ++i) {
-            ASSERT(isASCII(hostnameBuffer[i]));
-            buffer[i] = hostnameBuffer[i];
-        }
-        return String(buffer, numCharactersConverted);
-    }
-
-    // FIXME: Check for U_BUFFER_OVERFLOW_ERROR and retry with an allocated buffer.
-    return Nullopt;
+    // FIXME: Implement correctly
+    CString utf8 = domain.utf8();
+    return String(utf8.data(), utf8.length());
 }
 
 static bool hasInvalidDomainCharacter(const String& asciiDomain)
index e7078c5..830b51a 100644 (file)
@@ -1,5 +1,12 @@
 2016-09-07  Alex Christensen  <achristensen@webkit.org>
 
+        Roll out r205580 and r205582.
+        https://bugs.webkit.org/show_bug.cgi?id=161668
+
+        I need to figure out why this is failing on the bots before landing any more URLParser progress.
+
+2016-09-07  Alex Christensen  <achristensen@webkit.org>
+
         Unreviewed, revert r205533.
         https://bugs.webkit.org/show_bug.cgi?id=161668
 
index 83160af..e635f98 100644 (file)
@@ -84,16 +84,6 @@ static void checkURL(const String& urlString, const ExpectedParts& parts)
     EXPECT_TRUE(URLParser::allValuesEqual(url, oldURL));
 }
 
-template<size_t length>
-static String wideString(const wchar_t (&url)[length])
-{
-    StringBuilder builder;
-    builder.reserveCapacity(length - 1);
-    for (size_t i = 0; i < length - 1; ++i)
-        builder.append(url[i]);
-    return builder.toString();
-}
-
 TEST_F(URLParserTest, Basic)
 {
     checkURL("http://user:pass@webkit.org:123/path?query#fragment", {"http", "user", "pass", "webkit.org", 123, "/path", "query", "fragment", "http://user:pass@webkit.org:123/path?query#fragment"});
@@ -219,17 +209,6 @@ TEST_F(URLParserTest, ParseRelative)
     checkRelativeURL("//whatwg.org/index.html", "https://www.webkit.org/path", {"https", "", "", "whatwg.org", 0, "/index.html", "", "", "https://whatwg.org/index.html"});
     checkRelativeURL("http://example\t.\norg", "http://example.org/foo/bar", {"http", "", "", "example.org", 0, "/", "", "", "http://example.org/"});
     checkRelativeURL("test", "file:///path1/path2", {"file", "", "", "", 0, "/path1/test", "", "", "file:///path1/test"});
-    checkRelativeURL(wideString(L"http://www.foo。bar.com"), "http://other.com/", {"http", "", "", "www.foo.bar.com", 0, "/", "", "", "http://www.foo.bar.com/"});
-    checkRelativeURL(wideString(L"sc://ñ.test/"), "about:blank", {"sc", "", "", "xn--ida.test", 0, "/", "", "", "sc://xn--ida.test/"});
-    checkRelativeURL("#fragment", "http://host/path", {"http", "", "", "host", 0, "/path", "", "fragment", "http://host/path#fragment"});
-    checkRelativeURL("?query", "http://host/path", {"http", "", "", "host", 0, "/path", "query", "", "http://host/path?query"});
-    checkRelativeURL("?query#fragment", "http://host/path", {"http", "", "", "host", 0, "/path", "query", "fragment", "http://host/path?query#fragment"});
-    checkRelativeURL(wideString(L"?β"), "http://example.org/foo/bar", {"http", "", "", "example.org", 0, "/foo/bar", "%CE%B2", "", "http://example.org/foo/bar?%CE%B2"});
-    checkRelativeURL("?", "http://example.org/foo/bar", {"http", "", "", "example.org", 0, "/foo/bar", "", "", "http://example.org/foo/bar?"});
-    checkRelativeURL("#", "http://example.org/foo/bar", {"http", "", "", "example.org", 0, "/foo/bar", "", "", "http://example.org/foo/bar#"});
-    checkRelativeURL("?#", "http://example.org/foo/bar", {"http", "", "", "example.org", 0, "/foo/bar", "", "", "http://example.org/foo/bar?#"});
-    checkRelativeURL("#?", "http://example.org/foo/bar", {"http", "", "", "example.org", 0, "/foo/bar", "", "?", "http://example.org/foo/bar#?"});
-    checkRelativeURL("/", "http://example.org/foo/bar", {"http", "", "", "example.org", 0, "/", "", "", "http://example.org/"});
 }
 
 static void checkURLDifferences(const String& urlString, const ExpectedParts& partsNew, const ExpectedParts& partsOld)
@@ -351,9 +330,6 @@ TEST_F(URLParserTest, ParserDifferences)
     checkURLDifferences("file://[0:a:0:0:b:c:0:0]/path",
         {"file", "", "", "[0:a::b:c:0:0]", 0, "/path", "", "", "file://[0:a::b:c:0:0]/path"},
         {"file", "", "", "[0:a:0:0:b:c:0:0]", 0, "/path", "", "", "file://[0:a:0:0:b:c:0:0]/path"});
-    checkRelativeURLDifferences(wideString(L"#β"), "http://example.org/foo/bar",
-        {"http", "", "", "example.org", 0, "/foo/bar", "", wideString(L"β"), wideString(L"http://example.org/foo/bar#β")},
-        {"http", "", "", "example.org", 0, "/foo/bar", "", "%CE%B2", "http://example.org/foo/bar#%CE%B2"});
 
     // FIXME: This behavior ought to be specified in the standard.
     // With the existing URL::parse, WebKit returns "https:/", Firefox returns "https:///", and Chrome throws an error.
@@ -375,9 +351,6 @@ TEST_F(URLParserTest, ParserDifferences)
         {"http", "", "", "host%73", 0, "/", "", "", "http://host%73/"});
     
     // URLParser matches Chrome and the spec, but not URL::parse or Firefox.
-    checkURLDifferences(wideString(L"http://0Xc0.0250.01"),
-        {"http", "", "", "192.168.0.1", 0, "/", "", "", "http://192.168.0.1/"},
-        {"http", "", "", "0xc0.0250.01", 0, "/", "", "", "http://0xc0.0250.01/"});
     checkURLDifferences("http://host/path%2e.%2E",
         {"http", "", "", "host", 0, "/path...", "", "", "http://host/path..."},
         {"http", "", "", "host", 0, "/path%2e.%2E", "", "", "http://host/path%2e.%2E"});