Title: [211137] trunk
Revision
211137
Author
[email protected]
Date
2017-01-24 23:49:49 -0800 (Tue, 24 Jan 2017)

Log Message

REGRESSION (r208902): URLWithUserTypedString returns nil with file URLs
https://bugs.webkit.org/show_bug.cgi?id=167402
Source/WebCore:

<rdar://problem/29896656>

Reviewed by Ryosuke Niwa.

Covered by a new API test.

* platform/mac/WebCoreNSURLExtras.mm:
(WebCore::mapHostNameWithRange):
uidna_IDNToASCII succeeds when length is 0.
uidna_nameToASCII fails when length is 0.
This causes bad things to happen with file URLs, which have no host, so their host length is 0.
This makes us match behavior before r208902.

Tools:


Reviewed by Ryosuke Niwa.

* TestWebKitAPI/Tests/WebCore/cocoa/URLExtras.mm:
(TestWebKitAPI::TEST):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (211136 => 211137)


--- trunk/Source/WebCore/ChangeLog	2017-01-25 06:30:23 UTC (rev 211136)
+++ trunk/Source/WebCore/ChangeLog	2017-01-25 07:49:49 UTC (rev 211137)
@@ -1,3 +1,20 @@
+2017-01-24  Alex Christensen  <[email protected]>
+
+        REGRESSION (r208902): URLWithUserTypedString returns nil with file URLs
+        https://bugs.webkit.org/show_bug.cgi?id=167402
+        <rdar://problem/29896656>
+
+        Reviewed by Ryosuke Niwa.
+
+        Covered by a new API test.
+
+        * platform/mac/WebCoreNSURLExtras.mm:
+        (WebCore::mapHostNameWithRange):
+        uidna_IDNToASCII succeeds when length is 0.
+        uidna_nameToASCII fails when length is 0.
+        This causes bad things to happen with file URLs, which have no host, so their host length is 0.
+        This makes us match behavior before r208902.
+
 2017-01-24  Joseph Pecoraro  <[email protected]>
 
         Fold USER_TIMING into WEB_TIMING and make it a RuntimeEnabledFeature

Modified: trunk/Source/WebCore/platform/mac/WebCoreNSURLExtras.mm (211136 => 211137)


--- trunk/Source/WebCore/platform/mac/WebCoreNSURLExtras.mm	2017-01-25 06:30:23 UTC (rev 211136)
+++ trunk/Source/WebCore/platform/mac/WebCoreNSURLExtras.mm	2017-01-25 07:49:49 UTC (rev 211137)
@@ -481,7 +481,7 @@
     UErrorCode uerror = U_ZERO_ERROR;
     UIDNAInfo processingDetails = UIDNA_INFO_INITIALIZER;
     int32_t numCharactersConverted = (encode ? uidna_nameToASCII : uidna_nameToUnicode)(&URLParser::internationalDomainNameTranscoder(), sourceBuffer, length, destinationBuffer, HOST_NAME_BUFFER_LENGTH, &processingDetails, &uerror);
-    if (U_FAILURE(uerror) || processingDetails.errors) {
+    if (length && (U_FAILURE(uerror) || processingDetails.errors)) {
         *error = YES;
         return nil;
     }

Modified: trunk/Tools/ChangeLog (211136 => 211137)


--- trunk/Tools/ChangeLog	2017-01-25 06:30:23 UTC (rev 211136)
+++ trunk/Tools/ChangeLog	2017-01-25 07:49:49 UTC (rev 211137)
@@ -1,3 +1,13 @@
+2017-01-24  Alex Christensen  <[email protected]>
+
+        REGRESSION (r208902): URLWithUserTypedString returns nil with file URLs
+        https://bugs.webkit.org/show_bug.cgi?id=167402
+
+        Reviewed by Ryosuke Niwa.
+
+        * TestWebKitAPI/Tests/WebCore/cocoa/URLExtras.mm:
+        (TestWebKitAPI::TEST):
+
 2017-01-24  Zalan Bujtas  <[email protected]>
 
         Add simple line layout toggle to MiniBrowser

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


--- trunk/Tools/TestWebKitAPI/Tests/WebCore/cocoa/URLExtras.mm	2017-01-25 06:30:23 UTC (rev 211136)
+++ trunk/Tools/TestWebKitAPI/Tests/WebCore/cocoa/URLExtras.mm	2017-01-25 07:49:49 UTC (rev 211137)
@@ -127,6 +127,11 @@
     EXPECT_STREQ("site.com\xE3\x80\x80othersite.org", [WebCore::decodeHostName(@"site.com\xE3\x80\x80othersite.org") UTF8String]);
 }
 
+TEST(WebCore, URLExtras_File)
+{
+    EXPECT_STREQ("file:///%E2%98%83", [[WebCore::URLWithUserTypedString(@"file:///☃", nil) absoluteString] UTF8String]);
+}
+
 TEST(WebCore, URLExtras_ParsingError)
 {
     // Expect IDN failure.
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to