Changeset 208087 in webkit


Ignore:
Timestamp:
Oct 28, 2016, 5:20:38 PM (9 years ago)
Author:
achristensen@apple.com
Message:

Partially revert 207805 after resolution in URL spec issue 87
https://bugs.webkit.org/show_bug.cgi?id=164142

Reviewed by Andy Estes.

LayoutTests/imported/w3c:

  • web-platform-tests/url/a-element-expected.txt:
  • web-platform-tests/url/a-element-xhtml-expected.txt:
  • web-platform-tests/url/url-constructor-expected.txt:

Source/WebCore:

Covered by updated layout tests and API tests.

  • platform/URLParser.cpp:

(WebCore::URLParser::isSingleDotPathSegment):
(WebCore::URLParser::isDoubleDotPathSegment):
(WebCore::URLParser::consumeSingleDotPathSegment):
(WebCore::URLParser::consumeDoubleDotPathSegment):
Treat %2e%2e as .. and %2e as . but only if it is entirety of the path segment.
There are tests for URLs like http://host/abc%2edef which have not changed because
the %2e is not the entirety of the path segment.

Tools:

  • TestWebKitAPI/Tests/WebCore/URLParser.cpp:

(TestWebKitAPI::TEST_F):

LayoutTests:

  • fast/url/path-expected.txt:
  • fetch/fetch-url-serialization-expected.txt:
