File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1169,6 +1169,7 @@ void URL::Parse(const char* input,
11691169
11701170 while (p <= end) {
11711171 const char ch = p < end ? p[0 ] : kEOL ;
1172+ const size_t remaining = end == p ? 0 : (end - p - 1 );
11721173
11731174 if (IsASCIITabOrNewline (ch)) {
11741175 if (state == kAuthority ) {
@@ -1653,9 +1654,10 @@ void URL::Parse(const char* input,
16531654 state = kFragment ;
16541655 break ;
16551656 default :
1656- if ((!IsWindowsDriveLetter (ch, p[1 ]) ||
1657- end - p == 1 ||
1658- (p[2 ] != ' /' &&
1657+ if ((remaining == 0 ||
1658+ !IsWindowsDriveLetter (ch, p[1 ]) ||
1659+ (remaining >= 2 &&
1660+ p[2 ] != ' /' &&
16591661 p[2 ] != ' \\ ' &&
16601662 p[2 ] != ' ?' &&
16611663 p[2 ] != ' #' ))) {
Original file line number Diff line number Diff line change 11'use strict' ;
22
33/* WPT Refs:
4- https://github.com/w3c/web-platform-tests/blob/3eff1bd /url/urltestdata.json
4+ https://github.com/w3c/web-platform-tests/blob/28541bb /url/urltestdata.json
55 License: http://www.w3.org/Consortium/Legal/2008/04-testsuite-copyright.html
66*/
77module . exports =
@@ -5384,6 +5384,105 @@ module.exports =
53845384 "search" : "?chai" ,
53855385 "hash" : ""
53865386 } ,
5387+ "# Windows drive letter handling with the 'file:' base URL" ,
5388+ {
5389+ "input" : "C|" ,
5390+ "base" : "file://host/dir/file" ,
5391+ "href" : "file:///C:" ,
5392+ "protocol" : "file:" ,
5393+ "username" : "" ,
5394+ "password" : "" ,
5395+ "host" : "" ,
5396+ "hostname" : "" ,
5397+ "port" : "" ,
5398+ "pathname" : "/C:" ,
5399+ "search" : "" ,
5400+ "hash" : ""
5401+ } ,
5402+ {
5403+ "input" : "C|#" ,
5404+ "base" : "file://host/dir/file" ,
5405+ "href" : "file:///C:#" ,
5406+ "protocol" : "file:" ,
5407+ "username" : "" ,
5408+ "password" : "" ,
5409+ "host" : "" ,
5410+ "hostname" : "" ,
5411+ "port" : "" ,
5412+ "pathname" : "/C:" ,
5413+ "search" : "" ,
5414+ "hash" : ""
5415+ } ,
5416+ {
5417+ "input" : "C|?" ,
5418+ "base" : "file://host/dir/file" ,
5419+ "href" : "file:///C:?" ,
5420+ "protocol" : "file:" ,
5421+ "username" : "" ,
5422+ "password" : "" ,
5423+ "host" : "" ,
5424+ "hostname" : "" ,
5425+ "port" : "" ,
5426+ "pathname" : "/C:" ,
5427+ "search" : "" ,
5428+ "hash" : ""
5429+ } ,
5430+ {
5431+ "input" : "C|/" ,
5432+ "base" : "file://host/dir/file" ,
5433+ "href" : "file:///C:/" ,
5434+ "protocol" : "file:" ,
5435+ "username" : "" ,
5436+ "password" : "" ,
5437+ "host" : "" ,
5438+ "hostname" : "" ,
5439+ "port" : "" ,
5440+ "pathname" : "/C:/" ,
5441+ "search" : "" ,
5442+ "hash" : ""
5443+ } ,
5444+ {
5445+ "input" : "C|\\" ,
5446+ "base" : "file://host/dir/file" ,
5447+ "href" : "file:///C:/" ,
5448+ "protocol" : "file:" ,
5449+ "username" : "" ,
5450+ "password" : "" ,
5451+ "host" : "" ,
5452+ "hostname" : "" ,
5453+ "port" : "" ,
5454+ "pathname" : "/C:/" ,
5455+ "search" : "" ,
5456+ "hash" : ""
5457+ } ,
5458+ {
5459+ "input" : "C" ,
5460+ "base" : "file://host/dir/file" ,
5461+ "href" : "file://host/dir/C" ,
5462+ "protocol" : "file:" ,
5463+ "username" : "" ,
5464+ "password" : "" ,
5465+ "host" : "host" ,
5466+ "hostname" : "host" ,
5467+ "port" : "" ,
5468+ "pathname" : "/dir/C" ,
5469+ "search" : "" ,
5470+ "hash" : ""
5471+ } ,
5472+ {
5473+ "input" : "C|a" ,
5474+ "base" : "file://host/dir/file" ,
5475+ "href" : "file://host/dir/C|a" ,
5476+ "protocol" : "file:" ,
5477+ "username" : "" ,
5478+ "password" : "" ,
5479+ "host" : "host" ,
5480+ "hostname" : "host" ,
5481+ "port" : "" ,
5482+ "pathname" : "/dir/C|a" ,
5483+ "search" : "" ,
5484+ "hash" : ""
5485+ } ,
53875486 "# Windows drive letter quirk with not empty host" ,
53885487 {
53895488 "input" : "file://example.net/C:/" ,
You can’t perform that action at this time.
0 commit comments