File tree 2 files changed +105
-4
lines changed
2 files changed +105
-4
lines changed Original file line number Diff line number Diff line change @@ -1169,6 +1169,7 @@ void URL::Parse(const char* input,
1169
1169
1170
1170
while (p <= end) {
1171
1171
const char ch = p < end ? p[0 ] : kEOL ;
1172
+ const size_t remaining = end == p ? 0 : (end - p - 1 );
1172
1173
1173
1174
if (IsASCIITabOrNewline (ch)) {
1174
1175
if (state == kAuthority ) {
@@ -1653,9 +1654,10 @@ void URL::Parse(const char* input,
1653
1654
state = kFragment ;
1654
1655
break ;
1655
1656
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 ] != ' /' &&
1659
1661
p[2 ] != ' \\ ' &&
1660
1662
p[2 ] != ' ?' &&
1661
1663
p[2 ] != ' #' ))) {
Original file line number Diff line number Diff line change 1
1
'use strict' ;
2
2
3
3
/* WPT Refs:
4
- https://github.com/w3c/web-platform-tests/blob/3afae94 /url/urltestdata.json
4
+ https://github.com/w3c/web-platform-tests/blob/28541bb /url/urltestdata.json
5
5
License: http://www.w3.org/Consortium/Legal/2008/04-testsuite-copyright.html
6
6
*/
7
7
module . exports =
@@ -5430,6 +5430,105 @@ module.exports =
5430
5430
"search" : "?chai" ,
5431
5431
"hash" : ""
5432
5432
} ,
5433
+ "# Windows drive letter handling with the 'file:' base URL" ,
5434
+ {
5435
+ "input" : "C|" ,
5436
+ "base" : "file://host/dir/file" ,
5437
+ "href" : "file:///C:" ,
5438
+ "protocol" : "file:" ,
5439
+ "username" : "" ,
5440
+ "password" : "" ,
5441
+ "host" : "" ,
5442
+ "hostname" : "" ,
5443
+ "port" : "" ,
5444
+ "pathname" : "/C:" ,
5445
+ "search" : "" ,
5446
+ "hash" : ""
5447
+ } ,
5448
+ {
5449
+ "input" : "C|#" ,
5450
+ "base" : "file://host/dir/file" ,
5451
+ "href" : "file:///C:#" ,
5452
+ "protocol" : "file:" ,
5453
+ "username" : "" ,
5454
+ "password" : "" ,
5455
+ "host" : "" ,
5456
+ "hostname" : "" ,
5457
+ "port" : "" ,
5458
+ "pathname" : "/C:" ,
5459
+ "search" : "" ,
5460
+ "hash" : ""
5461
+ } ,
5462
+ {
5463
+ "input" : "C|?" ,
5464
+ "base" : "file://host/dir/file" ,
5465
+ "href" : "file:///C:?" ,
5466
+ "protocol" : "file:" ,
5467
+ "username" : "" ,
5468
+ "password" : "" ,
5469
+ "host" : "" ,
5470
+ "hostname" : "" ,
5471
+ "port" : "" ,
5472
+ "pathname" : "/C:" ,
5473
+ "search" : "" ,
5474
+ "hash" : ""
5475
+ } ,
5476
+ {
5477
+ "input" : "C|/" ,
5478
+ "base" : "file://host/dir/file" ,
5479
+ "href" : "file:///C:/" ,
5480
+ "protocol" : "file:" ,
5481
+ "username" : "" ,
5482
+ "password" : "" ,
5483
+ "host" : "" ,
5484
+ "hostname" : "" ,
5485
+ "port" : "" ,
5486
+ "pathname" : "/C:/" ,
5487
+ "search" : "" ,
5488
+ "hash" : ""
5489
+ } ,
5490
+ {
5491
+ "input" : "C|\\" ,
5492
+ "base" : "file://host/dir/file" ,
5493
+ "href" : "file:///C:/" ,
5494
+ "protocol" : "file:" ,
5495
+ "username" : "" ,
5496
+ "password" : "" ,
5497
+ "host" : "" ,
5498
+ "hostname" : "" ,
5499
+ "port" : "" ,
5500
+ "pathname" : "/C:/" ,
5501
+ "search" : "" ,
5502
+ "hash" : ""
5503
+ } ,
5504
+ {
5505
+ "input" : "C" ,
5506
+ "base" : "file://host/dir/file" ,
5507
+ "href" : "file://host/dir/C" ,
5508
+ "protocol" : "file:" ,
5509
+ "username" : "" ,
5510
+ "password" : "" ,
5511
+ "host" : "host" ,
5512
+ "hostname" : "host" ,
5513
+ "port" : "" ,
5514
+ "pathname" : "/dir/C" ,
5515
+ "search" : "" ,
5516
+ "hash" : ""
5517
+ } ,
5518
+ {
5519
+ "input" : "C|a" ,
5520
+ "base" : "file://host/dir/file" ,
5521
+ "href" : "file://host/dir/C|a" ,
5522
+ "protocol" : "file:" ,
5523
+ "username" : "" ,
5524
+ "password" : "" ,
5525
+ "host" : "host" ,
5526
+ "hostname" : "host" ,
5527
+ "port" : "" ,
5528
+ "pathname" : "/dir/C|a" ,
5529
+ "search" : "" ,
5530
+ "hash" : ""
5531
+ } ,
5433
5532
"# Windows drive letter quirk with not empty host" ,
5434
5533
{
5435
5534
"input" : "file://example.net/C:/" ,
You can’t perform that action at this time.
0 commit comments