Home | History | Annotate | Download | only in resources
      1 # FORMAT NOT DOCUMENTED YET (parser is urltestparser.js)
      2 
      3 # Based on http://trac.webkit.org/browser/trunk/LayoutTests/fast/url/script-tests/segments.js
      4 http://example\t.\norg http://example.org/foo/bar s:http h:example.org p:/
      5 http://user:pass@foo:21/bar;par?b#c  s:http u:user pass:pass h:foo port:21 p:/bar;par q:?b f:#c
      6 http:foo.com  s:http h:example.org p:/foo/foo.com
      7 \t\s\s\s:foo.com\s\s\s\n  s:http h:example.org p:/foo/:foo.com
      8 \sfoo.com\s\s  s:http h:example.org p:/foo/foo.com
      9 a:\t\sfoo.com  s:a p:\sfoo.com
     10 http://f:21/\sb\s?\sd\s#\se\s  s:http h:f port:21 p:/%20b%20 q:?%20d%20 f:#\se
     11 http://f:/c  s:http h:f p:/c
     12 http://f:0/c  s:http h:f port:0 p:/c
     13 http://f:00000000000000/c  s:http h:f port:0 p:/c
     14 http://f:00000000000000000000080/c  s:http h:f p:/c
     15 http://f:b/c
     16 http://f:\s/c
     17 http://f:\n/c  s:http h:f p:/c
     18 http://f:fifty-two/c
     19 http://f:999999/c  s:http h:f port:999999 p:/c
     20 http://f:\s21\s/\sb\s?\sd\s#\se\s
     21   s:http h:example.org p:/foo/bar
     22 \s\s\t  s:http h:example.org p:/foo/bar
     23 :foo.com/  s:http h:example.org p:/foo/:foo.com/
     24 :foo.com\\  s:http h:example.org p:/foo/:foo.com/
     25 :  s:http h:example.org p:/foo/:
     26 :a  s:http h:example.org p:/foo/:a
     27 :/  s:http h:example.org p:/foo/:/
     28 :\\  s:http h:example.org p:/foo/:/
     29 :#  s:http h:example.org p:/foo/: f:#
     30 \#  s:http h:example.org p:/foo/bar f:#
     31 \#/  s:http h:example.org p:/foo/bar f:#/
     32 \#\\  s:http h:example.org p:/foo/bar f:#\\
     33 \#;?  s:http h:example.org p:/foo/bar f:#;?
     34 ?  s:http h:example.org p:/foo/bar q:?
     35 /  s:http h:example.org p:/
     36 :23  s:http h:example.org p:/foo/:23
     37 /:23  s:http h:example.org p:/:23
     38 ::  s:http h:example.org p:/foo/::
     39 ::23  s:http h:example.org p:/foo/::23
     40 foo://  s:foo p://
     41 http://a:b@c:29/d  s:http u:a pass:b h:c port:29 p:/d
     42 http::@c:29  s:http h:example.org p:/foo/:@c:29
     43 http://&a:foo(b]c@d:2/  s:http u:&a pass:foo(b]c h:d port:2 p:/
     44 http://::@c@d:2  s:http pass::%40c h:d port:2 p:/
     45 http://foo.com:b@d/  s:http u:foo.com pass:b h:d p:/
     46 http://foo.com/\\@  s:http h:foo.com p://@
     47 http:\\\\foo.com\\  s:http h:foo.com p:/
     48 http:\\\\a\\b:c\\d (a] foo.com\\  s:http h:a p:/b:c/d (a] foo.com/
     49 foo:/  s:foo p:/
     50 foo:/bar.com/  s:foo p:/bar.com/
     51 foo://///////  s:foo p://///////
     52 foo://///////bar.com/  s:foo p://///////bar.com/
     53 foo:////://///  s:foo p:////://///
     54 c:/foo  s:c p:/foo
     55 //foo/bar  s:http h:foo p:/bar
     56 http://foo/path;a??e#f#g  s:http h:foo p:/path;a q:??e f:#f#g
     57 http://foo/abcd?efgh?ijkl  s:http h:foo p:/abcd q:?efgh?ijkl
     58 http://foo/abcd#foo?bar  s:http h:foo p:/abcd f:#foo?bar
     59 [61:24:74]:98  s:http h:example.org p:/foo/[61:24:74]:98
     60 http:[61:27]/:foo  s:http h:example.org p:/foo/[61:27]/:foo
     61 http://[1::2]:3:4
     62 http://2001::1
     63 http://2001::1]
     64 http://2001::1]:80
     65 http://[2001::1]  s:http h:[2001::1] p:/
     66 http://[2001::1]:80  s:http h:[2001::1] p:/
     67 http:/example.com/  s:http h:example.org p:/example.com/
     68 ftp:/example.com/  s:ftp h:example.com p:/
     69 https:/example.com/  s:https h:example.com p:/
     70 madeupscheme:/example.com/  s:madeupscheme p:/example.com/
     71 file:/example.com/  s:file p:/example.com/
     72 ftps:/example.com/  s:ftps p:/example.com/
     73 gopher:/example.com/  s:gopher h:example.com p:/
     74 ws:/example.com/  s:ws h:example.com p:/
     75 wss:/example.com/  s:wss h:example.com p:/
     76 data:/example.com/  s:data p:/example.com/
     77 javascript:/example.com/  s:javascript p:/example.com/
     78 mailto:/example.com/  s:mailto p:/example.com/
     79 http:example.com/  s:http h:example.org p:/foo/example.com/
     80 ftp:example.com/  s:ftp h:example.com p:/
     81 https:example.com/  s:https h:example.com p:/
     82 madeupscheme:example.com/  s:madeupscheme p:example.com/
     83 ftps:example.com/  s:ftps p:example.com/
     84 gopher:example.com/  s:gopher h:example.com p:/
     85 ws:example.com/  s:ws h:example.com p:/
     86 wss:example.com/  s:wss h:example.com p:/
     87 data:example.com/  s:data p:example.com/
     88 javascript:example.com/  s:javascript p:example.com/
     89 mailto:example.com/  s:mailto p:example.com/
     90 /a/b/c  s:http h:example.org p:/a/b/c
     91 /a/\s/c  s:http h:example.org p:/a/%20/c
     92 /a%2fc  s:http h:example.org p:/a%2fc
     93 /a/%2f/c  s:http h:example.org p:/a/%2f/c
     94 \#\u03B2  s:http h:example.org p:/foo/bar f:#\u03B2
     95 data:text/html,test#test  s:data p:text/html,test f:#test
     96 
     97 # Based on http://trac.webkit.org/browser/trunk/LayoutTests/fast/url/file.html
     98 
     99 # Basic canonicalization, uppercase should be converted to lowercase
    100 file:c:\\foo\\bar.html file:///tmp/mock/path s:file p:/c:/foo/bar.html
    101 
    102 # Spaces should fail
    103 \s\sFile:c|////foo\\bar.html  s:file p:/c:////foo/bar.html
    104 
    105 # This should fail
    106 C|/foo/bar  s:file p:/C:/foo/bar
    107 
    108 # This should fail
    109 /C|\\foo\\bar  s:file p:/C:/foo/bar
    110 //C|/foo/bar  s:file p:/C:/foo/bar
    111 //server/file  s:file h:server p:/file
    112 \\\\server\\file  s:file h:server p:/file
    113 /\\server/file  s:file h:server p:/file
    114 file:///foo/bar.txt  s:file p:/foo/bar.txt
    115 file:///home/me  s:file p:/home/me
    116 //  s:file p:/
    117 ///  s:file p:/
    118 ///test  s:file p:/test
    119 file://test  s:file h:test p:/
    120 file://localhost  s:file h:localhost p:/
    121 file://localhost/  s:file h:localhost p:/
    122 file://localhost/test  s:file h:localhost p:/test
    123 test  s:file p:/tmp/mock/test
    124 file:test  s:file p:/tmp/mock/test
    125 
    126 # Based on http://trac.webkit.org/browser/trunk/LayoutTests/fast/url/script-tests/path.js
    127 http://example.com/././foo about:blank s:http h:example.com p:/foo
    128 http://example.com/./.foo  s:http h:example.com p:/.foo
    129 http://example.com/foo/.  s:http h:example.com p:/foo/
    130 http://example.com/foo/./  s:http h:example.com p:/foo/
    131 http://example.com/foo/bar/..  s:http h:example.com p:/foo/
    132 http://example.com/foo/bar/../  s:http h:example.com p:/foo/
    133 http://example.com/foo/..bar  s:http h:example.com p:/foo/..bar
    134 http://example.com/foo/bar/../ton  s:http h:example.com p:/foo/ton
    135 http://example.com/foo/bar/../ton/../../a  s:http h:example.com p:/a
    136 http://example.com/foo/../../..  s:http h:example.com p:/
    137 http://example.com/foo/../../../ton  s:http h:example.com p:/ton
    138 http://example.com/foo/%2e  s:http h:example.com p:/foo/
    139 http://example.com/foo/%2e%2  s:http h:example.com p:/foo/%2e%2
    140 http://example.com/foo/%2e./%2e%2e/.%2e/%2e.bar  s:http h:example.com p:/%2e.bar
    141 http://example.com////../..  s:http h:example.com p://
    142 http://example.com/foo/bar//../..  s:http h:example.com p:/foo/
    143 http://example.com/foo/bar//..  s:http h:example.com p:/foo/bar/
    144 http://example.com/foo  s:http h:example.com p:/foo
    145 http://example.com/%20foo  s:http h:example.com p:/%20foo
    146 http://example.com/foo%  s:http h:example.com p:/foo%
    147 http://example.com/foo%2  s:http h:example.com p:/foo%2
    148 http://example.com/foo%2zbar  s:http h:example.com p:/foo%2zbar
    149 http://example.com/foo%2\u00C2\u00A9zbar  s:http h:example.com p:/foo%2%C3%82%C2%A9zbar
    150 http://example.com/foo%41%7a  s:http h:example.com p:/foo%41%7a
    151 http://example.com/foo\t\u0091%91  s:http h:example.com p:/foo%C2%91%91
    152 http://example.com/foo%00%51  s:http h:example.com p:/foo%00%51
    153 http://example.com/(%28:%3A%29)  s:http h:example.com p:/(%28:%3A%29)
    154 http://example.com/%3A%3a%3C%3c  s:http h:example.com p:/%3A%3a%3C%3c
    155 http://example.com/foo\tbar  s:http h:example.com p:/foobar
    156 http://example.com\\\\foo\\\\bar  s:http h:example.com p://foo//bar
    157 http://example.com/%7Ffp3%3Eju%3Dduvgw%3Dd  s:http h:example.com p:/%7Ffp3%3Eju%3Dduvgw%3Dd
    158 http://example.com/@asdf%40  s:http h:example.com p:/@asdf%40
    159 http://example.com/\u4F60\u597D\u4F60\u597D  s:http h:example.com p:/%E4%BD%A0%E5%A5%BD%E4%BD%A0%E5%A5%BD
    160 http://example.com/\u2025/foo  s:http h:example.com p:/%E2%80%A5/foo
    161 http://example.com/\uFEFF/foo  s:http h:example.com p:/%EF%BB%BF/foo
    162 http://example.com/\u202E/foo/\u202D/bar  s:http h:example.com p:/%E2%80%AE/foo/%E2%80%AD/bar
    163 
    164 # Based on http://trac.webkit.org/browser/trunk/LayoutTests/fast/url/script-tests/relative.js
    165 http://www.google.com/foo?bar=baz# about:blank s:http h:www.google.com p:/foo q:?bar=baz f:#
    166 http://www.google.com/foo?bar=baz#\s\u00BB  s:http h:www.google.com p:/foo q:?bar=baz f:#\s\u00BB
    167 data:test#\s\u00BB  s:data p:test f:#\s\u00BB
    168 http://[www.google.com]/
    169 http://www.google.com  s:http h:www.google.com p:/
    170 http://192.0x00A80001  s:http h:192.168.0.1 p:/
    171 http://www/foo%2Ehtml  s:http h:www p:/foo%2Ehtml
    172 http://www/foo/%2E/html  s:http h:www p:/foo/html
    173 http://user:pass@/
    174 http://%25DOMAIN:foobar@foodomain.com/  s:http u:%25DOMAIN pass:foobar h:foodomain.com p:/
    175 http:\\\\www.google.com\\foo  s:http h:www.google.com p:/foo
    176 http://foo:80/  s:http h:foo p:/
    177 http://foo:81/  s:http h:foo port:81 p:/
    178 httpa://foo:80/  s:httpa p://foo:80/
    179 http://foo:-80/
    180 https://foo:443/  s:https h:foo p:/
    181 https://foo:80/  s:https h:foo port:80 p:/
    182 ftp://foo:21/  s:ftp h:foo p:/
    183 ftp://foo:80/  s:ftp h:foo port:80 p:/
    184 gopher://foo:70/  s:gopher h:foo p:/
    185 gopher://foo:443/  s:gopher h:foo port:443 p:/
    186 ws://foo:80/  s:ws h:foo p:/
    187 ws://foo:81/  s:ws h:foo port:81 p:/
    188 ws://foo:443/  s:ws h:foo port:443 p:/
    189 ws://foo:815/  s:ws h:foo port:815 p:/
    190 wss://foo:80/  s:wss h:foo port:80 p:/
    191 wss://foo:81/  s:wss h:foo port:81 p:/
    192 wss://foo:443/  s:wss h:foo p:/
    193 wss://foo:815/  s:wss h:foo port:815 p:/
    194 http:/example.com/  s:http h:example.com p:/
    195 ftp:/example.com/  s:ftp h:example.com p:/
    196 https:/example.com/  s:https h:example.com p:/
    197 madeupscheme:/example.com/  s:madeupscheme p:/example.com/
    198 file:/example.com/  s:file p:/example.com/
    199 ftps:/example.com/  s:ftps p:/example.com/
    200 gopher:/example.com/  s:gopher h:example.com p:/
    201 ws:/example.com/  s:ws h:example.com p:/
    202 wss:/example.com/  s:wss h:example.com p:/
    203 data:/example.com/  s:data p:/example.com/
    204 javascript:/example.com/  s:javascript p:/example.com/
    205 mailto:/example.com/  s:mailto p:/example.com/
    206 http:example.com/  s:http h:example.com p:/
    207 ftp:example.com/  s:ftp h:example.com p:/
    208 https:example.com/  s:https h:example.com p:/
    209 madeupscheme:example.com/  s:madeupscheme p:example.com/
    210 ftps:example.com/  s:ftps p:example.com/
    211 gopher:example.com/  s:gopher h:example.com p:/
    212 ws:example.com/  s:ws h:example.com p:/
    213 wss:example.com/  s:wss h:example.com p:/
    214 data:example.com/  s:data p:example.com/
    215 javascript:example.com/  s:javascript p:example.com/
    216 mailto:example.com/  s:mailto p:example.com/
    217 
    218 # Based on http://trac.webkit.org/browser/trunk/LayoutTests/fast/url/segments-userinfo-vs-host.html
    219 http:@www.example.com about:blank s:http h:www.example.com p:/
    220 http:/@www.example.com  s:http h:www.example.com p:/
    221 http://@www.example.com  s:http h:www.example.com p:/
    222 http:a:b (a] www.example.com  s:http u:a pass:b h:www.example.com p:/
    223 http:/a:b (a] www.example.com  s:http u:a pass:b h:www.example.com p:/
    224 http://a:b@www.example.com  s:http u:a pass:b h:www.example.com p:/
    225 http://@pple.com  s:http h:pple.com p:/
    226 http::b (a] www.example.com  s:http pass:b h:www.example.com p:/
    227 http:/:b (a] www.example.com  s:http pass:b h:www.example.com p:/
    228 http://:b@www.example.com  s:http pass:b h:www.example.com p:/
    229 http:/:@/www.example.com
    230 http://user@/www.example.com
    231 http:@/www.example.com
    232 http:/@/www.example.com
    233 http://@/www.example.com
    234 https:@/www.example.com
    235 http:a:b@/www.example.com
    236 http:/a:b@/www.example.com
    237 http://a:b@/www.example.com
    238 http::@/www.example.com
    239 http:a:@www.example.com  s:http u:a pass: h:www.example.com p:/
    240 http:/a:@www.example.com  s:http u:a pass: h:www.example.com p:/
    241 http://a:@www.example.com  s:http u:a pass: h:www.example.com p:/
    242 http://www.@pple.com  s:http u:www. h:pple.com p:/
    243 http:@:www.example.com
    244 http:/@:www.example.com
    245 http://@:www.example.com
    246 http://:@www.example.com  s:http pass: h:www.example.com p:/
    247 
    248 #Others
    249 / http://www.example.com/test s:http h:www.example.com p:/
    250 /test.txt  s:http h:www.example.com p:/test.txt
    251 .  s:http h:www.example.com p:/
    252 ..  s:http h:www.example.com p:/
    253 test.txt  s:http h:www.example.com p:/test.txt
    254 ./test.txt  s:http h:www.example.com p:/test.txt
    255 ../test.txt  s:http h:www.example.com p:/test.txt
    256 ../aaa/test.txt  s:http h:www.example.com p:/aaa/test.txt
    257 ../../test.txt  s:http h:www.example.com p:/test.txt
    258 \u4E2D/test.txt  s:http h:www.example.com p:/%E4%B8%AD/test.txt
    259 http://www.example2.com  s:http h:www.example2.com p:/
    260 //www.example2.com  s:http h:www.example2.com p:/
    261 
    262 # Based on http://trac.webkit.org/browser/trunk/LayoutTests/fast/url/host.html
    263 
    264 # Basic canonicalization, uppercase should be converted to lowercase
    265 http://ExAmPlE.CoM http://other.com/ s:http p:/ h:example.com
    266 
    267 # Spaces should fail
    268 http://example\sexample.com
    269 
    270 # This should fail
    271 http://Goo%20\sgoo%7C|.com
    272 
    273 # U+3000 is mapped to U+0020 (space) which is disallowed
    274 http://GOO\u00a0\u3000goo.com
    275 
    276 # Other types of space (no-break, zero-width, zero-width-no-break) are
    277 # name-prepped away to nothing.
    278 # U+200B, U+2060, and U+FEFF, are ignored
    279 http://GOO\u200b\u2060\ufeffgoo.com  s:http p:/ h:googoo.com
    280 
    281 # Ideographic full stop (full-width period for Chinese, etc.) should be
    282 # treated as a dot.
    283 # U+3002 is mapped to U+002E (dot)
    284 http://www.foo\u3002bar.com  s:http p:/ h:www.foo.bar.com
    285 
    286 # Invalid unicode characters should fail...
    287 # U+FDD0 is disallowed; %ef%b7%90 is U+FDD0
    288 http://\ufdd0zyx.com
    289 
    290 # ...This is the same as previous but escaped.
    291 http://%ef%b7%90zyx.com
    292 
    293 # Test name prepping, fullwidth input should be converted to ASCII and NOT
    294 # IDN-ized. This is "Go" in fullwidth UTF-8/UTF-16.
    295 http://\uff27\uff4f.com  s:http p:/ h:go.com
    296 
    297 # URL spec forbids the following.
    298 # https://www.w3.org/Bugs/Public/show_bug.cgi?id=24257
    299 http://\uff05\uff14\uff11.com
    300 http://%ef%bc%85%ef%bc%94%ef%bc%91.com
    301 
    302 # ...%00 in fullwidth should fail (also as escaped UTF-8 input)
    303 http://\uff05\uff10\uff10.com
    304 http://%ef%bc%85%ef%bc%90%ef%bc%90.com
    305 
    306 # Basic IDN support, UTF-8 and UTF-16 input should be converted to IDN
    307 http://\u4f60\u597d\u4f60\u597d  s:http p:/ h:xn--6qqa088eba
    308 
    309 # Invalid escaped characters should fail and the percents should be
    310 # escaped. https://www.w3.org/Bugs/Public/show_bug.cgi?id=24191
    311 http://%zz%66%a.com
    312 
    313 # If we get an invalid character that has been escaped.
    314 http://%25
    315 http://hello%00
    316 
    317 # Escaped numbers should be treated like IP addresses if they are.
    318 # No special handling for IPv4 or IPv4-like URLs
    319 http://%30%78%63%30%2e%30%32%35%30.01  s:http p:/ h:192.168.0.1
    320 http://%30%78%63%30%2e%30%32%35%30.01%2e  s:http p:/ h:0xc0.0250.01.
    321 http://192.168.0.257
    322 
    323 # Invalid escaping should trigger the regular host error handling.
    324 http://%3g%78%63%30%2e%30%32%35%30%2E.01
    325 
    326 # Something that isn't exactly an IP should get treated as a host and
    327 # spaces escaped.
    328 http://192.168.0.1\shello
    329 
    330 # Fullwidth and escaped UTF-8 fullwidth should still be treated as IP.
    331 # These are "0Xc0.0250.01" in fullwidth.
    332 http://\uff10\uff38\uff43\uff10\uff0e\uff10\uff12\uff15\uff10\uff0e\uff10\uff11  s:http p:/ h:192.168.0.1
    333 
    334 # Broken IPv6
    335 http://[google.com]
    336 
    337 # Misc Unicode
    338 http://foo:\uD83D\uDCA9@example.com/bar  s:http h:example.com p:/bar u:foo pass:%F0%9F%92%A9
    339 
    340 # resolving a relative reference against an unknown scheme results in an error
    341 x test:test
    342 
    343