Changeset 267965 in webkit
- Timestamp:
- Oct 5, 2020 7:51:18 AM (4 years ago)
- Location:
- trunk
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/imported/w3c/ChangeLog
r267964 r267965 1 2020-10-05 Alex Christensen <achristensen@webkit.org> 2 3 URLParser should fail to parse URLs with hosts containing invalid punycode encodings 4 https://bugs.webkit.org/show_bug.cgi?id=217285 5 6 Reviewed by Darin Adler. 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/failure-expected.txt: 11 * web-platform-tests/url/toascii.window-expected.txt: 12 * web-platform-tests/url/url-constructor-expected.txt: 13 1 14 2020-10-05 Alex Christensen <achristensen@webkit.org> 2 15 -
trunk/LayoutTests/imported/w3c/web-platform-tests/url/a-element-expected.txt
r267964 r267965 580 580 PASS Parsing: <file:///p> against <about:blank> 581 581 PASS Parsing: <file://%C2%AD/p> against <about:blank> 582 FAIL Parsing: <file://xn--/p> against <about:blank> assert_unreached: Expected URL to fail parsing Reached unreachable code 582 PASS Parsing: <file://xn--/p> against <about:blank> 583 583 PASS Parsing: <#link> against <https://example.org/##link> 584 584 PASS Parsing: <non-special:cannot-be-a-base-url-\0 -
trunk/LayoutTests/imported/w3c/web-platform-tests/url/a-element-xhtml-expected.txt
r267964 r267965 580 580 PASS Parsing: <file:///p> against <about:blank> 581 581 PASS Parsing: <file://%C2%AD/p> against <about:blank> 582 FAIL Parsing: <file://xn--/p> against <about:blank> assert_unreached: Expected URL to fail parsing Reached unreachable code 582 PASS Parsing: <file://xn--/p> against <about:blank> 583 583 PASS Parsing: <#link> against <https://example.org/##link> 584 584 PASS Parsing: <non-special:cannot-be-a-base-url-\0 -
trunk/LayoutTests/imported/w3c/web-platform-tests/url/failure-expected.txt
r267647 r267965 4 4 Blocked access to external URL http://./y: 5 5 CONSOLE MESSAGE: Beacon API cannot load http://./y: due to access control checks. 6 CONSOLE MESSAGE: Not allowed to load local resource: p7 CONSOLE MESSAGE: Not allowed to load local resource: p8 6 9 7 PASS Loading data… … … 380 378 FAIL Location's href: file://%C2%AD/p should throw assert_throws_js: function "() => self[0].location = test.input" did not throw 381 379 PASS window.open(): file://%C2%AD/p should throw 382 FAIL URL's constructor's base argument: file://xn--/p should throw assert_throws_js: function "() => new URL("about:blank", test.input)" did notthrow383 FAIL URL's href: file://xn--/p should throw assert_throws_js: function "() => url.href = test.input" did notthrow384 FAIL XHR: file://xn--/p should throw assert_throws_dom: function "() => client.open("GET", test.input)" did notthrow380 PASS URL's constructor's base argument: file://xn--/p should throw 381 PASS URL's href: file://xn--/p should throw 382 PASS XHR: file://xn--/p should throw 385 383 PASS sendBeacon(): file://xn--/p should throw 386 384 FAIL Location's href: file://xn--/p should throw assert_throws_js: function "() => self[0].location = test.input" did not throw 387 FAIL window.open(): file://xn--/p should throw assert_throws_dom: function "() => self.open(test.input).close()" did notthrow385 PASS window.open(): file://xn--/p should throw 388 386 -
trunk/LayoutTests/imported/w3c/web-platform-tests/url/toascii.window-expected.txt
r267647 r267965 100 100 FAIL x..β (using <area>.host) assert_equals: expected "x..xn--nxa" but got "x" 101 101 FAIL x..β (using <area>.hostname) assert_equals: expected "x..xn--nxa" but got "x" 102 FAIL xn--a (using URL) assert_throws_js: function "() => makeURL("url", hostTest.input)" did not throw 103 FAIL xn--a (using URL.host) assert_equals: expected "x" but got "xn--a" 104 FAIL xn--a (using URL.hostname) assert_equals: expected "x" but got "xn--a" 105 FAIL xn--a (using <a>) assert_equals: expected "" but got "xn--a" 106 FAIL xn--a (using <a>.host) assert_equals: expected "x" but got "xn--a" 107 FAIL xn--a (using <a>.hostname) assert_equals: expected "x" but got "xn--a" 108 FAIL xn--a (using <area>) assert_equals: expected "" but got "xn--a" 109 FAIL xn--a (using <area>.host) assert_equals: expected "x" but got "xn--a" 110 FAIL xn--a (using <area>.hostname) assert_equals: expected "x" but got "xn--a" 111 FAIL xn--a.xn--nxa (using URL) assert_throws_js: function "() => makeURL("url", hostTest.input)" did not throw 112 FAIL xn--a.xn--nxa (using URL.host) assert_equals: expected "x" but got "xn--a.xn--nxa" 113 FAIL xn--a.xn--nxa (using URL.hostname) assert_equals: expected "x" but got "xn--a.xn--nxa" 114 FAIL xn--a.xn--nxa (using <a>) assert_equals: expected "" but got "xn--a.xn--nxa" 115 FAIL xn--a.xn--nxa (using <a>.host) assert_equals: expected "x" but got "xn--a.xn--nxa" 116 FAIL xn--a.xn--nxa (using <a>.hostname) assert_equals: expected "x" but got "xn--a.xn--nxa" 117 FAIL xn--a.xn--nxa (using <area>) assert_equals: expected "" but got "xn--a.xn--nxa" 118 FAIL xn--a.xn--nxa (using <area>.host) assert_equals: expected "x" but got "xn--a.xn--nxa" 119 FAIL xn--a.xn--nxa (using <area>.hostname) assert_equals: expected "x" but got "xn--a.xn--nxa" 102 PASS xn--a (using URL) 103 PASS xn--a (using URL.host) 104 PASS xn--a (using URL.hostname) 105 PASS xn--a (using <a>) 106 PASS xn--a (using <a>.host) 107 PASS xn--a (using <a>.hostname) 108 PASS xn--a (using <area>) 109 PASS xn--a (using <area>.host) 110 PASS xn--a (using <area>.hostname) 111 PASS xn--a.xn--nxa (using URL) 112 PASS xn--a.xn--nxa (using URL.host) 113 PASS xn--a.xn--nxa (using URL.hostname) 114 PASS xn--a.xn--nxa (using <a>) 115 PASS xn--a.xn--nxa (using <a>.host) 116 PASS xn--a.xn--nxa (using <a>.hostname) 117 PASS xn--a.xn--nxa (using <area>) 118 PASS xn--a.xn--nxa (using <area>.host) 119 PASS xn--a.xn--nxa (using <area>.hostname) 120 120 PASS xn--a.β (using URL) 121 121 PASS xn--a.β (using URL.host) … … 172 172 PASS .example (using <area>.host) 173 173 PASS .example (using <area>.hostname) 174 FAIL xn--1ug.example (using URL) assert_throws_js: function "() => makeURL("url", hostTest.input)" did not throw 175 FAIL xn--1ug.example (using URL.host) assert_equals: expected "x" but got "xn--1ug.example" 176 FAIL xn--1ug.example (using URL.hostname) assert_equals: expected "x" but got "xn--1ug.example" 177 FAIL xn--1ug.example (using <a>) assert_equals: expected "" but got "xn--1ug.example" 178 FAIL xn--1ug.example (using <a>.host) assert_equals: expected "x" but got "xn--1ug.example" 179 FAIL xn--1ug.example (using <a>.hostname) assert_equals: expected "x" but got "xn--1ug.example" 180 FAIL xn--1ug.example (using <area>) assert_equals: expected "" but got "xn--1ug.example" 181 FAIL xn--1ug.example (using <area>.host) assert_equals: expected "x" but got "xn--1ug.example" 182 FAIL xn--1ug.example (using <area>.hostname) assert_equals: expected "x" but got "xn--1ug.example" 174 PASS xn--1ug.example (using URL) 175 PASS xn--1ug.example (using URL.host) 176 PASS xn--1ug.example (using URL.hostname) 177 PASS xn--1ug.example (using <a>) 178 PASS xn--1ug.example (using <a>.host) 179 PASS xn--1ug.example (using <a>.hostname) 180 PASS xn--1ug.example (using <area>) 181 PASS xn--1ug.example (using <area>.host) 182 PASS xn--1ug.example (using <area>.hostname) 183 183 PASS يa (using URL) 184 184 PASS يa (using URL.host) … … 190 190 PASS يa (using <area>.host) 191 191 PASS يa (using <area>.hostname) 192 FAIL xn--a-yoc (using URL) assert_throws_js: function "() => makeURL("url", hostTest.input)" did not throw 193 FAIL xn--a-yoc (using URL.host) assert_equals: expected "x" but got "xn--a-yoc" 194 FAIL xn--a-yoc (using URL.hostname) assert_equals: expected "x" but got "xn--a-yoc" 195 FAIL xn--a-yoc (using <a>) assert_equals: expected "" but got "xn--a-yoc" 196 FAIL xn--a-yoc (using <a>.host) assert_equals: expected "x" but got "xn--a-yoc" 197 FAIL xn--a-yoc (using <a>.hostname) assert_equals: expected "x" but got "xn--a-yoc" 198 FAIL xn--a-yoc (using <area>) assert_equals: expected "" but got "xn--a-yoc" 199 FAIL xn--a-yoc (using <area>.host) assert_equals: expected "x" but got "xn--a-yoc" 200 FAIL xn--a-yoc (using <area>.hostname) assert_equals: expected "x" but got "xn--a-yoc" 192 PASS xn--a-yoc (using URL) 193 PASS xn--a-yoc (using URL.host) 194 PASS xn--a-yoc (using URL.hostname) 195 PASS xn--a-yoc (using <a>) 196 PASS xn--a-yoc (using <a>.host) 197 PASS xn--a-yoc (using <a>.hostname) 198 PASS xn--a-yoc (using <area>) 199 PASS xn--a-yoc (using <area>.host) 200 PASS xn--a-yoc (using <area>.hostname) 201 201 PASS ශ්රී (using URL) 202 202 PASS ශ්රී (using URL.host) … … 226 226 PASS �.com (using <area>.host) 227 227 PASS �.com (using <area>.hostname) 228 FAIL xn--zn7c.com (using URL) assert_throws_js: function "() => makeURL("url", hostTest.input)" did not throw 229 FAIL xn--zn7c.com (using URL.host) assert_equals: expected "x" but got "xn--zn7c.com" 230 FAIL xn--zn7c.com (using URL.hostname) assert_equals: expected "x" but got "xn--zn7c.com" 231 FAIL xn--zn7c.com (using <a>) assert_equals: expected "" but got "xn--zn7c.com" 232 FAIL xn--zn7c.com (using <a>.host) assert_equals: expected "x" but got "xn--zn7c.com" 233 FAIL xn--zn7c.com (using <a>.hostname) assert_equals: expected "x" but got "xn--zn7c.com" 234 FAIL xn--zn7c.com (using <area>) assert_equals: expected "" but got "xn--zn7c.com" 235 FAIL xn--zn7c.com (using <area>.host) assert_equals: expected "x" but got "xn--zn7c.com" 236 FAIL xn--zn7c.com (using <area>.hostname) assert_equals: expected "x" but got "xn--zn7c.com" 228 PASS xn--zn7c.com (using URL) 229 PASS xn--zn7c.com (using URL.host) 230 PASS xn--zn7c.com (using URL.hostname) 231 PASS xn--zn7c.com (using <a>) 232 PASS xn--zn7c.com (using <a>.host) 233 PASS xn--zn7c.com (using <a>.hostname) 234 PASS xn--zn7c.com (using <area>) 235 PASS xn--zn7c.com (using <area>.host) 236 PASS xn--zn7c.com (using <area>.hostname) 237 237 PASS x01234567890123456789012345678901234567890123456789012345678901x (using URL) 238 238 PASS x01234567890123456789012345678901234567890123456789012345678901x (using URL.host) … … 334 334 PASS %C2%AD (using <area>.host) 335 335 PASS %C2%AD (using <area>.hostname) 336 FAIL xn-- (using URL) assert_throws_js: function "() => makeURL("url", hostTest.input)" did not throw 337 FAIL xn-- (using URL.host) assert_equals: expected "x" but got "xn--" 338 FAIL xn-- (using URL.hostname) assert_equals: expected "x" but got "xn--" 339 FAIL xn-- (using <a>) assert_equals: expected "" but got "xn--" 340 FAIL xn-- (using <a>.host) assert_equals: expected "x" but got "xn--" 341 FAIL xn-- (using <a>.hostname) assert_equals: expected "x" but got "xn--" 342 FAIL xn-- (using <area>) assert_equals: expected "" but got "xn--" 343 FAIL xn-- (using <area>.host) assert_equals: expected "x" but got "xn--" 344 FAIL xn-- (using <area>.hostname) assert_equals: expected "x" but got "xn--" 336 PASS xn-- (using URL) 337 PASS xn-- (using URL.host) 338 PASS xn-- (using URL.hostname) 339 PASS xn-- (using <a>) 340 PASS xn-- (using <a>.host) 341 PASS xn-- (using <a>.hostname) 342 PASS xn-- (using <area>) 343 PASS xn-- (using <area>.host) 344 PASS xn-- (using <area>.hostname) 345 345 -
trunk/LayoutTests/imported/w3c/web-platform-tests/url/url-constructor-expected.txt
r267964 r267965 581 581 PASS Parsing: <file:///p> against <about:blank> 582 582 PASS Parsing: <file://%C2%AD/p> against <about:blank> 583 FAIL Parsing: <file://xn--/p> against <about:blank> assert_throws_js: function "function () { 584 bURL(expected.input, expected.base) 585 }" did not throw 583 PASS Parsing: <file://xn--/p> against <about:blank> 586 584 PASS Parsing: <#link> against <https://example.org/##link> 587 585 PASS Parsing: <non-special:cannot-be-a-base-url-\0 -
trunk/Source/WTF/ChangeLog
r267964 r267965 1 2020-10-05 Alex Christensen <achristensen@webkit.org> 2 3 URLParser should fail to parse URLs with hosts containing invalid punycode encodings 4 https://bugs.webkit.org/show_bug.cgi?id=217285 5 6 Reviewed by Darin Adler. 7 8 URLParser has a fast path for parsing hosts that are all ASCII, but that does not validate hosts that are invalid punycode, such as "xn--". 9 Since all punycode encoded strings start with "xn--", if the input string starts with "xn--" then skip the fast path and let ICU decide if it's valid. 10 11 * wtf/URLParser.cpp: 12 (WTF::URLParser::domainToASCII): 13 (WTF::URLParser::startsWithXNDashDash): 14 (WTF::URLParser::parseHostAndPort): 15 * wtf/URLParser.h: 16 1 17 2020-10-05 Alex Christensen <achristensen@webkit.org> 2 18 -
trunk/Source/WTF/wtf/URLParser.cpp
r267964 r267965 2518 2518 { 2519 2519 LCharBuffer ascii; 2520 if (domain.isAllASCII() ) {2520 if (domain.isAllASCII() && !startsWithLettersIgnoringASCIICase(domain, "xn--")) { 2521 2521 size_t length = domain.length(); 2522 2522 if (domain.is8Bit()) { … … 2622 2622 RELEASE_ASSERT(portLength <= URL::maxPortLength); 2623 2623 m_url.m_portLength = portLength; 2624 return true; 2625 } 2626 2627 template<typename CharacterType> 2628 bool URLParser::startsWithXNDashDash(CodePointIterator<CharacterType> iterator) 2629 { 2630 if (iterator.atEnd() || (*iterator != 'x' && *iterator != 'X')) 2631 return false; 2632 advance<CharacterType, ReportSyntaxViolation::No>(iterator); 2633 if (iterator.atEnd() || (*iterator != 'n' && *iterator != 'N')) 2634 return false; 2635 advance<CharacterType, ReportSyntaxViolation::No>(iterator); 2636 if (iterator.atEnd() || *iterator != '-') 2637 return false; 2638 advance<CharacterType, ReportSyntaxViolation::No>(iterator); 2639 if (iterator.atEnd() || *iterator != '-') 2640 return false; 2624 2641 return true; 2625 2642 } … … 2674 2691 } 2675 2692 2676 if (LIKELY(!m_hostHasPercentOrNonASCII )) {2693 if (LIKELY(!m_hostHasPercentOrNonASCII && !startsWithXNDashDash(iterator))) { 2677 2694 auto hostIterator = iterator; 2678 2695 for (; !iterator.atEnd(); ++iterator) { -
trunk/Source/WTF/wtf/URLParser.h
r267837 r267965 114 114 StringView parsedDataView(size_t start, size_t length); 115 115 UChar parsedDataView(size_t position); 116 template<typename CharacterType> bool startsWithXNDashDash(CodePointIterator<CharacterType>); 116 117 117 118 bool needsNonSpecialDotSlash() const;
Note: See TracChangeset
for help on using the changeset viewer.