Skip to content

Commit 976e8d9

Browse files
author
achristensen@apple.com
committed
Copy host from base file URL
https://bugs.webkit.org/show_bug.cgi?id=217170 Reviewed by Brady Eidson. LayoutTests/imported/w3c: * web-platform-tests/url/a-element-expected.txt: * web-platform-tests/url/a-element-xhtml-expected.txt: * web-platform-tests/url/resources/urltestdata.json: * web-platform-tests/url/url-constructor-expected.txt: Source/WTF: This matches Chrome and the URL specification. Covered by newly passing web platform tests. I also updated the web platform tests from web-platform-tests/wpt#25716 which aligns with Safari in cases except copying of the host from base file URLs. The implementation pushes copying from the base URL downstream in the parsing process to where it is in the URL specification so that we can properly decide how much of the base URL to copy and so we can copy it into the right place in the result URL. I also updated an assertion that makes sure that we re-use the input String if possible because there are cases where we copy part of the parent URL, which is a "syntax violation" (meaning we copy the string parts and assemble a new one), then re-assemble a new String that is equal to the input string. This is not a problem, it just needed to be reflected in the assertion. * wtf/URLParser.cpp: (WTF::URLParser::URLParser): (WTF::URLParser::parse): git-svn-id: http://svn.webkit.org/repository/webkit/trunk@267896 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent ea87d23 commit 976e8d9

7 files changed

Lines changed: 410 additions & 140 deletions

File tree

LayoutTests/imported/w3c/ChangeLog

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
2020-10-02 Alex Christensen <achristensen@webkit.org>
2+
3+
Copy host from base file URL
4+
https://bugs.webkit.org/show_bug.cgi?id=217170
5+
6+
Reviewed by Brady Eidson.
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/resources/urltestdata.json:
11+
* web-platform-tests/url/url-constructor-expected.txt:
12+
113
2020-10-02 Sam Weinig <weinig@apple.com>
214

315
Re-align HTMLElement with the HTML spec

LayoutTests/imported/w3c/web-platform-tests/url/a-element-expected.txt

