Changeset 256629 in webkit


Ignore:
Timestamp:
Feb 14, 2020 11:09:32 AM (4 years ago)
Author:
commit-queue@webkit.org
Message:

Allow UIDNAInfo.errors from uidna_nameToUnicode that would not cause URL parsing failures
https://bugs.webkit.org/show_bug.cgi?id=207360
<rdar://problem/57825317>

Patch by Alex Christensen <achristensen@webkit.org> on 2020-02-14
Reviewed by Ryosuke Niwa.

Source/WTF:

  • wtf/URLHelpers.cpp:

(WTF::URLHelpers::mapHostName):

Tools:

  • TestWebKitAPI/Tests/WTF/cocoa/URLExtras.mm:

(TestWebKitAPI::TEST):

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WTF/ChangeLog

    r256501 r256629  
     12020-02-14  Alex Christensen  <achristensen@webkit.org>
     2
     3        Allow UIDNAInfo.errors from uidna_nameToUnicode that would not cause URL parsing failures
     4        https://bugs.webkit.org/show_bug.cgi?id=207360
     5        <rdar://problem/57825317>
     6
     7        Reviewed by Ryosuke Niwa.
     8
     9        * wtf/URLHelpers.cpp:
     10        (WTF::URLHelpers::mapHostName):
     11
    1122020-02-12  Said Abou-Hallawa  <sabouhallawa@apple.com>
    213
  • trunk/Source/WTF/wtf/URLHelpers.cpp

    r250747 r256629  
    549549    UIDNAInfo processingDetails = UIDNA_INFO_INITIALIZER;
    550550    int32_t numCharactersConverted = (decodeFunction ? uidna_nameToASCII : uidna_nameToUnicode)(&URLParser::internationalDomainNameTranscoder(), sourceBuffer.data(), length, destinationBuffer, hostNameBufferLength, &processingDetails, &uerror);
    551     if (length && (U_FAILURE(uerror) || processingDetails.errors))
     551    int allowedErrors = decodeFunction ? 0 : UIDNA_ERROR_EMPTY_LABEL | UIDNA_ERROR_LEADING_HYPHEN | UIDNA_ERROR_TRAILING_HYPHEN | UIDNA_ERROR_HYPHEN_3_4;
     552    if (length && (U_FAILURE(uerror) || processingDetails.errors & ~allowedErrors))
    552553        return nullopt;
    553554   
  • trunk/Tools/ChangeLog

    r256601 r256629  
     12020-02-14  Alex Christensen  <achristensen@webkit.org>
     2
     3        Allow UIDNAInfo.errors from uidna_nameToUnicode that would not cause URL parsing failures
     4        https://bugs.webkit.org/show_bug.cgi?id=207360
     5        <rdar://problem/57825317>
     6
     7        Reviewed by Ryosuke Niwa.
     8
     9        * TestWebKitAPI/Tests/WTF/cocoa/URLExtras.mm:
     10        (TestWebKitAPI::TEST):
     11
    1122020-02-14  Don Olmstead  <don.olmstead@sony.com>
    213
  • trunk/Tools/TestWebKitAPI/Tests/WTF/cocoa/URLExtras.mm

    r244903 r256629  
    7171    EXPECT_STREQ("http://site.com", userVisibleString(literalURL("http://site.com")));
    7272    EXPECT_STREQ("http://%77ebsite.com", userVisibleString(literalURL("http://%77ebsite.com")));
     73
     74    EXPECT_STREQ("-.example.com", [WTF::decodeHostName(@"-.example.com") UTF8String]);
     75    EXPECT_STREQ("-a.example.com", [WTF::decodeHostName(@"-a.example.com") UTF8String]);
     76    EXPECT_STREQ("a-.example.com", [WTF::decodeHostName(@"a-.example.com") UTF8String]);
     77    EXPECT_STREQ("ab--cd.example.com", [WTF::decodeHostName(@"ab--cd.example.com") UTF8String]);
     78    EXPECT_STREQ(".example.com", [WTF::decodeHostName(@"xn--.example.com") UTF8String]);
     79    EXPECT_STREQ("a..example.com", [WTF::decodeHostName(@"a..example.com") UTF8String]);
    7380}
    7481   
Note: See TracChangeset for help on using the changeset viewer.