Title: [236702] trunk
Revision
236702
Author
achristen...@apple.com
Date
2018-10-01 17:16:54 -0700 (Mon, 01 Oct 2018)

Log Message

Unreviewed, rolling out r236551.

Fails URL validating too aggressively

Reverted changeset:

"URLWithUserTypedString should return nil for URLs deemed to
be invalid by WebCore::URL"
https://bugs.webkit.org/show_bug.cgi?id=189979
https://trac.webkit.org/changeset/236551

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (236701 => 236702)


--- trunk/Source/WebCore/ChangeLog	2018-10-02 00:07:04 UTC (rev 236701)
+++ trunk/Source/WebCore/ChangeLog	2018-10-02 00:16:54 UTC (rev 236702)
@@ -1,3 +1,16 @@
+2018-10-01  Alex Christensen  <achristen...@webkit.org>
+
+        Unreviewed, rolling out r236551.
+
+        Fails URL validating too aggressively
+
+        Reverted changeset:
+
+        "URLWithUserTypedString should return nil for URLs deemed to
+        be invalid by WebCore::URL"
+        https://bugs.webkit.org/show_bug.cgi?id=189979
+        https://trac.webkit.org/changeset/236551
+
 2018-10-01  Keith Miller  <keith_mil...@apple.com>
 
         Create a RELEASE_AND_RETURN macro for ExceptionScopes

Modified: trunk/Source/WebCore/platform/mac/WebCoreNSURLExtras.mm (236701 => 236702)


--- trunk/Source/WebCore/platform/mac/WebCoreNSURLExtras.mm	2018-10-02 00:07:04 UTC (rev 236701)
+++ trunk/Source/WebCore/platform/mac/WebCoreNSURLExtras.mm	2018-10-02 00:16:54 UTC (rev 236702)
@@ -895,7 +895,7 @@
 
     // Let's check whether the URL is bogus.
     URL url { URL { nsURL }, string };
-    if (!url.isValid() || !url.createCFURL())
+    if (!url.createCFURL())
         return nil;
 
     // FIXME: https://bugs.webkit.org/show_bug.cgi?id=186057
@@ -935,8 +935,6 @@
 
 NSData *dataForURLComponentType(NSURL *URL, CFURLComponentType componentType)
 {
-    if (!URL)
-        return nil;
     Vector<UInt8, URL_BYTES_BUFFER_LENGTH> allBytesBuffer(URL_BYTES_BUFFER_LENGTH);
     CFIndex bytesFilled = CFURLGetBytes((__bridge CFURLRef)URL, allBytesBuffer.data(), allBytesBuffer.size());
     if (bytesFilled == -1) {
@@ -986,8 +984,6 @@
 
 static NSURL *URLByRemovingComponentAndSubsequentCharacter(NSURL *URL, CFURLComponentType component)
 {
-    if (!URL)
-        return nil;
     CFRange range = CFURLGetByteRangeForComponent((__bridge CFURLRef)URL, component, 0);
     if (range.location == kCFNotFound)
         return URL;
@@ -1025,8 +1021,6 @@
 
 NSURL *URLByCanonicalizingURL(NSURL *URL)
 {
-    if (!URL)
-        return nil;
     RetainPtr<NSURLRequest> request = adoptNS([[NSURLRequest alloc] initWithURL:URL]);
     Class concreteClass = [NSURLProtocol _protocolClassForRequest:request.get()];
     if (!concreteClass) {
@@ -1044,8 +1038,6 @@
 
 NSData *originalURLData(NSURL *URL)
 {
-    if (!URL)
-        return nil;
     UInt8 *buffer = (UInt8 *)malloc(URL_BYTES_BUFFER_LENGTH);
     CFIndex bytesFilled = CFURLGetBytes((__bridge CFURLRef)URL, buffer, URL_BYTES_BUFFER_LENGTH);
     if (bytesFilled == -1) {
@@ -1107,8 +1099,6 @@
 
 NSString *userVisibleString(NSURL *URL)
 {
-    if (!URL)
-        return nil;
     NSData *data = ""
     const unsigned char *before = static_cast<const unsigned char*>([data bytes]);
     int length = [data length];

Modified: trunk/Tools/ChangeLog (236701 => 236702)


--- trunk/Tools/ChangeLog	2018-10-02 00:07:04 UTC (rev 236701)
+++ trunk/Tools/ChangeLog	2018-10-02 00:16:54 UTC (rev 236702)
@@ -1,3 +1,16 @@
+2018-10-01  Alex Christensen  <achristen...@webkit.org>
+
+        Unreviewed, rolling out r236551.
+
+        Fails URL validating too aggressively
+
+        Reverted changeset:
+
+        "URLWithUserTypedString should return nil for URLs deemed to
+        be invalid by WebCore::URL"
+        https://bugs.webkit.org/show_bug.cgi?id=189979
+        https://trac.webkit.org/changeset/236551
+
 2018-10-01  Wenson Hsieh  <wenson_hs...@apple.com>
 
         [iOS] Add SPI to customize the input accessory view when focusing an element

Modified: trunk/Tools/TestWebKitAPI/Tests/WebCore/cocoa/URLExtras.mm (236701 => 236702)


--- trunk/Tools/TestWebKitAPI/Tests/WebCore/cocoa/URLExtras.mm	2018-10-02 00:07:04 UTC (rev 236701)
+++ trunk/Tools/TestWebKitAPI/Tests/WebCore/cocoa/URLExtras.mm	2018-10-02 00:16:54 UTC (rev 236702)
@@ -50,8 +50,6 @@
 
 static const char* originalDataAsString(NSURL *URL)
 {
-    if (!URL)
-        return "NULL";
     return dataAsString(WebCore::originalURLData(URL));
 }
 
@@ -167,8 +165,8 @@
     // Selected ideographic space, which looks like the ASCII space, which is not allowed unescaped.
 
     // Code path similar to the one used when typing in a URL.
-    EXPECT_STREQ("NULL", originalDataAsString(WebCore::URLWithUserTypedString(@"http://site.com\xE3\x80\x80othersite.org", nil)));
-    EXPECT_STREQ(nullptr, userVisibleString(WebCore::URLWithUserTypedString(@"http://site.com\xE3\x80\x80othersite.org", nil)));
+    EXPECT_STREQ("http://site.com%20othersite.org", originalDataAsString(WebCore::URLWithUserTypedString(@"http://site.com\xE3\x80\x80othersite.org", nil)));
+    EXPECT_STREQ("http://site.com%20othersite.org", userVisibleString(WebCore::URLWithUserTypedString(@"http://site.com\xE3\x80\x80othersite.org", nil)));
 
     // Code paths similar to the ones used for URLs found in webpages or HTTP responses.
     EXPECT_STREQ("http://site.com\xE3\x80\x80othersite.org", originalDataAsString(literalURL("http://site.com\xE3\x80\x80othersite.org")));
@@ -194,8 +192,6 @@
 
     NSString *encodedHostName = WebCore::encodeHostName(@"http://.com");
     EXPECT_TRUE(encodedHostName == nil);
-    
-    EXPECT_TRUE(WebCore::URLWithUserTypedString(@"https://a@/b", nil) == nil);
 }
 
 TEST(WebCore, URLExtras_Nil)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to