Changeset 263637 in webkit


Ignore:
Timestamp:
Jun 28, 2020 2:36:05 PM (4 years ago)
Author:
commit-queue@webkit.org
Message:

Setting url.search="??" (two questionmarks) has incorrect behavior
https://bugs.webkit.org/show_bug.cgi?id=170452

Patch by Rob Buis <rbuis@igalia.com> on 2020-06-28
Reviewed by Darin Adler.

LayoutTests/imported/w3c:

Update improved test result.

  • web-platform-tests/url/url-setters-expected.txt:

Source/WebCore:

There is no need to strip leading "?" character since
URLParser expects it to be there. This differs from the
specification algorithm [1], which relies on state override,
which URLParser does not support.

Behavior matches Firefox and Chrome.

Test: imported/w3c/web-platform-tests/url/url-setters.html

[1] https://url.spec.whatwg.org/#dom-url-search

  • html/URLDecomposition.cpp:

(WebCore::URLDecomposition::setSearch):

Location:
trunk
Files:
4 edited

Legend:

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

    r263626 r263637  
     12020-06-28  Rob Buis  <rbuis@igalia.com>
     2
     3        Setting url.search="??" (two questionmarks) has incorrect behavior
     4        https://bugs.webkit.org/show_bug.cgi?id=170452
     5
     6        Reviewed by Darin Adler.
     7
     8        Update improved test result.
     9
     10        * web-platform-tests/url/url-setters-expected.txt:
     11
    1122020-06-27  Chris Dumez  <cdumez@apple.com>
    213
  • trunk/LayoutTests/imported/w3c/web-platform-tests/url/url-setters-expected.txt

    r262900 r263637  
    541541PASS <a>: Setting <https://example.net?lang=en-US#nav>.search = '?lang=fr'
    542542PASS <area>: Setting <https://example.net?lang=en-US#nav>.search = '?lang=fr'
    543 FAIL URL: Setting <https://example.net?lang=en-US#nav>.search = '??lang=fr' assert_equals: expected "https://example.net/??lang=fr#nav" but got "https://example.net/?lang=fr#nav"
    544 FAIL <a>: Setting <https://example.net?lang=en-US#nav>.search = '??lang=fr' assert_equals: expected "https://example.net/??lang=fr#nav" but got "https://example.net/?lang=fr#nav"
    545 FAIL <area>: Setting <https://example.net?lang=en-US#nav>.search = '??lang=fr' assert_equals: expected "https://example.net/??lang=fr#nav" but got "https://example.net/?lang=fr#nav"
     543PASS URL: Setting <https://example.net?lang=en-US#nav>.search = '??lang=fr'
     544PASS <a>: Setting <https://example.net?lang=en-US#nav>.search = '??lang=fr'
     545PASS <area>: Setting <https://example.net?lang=en-US#nav>.search = '??lang=fr'
    546546PASS URL: Setting <https://example.net?lang=en-US#nav>.search = '?'
    547547PASS <a>: Setting <https://example.net?lang=en-US#nav>.search = '?'
  • trunk/Source/WebCore/ChangeLog

    r263635 r263637  
     12020-06-28  Rob Buis  <rbuis@igalia.com>
     2
     3        Setting url.search="??" (two questionmarks) has incorrect behavior
     4        https://bugs.webkit.org/show_bug.cgi?id=170452
     5
     6        Reviewed by Darin Adler.
     7
     8        There is no need to strip leading "?" character since
     9        URLParser expects it to be there. This differs from the
     10        specification algorithm [1], which relies on state override,
     11        which URLParser does not support.
     12
     13        Behavior matches Firefox and Chrome.
     14
     15        Test: imported/w3c/web-platform-tests/url/url-setters.html
     16
     17        [1] https://url.spec.whatwg.org/#dom-url-search
     18
     19        * html/URLDecomposition.cpp:
     20        (WebCore::URLDecomposition::setSearch):
     21
    1222020-06-28  Geoffrey Garen  <ggaren@apple.com>
    223
  • trunk/Source/WebCore/html/URLDecomposition.cpp

    r262900 r263637  
    222222        fullURL.setQuery({ });
    223223    } else {
    224         String newSearch = value.startsWith('?') ? value.substring(1) : value;
     224        String newSearch = value;
    225225        // Make sure that '#' in the query does not leak to the hash.
    226226        fullURL.setQuery(newSearch.replaceWithLiteral('#', "%23"));
Note: See TracChangeset for help on using the changeset viewer.