diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog index cc391bc487307..c70af9da910a9 100644 --- a/LayoutTests/ChangeLog +++ b/LayoutTests/ChangeLog @@ -1,3 +1,13 @@ +2016-10-24 Alex Christensen + + URLParser should match old URL::parse with %2E in path + https://bugs.webkit.org/show_bug.cgi?id=163929 + + Reviewed by Alexey Proskuryakov. + + * fast/url/path-expected.txt: + * fast/url/standard-url-expected.txt: + 2016-10-24 Zalan Bujtas Do not update selection rect on dirty lineboxes. diff --git a/LayoutTests/fast/url/path-expected.txt b/LayoutTests/fast/url/path-expected.txt index 7060c69ebf44d..e9b357d6f9f8c 100644 --- a/LayoutTests/fast/url/path-expected.txt +++ b/LayoutTests/fast/url/path-expected.txt @@ -14,9 +14,9 @@ PASS canonicalize('http://example.com/foo/bar/../ton') is 'http://example.com/fo PASS canonicalize('http://example.com/foo/bar/../ton/../../a') is 'http://example.com/a' PASS canonicalize('http://example.com/foo/../../..') is 'http://example.com/' PASS canonicalize('http://example.com/foo/../../../ton') is 'http://example.com/ton' -PASS canonicalize('http://example.com/foo/%2e') is 'http://example.com/foo/' -PASS canonicalize('http://example.com/foo/%2e%2') is 'http://example.com/foo/.%2' -PASS canonicalize('http://example.com/foo/%2e./%2e%2e/.%2e/%2e.bar') is 'http://example.com/..bar' +FAIL canonicalize('http://example.com/foo/%2e') should be http://example.com/foo/. Was http://example.com/foo/%2e. +FAIL canonicalize('http://example.com/foo/%2e%2') should be http://example.com/foo/.%2. Was http://example.com/foo/%2e%2. +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. PASS canonicalize('http://example.com////../..') is 'http://example.com//' PASS canonicalize('http://example.com/foo/bar//../..') is 'http://example.com/foo/' PASS canonicalize('http://example.com/foo/bar//..') is 'http://example.com/foo/bar/' diff --git a/LayoutTests/fast/url/standard-url-expected.txt b/LayoutTests/fast/url/standard-url-expected.txt index 6a3cff2def9f3..06d4613b35a5a 100644 --- a/LayoutTests/fast/url/standard-url-expected.txt +++ b/LayoutTests/fast/url/standard-url-expected.txt @@ -9,7 +9,7 @@ PASS canonicalize('http://[www.google.com]/') is 'http://[www.google.com]/' PASS canonicalize('http://www.google.com') is 'http://www.google.com/' PASS canonicalize('http:////////user:@google.com:99?foo') is 'http://user@google.com:99/?foo' PASS canonicalize('http://192.0x00A80001') is 'http://192.168.0.1/' -PASS canonicalize('http://www/foo%2Ehtml') is 'http://www/foo.html' +FAIL canonicalize('http://www/foo%2Ehtml') should be http://www/foo.html. Was http://www/foo%2Ehtml. PASS canonicalize('http://user:pass@/') is 'http://user:pass@/' PASS canonicalize('http://%25DOMAIN:foobar@foodomain.com/') is 'http://%25DOMAIN:foobar@foodomain.com/' PASS canonicalize('http:\\\\www.google.com\\foo') is 'http://www.google.com/foo' diff --git a/LayoutTests/imported/w3c/ChangeLog b/LayoutTests/imported/w3c/ChangeLog index 29a67b4258e7f..e7df0db6beb76 100644 --- a/LayoutTests/imported/w3c/ChangeLog +++ b/LayoutTests/imported/w3c/ChangeLog @@ -1,3 +1,14 @@ +2016-10-24 Alex Christensen + + URLParser should match old URL::parse with %2E in path + https://bugs.webkit.org/show_bug.cgi?id=163929 + + Reviewed by Alexey Proskuryakov. + + * 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: + 2016-10-24 Ryan Haddad Unreviewed, rolling out r207795. diff --git a/LayoutTests/imported/w3c/web-platform-tests/url/a-element-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/url/a-element-expected.txt index 40a911f9c0c8f..0c934a263aba8 100644 --- a/LayoutTests/imported/w3c/web-platform-tests/url/a-element-expected.txt +++ b/LayoutTests/imported/w3c/web-platform-tests/url/a-element-expected.txt @@ -126,9 +126,9 @@ PASS Parsing: against PASS Parsing: against PASS Parsing: against PASS Parsing: against -PASS Parsing: against -PASS Parsing: against -PASS Parsing: against +FAIL Parsing: against assert_equals: href expected "http://example.com/foo/" but got "http://example.com/foo/%2e" +FAIL Parsing: against assert_equals: href expected "http://example.com/foo/.%2" but got "http://example.com/foo/%2e%2" +FAIL Parsing: against assert_equals: href expected "http://example.com/..bar" but got "http://example.com/foo/%2e./%2e%2e/.%2e/%2e.bar" PASS Parsing: against PASS Parsing: against PASS Parsing: against @@ -157,8 +157,8 @@ FAIL Parsing: against assert_equals: href expected PASS Parsing: against PASS Parsing: against PASS Parsing: against -PASS Parsing: against -PASS Parsing: against +FAIL Parsing: against assert_equals: href expected "http://www/foo.html" but got "http://www/foo%2Ehtml" +FAIL Parsing: against assert_equals: href expected "http://www/foo/html" but got "http://www/foo/%2E/html" PASS Parsing: against PASS Parsing: against PASS Parsing: against diff --git a/LayoutTests/imported/w3c/web-platform-tests/url/a-element-xhtml-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/url/a-element-xhtml-expected.txt index 40a911f9c0c8f..0c934a263aba8 100644 --- a/LayoutTests/imported/w3c/web-platform-tests/url/a-element-xhtml-expected.txt +++ b/LayoutTests/imported/w3c/web-platform-tests/url/a-element-xhtml-expected.txt @@ -126,9 +126,9 @@ PASS Parsing: against PASS Parsing: against PASS Parsing: against PASS Parsing: against -PASS Parsing: against -PASS Parsing: against -PASS Parsing: against +FAIL Parsing: against assert_equals: href expected "http://example.com/foo/" but got "http://example.com/foo/%2e" +FAIL Parsing: against assert_equals: href expected "http://example.com/foo/.%2" but got "http://example.com/foo/%2e%2" +FAIL Parsing: against assert_equals: href expected "http://example.com/..bar" but got "http://example.com/foo/%2e./%2e%2e/.%2e/%2e.bar" PASS Parsing: against PASS Parsing: against PASS Parsing: against @@ -157,8 +157,8 @@ FAIL Parsing: against assert_equals: href expected PASS Parsing: against PASS Parsing: against PASS Parsing: against -PASS Parsing: against -PASS Parsing: against +FAIL Parsing: against assert_equals: href expected "http://www/foo.html" but got "http://www/foo%2Ehtml" +FAIL Parsing: against assert_equals: href expected "http://www/foo/html" but got "http://www/foo/%2E/html" PASS Parsing: against PASS Parsing: against PASS Parsing: against diff --git a/LayoutTests/imported/w3c/web-platform-tests/url/url-constructor-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/url/url-constructor-expected.txt index 64f6872c8edcb..01c8060cbb287 100644 --- a/LayoutTests/imported/w3c/web-platform-tests/url/url-constructor-expected.txt +++ b/LayoutTests/imported/w3c/web-platform-tests/url/url-constructor-expected.txt @@ -130,9 +130,9 @@ PASS Parsing: against PASS Parsing: against PASS Parsing: against PASS Parsing: against -PASS Parsing: against -PASS Parsing: against -PASS Parsing: against +FAIL Parsing: against assert_equals: href expected "http://example.com/foo/" but got "http://example.com/foo/%2e" +FAIL Parsing: against assert_equals: href expected "http://example.com/foo/.%2" but got "http://example.com/foo/%2e%2" +FAIL Parsing: against assert_equals: href expected "http://example.com/..bar" but got "http://example.com/foo/%2e./%2e%2e/.%2e/%2e.bar" PASS Parsing: against PASS Parsing: against PASS Parsing: against @@ -161,8 +161,8 @@ FAIL Parsing: against assert_equals: href expected PASS Parsing: against PASS Parsing: against PASS Parsing: against -PASS Parsing: against -PASS Parsing: against +FAIL Parsing: against assert_equals: href expected "http://www/foo.html" but got "http://www/foo%2Ehtml" +FAIL Parsing: against assert_equals: href expected "http://www/foo/html" but got "http://www/foo/%2E/html" PASS Parsing: against PASS Parsing: against PASS Parsing: against diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog index bb2d9a36bdcd4..8aefc5df58574 100644 --- a/Source/WebCore/ChangeLog +++ b/Source/WebCore/ChangeLog @@ -1,3 +1,22 @@ +2016-10-24 Alex Christensen + + URLParser should match old URL::parse with %2E in path + https://bugs.webkit.org/show_bug.cgi?id=163929 + + Reviewed by Alexey Proskuryakov. + + Covered by updated API tests, which show that URLParser now matches URL::parse in these cases. + Also covered by newly failing web platform tests, which were failing before URLParser was enabled. + If https://github.com/whatwg/url/issues/87 is resolved we can change behavior to match. + + * platform/URLParser.cpp: + (WebCore::URLParser::isSingleDotPathSegment): + (WebCore::URLParser::isDoubleDotPathSegment): + (WebCore::URLParser::consumeSingleDotPathSegment): + (WebCore::URLParser::consumeDoubleDotPathSegment): + (WebCore::URLParser::parse): + (WebCore::URLParser::isPercentEncodedDot): Deleted. + 2016-10-24 Zalan Bujtas Do not update selection rect on dirty lineboxes. diff --git a/Source/WebCore/platform/URLParser.cpp b/Source/WebCore/platform/URLParser.cpp index a4f55e4e01e24..5a65e04a902a1 100644 --- a/Source/WebCore/platform/URLParser.cpp +++ b/Source/WebCore/platform/URLParser.cpp @@ -891,26 +891,6 @@ void URLParser::copyURLPartsUntil(const URL& base, URLPart part, const CodePoint ASSERT_NOT_REACHED(); } -static const char* dotASCIICode = "2e"; - -template -ALWAYS_INLINE bool URLParser::isPercentEncodedDot(CodePointIterator c) -{ - if (c.atEnd()) - return false; - if (*c != '%') - return false; - advance(c); - if (c.atEnd()) - return false; - if (*c != dotASCIICode[0]) - return false; - advance(c); - if (c.atEnd()) - return false; - return toASCIILower(*c) == dotASCIICode[1]; -} - template ALWAYS_INLINE bool URLParser::isSingleDotPathSegment(CodePointIterator c) { @@ -920,18 +900,6 @@ ALWAYS_INLINE bool URLParser::isSingleDotPathSegment(CodePointIterator(c); return c.atEnd() || isSlashQuestionOrHash(*c); } - if (*c != '%') - return false; - advance(c); - if (c.atEnd() || *c != dotASCIICode[0]) - return false; - advance(c); - if (c.atEnd()) - return false; - if (toASCIILower(*c) == dotASCIICode[1]) { - advance(c); - return c.atEnd() || isSlashQuestionOrHash(*c); - } return false; } @@ -944,18 +912,6 @@ ALWAYS_INLINE bool URLParser::isDoubleDotPathSegment(CodePointIterator(c); return isSingleDotPathSegment(c); } - if (*c != '%') - return false; - advance(c); - if (c.atEnd() || *c != dotASCIICode[0]) - return false; - advance(c); - if (c.atEnd()) - return false; - if (toASCIILower(*c) == dotASCIICode[1]) { - advance(c); - return isSingleDotPathSegment(c); - } return false; } @@ -963,27 +919,12 @@ template void URLParser::consumeSingleDotPathSegment(CodePointIterator& c) { ASSERT(isSingleDotPathSegment(c)); - if (*c == '.') { - advance(c); - if (!c.atEnd()) { - if (*c == '/' || *c == '\\') - advance(c); - else - ASSERT(*c == '?' || *c == '#'); - } - } else { - ASSERT(*c == '%'); - advance(c); - ASSERT(*c == dotASCIICode[0]); - advance(c); - ASSERT(toASCIILower(*c) == dotASCIICode[1]); - advance(c); - if (!c.atEnd()) { - if (*c == '/' || *c == '\\') - advance(c); - else - ASSERT(*c == '?' || *c == '#'); - } + advance(c); + if (!c.atEnd()) { + if (*c == '/' || *c == '\\') + advance(c); + else + ASSERT(*c == '?' || *c == '#'); } } @@ -991,16 +932,7 @@ template void URLParser::consumeDoubleDotPathSegment(CodePointIterator& c) { ASSERT(isDoubleDotPathSegment(c)); - if (*c == '.') - advance(c); - else { - ASSERT(*c == '%'); - advance(c); - ASSERT(*c == dotASCIICode[0]); - advance(c); - ASSERT(toASCIILower(*c) == dotASCIICode[1]); - advance(c); - } + advance(c); consumeSingleDotPathSegment(c); } @@ -1723,17 +1655,6 @@ void URLParser::parse(const CharacterType* input, const unsigned length, const U state = State::Fragment; break; } - if (UNLIKELY(isPercentEncodedDot(c))) { - syntaxViolation(c); - appendToASCIIBuffer('.'); - ASSERT(*c == '%'); - advance(c); - ASSERT(*c == dotASCIICode[0]); - advance(c); - ASSERT(toASCIILower(*c) == dotASCIICode[1]); - advance(c); - break; - } utf8PercentEncode(c); ++c; break; diff --git a/Tools/ChangeLog b/Tools/ChangeLog index deaa4df28a6a2..cd855e0c6e9de 100644 --- a/Tools/ChangeLog +++ b/Tools/ChangeLog @@ -1,3 +1,13 @@ +2016-10-24 Alex Christensen + + URLParser should match old URL::parse with %2E in path + https://bugs.webkit.org/show_bug.cgi?id=163929 + + Reviewed by Alexey Proskuryakov. + + * TestWebKitAPI/Tests/WebCore/URLParser.cpp: + (TestWebKitAPI::TEST_F): + 2016-10-24 Ryan Haddad Unreviewed, rolling out r207795. diff --git a/Tools/TestWebKitAPI/Tests/WebCore/URLParser.cpp b/Tools/TestWebKitAPI/Tests/WebCore/URLParser.cpp index f3dcddfec9ace..95be5e5232ea8 100644 --- a/Tools/TestWebKitAPI/Tests/WebCore/URLParser.cpp +++ b/Tools/TestWebKitAPI/Tests/WebCore/URLParser.cpp @@ -596,42 +596,18 @@ TEST_F(URLParserTest, ParserDifferences) checkURLDifferences("http://127.0.0.01/", {"http", "", "", "127.0.0.1", 0, "/", "", "", "http://127.0.0.1/"}, {"http", "", "", "127.0.0.01", 0, "/", "", "", "http://127.0.0.01/"}); - checkURLDifferences("http://example.com/path1/.%2e", - {"http", "", "", "example.com", 0, "/", "", "", "http://example.com/"}, - {"http", "", "", "example.com", 0, "/path1/.%2e", "", "", "http://example.com/path1/.%2e"}); - checkURLDifferences("http://example.com/path1/.%2E", - {"http", "", "", "example.com", 0, "/", "", "", "http://example.com/"}, - {"http", "", "", "example.com", 0, "/path1/.%2E", "", "", "http://example.com/path1/.%2E"}); - checkURLDifferences("http://example.com/path1/.%2E/", - {"http", "", "", "example.com", 0, "/", "", "", "http://example.com/"}, - {"http", "", "", "example.com", 0, "/path1/.%2E/", "", "", "http://example.com/path1/.%2E/"}); - checkURLDifferences("http://example.com/path1/%2e.", - {"http", "", "", "example.com", 0, "/", "", "", "http://example.com/"}, - {"http", "", "", "example.com", 0, "/path1/%2e.", "", "", "http://example.com/path1/%2e."}); - checkURLDifferences("http://example.com/path1/%2E%2e", - {"http", "", "", "example.com", 0, "/", "", "", "http://example.com/"}, - {"http", "", "", "example.com", 0, "/path1/%2E%2e", "", "", "http://example.com/path1/%2E%2e"}); - checkURLDifferences("http://example.com/path1/%2e", - {"http", "", "", "example.com", 0, "/path1/", "", "", "http://example.com/path1/"}, - {"http", "", "", "example.com", 0, "/path1/%2e", "", "", "http://example.com/path1/%2e"}); - checkURLDifferences("http://example.com/path1/%2E", - {"http", "", "", "example.com", 0, "/path1/", "", "", "http://example.com/path1/"}, - {"http", "", "", "example.com", 0, "/path1/%2E", "", "", "http://example.com/path1/%2E"}); - checkURLDifferences("http://example.com/path1/%2E/", - {"http", "", "", "example.com", 0, "/path1/", "", "", "http://example.com/path1/"}, - {"http", "", "", "example.com", 0, "/path1/%2E/", "", "", "http://example.com/path1/%2E/"}); - checkURLDifferences("http://example.com/path1/path2/%2e?query", - {"http", "", "", "example.com", 0, "/path1/path2/", "query", "", "http://example.com/path1/path2/?query"}, - {"http", "", "", "example.com", 0, "/path1/path2/%2e", "query", "", "http://example.com/path1/path2/%2e?query"}); - checkURLDifferences("http://example.com/path1/path2/%2e%2e?query", - {"http", "", "", "example.com", 0, "/path1/", "query", "", "http://example.com/path1/?query"}, - {"http", "", "", "example.com", 0, "/path1/path2/%2e%2e", "query", "", "http://example.com/path1/path2/%2e%2e?query"}); - checkURLDifferences("http://example.com/path1/path2/%2e#fragment", - {"http", "", "", "example.com", 0, "/path1/path2/", "", "fragment", "http://example.com/path1/path2/#fragment"}, - {"http", "", "", "example.com", 0, "/path1/path2/%2e", "", "fragment", "http://example.com/path1/path2/%2e#fragment"}); - checkURLDifferences("http://example.com/path1/path2/%2e%2e#fragment", - {"http", "", "", "example.com", 0, "/path1/", "", "fragment", "http://example.com/path1/#fragment"}, - {"http", "", "", "example.com", 0, "/path1/path2/%2e%2e", "", "fragment", "http://example.com/path1/path2/%2e%2e#fragment"}); + checkURL("http://example.com/path1/.%2e", {"http", "", "", "example.com", 0, "/path1/.%2e", "", "", "http://example.com/path1/.%2e"}); + checkURL("http://example.com/path1/.%2E", {"http", "", "", "example.com", 0, "/path1/.%2E", "", "", "http://example.com/path1/.%2E"}); + checkURL("http://example.com/path1/.%2E/", {"http", "", "", "example.com", 0, "/path1/.%2E/", "", "", "http://example.com/path1/.%2E/"}); + checkURL("http://example.com/path1/%2e.", {"http", "", "", "example.com", 0, "/path1/%2e.", "", "", "http://example.com/path1/%2e."}); + checkURL("http://example.com/path1/%2E%2e", {"http", "", "", "example.com", 0, "/path1/%2E%2e", "", "", "http://example.com/path1/%2E%2e"}); + checkURL("http://example.com/path1/%2e", {"http", "", "", "example.com", 0, "/path1/%2e", "", "", "http://example.com/path1/%2e"}); + checkURL("http://example.com/path1/%2E", {"http", "", "", "example.com", 0, "/path1/%2E", "", "", "http://example.com/path1/%2E"}); + checkURL("http://example.com/path1/%2E/", {"http", "", "", "example.com", 0, "/path1/%2E/", "", "", "http://example.com/path1/%2E/"}); + checkURL("http://example.com/path1/path2/%2e?query", {"http", "", "", "example.com", 0, "/path1/path2/%2e", "query", "", "http://example.com/path1/path2/%2e?query"}); + 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"}); + checkURL("http://example.com/path1/path2/%2e#fragment", {"http", "", "", "example.com", 0, "/path1/path2/%2e", "", "fragment", "http://example.com/path1/path2/%2e#fragment"}); + 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"}); checkURLDifferences("file://[0:a:0:0:b:c:0:0]/path", {"file", "", "", "[0:a::b:c:0:0]", 0, "/path", "", "", "file://[0:a::b:c:0:0]/path"}, {"file", "", "", "[0:a:0:0:b:c:0:0]", 0, "/path", "", "", "file://[0:a:0:0:b:c:0:0]/path"}); @@ -734,9 +710,8 @@ TEST_F(URLParserTest, ParserDifferences) checkURLDifferences(utf16String(u"http://0Xc0.0250.01"), {"http", "", "", "192.168.0.1", 0, "/", "", "", "http://192.168.0.1/"}, {"http", "", "", "0xc0.0250.01", 0, "/", "", "", "http://0xc0.0250.01/"}); - checkURLDifferences("http://host/path%2e.%2E", - {"http", "", "", "host", 0, "/path...", "", "", "http://host/path..."}, - {"http", "", "", "host", 0, "/path%2e.%2E", "", "", "http://host/path%2e.%2E"}); + + checkURL("http://host/path%2e.%2E", {"http", "", "", "host", 0, "/path%2e.%2E", "", "", "http://host/path%2e.%2E"}); checkRelativeURLDifferences(utf16String(u"http://foo:💩@example.com/bar"), "http://other.com/", {"http", "foo", utf16String(u"💩"), "example.com", 0, "/bar", "", "", "http://foo:%F0%9F%92%A9@example.com/bar"},