Lines changed: 29 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,8 @@ PASS Parsing: <pix/submit.gif> against <file:///C:/Users/Domenic/Dropbox/GitHub/
417417
PASS Parsing: <..> against <file:///C:/>
418418
PASS Parsing: <..> against <file:///>
419419
PASS Parsing: </> against <file:///C:/a/b>
420+
PASS Parsing: </> against <file://h/C:/a/b>
421+
PASS Parsing: </> against <file://h/a/b>
420422
PASS Parsing: <//d:> against <file:///C:/a/b>
421423
PASS Parsing: <//d:/..> against <file:///C:/a/b>
422424
PASS Parsing: <..> against <file:///ab:/>
@@ -427,24 +429,24 @@ PASS Parsing: <?x> against <file:///test?test#test>
427429
PASS Parsing: <file:?x> against <file:///test?test#test>
428430
PASS Parsing: <#x> against <file:///test?test#test>
429431
PASS Parsing: <file:#x> against <file:///test?test#test>
430-
FAIL Parsing: <file:\\//> against <about:blank> assert_equals: href expected "file:///" but got "file:////"
431-
FAIL Parsing: <file:\\\\> against <about:blank> assert_equals: href expected "file:///" but got "file:////"
432-
FAIL Parsing: <file:\\\\?fox> against <about:blank> assert_equals: href expected "file:///?fox" but got "file:////?fox"
433-
FAIL Parsing: <file:\\\\#guppy> against <about:blank> assert_equals: href expected "file:///#guppy" but got "file:////#guppy"
434-
FAIL Parsing: <file://spider///> against <about:blank> assert_equals: href expected "file://spider/" but got "file://spider///"
435-
FAIL Parsing: <file:\\localhost//> against <about:blank> assert_equals: href expected "file:///" but got "file:////"
432+
PASS Parsing: <file:\\//> against <about:blank>
433+
PASS Parsing: <file:\\\\> against <about:blank>
434+
PASS Parsing: <file:\\\\?fox> against <about:blank>
435+
PASS Parsing: <file:\\\\#guppy> against <about:blank>
436+
PASS Parsing: <file://spider///> against <about:blank>
437+
PASS Parsing: <file:\\localhost//> against <about:blank>
436438
PASS Parsing: <file:///localhost//cat> against <about:blank>
437-
FAIL Parsing: <file://\/localhost//cat> against <about:blank> assert_equals: href expected "file:///localhost//cat" but got "file:////localhost//cat"
438-
FAIL Parsing: <file://localhost//a//../..//> against <about:blank> assert_equals: href expected "file:///" but got "file://///"
439-
FAIL Parsing: </////mouse> against <file:///elephant> assert_equals: href expected "file:///mouse" but got "file://///mouse"
439+
PASS Parsing: <file://\/localhost//cat> against <about:blank>
440+
PASS Parsing: <file://localhost//a//../..//> against <about:blank>
441+
PASS Parsing: </////mouse> against <file:///elephant>
440442
PASS Parsing: <\//pig> against <file://lion/>
441-
FAIL Parsing: <\/localhost//pig> against <file://lion/> assert_equals: href expected "file:///pig" but got "file:////pig"
442-
FAIL Parsing: <//localhost//pig> against <file://lion/> assert_equals: href expected "file:///pig" but got "file:////pig"
443-
FAIL Parsing: </..//localhost//pig> against <file://lion/> assert_equals: href expected "file://lion/localhost//pig" but got "file:////localhost//pig"
443+
PASS Parsing: <\/localhost//pig> against <file://lion/>
444+
PASS Parsing: <//localhost//pig> against <file://lion/>
445+
PASS Parsing: </..//localhost//pig> against <file://lion/>
444446
PASS Parsing: <file://> against <file://ape/>
445-
FAIL Parsing: </rooibos> against <file://tea/> assert_equals: href expected "file://tea/rooibos" but got "file:///rooibos"
446-
FAIL Parsing: </?chai> against <file://tea/> assert_equals: href expected "file://tea/?chai" but got "file:///?chai"
447-
FAIL Parsing: <C|> against <file://host/dir/file> assert_equals: href expected "file:///C:" but got "file://host/dir/C|"
447+
PASS Parsing: </rooibos> against <file://tea/>
448+
PASS Parsing: </?chai> against <file://tea/>
449+
FAIL Parsing: <C|> against <file://host/dir/file> assert_equals: href expected "file://host/C:" but got "file://host/dir/C|"
448450
PASS Parsing: <C|#> against <file://host/dir/file>
449451
PASS Parsing: <C|?> against <file://host/dir/file>
450452
PASS Parsing: <C|/> against <file://host/dir/file>
@@ -457,9 +459,9 @@ PASS Parsing: </c:/foo/bar> against <file:///c:/baz/qux>
457459
PASS Parsing: </c|/foo/bar> against <file:///c:/baz/qux>
458460
PASS Parsing: <file:\c:\foo\bar> against <file:///c:/baz/qux>
459461
PASS Parsing: </c:/foo/bar> against <file://host/path>
460-
FAIL Parsing: <file://example.net/C:/> against <about:blank> assert_equals: href expected "file:///C:/" but got "file://example.net/C:/"
461-
FAIL Parsing: <file://1.2.3.4/C:/> against <about:blank> assert_equals: href expected "file:///C:/" but got "file://1.2.3.4/C:/"
462-
FAIL Parsing: <file://[1::8]/C:/> against <about:blank> assert_equals: href expected "file:///C:/" but got "file://[1::8]/C:/"
462+
PASS Parsing: <file://example.net/C:/> against <about:blank>
463+
PASS Parsing: <file://1.2.3.4/C:/> against <about:blank>
464+
PASS Parsing: <file://[1::8]/C:/> against <about:blank>
463465
PASS Parsing: <file:/C|/> against <about:blank>
464466
PASS Parsing: <file://C|/> against <about:blank>
465467
PASS Parsing: <file:> against <about:blank>
@@ -475,6 +477,15 @@ PASS Parsing: <file:///y:/> against <about:blank>
475477
PASS Parsing: <file:///./y> against <about:blank>
476478
PASS Parsing: <file:///./y:> against <about:blank>
477479
PASS Parsing: <\\\.\y:> against <about:blank>
480+
PASS Parsing: <file://localhost//a//../..//foo> against <about:blank>
481+
PASS Parsing: <file://localhost////foo> against <about:blank>
482+
PASS Parsing: <file:////foo> against <about:blank>
483+
PASS Parsing: <file:///one/two> against <file:///>
484+
PASS Parsing: <file:////one/two> against <file:///>
485+
PASS Parsing: <//one/two> against <file:///>
486+
PASS Parsing: <///one/two> against <file:///>
487+
PASS Parsing: <////one/two> against <file:///>
488+
PASS Parsing: <file:///.//> against <file:////>
478489
PASS Parsing: <http://[1:0::]> against <http://example.net/>
479490
PASS Parsing: <http://[0:1:2:3:4:5:6:7:8]> against <http://example.net/>
480491
PASS Parsing: <https://[0::0::0]> against <about:blank>

