Changeset 279662 in webkit


Ignore:
Timestamp:
Jul 7, 2021, 1:20:06 PM (3 years ago)
Author:
achristensen@apple.com
Message:

URL path setter should add "./" before non-empty path and after empty host for URLs with non-special schemes
https://bugs.webkit.org/show_bug.cgi?id=227750

Reviewed by Chris Dumez.

LayoutTests/imported/w3c:

  • web-platform-tests/url/url-setters-a-area.window-expected.txt:
  • web-platform-tests/url/url-setters.any-expected.txt:
  • web-platform-tests/url/url-setters.any.worker-expected.txt:

Source/WTF:

This is related to r267837 but in the path setter, too.
This helps preserve idempotence in parsed URLs.
This is an edge case that will rarely be hit in practice, but now the path setter matches the parser.

  • wtf/URL.cpp:

(WTF::URL::setPath):

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r279648 r279662  
     12021-07-07  Alex Christensen  <achristensen@webkit.org>
     2
     3        URL path setter should add "./" before non-empty path and after empty host for URLs with non-special schemes
     4        https://bugs.webkit.org/show_bug.cgi?id=227750
     5
     6        Reviewed by Chris Dumez.
     7
     8        * web-platform-tests/url/url-setters-a-area.window-expected.txt:
     9        * web-platform-tests/url/url-setters.any-expected.txt:
     10        * web-platform-tests/url/url-setters.any.worker-expected.txt:
     11
    1122021-07-07  Chris Dumez  <cdumez@apple.com>
    213
  • trunk/LayoutTests/imported/w3c/web-platform-tests/url/url-setters-a-area.window-expected.txt

    r279211 r279662  
    379379PASS <a>: Setting <non-spec:/>.pathname = '/..//p'
    380380PASS <area>: Setting <non-spec:/>.pathname = '/..//p'
    381 FAIL <a>: Setting <non-spec:/>.pathname = '//p' assert_equals: expected "non-spec:/.//p" but got "non-spec://p"
    382 FAIL <area>: Setting <non-spec:/>.pathname = '//p' assert_equals: expected "non-spec:/.//p" but got "non-spec://p"
     381PASS <a>: Setting <non-spec:/>.pathname = '//p'
     382PASS <area>: Setting <non-spec:/>.pathname = '//p'
    383383PASS <a>: Setting <non-spec:/.//>.pathname = 'p' Drop /. from path
    384384PASS <area>: Setting <non-spec:/.//>.pathname = 'p' Drop /. from path
  • trunk/LayoutTests/imported/w3c/web-platform-tests/url/url-setters.any-expected.txt

    r279211 r279662  
    190190PASS URL: Setting <non-spec:/>.pathname = '/.//p' Serialize /. in path
    191191PASS URL: Setting <non-spec:/>.pathname = '/..//p'
    192 FAIL URL: Setting <non-spec:/>.pathname = '//p' assert_equals: expected "non-spec:/.//p" but got "non-spec://p"
     192PASS URL: Setting <non-spec:/>.pathname = '//p'
    193193PASS URL: Setting <non-spec:/.//>.pathname = 'p' Drop /. from path
    194194PASS URL: Setting <https://example.net#nav>.search = 'lang=fr'
  • trunk/LayoutTests/imported/w3c/web-platform-tests/url/url-setters.any.worker-expected.txt

    r279211 r279662  
    190190PASS URL: Setting <non-spec:/>.pathname = '/.//p' Serialize /. in path
    191191PASS URL: Setting <non-spec:/>.pathname = '/..//p'
    192 FAIL URL: Setting <non-spec:/>.pathname = '//p' assert_equals: expected "non-spec:/.//p" but got "non-spec://p"
     192PASS URL: Setting <non-spec:/>.pathname = '//p'
    193193PASS URL: Setting <non-spec:/.//>.pathname = 'p' Drop /. from path
    194194PASS URL: Setting <https://example.net#nav>.search = 'lang=fr'
  • trunk/Source/WTF/ChangeLog

    r279660 r279662  
     12021-07-07  Alex Christensen  <achristensen@webkit.org>
     2
     3        URL path setter should add "./" before non-empty path and after empty host for URLs with non-special schemes
     4        https://bugs.webkit.org/show_bug.cgi?id=227750
     5
     6        Reviewed by Chris Dumez.
     7
     8        This is related to r267837 but in the path setter, too.
     9        This helps preserve idempotence in parsed URLs.
     10        This is an edge case that will rarely be hit in practice, but now the path setter matches the parser.
     11
     12        * wtf/URL.cpp:
     13        (WTF::URL::setPath):
     14
    1152021-07-07  Christopher Reid  <chris.reid@sony.com>
    216
  • trunk/Source/WTF/wtf/URL.cpp

    r279099 r279662  
    684684        StringView(m_string).left(pathStart()),
    685685        path.startsWith('/') || (path.startsWith('\\') && (hasSpecialScheme() || protocolIs("file"))) ? "" : "/",
     686        !hasSpecialScheme() && host().isEmpty() && path.startsWith("//") && path.length() > 2 ? "/." : "",
    686687        escapePathWithoutCopying(path),
    687688        StringView(m_string).substring(m_pathEnd)
Note: See TracChangeset for help on using the changeset viewer.