Location:
trunk
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r208083 r208087  
     12016-10-28  Alex Christensen  <achristensen@webkit.org>
     2
     3        Partially revert 207805 after resolution in URL spec issue 87
     4        https://bugs.webkit.org/show_bug.cgi?id=164142
     5
     6        Reviewed by Andy Estes.
     7
     8        * fast/url/path-expected.txt:
     9        * fetch/fetch-url-serialization-expected.txt:
     10
    1112016-10-28  Chris Dumez  <cdumez@apple.com>
    212
  • trunk/LayoutTests/fast/url/path-expected.txt

    r207805 r208087  
    1515PASS canonicalize('http://example.com/foo/../../..') is 'http://example.com/'
    1616PASS canonicalize('http://example.com/foo/../../../ton') is 'http://example.com/ton'
    17 FAIL canonicalize('http://example.com/foo/%2e') should be http://example.com/foo/. Was http://example.com/foo/%2e.
     17PASS canonicalize('http://example.com/foo/%2e') is 'http://example.com/foo/'
    1818FAIL canonicalize('http://example.com/foo/%2e%2') should be http://example.com/foo/.%2. Was http://example.com/foo/%2e%2.
    19 FAIL canonicalize('http://example.com/foo/%2e./%2e%2e/.%2e/%2e.bar') should be http://example.com/..bar. Was http://example.com/foo/%2e./%2e%2e/.%2e/%2e.bar.
     19FAIL canonicalize('http://example.com/foo/%2e./%2e%2e/.%2e/%2e.bar') should be http://example.com/..bar. Was http://example.com/%2e.bar.
    2020PASS canonicalize('http://example.com////../..') is 'http://example.com//'
    2121PASS canonicalize('http://example.com/foo/bar//../..') is 'http://example.com/foo/'
  • trunk/LayoutTests/fetch/fetch-url-serialization-expected.txt

    r207995 r208087  
    124124PASS Testing Request url 'http://example.com/foo/../../..' with base 'about:blank'
    125125PASS Testing Request url 'http://example.com/foo/../../../ton' with base 'about:blank'
    126 FAIL Testing Request url 'http://example.com/foo/%2e' with base 'about:blank' assert_equals: expected "http://example.com/foo/" but got "http://example.com/foo/%2e"
     126PASS Testing Request url 'http://example.com/foo/%2e' with base 'about:blank'
    127127FAIL Testing Request url 'http://example.com/foo/%2e%2' with base 'about:blank' assert_equals: expected "http://example.com/foo/.%2" but got "http://example.com/foo/%2e%2"
    128 FAIL Testing Request url 'http://example.com/foo/%2e./%2e%2e/.%2e/%2e.bar' with base 'about:blank' assert_equals: expected "http://example.com/..bar" but got "http://example.com/foo/%2e./%2e%2e/.%2e/%2e.bar"
     128FAIL Testing Request url 'http://example.com/foo/%2e./%2e%2e/.%2e/%2e.bar' with base 'about:blank' assert_equals: expected "http://example.com/..bar" but got "http://example.com/%2e.bar"
    129129PASS Testing Request url 'http://example.com////../..' with base 'about:blank'
    130130PASS Testing Request url 'http://example.com/foo/bar//../..' with base 'about:blank'
     
    156156PASS Testing Request url 'http://192.0x00A80001' with base 'about:blank'
    157157FAIL Testing Request url 'http://www/foo%2Ehtml' with base 'about:blank' assert_equals: expected "http://www/foo.html" but got "http://www/foo%2Ehtml"
    158 FAIL Testing Request url 'http://www/foo/%2E/html' with base 'about:blank' assert_equals: expected "http://www/foo/html" but got "http://www/foo/%2E/html"
     158PASS Testing Request url 'http://www/foo/%2E/html' with base 'about:blank'
    159159PASS Testing Request url 'http://user:pass@/' with base 'about:blank'
    160160PASS Testing Request url 'http://%25DOMAIN:foobar@foodomain.com/' with base 'about:blank'
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r208057 r208087  
     12016-10-28  Alex Christensen  <achristensen@webkit.org>
     2
     3        Partially revert 207805 after resolution in URL spec issue 87
     4        https://bugs.webkit.org/show_bug.cgi?id=164142
     5
     6        Reviewed by Andy Estes.
     7
     8        * web-platform-tests/url/a-element-expected.txt:
     9        * web-platform-tests/url/a-element-xhtml-expected.txt:
     10        * web-platform-tests/url/url-constructor-expected.txt:
     11
    1122016-10-28  Youenn Fablet  <youenn@apple.com>
    213
  • trunk/LayoutTests/imported/w3c/web-platform-tests/url/a-element-expected.txt

    r207995 r208087  
    127127PASS Parsing: <http://example.com/foo/../../..> against <about:blank>
    128128PASS Parsing: <http://example.com/foo/../../../ton> against <about:blank>
    129 FAIL Parsing: <http://example.com/foo/%2e> against <about:blank> assert_equals: href expected "http://example.com/foo/" but got "http://example.com/foo/%2e"
     129PASS Parsing: <http://example.com/foo/%2e> against <about:blank>
    130130FAIL Parsing: <http://example.com/foo/%2e%2> against <about:blank> assert_equals: href expected "http://example.com/foo/.%2" but got "http://example.com/foo/%2e%2"
    131 FAIL Parsing: <http://example.com/foo/%2e./%2e%2e/.%2e/%2e.bar> against <about:blank> assert_equals: href expected "http://example.com/..bar" but got "http://example.com/foo/%2e./%2e%2e/.%2e/%2e.bar"
     131FAIL Parsing: <http://example.com/foo/%2e./%2e%2e/.%2e/%2e.bar> against <about:blank> assert_equals: href expected "http://example.com/..bar" but got "http://example.com/%2e.bar"
    132132PASS Parsing: <http://example.com////../..> against <about:blank>
    133133PASS Parsing: <http://example.com/foo/bar//../..> against <about:blank>
     
    159159PASS Parsing: <http://192.0x00A80001> against <about:blank>
    160160FAIL Parsing: <http://www/foo%2Ehtml> against <about:blank> assert_equals: href expected "http://www/foo.html" but got "http://www/foo%2Ehtml"
    161 FAIL Parsing: <http://www/foo/%2E/html> against <about:blank> assert_equals: href expected "http://www/foo/html" but got "http://www/foo/%2E/html"
     161PASS Parsing: <http://www/foo/%2E/html> against <about:blank>
    162162PASS Parsing: <http://user:pass@/> against <about:blank>
    163163PASS Parsing: <http://%25DOMAIN:foobar@foodomain.com/> against <about:blank>
  • trunk/LayoutTests/imported/w3c/web-platform-tests/url/a-element-xhtml-expected.txt

    r207995 r208087  
    127127PASS Parsing: <http://example.com/foo/../../..> against <about:blank>
    128128PASS Parsing: <http://example.com/foo/../../../ton> against <about:blank>
    129 FAIL Parsing: <http://example.com/foo/%2e> against <about:blank> assert_equals: href expected "http://example.com/foo/" but got "http://example.com/foo/%2e"
     129PASS Parsing: <http://example.com/foo/%2e> against <about:blank>
    130130FAIL Parsing: <http://example.com/foo/%2e%2> against <about:blank> assert_equals: href expected "http://example.com/foo/.%2" but got "http://example.com/foo/%2e%2"
    131 FAIL Parsing: <http://example.com/foo/%2e./%2e%2e/.%2e/%2e.bar> against <about:blank> assert_equals: href expected "http://example.com/..bar" but got "http://example.com/foo/%2e./%2e%2e/.%2e/%2e.bar"
     131FAIL Parsing: <http://example.com/foo/%2e./%2e%2e/.%2e/%2e.bar> against <about:blank> assert_equals: href expected "http://example.com/..bar" but got "http://example.com/%2e.bar"
    132132PASS Parsing: <http://example.com////../..> against <about:blank>
    133133PASS Parsing: <http://example.com/foo/bar//../..> against <about:blank>
     
    159159PASS Parsing: <http://192.0x00A80001> against <about:blank>
    160160FAIL Parsing: <http://www/foo%2Ehtml> against <about:blank> assert_equals: href expected "http://www/foo.html" but got "http://www/foo%2Ehtml"
    161 FAIL Parsing: <http://www/foo/%2E/html> against <about:blank> assert_equals: href expected "http://www/foo/html" but got "http://www/foo/%2E/html"
     161PASS Parsing: <http://www/foo/%2E/html> against <about:blank>
    162162PASS Parsing: <http://user:pass@/> against <about:blank>
    163163PASS Parsing: <http://%25DOMAIN:foobar@foodomain.com/> against <about:blank>
  • trunk/LayoutTests/imported/w3c/web-platform-tests/url/url-constructor-expected.txt

    r207995 r208087  
    131131PASS Parsing: <http://example.com/foo/../../..> against <about:blank>
    132132PASS Parsing: <http://example.com/foo/../../../ton> against <about:blank>
    133 FAIL Parsing: <http://example.com/foo/%2e> against <about:blank> assert_equals: href expected "http://example.com/foo/" but got "http://example.com/foo/%2e"
     133PASS Parsing: <http://example.com/foo/%2e> against <about:blank>
    134134FAIL Parsing: <http://example.com/foo/%2e%2> against <about:blank> assert_equals: href expected "http://example.com/foo/.%2" but got "http://example.com/foo/%2e%2"
    135 FAIL Parsing: <http://example.com/foo/%2e./%2e%2e/.%2e/%2e.bar> against <about:blank> assert_equals: href expected "http://example.com/..bar" but got "http://example.com/foo/%2e./%2e%2e/.%2e/%2e.bar"
     135FAIL Parsing: <http://example.com/foo/%2e./%2e%2e/.%2e/%2e.bar> against <about:blank> assert_equals: href expected "http://example.com/..bar" but got "http://example.com/%2e.bar"
    136136PASS Parsing: <http://example.com////../..> against <about:blank>
    137137PASS Parsing: <http://example.com/foo/bar//../..> against <about:blank>
     
    163163PASS Parsing: <http://192.0x00A80001> against <about:blank>
    164164FAIL Parsing: <http://www/foo%2Ehtml> against <about:blank> assert_equals: href expected "http://www/foo.html" but got "http://www/foo%2Ehtml"
    165 FAIL Parsing: <http://www/foo/%2E/html> against <about:blank> assert_equals: href expected "http://www/foo/html" but got "http://www/foo/%2E/html"
     165PASS Parsing: <http://www/foo/%2E/html> against <about:blank>
    166166PASS Parsing: <http://user:pass@/> against <about:blank>
    167167PASS Parsing: <http://%25DOMAIN:foobar@foodomain.com/> against <about:blank>
  • trunk/Source/WebCore/ChangeLog

    r208086 r208087  
     12016-10-28  Alex Christensen  <achristensen@webkit.org>
     2
     3        Partially revert 207805 after resolution in URL spec issue 87
     4        https://bugs.webkit.org/show_bug.cgi?id=164142
     5
     6        Reviewed by Andy Estes.
     7
     8        Covered by updated layout tests and API tests.
     9
     10        * platform/URLParser.cpp:
     11        (WebCore::URLParser::isSingleDotPathSegment):
     12        (WebCore::URLParser::isDoubleDotPathSegment):
     13        (WebCore::URLParser::consumeSingleDotPathSegment):
     14        (WebCore::URLParser::consumeDoubleDotPathSegment):
     15        Treat %2e%2e as .. and %2e as . but only if it is entirety of the path segment.
     16        There are tests for URLs like http://host/abc%2edef which have not changed because
     17        the %2e is not the entirety of the path segment.
     18
    1192016-10-28  Alex Christensen  <achristensen@webkit.org>
    220
  • trunk/Source/WebCore/platform/URLParser.cpp

    r208086 r208087  
    892892}
    893893
     894static const char dotASCIICode[2] = {'2', 'e'};
     895
    894896template<typename CharacterType>
    895897ALWAYS_INLINE bool URLParser::isSingleDotPathSegment(CodePointIterator<CharacterType> c)
     
    901903        return c.atEnd() || isSlashQuestionOrHash(*c);
    902904    }
     905    if (*c != '%')
     906        return false;
     907    advance<CharacterType, ReportSyntaxViolation::No>(c);
     908    if (c.atEnd() || *c != dotASCIICode[0])
     909        return false;
     910    advance<CharacterType, ReportSyntaxViolation::No>(c);
     911    if (c.atEnd())
     912        return false;
     913    if (toASCIILower(*c) == dotASCIICode[1]) {
     914        advance<CharacterType, ReportSyntaxViolation::No>(c);
     915        return c.atEnd() || isSlashQuestionOrHash(*c);
     916    }
    903917    return false;
    904918}
     
    913927        return isSingleDotPathSegment(c);
    914928    }
     929    if (*c != '%')
     930        return false;
     931    advance<CharacterType, ReportSyntaxViolation::No>(c);
     932    if (c.atEnd() || *c != dotASCIICode[0])
     933        return false;
     934    advance<CharacterType, ReportSyntaxViolation::No>(c);
     935    if (c.atEnd())
     936        return false;
     937    if (toASCIILower(*c) == dotASCIICode[1]) {
     938        advance<CharacterType, ReportSyntaxViolation::No>(c);
     939        return isSingleDotPathSegment(c);
     940    }
    915941    return false;
    916942}
     
    920946{
    921947    ASSERT(isSingleDotPathSegment(c));
    922     advance(c);
    923     if (!c.atEnd()) {
    924         if (*c == '/' || *c == '\\')
    925             advance(c);
    926         else
    927             ASSERT(*c == '?' || *c == '#');
     948    if (*c == '.') {
     949        advance(c);
     950        if (!c.atEnd()) {
     951            if (*c == '/' || *c == '\\')
     952                advance(c);
     953            else
     954                ASSERT(*c == '?' || *c == '#');
     955        }
     956    } else {
     957        ASSERT(*c == '%');
     958        advance(c);
     959        ASSERT(*c == dotASCIICode[0]);
     960        advance(c);
     961        ASSERT(toASCIILower(*c) == dotASCIICode[1]);
     962        advance(c);
     963        if (!c.atEnd()) {
     964            if (*c == '/' || *c == '\\')
     965                advance(c);
     966            else
     967                ASSERT(*c == '?' || *c == '#');
     968        }
    928969    }
    929970}
     
    933974{
    934975    ASSERT(isDoubleDotPathSegment(c));
    935     advance(c);
     976    if (*c == '.')
     977        advance(c);
     978    else {
     979        ASSERT(*c == '%');
     980        advance(c);
     981        ASSERT(*c == dotASCIICode[0]);
     982        advance(c);
     983        ASSERT(toASCIILower(*c) == dotASCIICode[1]);
     984        advance(c);
     985    }
    936986    consumeSingleDotPathSegment(c);
    937987}
  • trunk/Tools/ChangeLog

    r208086 r208087  
     12016-10-28  Alex Christensen  <achristensen@webkit.org>
     2
     3        Partially revert 207805 after resolution in URL spec issue 87
     4        https://bugs.webkit.org/show_bug.cgi?id=164142
     5
     6        Reviewed by Andy Estes.
     7
     8        * TestWebKitAPI/Tests/WebCore/URLParser.cpp:
     9        (TestWebKitAPI::TEST_F):
     10
    1112016-10-28  Alex Christensen  <achristensen@webkit.org>
    212
  • trunk/Tools/TestWebKitAPI/Tests/WebCore/URLParser.cpp

    r208086 r208087  
    597597        {"http", "", "", "127.0.0.1", 0, "/", "", "", "http://127.0.0.1/"},
    598598        {"http", "", "", "127.0.0.01", 0, "/", "", "", "http://127.0.0.01/"});
    599     checkURL("http://example.com/path1/.%2e", {"http", "", "", "example.com", 0, "/path1/.%2e", "", "", "http://example.com/path1/.%2e"});
    600     checkURL("http://example.com/path1/.%2E", {"http", "", "", "example.com", 0, "/path1/.%2E", "", "", "http://example.com/path1/.%2E"});
    601     checkURL("http://example.com/path1/.%2E/", {"http", "", "", "example.com", 0, "/path1/.%2E/", "", "", "http://example.com/path1/.%2E/"});
    602     checkURL("http://example.com/path1/%2e.", {"http", "", "", "example.com", 0, "/path1/%2e.", "", "", "http://example.com/path1/%2e."});
    603     checkURL("http://example.com/path1/%2E%2e", {"http", "", "", "example.com", 0, "/path1/%2E%2e", "", "", "http://example.com/path1/%2E%2e"});
    604     checkURL("http://example.com/path1/%2e", {"http", "", "", "example.com", 0, "/path1/%2e", "", "", "http://example.com/path1/%2e"});
    605     checkURL("http://example.com/path1/%2E", {"http", "", "", "example.com", 0, "/path1/%2E", "", "", "http://example.com/path1/%2E"});
    606     checkURL("http://example.com/path1/%2E/", {"http", "", "", "example.com", 0, "/path1/%2E/", "", "", "http://example.com/path1/%2E/"});
    607     checkURL("http://example.com/path1/path2/%2e?query", {"http", "", "", "example.com", 0, "/path1/path2/%2e", "query", "", "http://example.com/path1/path2/%2e?query"});
    608     checkURL("http://example.com/path1/path2/%2e%2e?query", {"http", "", "", "example.com", 0, "/path1/path2/%2e%2e", "query", "", "http://example.com/path1/path2/%2e%2e?query"});
    609     checkURL("http://example.com/path1/path2/%2e#fragment", {"http", "", "", "example.com", 0, "/path1/path2/%2e", "", "fragment", "http://example.com/path1/path2/%2e#fragment"});
    610     checkURL("http://example.com/path1/path2/%2e%2e#fragment", {"http", "", "", "example.com", 0, "/path1/path2/%2e%2e", "", "fragment", "http://example.com/path1/path2/%2e%2e#fragment"});
     599    checkURLDifferences("http://example.com/path1/.%2e",
     600        {"http", "", "", "example.com", 0, "/", "", "", "http://example.com/"},
     601        {"http", "", "", "example.com", 0, "/path1/.%2e", "", "", "http://example.com/path1/.%2e"});
     602    checkURLDifferences("http://example.com/path1/.%2E",
     603        {"http", "", "", "example.com", 0, "/", "", "", "http://example.com/"},
     604        {"http", "", "", "example.com", 0, "/path1/.%2E", "", "", "http://example.com/path1/.%2E"});
     605    checkURLDifferences("http://example.com/path1/.%2E/",
     606        {"http", "", "", "example.com", 0, "/", "", "", "http://example.com/"},
     607        {"http", "", "", "example.com", 0, "/path1/.%2E/", "", "", "http://example.com/path1/.%2E/"});
     608    checkURLDifferences("http://example.com/path1/%2e.",
     609        {"http", "", "", "example.com", 0, "/", "", "", "http://example.com/"},
     610        {"http", "", "", "example.com", 0, "/path1/%2e.", "", "", "http://example.com/path1/%2e."});
     611    checkURLDifferences("http://example.com/path1/%2E%2e",
     612        {"http", "", "", "example.com", 0, "/", "", "", "http://example.com/"},
     613        {"http", "", "", "example.com", 0, "/path1/%2E%2e", "", "", "http://example.com/path1/%2E%2e"});
     614    checkURLDifferences("http://example.com/path1/%2e",
     615        {"http", "", "", "example.com", 0, "/path1/", "", "", "http://example.com/path1/"},
     616        {"http", "", "", "example.com", 0, "/path1/%2e", "", "", "http://example.com/path1/%2e"});
     617    checkURLDifferences("http://example.com/path1/%2E",
     618        {"http", "", "", "example.com", 0, "/path1/", "", "", "http://example.com/path1/"},
     619        {"http", "", "", "example.com", 0, "/path1/%2E", "", "", "http://example.com/path1/%2E"});
     620    checkURLDifferences("http://example.com/path1/%2E/",
     621        {"http", "", "", "example.com", 0, "/path1/", "", "", "http://example.com/path1/"},
     622        {"http", "", "", "example.com", 0, "/path1/%2E/", "", "", "http://example.com/path1/%2E/"});
     623    checkURLDifferences("http://example.com/path1/path2/%2e?query",
     624        {"http", "", "", "example.com", 0, "/path1/path2/", "query", "", "http://example.com/path1/path2/?query"},
     625        {"http", "", "", "example.com", 0, "/path1/path2/%2e", "query", "", "http://example.com/path1/path2/%2e?query"});
     626    checkURLDifferences("http://example.com/path1/path2/%2e%2e?query",
     627        {"http", "", "", "example.com", 0, "/path1/", "query", "", "http://example.com/path1/?query"},
     628        {"http", "", "", "example.com", 0, "/path1/path2/%2e%2e", "query", "", "http://example.com/path1/path2/%2e%2e?query"});
     629    checkURLDifferences("http://example.com/path1/path2/%2e#fragment",
     630        {"http", "", "", "example.com", 0, "/path1/path2/", "", "fragment", "http://example.com/path1/path2/#fragment"},
     631        {"http", "", "", "example.com", 0, "/path1/path2/%2e", "", "fragment", "http://example.com/path1/path2/%2e#fragment"});
     632    checkURLDifferences("http://example.com/path1/path2/%2e%2e#fragment",
     633        {"http", "", "", "example.com", 0, "/path1/", "", "fragment", "http://example.com/path1/#fragment"},
     634        {"http", "", "", "example.com", 0, "/path1/path2/%2e%2e", "", "fragment", "http://example.com/path1/path2/%2e%2e#fragment"});
     635    checkURL("http://example.com/path1/path2/A%2e%2e#fragment", {"http", "", "", "example.com", 0, "/path1/path2/A%2e%2e", "", "fragment", "http://example.com/path1/path2/A%2e%2e#fragment"});
    611636    checkURLDifferences("file://[0:a:0:0:b:c:0:0]/path",
    612637        {"file", "", "", "[0:a::b:c:0:0]", 0, "/path", "", "", "file://[0:a::b:c:0:0]/path"},
Note: See TracChangeset for help on using the changeset viewer.