LayoutTests/imported/w3c/web-platform-tests/url/a-element-xhtml-expected.txt

Lines changed: 29 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,8 @@ PASS Parsing: <pix/submit.gif> against <file:///C:/Users/Domenic/Dropbox/GitHub/
417417
PASS Parsing: <..> against <file:///C:/>
418418
PASS Parsing: <..> against <file:///>
419419
PASS Parsing: </> against <file:///C:/a/b>
420+
PASS Parsing: </> against <file://h/C:/a/b>
421+
PASS Parsing: </> against <file://h/a/b>
420422
PASS Parsing: <//d:> against <file:///C:/a/b>
421423
PASS Parsing: <//d:/..> against <file:///C:/a/b>
422424
PASS Parsing: <..> against <file:///ab:/>
@@ -427,24 +429,24 @@ PASS Parsing: <?x> against <file:///test?test#test>
427429
PASS Parsing: <file:?x> against <file:///test?test#test>
428430
PASS Parsing: <#x> against <file:///test?test#test>
429431
PASS Parsing: <file:#x> against <file:///test?test#test>
430-
FAIL Parsing: <file:\\//> against <about:blank> assert_equals: href expected "file:///" but got "file:////"
431-
FAIL Parsing: <file:\\\\> against <about:blank> assert_equals: href expected "file:///" but got "file:////"
432-
FAIL Parsing: <file:\\\\?fox> against <about:blank> assert_equals: href expected "file:///?fox" but got "file:////?fox"
433-
FAIL Parsing: <file:\\\\#guppy> against <about:blank> assert_equals: href expected "file:///#guppy" but got "file:////#guppy"
434-
FAIL Parsing: <file://spider///> against <about:blank> assert_equals: href expected "file://spider/" but got "file://spider///"
435-
FAIL Parsing: <file:\\localhost//> against <about:blank> assert_equals: href expected "file:///" but got "file:////"
432+
PASS Parsing: <file:\\//> against <about:blank>
433+
PASS Parsing: <file:\\\\> against <about:blank>
434+
PASS Parsing: <file:\\\\?fox> against <about:blank>
435+
PASS Parsing: <file:\\\\#guppy> against <about:blank>
436+
PASS Parsing: <file://spider///> against <about:blank>
437+
PASS Parsing: <file:\\localhost//> against <about:blank>
436438
PASS Parsing: <file:///localhost//cat> against <about:blank>
437-
FAIL Parsing: <file://\/localhost//cat> against <about:blank> assert_equals: href expected "file:///localhost//cat" but got "file:////localhost//cat"
438-
FAIL Parsing: <file://localhost//a//../..//> against <about:blank> assert_equals: href expected "file:///" but got "file://///"
439-
FAIL Parsing: </////mouse> against <file:///elephant> assert_equals: href expected "file:///mouse" but got "file://///mouse"
439+
PASS Parsing: <file://\/localhost//cat> against <about:blank>
440+
PASS Parsing: <file://localhost//a//../..//> against <about:blank>
441+
PASS Parsing: </////mouse> against <file:///elephant>
440442
PASS Parsing: <\//pig> against <file://lion/>
441-
FAIL Parsing: <\/localhost//pig> against <file://lion/> assert_equals: href expected "file:///pig" but got "file:////pig"
442-
FAIL Parsing: <//localhost//pig> against <file://lion/> assert_equals: href expected "file:///pig" but got "file:////pig"
443-
FAIL Parsing: </..//localhost//pig> against <file://lion/> assert_equals: href expected "file://lion/localhost//pig" but got "file:////localhost//pig"
443+
PASS Parsing: <\/localhost//pig> against <file://lion/>
444+
PASS Parsing: <//localhost//pig> against <file://lion/>
445+
PASS Parsing: </..//localhost//pig> against <file://lion/>
444446
PASS Parsing: <file://> against <file://ape/>
445-
FAIL Parsing: </rooibos> against <file://tea/> assert_equals: href expected "file://tea/rooibos" but got "file:///rooibos"
446-
FAIL Parsing: </?chai> against <file://tea/> assert_equals: href expected "file://tea/?chai" but got "file:///?chai"
447-
FAIL Parsing: <C|> against <file://host/dir/file> assert_equals: href expected "file:///C:" but got "file://host/dir/C|"
447+
PASS Parsing: </rooibos> against <file://tea/>
448+
PASS Parsing: </?chai> against <file://tea/>
449+
FAIL Parsing: <C|> against <file://host/dir/file> assert_equals: href expected "file://host/C:" but got "file://host/dir/C|"
448450
PASS Parsing: <C|#> against <file://host/dir/file>
449451
PASS Parsing: <C|?> against <file://host/dir/file>
450452
PASS Parsing: <C|/> against <file://host/dir/file>
@@ -457,9 +459,9 @@ PASS Parsing: </c:/foo/bar> against <file:///c:/baz/qux>
457459
PASS Parsing: </c|/foo/bar> against <file:///c:/baz/qux>
458460
PASS Parsing: <file:\c:\foo\bar> against <file:///c:/baz/qux>
459461
PASS Parsing: </c:/foo/bar> against <file://host/path>
460-
FAIL Parsing: <file://example.net/C:/> against <about:blank> assert_equals: href expected "file:///C:/" but got "file://example.net/C:/"
461-
FAIL Parsing: <file://1.2.3.4/C:/> against <about:blank> assert_equals: href expected "file:///C:/" but got "file://1.2.3.4/C:/"
462-
FAIL Parsing: <file://[1::8]/C:/> against <about:blank> assert_equals: href expected "file:///C:/" but got "file://[1::8]/C:/"
462+
PASS Parsing: <file://example.net/C:/> against <about:blank>
463+
PASS Parsing: <file://1.2.3.4/C:/> against <about:blank>
464+
PASS Parsing: <file://[1::8]/C:/> against <about:blank>
463465
PASS Parsing: <file:/C|/> against <about:blank>
464466
PASS Parsing: <file://C|/> against <about:blank>
465467
PASS Parsing: <file:> against <about:blank>
@@ -475,6 +477,15 @@ PASS Parsing: <file:///y:/> against <about:blank>
475477
PASS Parsing: <file:///./y> against <about:blank>
476478
PASS Parsing: <file:///./y:> against <about:blank>
477479
PASS Parsing: <\\\.\y:> against <about:blank>
480+
PASS Parsing: <file://localhost//a//../..//foo> against <about:blank>
481+
PASS Parsing: <file://localhost////foo> against <about:blank>
482+
PASS Parsing: <file:////foo> against <about:blank>
483+
PASS Parsing: <file:///one/two> against <file:///>
484+
PASS Parsing: <file:////one/two> against <file:///>
485+
PASS Parsing: <//one/two> against <file:///>
486+
PASS Parsing: <///one/two> against <file:///>
487+
PASS Parsing: <////one/two> against <file:///>
488+
PASS Parsing: <file:///.//> against <file:////>
478489
PASS Parsing: <http://[1:0::]> against <http://example.net/>
479490
PASS Parsing: <http://[0:1:2:3:4:5:6:7:8]> against <http://example.net/>
480491
PASS Parsing: <https://[0::0::0]> against <about:blank>

0 commit comments

Comments
 (0)