Changeset 206219 in webkit


Ignore:
Timestamp:
Sep 21, 2016 11:02:52 AM (8 years ago)
Author:
achristensen@apple.com
Message:

URLParser: Correctly parse URLs that are just nonspecialscheme:/
https://bugs.webkit.org/show_bug.cgi?id=162340

Reviewed by Tim Horton.

Source/WebCore:

Covered by new API tests.

  • platform/URLParser.cpp:

(WebCore::URLParser::parse):
r206162 wasn't quite right. If a url is just nonspecialscheme:/ then the path should indeed be /

Tools:

  • TestWebKitAPI/Tests/WebCore/URLParser.cpp:

(TestWebKitAPI::TEST_F):

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r206218 r206219  
     12016-09-21  Alex Christensen  <achristensen@webkit.org>
     2
     3        URLParser: Correctly parse URLs that are just nonspecialscheme:/
     4        https://bugs.webkit.org/show_bug.cgi?id=162340
     5
     6        Reviewed by Tim Horton.
     7
     8        Covered by new API tests.
     9
     10        * platform/URLParser.cpp:
     11        (WebCore::URLParser::parse):
     12        r206162 wasn't quite right.  If a url is just nonspecialscheme:/ then the path should indeed be /
     13
    1142016-09-21  Alex Christensen  <achristensen@webkit.org>
    215
  • trunk/Source/WebCore/platform/URLParser.cpp

    r206218 r206219  
    14741474    case State::PathOrAuthority:
    14751475        LOG_FINAL_STATE("PathOrAuthority");
    1476         m_url.m_userEnd = m_asciiBuffer.size();
    1477         m_url.m_passwordEnd = m_url.m_userEnd;
    1478         m_url.m_hostEnd = m_url.m_userEnd;
    1479         m_url.m_portEnd = m_url.m_userEnd;
    1480         m_url.m_pathAfterLastSlash = m_url.m_userEnd;
     1476        ASSERT(m_url.m_userStart);
     1477        ASSERT(m_url.m_userStart == m_asciiBuffer.size());
     1478        ASSERT(m_asciiBuffer.last() == '/');
     1479        m_url.m_userStart--;
     1480        m_url.m_userEnd = m_url.m_userStart;
     1481        m_url.m_passwordEnd = m_url.m_userStart;
     1482        m_url.m_hostEnd = m_url.m_userStart;
     1483        m_url.m_portEnd = m_url.m_userStart;
     1484        m_url.m_pathAfterLastSlash = m_url.m_userStart + 1;
    14811485        m_url.m_pathEnd = m_url.m_pathAfterLastSlash;
    14821486        m_url.m_queryEnd = m_url.m_pathAfterLastSlash;
  • trunk/Tools/ChangeLog

    r206218 r206219  
     12016-09-21  Alex Christensen  <achristensen@webkit.org>
     2
     3        URLParser: Correctly parse URLs that are just nonspecialscheme:/
     4        https://bugs.webkit.org/show_bug.cgi?id=162340
     5
     6        Reviewed by Tim Horton.
     7
     8        * TestWebKitAPI/Tests/WebCore/URLParser.cpp:
     9        (TestWebKitAPI::TEST_F):
     10
    1112016-09-21  Alex Christensen  <achristensen@webkit.org>
    212
  • trunk/Tools/TestWebKitAPI/Tests/WebCore/URLParser.cpp

    r206218 r206219  
    216216    checkURL("notspecial:/a", {"notspecial", "", "", "", 0, "/a", "", "", "notspecial:/a"});
    217217    checkURL("notspecial:", {"notspecial", "", "", "", 0, "", "", "", "notspecial:"});
     218    checkURL("notspecial:/", {"notspecial", "", "", "", 0, "/", "", "", "notspecial:/"});
    218219
    219220    // This disagrees with the web platform test for http://:@www.example.com but agrees with Chrome and URL::parse,
     
    303304    checkRelativeURL("!", "sc://ho/pa", {"sc", "", "", "ho", 0, "/!", "", "", "sc://ho/!"});
    304305    checkRelativeURL("!", "sc:/ho/pa", {"sc", "", "", "", 0, "/ho/!", "", "", "sc:/ho/!"});
    305    
     306    checkRelativeURL("notspecial:/", "about:blank", {"notspecial", "", "", "", 0, "/", "", "", "notspecial:/"});
     307    checkRelativeURL("notspecial:/", "http://host", {"notspecial", "", "", "", 0, "/", "", "", "notspecial:/"});
     308    checkRelativeURL("foo:/", "http://example.org/foo/bar", {"foo", "", "", "", 0, "/", "", "", "foo:/"});
     309
    306310    // The checking of slashes in SpecialAuthoritySlashes needed to get this to pass contradicts what is in the spec,
    307311    // but it is included in the web platform tests.
     
    568572        {"http", "", "", "host", 0, "/", "%C3%9F%F0%9F%98%8D", wideString(L"ß😍"), wideString(L"http://host/?%C3%9F%F0%9F%98%8D#ß😍")},
    569573        {"http", "", "", "host", 0, "/", "%C3%9F%F0%9F%98%8D", "%C3%9F%F0%9F%98%8D", "http://host/?%C3%9F%F0%9F%98%8D#%C3%9F%F0%9F%98%8D"});
    570 
    571     // This matches the spec and web platform tests, but not Chrome, Firefox, or URL::parse.
    572     checkRelativeURLDifferences("notspecial:/", "about:blank",
    573         {"notspecial", "", "", "", 0, "", "", "", "notspecial:/"},
    574         {"notspecial", "", "", "", 0, "/", "", "", "notspecial:/"});
    575     checkRelativeURLDifferences("notspecial:/", "http://host",
    576         {"notspecial", "", "", "", 0, "", "", "", "notspecial:/"},
    577         {"notspecial", "", "", "", 0, "/", "", "", "notspecial:/"});
    578     checkURLDifferences("notspecial:/",
    579         {"notspecial", "", "", "", 0, "", "", "", "notspecial:/"},
    580         {"notspecial", "", "", "", 0, "/", "", "", "notspecial:/"});
    581574}
    582575
Note: See TracChangeset for help on using the changeset viewer.