From 430b6b672341c7e8b5e4cfafaaae20315e68701b Mon Sep 17 00:00:00 2001 From: Steve Block Date: Fri, 3 Sep 2010 18:46:30 +0100 Subject: Add fast/url LayoutTests at r66079 All tests pass. Change-Id: I2564b234be722a743e48ad07e3995a654202a208 --- LayoutTests/fast/url/anchor-expected.txt | 17 +++ LayoutTests/fast/url/anchor.html | 14 +++ LayoutTests/fast/url/file-expected.txt | 37 ++++++ LayoutTests/fast/url/file-http-base-expected.txt | 37 ++++++ LayoutTests/fast/url/file-http-base.html | 14 +++ LayoutTests/fast/url/file.html | 14 +++ LayoutTests/fast/url/host-expected.txt | 34 ++++++ LayoutTests/fast/url/host.html | 14 +++ LayoutTests/fast/url/ipv4-expected.txt | 63 +++++++++++ LayoutTests/fast/url/ipv4.html | 14 +++ LayoutTests/fast/url/ipv6-expected.txt | 58 ++++++++++ LayoutTests/fast/url/ipv6.html | 14 +++ LayoutTests/fast/url/mailto-expected.txt | 19 ++++ LayoutTests/fast/url/mailto.html | 14 +++ LayoutTests/fast/url/path-expected.txt | 41 +++++++ LayoutTests/fast/url/path-url-expected.txt | 11 ++ LayoutTests/fast/url/path-url.html | 14 +++ LayoutTests/fast/url/path.html | 14 +++ LayoutTests/fast/url/port-expected.txt | 14 +++ LayoutTests/fast/url/port.html | 14 +++ LayoutTests/fast/url/query-expected.txt | 17 +++ LayoutTests/fast/url/query.html | 14 +++ LayoutTests/fast/url/relative-expected.txt | 63 +++++++++++ LayoutTests/fast/url/relative-unix-expected.txt | 12 ++ LayoutTests/fast/url/relative-unix.html | 14 +++ LayoutTests/fast/url/relative-win-expected.txt | 25 ++++ LayoutTests/fast/url/relative-win.html | 14 +++ LayoutTests/fast/url/relative.html | 14 +++ LayoutTests/fast/url/resources/utilities.js | 36 ++++++ LayoutTests/fast/url/scheme-expected.txt | 11 ++ LayoutTests/fast/url/scheme.html | 14 +++ LayoutTests/fast/url/script-tests/TEMPLATE.html | 14 +++ LayoutTests/fast/url/script-tests/anchor.js | 19 ++++ .../fast/url/script-tests/file-http-base.js | 68 +++++++++++ LayoutTests/fast/url/script-tests/file.js | 68 +++++++++++ LayoutTests/fast/url/script-tests/host.js | 72 ++++++++++++ LayoutTests/fast/url/script-tests/ipv4.js | 104 +++++++++++++++++ LayoutTests/fast/url/script-tests/ipv6.js | 126 +++++++++++++++++++++ LayoutTests/fast/url/script-tests/mailto.js | 31 +++++ LayoutTests/fast/url/script-tests/path-url.js | 17 +++ LayoutTests/fast/url/script-tests/path.js | 81 +++++++++++++ LayoutTests/fast/url/script-tests/port.js | 21 ++++ LayoutTests/fast/url/script-tests/query.js | 30 +++++ LayoutTests/fast/url/script-tests/relative-unix.js | 28 +++++ LayoutTests/fast/url/script-tests/relative-win.js | 48 ++++++++ LayoutTests/fast/url/script-tests/relative.js | 94 +++++++++++++++ LayoutTests/fast/url/script-tests/scheme.js | 22 ++++ .../url/script-tests/segments-from-data-url.js | 83 ++++++++++++++ LayoutTests/fast/url/script-tests/segments.js | 83 ++++++++++++++ LayoutTests/fast/url/script-tests/standard-url.js | 47 ++++++++ .../fast/url/script-tests/trivial-segments.js | 18 +++ LayoutTests/fast/url/script-tests/trivial.js | 18 +++ LayoutTests/fast/url/segments-expected.txt | 75 ++++++++++++ .../fast/url/segments-from-data-url-expected.txt | 75 ++++++++++++ LayoutTests/fast/url/segments-from-data-url.html | 14 +++ LayoutTests/fast/url/segments.html | 14 +++ LayoutTests/fast/url/standard-url-expected.txt | 36 ++++++ LayoutTests/fast/url/standard-url.html | 14 +++ LayoutTests/fast/url/trivial-expected.txt | 11 ++ LayoutTests/fast/url/trivial-segments-expected.txt | 10 ++ LayoutTests/fast/url/trivial-segments.html | 14 +++ LayoutTests/fast/url/trivial.html | 14 +++ 62 files changed, 2074 insertions(+) create mode 100644 LayoutTests/fast/url/anchor-expected.txt create mode 100644 LayoutTests/fast/url/anchor.html create mode 100644 LayoutTests/fast/url/file-expected.txt create mode 100644 LayoutTests/fast/url/file-http-base-expected.txt create mode 100644 LayoutTests/fast/url/file-http-base.html create mode 100644 LayoutTests/fast/url/file.html create mode 100644 LayoutTests/fast/url/host-expected.txt create mode 100644 LayoutTests/fast/url/host.html create mode 100644 LayoutTests/fast/url/ipv4-expected.txt create mode 100644 LayoutTests/fast/url/ipv4.html create mode 100644 LayoutTests/fast/url/ipv6-expected.txt create mode 100644 LayoutTests/fast/url/ipv6.html create mode 100644 LayoutTests/fast/url/mailto-expected.txt create mode 100644 LayoutTests/fast/url/mailto.html create mode 100644 LayoutTests/fast/url/path-expected.txt create mode 100644 LayoutTests/fast/url/path-url-expected.txt create mode 100644 LayoutTests/fast/url/path-url.html create mode 100644 LayoutTests/fast/url/path.html create mode 100644 LayoutTests/fast/url/port-expected.txt create mode 100644 LayoutTests/fast/url/port.html create mode 100644 LayoutTests/fast/url/query-expected.txt create mode 100644 LayoutTests/fast/url/query.html create mode 100644 LayoutTests/fast/url/relative-expected.txt create mode 100644 LayoutTests/fast/url/relative-unix-expected.txt create mode 100644 LayoutTests/fast/url/relative-unix.html create mode 100644 LayoutTests/fast/url/relative-win-expected.txt create mode 100644 LayoutTests/fast/url/relative-win.html create mode 100644 LayoutTests/fast/url/relative.html create mode 100644 LayoutTests/fast/url/resources/utilities.js create mode 100644 LayoutTests/fast/url/scheme-expected.txt create mode 100644 LayoutTests/fast/url/scheme.html create mode 100644 LayoutTests/fast/url/script-tests/TEMPLATE.html create mode 100644 LayoutTests/fast/url/script-tests/anchor.js create mode 100644 LayoutTests/fast/url/script-tests/file-http-base.js create mode 100644 LayoutTests/fast/url/script-tests/file.js create mode 100644 LayoutTests/fast/url/script-tests/host.js create mode 100644 LayoutTests/fast/url/script-tests/ipv4.js create mode 100644 LayoutTests/fast/url/script-tests/ipv6.js create mode 100644 LayoutTests/fast/url/script-tests/mailto.js create mode 100644 LayoutTests/fast/url/script-tests/path-url.js create mode 100644 LayoutTests/fast/url/script-tests/path.js create mode 100644 LayoutTests/fast/url/script-tests/port.js create mode 100644 LayoutTests/fast/url/script-tests/query.js create mode 100644 LayoutTests/fast/url/script-tests/relative-unix.js create mode 100644 LayoutTests/fast/url/script-tests/relative-win.js create mode 100644 LayoutTests/fast/url/script-tests/relative.js create mode 100644 LayoutTests/fast/url/script-tests/scheme.js create mode 100644 LayoutTests/fast/url/script-tests/segments-from-data-url.js create mode 100644 LayoutTests/fast/url/script-tests/segments.js create mode 100644 LayoutTests/fast/url/script-tests/standard-url.js create mode 100644 LayoutTests/fast/url/script-tests/trivial-segments.js create mode 100644 LayoutTests/fast/url/script-tests/trivial.js create mode 100644 LayoutTests/fast/url/segments-expected.txt create mode 100644 LayoutTests/fast/url/segments-from-data-url-expected.txt create mode 100644 LayoutTests/fast/url/segments-from-data-url.html create mode 100644 LayoutTests/fast/url/segments.html create mode 100644 LayoutTests/fast/url/standard-url-expected.txt create mode 100644 LayoutTests/fast/url/standard-url.html create mode 100644 LayoutTests/fast/url/trivial-expected.txt create mode 100644 LayoutTests/fast/url/trivial-segments-expected.txt create mode 100644 LayoutTests/fast/url/trivial-segments.html create mode 100644 LayoutTests/fast/url/trivial.html (limited to 'LayoutTests/fast') diff --git a/LayoutTests/fast/url/anchor-expected.txt b/LayoutTests/fast/url/anchor-expected.txt new file mode 100644 index 0000000..15dc84f --- /dev/null +++ b/LayoutTests/fast/url/anchor-expected.txt @@ -0,0 +1,17 @@ +Test URLs that have an anchor. + +On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". + + +FAIL canonicalize('http://www.example.com/#hello, world') should be http://www.example.com/#hello, world. Was http://www.example.com/#hello,%20world. +FAIL canonicalize('http://www.example.com/#©') should be http://www.example.com/#©. Was http://www.example.com/#%C2%A9. +FAIL canonicalize('http://www.example.com/#𐌀ss') should be http://www.example.com/#𐌀ss. Was http://www.example.com/#%26%2366304%3Bss. +PASS canonicalize('http://www.example.com/#%41%a') is 'http://www.example.com/#%41%a' +FAIL canonicalize('http://www.example.com/#\ud800\u597d') should be http://www.example.com/#�好. Was http://www.example.com/#%26%2355296%3B%26%2322909%3B. +FAIL canonicalize('http://www.example.com/#a\uFDD0') should be http://www.example.com/#a﷐. Was http://www.example.com/#a%26%2364976%3B. +FAIL canonicalize('http://www.example.com/#asdf#qwer') should be http://www.example.com/#asdf#qwer. Was http://www.example.com/#asdf%23qwer. +FAIL canonicalize('http://www.example.com/##asdf') should be http://www.example.com/##asdf. Was http://www.example.com/#%23asdf. +PASS successfullyParsed is true + +TEST COMPLETE + diff --git a/LayoutTests/fast/url/anchor.html b/LayoutTests/fast/url/anchor.html new file mode 100644 index 0000000..b6162c8 --- /dev/null +++ b/LayoutTests/fast/url/anchor.html @@ -0,0 +1,14 @@ + + + + + + + + +

+
+ + + + diff --git a/LayoutTests/fast/url/file-expected.txt b/LayoutTests/fast/url/file-expected.txt new file mode 100644 index 0000000..e85ff52 --- /dev/null +++ b/LayoutTests/fast/url/file-expected.txt @@ -0,0 +1,37 @@ +Canonicalization of file URLs + +On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". + + +FAIL canonicalize('file:c:\\foo\\bar.html') should be file:///C:/foo/bar.html. Was file:///tmp/mock/c:/foo/bar.html. +FAIL canonicalize(' File:c|////foo\\bar.html') should be file:///C:////foo/bar.html. Was file:///tmp/mock/c|////foo/bar.html. +FAIL canonicalize('file:') should be file:///. Was file:///tmp/mock/path. +FAIL canonicalize('file:UNChost/path') should be file://unchost/path. Was file:///tmp/mock/UNChost/path. +FAIL canonicalize('c:\\foo\\bar') should be file:///C:/foo/bar. Was c:/foo/bar. +FAIL canonicalize('C|/foo/bar') should be file:///C:/foo/bar. Was file:///tmp/mock/C|/foo/bar. +FAIL canonicalize('/C|\\foo\\bar') should be file:///C:/foo/bar. Was file:///C|/foo/bar. +FAIL canonicalize('//C|/foo/bar') should be file:///C:/foo/bar. Was file://C|/foo/bar. +PASS canonicalize('//server/file') is 'file://server/file' +PASS canonicalize('\\\\server\\file') is 'file://server/file' +PASS canonicalize('/\\server/file') is 'file://server/file' +FAIL canonicalize('file:c:foo/bar.html') should be file:///C:/foo/bar.html. Was file:///tmp/mock/c:foo/bar.html. +FAIL canonicalize('file:/\\/\\C:\\\\//foo\\bar.html') should be file:///C:////foo/bar.html. Was file:////C:////foo/bar.html. +PASS canonicalize('file:///foo/bar.txt') is 'file:///foo/bar.txt' +FAIL canonicalize('FILE:/\\/\\7:\\\\//foo\\bar.html') should be file://7:////foo/bar.html. Was FILE:////7:////foo/bar.html. +FAIL canonicalize('file:filer/home\\me') should be file://filer/home/me. Was file:///tmp/mock/filer/home/me. +FAIL canonicalize('file:///C:/foo/../../../bar.html') should be file:///C:/bar.html. Was file:///bar.html. +FAIL canonicalize('file:///C:/asdf#\xc2') should be file:///C:/asdf#�. Was file:///C:/asdf#%C2. +PASS canonicalize('file:///home/me') is 'file:///home/me' +FAIL canonicalize('file:c:\\foo\\bar.html') should be file:///c:/foo/bar.html. Was file:///tmp/mock/c:/foo/bar.html. +FAIL canonicalize('file:c|//foo\\bar.html') should be file:///c%7C//foo/bar.html. Was file:///tmp/mock/c|//foo/bar.html. +FAIL canonicalize('//') should be file:///. Was file:. +PASS canonicalize('///') is 'file:///' +PASS canonicalize('///test') is 'file:///test' +FAIL canonicalize('file://test') should be file://test/. Was file://test. +FAIL canonicalize('file://localhost') should be file://localhost/. Was file:. +FAIL canonicalize('file://localhost/') should be file://localhost/. Was file:///. +FAIL canonicalize('file://localhost/test') should be file://localhost/test. Was file:///test. +PASS successfullyParsed is true + +TEST COMPLETE + diff --git a/LayoutTests/fast/url/file-http-base-expected.txt b/LayoutTests/fast/url/file-http-base-expected.txt new file mode 100644 index 0000000..aa860a1 --- /dev/null +++ b/LayoutTests/fast/url/file-http-base-expected.txt @@ -0,0 +1,37 @@ +Canonicalization of file URLs when the base URL is an http URL + +On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". + + +FAIL canonicalize('file:c:\\foo\\bar.html') should be file:///C:/foo/bar.html. Was file://c:/foo/bar.html. +FAIL canonicalize(' File:c|////foo\\bar.html') should be file:///C:////foo/bar.html. Was File://c|////foo/bar.html. +FAIL canonicalize('file:') should be file:///. Was file:. +FAIL canonicalize('file:UNChost/path') should be file://unchost/path. Was file://UNChost/path. +FAIL canonicalize('c:\\foo\\bar') should be file:///C:/foo/bar. Was c:/foo/bar. +FAIL canonicalize('C|/foo/bar') should be file:///C:/foo/bar. Was http://example.com/mock/C|/foo/bar. +FAIL canonicalize('/C|\\foo\\bar') should be file:///C:/foo/bar. Was http://example.com/C|/foo/bar. +FAIL canonicalize('//C|/foo/bar') should be file:///C:/foo/bar. Was http://C|/foo/bar. +FAIL canonicalize('//server/file') should be file://server/file. Was http://server/file. +FAIL canonicalize('\\\\server\\file') should be file://server/file. Was http://server/file. +FAIL canonicalize('/\\server/file') should be file://server/file. Was http://server/file. +FAIL canonicalize('file:c:foo/bar.html') should be file:///C:/foo/bar.html. Was file://c:foo/bar.html. +FAIL canonicalize('file:/\\/\\C:\\\\//foo\\bar.html') should be file:///C:////foo/bar.html. Was file:////C:////foo/bar.html. +PASS canonicalize('file:///foo/bar.txt') is 'file:///foo/bar.txt' +FAIL canonicalize('FILE:/\\/\\7:\\\\//foo\\bar.html') should be file://7:////foo/bar.html. Was FILE:////7:////foo/bar.html. +PASS canonicalize('file:filer/home\\me') is 'file://filer/home/me' +FAIL canonicalize('file:///C:/foo/../../../bar.html') should be file:///C:/bar.html. Was file:///bar.html. +FAIL canonicalize('file:///C:/asdf#\xc2') should be file:///C:/asdf#�. Was file:///C:/asdf#%C2. +PASS canonicalize('file:///home/me') is 'file:///home/me' +FAIL canonicalize('file:c:\\foo\\bar.html') should be file:///c:/foo/bar.html. Was file://c:/foo/bar.html. +FAIL canonicalize('file:c|//foo\\bar.html') should be file:///c%7C//foo/bar.html. Was file://c|//foo/bar.html. +FAIL canonicalize('//') should be file:///. Was http:/. +FAIL canonicalize('///') should be file:///. Was http:/. +FAIL canonicalize('///test') should be file:///test. Was http:/test. +FAIL canonicalize('file://test') should be file://test/. Was file://test. +FAIL canonicalize('file://localhost') should be file://localhost/. Was file:. +FAIL canonicalize('file://localhost/') should be file://localhost/. Was file:///. +FAIL canonicalize('file://localhost/test') should be file://localhost/test. Was file:///test. +PASS successfullyParsed is true + +TEST COMPLETE + diff --git a/LayoutTests/fast/url/file-http-base.html b/LayoutTests/fast/url/file-http-base.html new file mode 100644 index 0000000..8f66a96 --- /dev/null +++ b/LayoutTests/fast/url/file-http-base.html @@ -0,0 +1,14 @@ + + + + + + + + +

+
+ + + + diff --git a/LayoutTests/fast/url/file.html b/LayoutTests/fast/url/file.html new file mode 100644 index 0000000..f808900 --- /dev/null +++ b/LayoutTests/fast/url/file.html @@ -0,0 +1,14 @@ + + + + + + + + +

+
+ + + + diff --git a/LayoutTests/fast/url/host-expected.txt b/LayoutTests/fast/url/host-expected.txt new file mode 100644 index 0000000..afca9ed --- /dev/null +++ b/LayoutTests/fast/url/host-expected.txt @@ -0,0 +1,34 @@ +Canonicalization of host names. + +On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". + + +FAIL canonicalize('http://GoOgLe.CoM/') should be http://google.com/. Was http://GoOgLe.CoM/. +FAIL canonicalize('http://Goo%20 goo%7C|.com/') should be http://goo%20%20goo%7C%7C.com/. Was http://Goo%20 goo%7C|.com/. +FAIL canonicalize('http://GOO  goo.com/') should be http://goo%20%20goo.com/. Was http://goo goo.com/. +PASS canonicalize('http://GOO​⁠goo.com/') is 'http://googoo.com/' +PASS canonicalize('http://www.foo。bar.com/') is 'http://www.foo.bar.com/' +FAIL canonicalize('http://﷐zyx.com/') should be http://%EF%BF%BDzyx.com/. Was http:/. +FAIL canonicalize('http://%ef%b7%90zyx.com/') should be http://%EF%BF%BDzyx.com/. Was http://%ef%b7%90zyx.com/. +PASS canonicalize('http://Go.com/') is 'http://go.com/' +FAIL canonicalize('http://%41.com/') should be http://a.com/. Was http://%41.com/. +FAIL canonicalize('http://%ef%bc%85%ef%bc%94%ef%bc%91.com/') should be http://a.com/. Was http://%ef%bc%85%ef%bc%94%ef%bc%91.com/. +PASS canonicalize('http://%00.com/') is 'http://%00.com/' +FAIL canonicalize('http://%ef%bc%85%ef%bc%90%ef%bc%90.com/') should be http://%00.com/. Was http://%ef%bc%85%ef%bc%90%ef%bc%90.com/. +PASS canonicalize('http://你好你好/') is 'http://xn--6qqa088eba/' +FAIL canonicalize('http://%E4%BD%A0%E5%A5%BD你好/') should be http://xn--6qqa088eba/. Was http://xn--%e4%bd%a0%e5%a5%bd-5g72ap39l/. +FAIL canonicalize('http://%zz%66%a/') should be http://%25zzf%25a/. Was http://%zz%66%a/. +PASS canonicalize('http://%25/') is 'http://%25/' +PASS canonicalize('http://hello%00/') is 'http://hello%00/' +FAIL canonicalize('http://%30%78%63%30%2e%30%32%35%30.01/') should be http://192.168.0.1/. Was http://%30%78%63%30%2e%30%32%35%30.01/. +FAIL canonicalize('http://%30%78%63%30%2e%30%32%35%30.01%2e/') should be http://192.168.0.1/. Was http://%30%78%63%30%2e%30%32%35%30.01%2e/. +FAIL canonicalize('http://%3g%78%63%30%2e%30%32%35%30%2E.01/') should be http://%253gxc0.0250..01/. Was http://%3g%78%63%30%2e%30%32%35%30%2E.01/. +FAIL canonicalize('http://192.168.0.1 hello/') should be http://192.168.0.1%20hello/. Was http://192.168.0.1 hello/. +FAIL canonicalize('http://0Xc0.0250.01/') should be http://192.168.0.1/. Was http://0xc0.0250.01/. +PASS canonicalize('http://192.168.0.257/') is 'http://192.168.0.257/' +PASS canonicalize('http://[google.com]/') is 'http://[google.com]/' +FAIL canonicalize('http://т(/') should be http://xn--%28-7ed/. Was http://xn--(-8tb/. +PASS successfullyParsed is true + +TEST COMPLETE + diff --git a/LayoutTests/fast/url/host.html b/LayoutTests/fast/url/host.html new file mode 100644 index 0000000..32082c2 --- /dev/null +++ b/LayoutTests/fast/url/host.html @@ -0,0 +1,14 @@ + + + + + + + + +

+
+ + + + diff --git a/LayoutTests/fast/url/ipv4-expected.txt b/LayoutTests/fast/url/ipv4-expected.txt new file mode 100644 index 0000000..473e8b3 --- /dev/null +++ b/LayoutTests/fast/url/ipv4-expected.txt @@ -0,0 +1,63 @@ +Canonicalization of IPv4 addresses. + +On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". + + +FAIL canonicalize('http:///') should be http:. Was http:/. +PASS canonicalize('http://./') is 'http://./' +PASS canonicalize('http://192.168.0.1/') is 'http://192.168.0.1/' +FAIL canonicalize('http://0300.0250.00.01/') should be http://192.168.0.1/. Was http://0300.0250.00.01/. +FAIL canonicalize('http://0xC0.0Xa8.0x0.0x1/') should be http://192.168.0.1/. Was http://0xC0.0Xa8.0x0.0x1/. +PASS canonicalize('http://192.168.9.com/') is 'http://192.168.9.com/' +PASS canonicalize('http://19a.168.0.1/') is 'http://19a.168.0.1/' +PASS canonicalize('http://0308.0250.00.01/') is 'http://0308.0250.00.01/' +FAIL canonicalize('http://0xCG.0xA8.0x0.0x1/') should be http://0xcg.0xa8.0x0.0x1/. Was http://0xCG.0xA8.0x0.0x1/. +FAIL canonicalize('http://192/') should be http://0.0.0.192/. Was http://192/. +FAIL canonicalize('http://0xC0a80001/') should be http://192.168.0.1/. Was http://0xC0a80001/. +FAIL canonicalize('http://030052000001/') should be http://192.168.0.1/. Was http://030052000001/. +FAIL canonicalize('http://000030052000001/') should be http://192.168.0.1/. Was http://000030052000001/. +FAIL canonicalize('http://192.168/') should be http://192.0.0.168/. Was http://192.168/. +FAIL canonicalize('http://192.0x00A80001/') should be http://192.168.0.1/. Was http://192.0x00A80001/. +FAIL canonicalize('http://0xc0.052000001/') should be http://192.168.0.1/. Was http://0xc0.052000001/. +FAIL canonicalize('http://192.168.1/') should be http://192.168.0.1/. Was http://192.168.1/. +PASS canonicalize('http://192.168.0.0.1/') is 'http://192.168.0.0.1/' +FAIL canonicalize('http://192.168.0.1./') should be http://192.168.0.1/. Was http://192.168.0.1./. +FAIL canonicalize('http://192.168.0.1. hello/') should be http://192.168.0.1.%20hello/. Was http://192.168.0.1. hello/. +PASS canonicalize('http://192.168.0.1../') is 'http://192.168.0.1../' +PASS canonicalize('http://192.168..1/') is 'http://192.168..1/' +PASS canonicalize('http://0x100.0/') is 'http://0x100.0/' +PASS canonicalize('http://0x100.0.0/') is 'http://0x100.0.0/' +PASS canonicalize('http://0x100.0.0.0/') is 'http://0x100.0.0.0/' +PASS canonicalize('http://0.0x100.0.0/') is 'http://0.0x100.0.0/' +PASS canonicalize('http://0.0.0x100.0/') is 'http://0.0.0x100.0/' +PASS canonicalize('http://0.0.0.0x100/') is 'http://0.0.0.0x100/' +PASS canonicalize('http://0.0.0x10000/') is 'http://0.0.0x10000/' +PASS canonicalize('http://0.0x1000000/') is 'http://0.0x1000000/' +PASS canonicalize('http://0x100000000/') is 'http://0x100000000/' +FAIL canonicalize('http://0xFF.0/') should be http://255.0.0.0/. Was http://0xFF.0/. +FAIL canonicalize('http://0xFF.0.0/') should be http://255.0.0.0/. Was http://0xFF.0.0/. +FAIL canonicalize('http://0xFF.0.0.0/') should be http://255.0.0.0/. Was http://0xFF.0.0.0/. +FAIL canonicalize('http://0.0xFF.0.0/') should be http://0.255.0.0/. Was http://0.0xFF.0.0/. +FAIL canonicalize('http://0.0.0xFF.0/') should be http://0.0.255.0/. Was http://0.0.0xFF.0/. +FAIL canonicalize('http://0.0.0.0xFF/') should be http://0.0.0.255/. Was http://0.0.0.0xFF/. +FAIL canonicalize('http://0.0.0xFFFF/') should be http://0.0.255.255/. Was http://0.0.0xFFFF/. +FAIL canonicalize('http://0.0xFFFFFF/') should be http://0.255.255.255/. Was http://0.0xFFFFFF/. +FAIL canonicalize('http://0xFFFFFFFF/') should be http://255.255.255.255/. Was http://0xFFFFFFFF/. +PASS canonicalize('http://276.256.0xf1a2.077777/') is 'http://276.256.0xf1a2.077777/' +PASS canonicalize('http://192.168.0.257/') is 'http://192.168.0.257/' +PASS canonicalize('http://192.168.0xa20001/') is 'http://192.168.0xa20001/' +PASS canonicalize('http://192.015052000001/') is 'http://192.015052000001/' +FAIL canonicalize('http://0X12C0a80001/') should be http://0x12c0a80001/. Was http://0X12C0a80001/. +PASS canonicalize('http://276.1.2/') is 'http://276.1.2/' +FAIL canonicalize('http://192.168.0.1 hello/') should be http://192.168.0.1%20hello/. Was http://192.168.0.1 hello/. +FAIL canonicalize('http://0000000000000300.0x00000000000000fF.00000000000000001/') should be http://192.255.0.1/. Was http://0000000000000300.0x00000000000000fF.00000000000000001/. +FAIL canonicalize('http://0000000000000300.0xffffffffFFFFFFFF.3022415481470977/') should be http://0000000000000300.0xffffffffffffffff.3022415481470977/. Was http://0000000000000300.0xffffffffFFFFFFFF.3022415481470977/. +FAIL canonicalize('http://00000000000000000001/') should be http://0.0.0.1/. Was http://00000000000000000001/. +PASS canonicalize('http://0000000000000000100000000000000001/') is 'http://0000000000000000100000000000000001/' +PASS canonicalize('http://0.0.0.000000000000000000z/') is 'http://0.0.0.000000000000000000z/' +PASS canonicalize('http://0.0.0.100000000000000000z/') is 'http://0.0.0.100000000000000000z/' +FAIL canonicalize('http://0.00.0x.0x0/') should be http://0.0.0.0/. Was http://0.00.0x.0x0/. +PASS successfullyParsed is true + +TEST COMPLETE + diff --git a/LayoutTests/fast/url/ipv4.html b/LayoutTests/fast/url/ipv4.html new file mode 100644 index 0000000..588e991 --- /dev/null +++ b/LayoutTests/fast/url/ipv4.html @@ -0,0 +1,14 @@ + + + + + + + + +

+
+ + + + diff --git a/LayoutTests/fast/url/ipv6-expected.txt b/LayoutTests/fast/url/ipv6-expected.txt new file mode 100644 index 0000000..a7319de --- /dev/null +++ b/LayoutTests/fast/url/ipv6-expected.txt @@ -0,0 +1,58 @@ +Canonicalization of IPv6 addresses. + +On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". + + +FAIL canonicalize('http:///') should be http:. Was http:/. +PASS canonicalize('http://[/') is 'http://[/' +PASS canonicalize('http://[:/') is 'http://[:/' +PASS canonicalize('http://]/') is 'http://]/' +PASS canonicalize('http://:]/') is 'http://:]/' +PASS canonicalize('http://[]/') is 'http://[]/' +PASS canonicalize('http://[:]/') is 'http://[:]/' +PASS canonicalize('http://2001:db8::1/') is 'http://2001:db8::1/' +PASS canonicalize('http://[2001:db8::1/') is 'http://[2001:db8::1/' +PASS canonicalize('http://2001:db8::1]/') is 'http://2001:db8::1]/' +PASS canonicalize('http://[::]/') is 'http://[::]/' +PASS canonicalize('http://[::1]/') is 'http://[::1]/' +PASS canonicalize('http://[1::]/') is 'http://[1::]/' +FAIL canonicalize('http://[::192.168.0.1]/') should be http://[::c0a8:1]/. Was http://[::192.168.0.1]/. +FAIL canonicalize('http://[::ffff:192.168.0.1]/') should be http://[::ffff:c0a8:1]/. Was http://[::ffff:192.168.0.1]/. +FAIL canonicalize('http://[000:01:02:003:004:5:6:007]/') should be http://[0:1:2:3:4:5:6:7]/. Was http://[000:01:02:003:004:5:6:007]/. +FAIL canonicalize('http://[A:b:c:DE:fF:0:1:aC]/') should be http://[a:b:c:de:ff:0:1:ac]/. Was http://[A:b:c:DE:fF:0:1:aC]/. +FAIL canonicalize('http://[1:0:0:2::3:0]/') should be http://[1::2:0:0:3:0]/. Was http://[1:0:0:2::3:0]/. +PASS canonicalize('http://[1::2:0:0:3:0]/') is 'http://[1::2:0:0:3:0]/' +PASS canonicalize('http://[::eeee:192.168.0.1]/') is 'http://[::eeee:192.168.0.1]/' +PASS canonicalize('http://[2001::192.168.0.1]/') is 'http://[2001::192.168.0.1]/' +PASS canonicalize('http://[1:2:192.168.0.1:5:6]/') is 'http://[1:2:192.168.0.1:5:6]/' +FAIL canonicalize('http://[::ffff:192.1.2]/') should be http://[::ffff:c001:2]/. Was http://[::ffff:192.1.2]/. +FAIL canonicalize('http://[::ffff:0xC0.0Xa8.0x0.0x1]/') should be http://[::ffff:c0a8:1]/. Was http://[::ffff:0xC0.0Xa8.0x0.0x1]/. +FAIL canonicalize('http://[0:0::0:0:8]/') should be http://[::8]/. Was http://[0:0::0:0:8]/. +PASS canonicalize('http://[2001:db8::1]/') is 'http://[2001:db8::1]/' +PASS canonicalize('http://[2001::db8::1]/') is 'http://[2001::db8::1]/' +PASS canonicalize('http://[2001:db8:::1]/') is 'http://[2001:db8:::1]/' +PASS canonicalize('http://[:::]/') is 'http://[:::]/' +PASS canonicalize('http://[2001::.com]/') is 'http://[2001::.com]/' +PASS canonicalize('http://[::192.168.0.0.1]/') is 'http://[::192.168.0.0.1]/' +PASS canonicalize('http://[::ffff:192.168.0.0.1]/') is 'http://[::ffff:192.168.0.0.1]/' +PASS canonicalize('http://[1:2:3:4:5:6:7:8:9]/') is 'http://[1:2:3:4:5:6:7:8:9]/' +PASS canonicalize('http://[0:0:0:0:0:0:0:192.168.0.1]/') is 'http://[0:0:0:0:0:0:0:192.168.0.1]/' +PASS canonicalize('http://[1:2:3:4:5:6::192.168.0.1]/') is 'http://[1:2:3:4:5:6::192.168.0.1]/' +FAIL canonicalize('http://[1:2:3:4:5:6::8]/') should be http://[1:2:3:4:5:6:0:8]/. Was http://[1:2:3:4:5:6::8]/. +PASS canonicalize('http://[1:2:3:4:5:6:7:8:]/') is 'http://[1:2:3:4:5:6:7:8:]/' +PASS canonicalize('http://[1:2:3:4:5:6:192.168.0.1:]/') is 'http://[1:2:3:4:5:6:192.168.0.1:]/' +PASS canonicalize('http://[-1:2:3:4:5:6:7:8]/') is 'http://[-1:2:3:4:5:6:7:8]/' +FAIL canonicalize('http://[1::%1]/') should be http://[1::%251]/. Was http://[1::%1]/. +FAIL canonicalize('http://[1::%eth0]/') should be http://[1::%25eth0]/. Was http://[1::%eth0]/. +FAIL canonicalize('http://[1::%]/') should be http://[1::%25]/. Was http://[1::%]/. +FAIL canonicalize('http://[%]/') should be http://[%25]/. Was http://[%]/. +FAIL canonicalize('http://[::%:]/') should be http://[::%25:]/. Was http://[::%:]/. +PASS canonicalize('http://[:0:0::0:0:8]/') is 'http://[:0:0::0:0:8]/' +PASS canonicalize('http://[0:0::0:0:8:]/') is 'http://[0:0::0:0:8:]/' +PASS canonicalize('http://[:0:0::0:0:8:]/') is 'http://[:0:0::0:0:8:]/' +PASS canonicalize('http://[::192.168..1]/') is 'http://[::192.168..1]/' +FAIL canonicalize('http://[::1 hello]/') should be http://[::1%20hello]/. Was http://[::1 hello]/. +PASS successfullyParsed is true + +TEST COMPLETE + diff --git a/LayoutTests/fast/url/ipv6.html b/LayoutTests/fast/url/ipv6.html new file mode 100644 index 0000000..d650d1e --- /dev/null +++ b/LayoutTests/fast/url/ipv6.html @@ -0,0 +1,14 @@ + + + + + + + + +

+
+ + + + diff --git a/LayoutTests/fast/url/mailto-expected.txt b/LayoutTests/fast/url/mailto-expected.txt new file mode 100644 index 0000000..cd318f9 --- /dev/null +++ b/LayoutTests/fast/url/mailto-expected.txt @@ -0,0 +1,19 @@ +Tests mailto: URL canonicalization + +On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". + + +PASS canonicalize('mailto:addr1') is 'mailto:addr1' +PASS canonicalize('mailto:addr1@foo.com') is 'mailto:addr1@foo.com' +PASS canonicalize('mailto:addr1 ') is 'mailto:addr1' +PASS canonicalize('mailto:addr1?to=jon') is 'mailto:addr1?to=jon' +PASS canonicalize('mailto:addr1,addr2') is 'mailto:addr1,addr2' +FAIL canonicalize('mailto:addr1, addr2') should be mailto:addr1, addr2. Was mailto:addr1,%20addr2. +PASS canonicalize('mailto:addr1%2caddr2') is 'mailto:addr1%2caddr2' +PASS canonicalize('mailto:𐌀') is 'mailto:%F0%90%8C%80' +PASS canonicalize('mailto:addr1?') is 'mailto:addr1?' +PASS canonicalize('mailto:í €') == 'mailto:%EF%BF%BD' is false +PASS successfullyParsed is true + +TEST COMPLETE + diff --git a/LayoutTests/fast/url/mailto.html b/LayoutTests/fast/url/mailto.html new file mode 100644 index 0000000..eae0213 --- /dev/null +++ b/LayoutTests/fast/url/mailto.html @@ -0,0 +1,14 @@ + + + + + + + + +

+
+ + + + diff --git a/LayoutTests/fast/url/path-expected.txt b/LayoutTests/fast/url/path-expected.txt new file mode 100644 index 0000000..629806b --- /dev/null +++ b/LayoutTests/fast/url/path-expected.txt @@ -0,0 +1,41 @@ +Canonicalization of paths. + +On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". + + +PASS canonicalize('http://example.com/././foo') is 'http://example.com/foo' +PASS canonicalize('http://example.com/./.foo') is 'http://example.com/.foo' +PASS canonicalize('http://example.com/foo/.') is 'http://example.com/foo/' +PASS canonicalize('http://example.com/foo/./') is 'http://example.com/foo/' +PASS canonicalize('http://example.com/foo/bar/..') is 'http://example.com/foo/' +PASS canonicalize('http://example.com/foo/bar/../') is 'http://example.com/foo/' +PASS canonicalize('http://example.com/foo/..bar') is 'http://example.com/foo/..bar' +PASS canonicalize('http://example.com/foo/bar/../ton') is 'http://example.com/foo/ton' +PASS canonicalize('http://example.com/foo/bar/../ton/../../a') is 'http://example.com/a' +PASS canonicalize('http://example.com/foo/../../..') is 'http://example.com/' +PASS canonicalize('http://example.com/foo/../../../ton') is 'http://example.com/ton' +FAIL canonicalize('http://example.com/foo/%2e') should be http://example.com/foo/. Was http://example.com/foo/%2e. +FAIL canonicalize('http://example.com/foo/%2e%2') should be http://example.com/foo/.%2. Was http://example.com/foo/%2e%2. +FAIL canonicalize('http://example.com/foo/%2e./%2e%2e/.%2e/%2e.bar') should be http://example.com/..bar. Was http://example.com/foo/%2e./%2e%2e/.%2e/%2e.bar. +FAIL canonicalize('http://example.com////../..') should be http://example.com//. Was http://example.com/. +PASS canonicalize('http://example.com/foo') is 'http://example.com/foo' +PASS canonicalize('http://example.com/%20foo') is 'http://example.com/%20foo' +PASS canonicalize('http://example.com/foo%') is 'http://example.com/foo%' +PASS canonicalize('http://example.com/foo%2') is 'http://example.com/foo%2' +PASS canonicalize('http://example.com/foo%2zbar') is 'http://example.com/foo%2zbar' +PASS canonicalize('http://example.com/foo%2©zbar') is 'http://example.com/foo%2%C3%82%C2%A9zbar' +FAIL canonicalize('http://example.com/foo%41%7a') should be http://example.com/fooAz. Was http://example.com/foo%41%7a. +FAIL canonicalize('http://example.com/foo ‘%91') should be http://example.com/foo%09%C2%91%91. Was http://example.com/foo%C2%91%91. +FAIL canonicalize('http://example.com/foo%00%51') should be http://example.com/foo%00Q. Was http://example.com/foo%00%51. +PASS canonicalize('http://example.com/(%28:%3A%29)') is 'http://example.com/(%28:%3A%29)' +PASS canonicalize('http://example.com/%3A%3a%3C%3c') is 'http://example.com/%3A%3a%3C%3c' +FAIL canonicalize('http://example.com/foo bar') should be http://example.com/foo%09bar. Was http://example.com/foobar. +PASS canonicalize('http://example.com\\foo\\bar') is 'http://example.com/foo/bar' +PASS canonicalize('http://example.com/%7Ffp3%3Eju%3Dduvgw%3Dd') is 'http://example.com/%7Ffp3%3Eju%3Dduvgw%3Dd' +PASS canonicalize('http://example.com/@asdf%40') is 'http://example.com/@asdf%40' +PASS canonicalize('http://example.com/你好你好') is 'http://example.com/%E4%BD%A0%E5%A5%BD%E4%BD%A0%E5%A5%BD' +FAIL canonicalize('http://example.com/﷐zyx') should be http://example.com/%EF%BF%BDzyx. Was http://example.com/%EF%B7%90zyx. +PASS successfullyParsed is true + +TEST COMPLETE + diff --git a/LayoutTests/fast/url/path-url-expected.txt b/LayoutTests/fast/url/path-url-expected.txt new file mode 100644 index 0000000..73eaf54 --- /dev/null +++ b/LayoutTests/fast/url/path-url-expected.txt @@ -0,0 +1,11 @@ +Canonicalization of path URLs + +On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". + + +PASS canonicalize('javascript:') is 'javascript:' +FAIL canonicalize('JavaScript:Foo') should be javascript:Foo. Was JavaScript:Foo. +PASS successfullyParsed is true + +TEST COMPLETE + diff --git a/LayoutTests/fast/url/path-url.html b/LayoutTests/fast/url/path-url.html new file mode 100644 index 0000000..b1bfbbc --- /dev/null +++ b/LayoutTests/fast/url/path-url.html @@ -0,0 +1,14 @@ + + + + + + + + +

+
+ + + + diff --git a/LayoutTests/fast/url/path.html b/LayoutTests/fast/url/path.html new file mode 100644 index 0000000..b4e7049 --- /dev/null +++ b/LayoutTests/fast/url/path.html @@ -0,0 +1,14 @@ + + + + + + + + +

+
+ + + + diff --git a/LayoutTests/fast/url/port-expected.txt b/LayoutTests/fast/url/port-expected.txt new file mode 100644 index 0000000..d64dd3a --- /dev/null +++ b/LayoutTests/fast/url/port-expected.txt @@ -0,0 +1,14 @@ +Test URLs that have a port number. + +On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". + + +FAIL canonicalize('http://www.example.com:as df/') should be http://www.example.com:as%20df/. Was http://www.example.com:as df/. +PASS canonicalize('http://www.example.com:-2/') is 'http://www.example.com:-2/' +FAIL canonicalize('http://www.example.com:80/') should be http://www.example.com/. Was http://www.example.com:80/. +PASS canonicalize('http://www.example.com:8080/') is 'http://www.example.com:8080/' +PASS canonicalize('foobar://www.example.com:80/') is 'foobar://www.example.com:80/' +PASS successfullyParsed is true + +TEST COMPLETE + diff --git a/LayoutTests/fast/url/port.html b/LayoutTests/fast/url/port.html new file mode 100644 index 0000000..9200755 --- /dev/null +++ b/LayoutTests/fast/url/port.html @@ -0,0 +1,14 @@ + + + + + + + + +

+
+ + + + diff --git a/LayoutTests/fast/url/query-expected.txt b/LayoutTests/fast/url/query-expected.txt new file mode 100644 index 0000000..9941416 --- /dev/null +++ b/LayoutTests/fast/url/query-expected.txt @@ -0,0 +1,17 @@ +Test URLs that have a query string. + +On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". + + +PASS canonicalize('http://www.example.com/?foo=bar') is 'http://www.example.com/?foo=bar' +PASS canonicalize('http://www.example.com/?as?df') is 'http://www.example.com/?as?df' +FAIL canonicalize('http://www.example.com/?\x02hello bye') should be http://www.example.com/?%02hello%7F%20bye. Was http://www.example.com/?hello%7F%20bye. +PASS canonicalize('http://www.example.com/?%40%41123') is 'http://www.example.com/?%40%41123' +PASS canonicalize('http://www.example.com/?q=你好') is 'http://www.example.com/?q=%26%2320320%3B%26%2322909%3B' +PASS canonicalize('http://www.example.com/?q=\ud800\ud800') is 'http://www.example.com/?q=%26%2355296%3B%26%2355296%3B' +PASS canonicalize('http://www.example.com/?q=') is 'http://www.example.com/?q=%3Casdf%3E' +PASS canonicalize('http://www.example.com/?q="asdf"') is 'http://www.example.com/?q=%22asdf%22' +PASS successfullyParsed is true + +TEST COMPLETE + diff --git a/LayoutTests/fast/url/query.html b/LayoutTests/fast/url/query.html new file mode 100644 index 0000000..ab8e62d --- /dev/null +++ b/LayoutTests/fast/url/query.html @@ -0,0 +1,14 @@ + + + + + + + + +

+
+ + + + diff --git a/LayoutTests/fast/url/relative-expected.txt b/LayoutTests/fast/url/relative-expected.txt new file mode 100644 index 0000000..684253f --- /dev/null +++ b/LayoutTests/fast/url/relative-expected.txt @@ -0,0 +1,63 @@ +Test resolution of relative URLs. + +On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". + + +PASS canonicalize('http://another/') is 'http://another/' +PASS canonicalize('http:////another/') is 'http://another/' +PASS canonicalize('') is 'http://foo/bar' +PASS canonicalize('') is 'http://foo/bar' +PASS canonicalize('') is 'http://foo/bar' +PASS canonicalize(' another ') is 'http://foo/another' +PASS canonicalize(' . ') is 'http://foo/' +PASS canonicalize(' ') is 'http://foo/bar' +PASS canonicalize('http:path') is 'http://host/path' +PASS canonicalize('http:path') is 'http://host/a/path' +FAIL canonicalize('http:/path') should be http://host/path. Was http:/path. +FAIL canonicalize('HTTP:/path') should be http://host/path. Was HTTP:/path. +FAIL canonicalize('https:host2') should be https://host2/. Was https:host2. +PASS canonicalize('htto:/host2') is 'htto:/host2' +PASS canonicalize('/b/c/d') is 'http://host/b/c/d' +PASS canonicalize('\\b\\c\\d') is 'http://host/b/c/d' +PASS canonicalize('/b/../c') is 'http://host/c' +PASS canonicalize('/b/../c') is 'http://host/c' +PASS canonicalize('\\b/../c?x#y') is 'http://host/c?x#y' +PASS canonicalize('/b/../c?x#y') is 'http://host/c?x#y' +PASS canonicalize('b') is 'http://host/b' +PASS canonicalize('bc/de') is 'http://host/bc/de' +PASS canonicalize('bc/de?query#ref') is 'http://host/a/bc/de?query#ref' +PASS canonicalize('.') is 'http://host/a/' +PASS canonicalize('..') is 'http://host/' +PASS canonicalize('./..') is 'http://host/' +PASS canonicalize('../.') is 'http://host/' +PASS canonicalize('././.') is 'http://host/a/' +PASS canonicalize('../../../foo') is 'http://host/foo' +PASS canonicalize('?foo=bar') is 'http://host/a?foo=bar' +PASS canonicalize('?') is 'http://host/a?' +PASS canonicalize('?foo=bar#com') is 'http://host/a?foo=bar#com' +PASS canonicalize('#ref') is 'http://host/a#ref' +PASS canonicalize('#') is 'http://host/a#' +PASS canonicalize('#bye') is 'http://host/a?foo=bar#bye' +FAIL canonicalize('baz.html') should be . Was baz.html. +PASS canonicalize('data:baz') is 'data:baz' +PASS canonicalize('data:/base') is 'data:/base' +PASS canonicalize('http://host/') is 'http://host/' +FAIL canonicalize('http:host') should be http://host/. Was http:host. +PASS canonicalize('./asd:fgh') is 'http://foo/asd:fgh' +PASS canonicalize(':foo') is 'http://foo/:foo' +PASS canonicalize(' hello world') is 'http://foo/hello%20world' +FAIL canonicalize(':foo') should be . Was :foo. +PASS canonicalize(';foo') is 'http://host/;foo' +PASS canonicalize(';foo') is 'http://host/;foo' +PASS canonicalize(';/../bar') is 'http://host/bar' +PASS canonicalize('//another') is 'http://another/' +PASS canonicalize('//another/path?query#ref') is 'http://another/path?query#ref' +FAIL canonicalize('///another/path') should be http://another/path. Was http:/another/path. +FAIL canonicalize('//Another\\path') should be http://another/path. Was http://Another/path. +FAIL canonicalize('//') should be http:. Was http:/. +PASS canonicalize('\\/another/path') is 'http://another/path' +FAIL canonicalize('/\\Another\\path') should be http://another/path. Was http://Another/path. +PASS successfullyParsed is true + +TEST COMPLETE + diff --git a/LayoutTests/fast/url/relative-unix-expected.txt b/LayoutTests/fast/url/relative-unix-expected.txt new file mode 100644 index 0000000..acd59ab --- /dev/null +++ b/LayoutTests/fast/url/relative-unix-expected.txt @@ -0,0 +1,12 @@ +Test resolution of relative UNIX-like URLs. + +On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". + + +FAIL canonicalize('\\\\Another\\path') should be http://another/path. Was http://Another/path. +PASS canonicalize('/c:\\foo') is 'http://host/c:/foo' +FAIL canonicalize('//c:\\foo') should be http://c/foo. Was http://c:/foo. +PASS successfullyParsed is true + +TEST COMPLETE + diff --git a/LayoutTests/fast/url/relative-unix.html b/LayoutTests/fast/url/relative-unix.html new file mode 100644 index 0000000..56c5c56 --- /dev/null +++ b/LayoutTests/fast/url/relative-unix.html @@ -0,0 +1,14 @@ + + + + + + + + +

+
+ + + + diff --git a/LayoutTests/fast/url/relative-win-expected.txt b/LayoutTests/fast/url/relative-win-expected.txt new file mode 100644 index 0000000..733f815 --- /dev/null +++ b/LayoutTests/fast/url/relative-win-expected.txt @@ -0,0 +1,25 @@ +Test resolution of relative Windows-like URLs. + +On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". + + +PASS canonicalize('http://host/') is 'http://host/' +PASS canonicalize('bar') is 'file:///C:/bar' +FAIL canonicalize('../../../bar.html') should be file:///C:/bar.html. Was file:///bar.html. +FAIL canonicalize('/../bar.html') should be file:///C:/bar.html. Was file:///bar.html. +FAIL canonicalize('\\\\another\\path') should be . Was http://another/path. +FAIL canonicalize('//c:/foo') should be file:///C:/foo. Was file://c:/foo. +FAIL canonicalize('//localhost/c:/foo') should be file:///C:/foo. Was file:///c:/foo. +FAIL canonicalize('c:') should be . Was c:. +FAIL canonicalize('c:/foo') should be . Was c:/foo. +FAIL canonicalize('c:\\foo') should be . Was c:/foo. +FAIL canonicalize('/z:/bar') should be file:///Z:/bar. Was file:///z:/bar. +FAIL canonicalize('/bar') should be file:///C:/bar. Was file:///bar. +FAIL canonicalize('/bar') should be file://localhost/C:/bar. Was file:///bar. +FAIL canonicalize('/bar') should be file:///C:/bar. Was file:///bar. +PASS canonicalize('//somehost/path') is 'file://somehost/path' +FAIL canonicalize('/\\//somehost/path') should be file://somehost/path. Was file:////somehost/path. +PASS successfullyParsed is true + +TEST COMPLETE + diff --git a/LayoutTests/fast/url/relative-win.html b/LayoutTests/fast/url/relative-win.html new file mode 100644 index 0000000..39ffaec --- /dev/null +++ b/LayoutTests/fast/url/relative-win.html @@ -0,0 +1,14 @@ + + + + + + + + +

+
+ + + + diff --git a/LayoutTests/fast/url/relative.html b/LayoutTests/fast/url/relative.html new file mode 100644 index 0000000..a29a482 --- /dev/null +++ b/LayoutTests/fast/url/relative.html @@ -0,0 +1,14 @@ + + + + + + + + +

+
+ + + + diff --git a/LayoutTests/fast/url/resources/utilities.js b/LayoutTests/fast/url/resources/utilities.js new file mode 100644 index 0000000..6392198 --- /dev/null +++ b/LayoutTests/fast/url/resources/utilities.js @@ -0,0 +1,36 @@ +// Start the bidding at 42 for no particular reason. +var lastID = 42; + +function canonicalize(url) +{ + // It would be more elegant to use the DOM here, but we use document.write() + // so the tests run correctly in Firefox. + var id = ++lastID; + document.write(""); + return document.getElementById(id).href; +} + +function setBaseURL(url) +{ + // According to the HTML5 spec, we're only supposed to honor elements + // in the , but we use document.write() here to make the test run in + // Firefox. + document.write(''); +} + +function segments(url) +{ + // It would be more elegant to use the DOM here, but we use document.write() + // so the tests run correctly in Firefox. + var id = ++lastID; + document.write(""); + var elmt = document.getElementById(id); + return JSON.stringify([ + elmt.protocol, + elmt.hostname, + elmt.port, + elmt.pathname, + elmt.search, + elmt.hash + ]); +} diff --git a/LayoutTests/fast/url/scheme-expected.txt b/LayoutTests/fast/url/scheme-expected.txt new file mode 100644 index 0000000..8709b81 --- /dev/null +++ b/LayoutTests/fast/url/scheme-expected.txt @@ -0,0 +1,11 @@ +Canonicalization of URL schemes. + +On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". + + +PASS canonicalize('http://example.com/') is 'http://example.com/' +FAIL canonicalize('HTTP://example.com/') should be http://example.com/. Was HTTP://example.com/. +PASS successfullyParsed is true + +TEST COMPLETE + diff --git a/LayoutTests/fast/url/scheme.html b/LayoutTests/fast/url/scheme.html new file mode 100644 index 0000000..afb7782 --- /dev/null +++ b/LayoutTests/fast/url/scheme.html @@ -0,0 +1,14 @@ + + + + + + + + +

+
+ + + + diff --git a/LayoutTests/fast/url/script-tests/TEMPLATE.html b/LayoutTests/fast/url/script-tests/TEMPLATE.html new file mode 100644 index 0000000..1c30984 --- /dev/null +++ b/LayoutTests/fast/url/script-tests/TEMPLATE.html @@ -0,0 +1,14 @@ + + + + + + + + +

+
+ + + + diff --git a/LayoutTests/fast/url/script-tests/anchor.js b/LayoutTests/fast/url/script-tests/anchor.js new file mode 100644 index 0000000..0387a86 --- /dev/null +++ b/LayoutTests/fast/url/script-tests/anchor.js @@ -0,0 +1,19 @@ +description("Test URLs that have an anchor."); + +cases = [ + ["hello, world", "hello, world"], + ["\xc2\xa9", "\xc2\xa9"], + ["\ud800\udf00ss", "\ud800\udf00ss"], + ["%41%a", "%41%a"], + ["\\ud800\\u597d", "\\uFFFD\\u597D"], + ["a\\uFDD0", "a\\uFDD0"], + ["asdf#qwer", "asdf#qwer"], + ["#asdf", "#asdf"], +]; + +for (var i = 0; i < cases.length; ++i) { + shouldBe("canonicalize('http://www.example.com/#" + cases[i][0] + "')", + "'http://www.example.com/#" + cases[i][1] + "'"); +} + +var successfullyParsed = true; diff --git a/LayoutTests/fast/url/script-tests/file-http-base.js b/LayoutTests/fast/url/script-tests/file-http-base.js new file mode 100644 index 0000000..ca9e734 --- /dev/null +++ b/LayoutTests/fast/url/script-tests/file-http-base.js @@ -0,0 +1,68 @@ +description("Canonicalization of file URLs when the base URL is an http URL"); + +cases = [ + // Windows-style paths + ["file:c:\\\\foo\\\\bar.html", "file:///C:/foo/bar.html"], + [" File:c|////foo\\\\bar.html", "file:///C:////foo/bar.html"], + ["file:", "file:///"], + ["file:UNChost/path", "file://unchost/path"], + // CanonicalizeFileURL supports absolute Windows style paths for IE + // compatability. Note that the caller must decide that this is a file + // URL itself so it can call the file canonicalizer. This is usually + // done automatically as part of relative URL resolving. + ["c:\\\\foo\\\\bar", "file:///C:/foo/bar"], + ["C|/foo/bar", "file:///C:/foo/bar"], + ["/C|\\\\foo\\\\bar", "file:///C:/foo/bar"], + ["//C|/foo/bar", "file:///C:/foo/bar"], + ["//server/file", "file://server/file"], + ["\\\\\\\\server\\\\file", "file://server/file"], + ["/\\\\server/file", "file://server/file"], + // We should preserve the number of slashes after the colon for IE + // compatability, except when there is none, in which case we should + // add one. + ["file:c:foo/bar.html", "file:///C:/foo/bar.html"], + ["file:/\\\\/\\\\C:\\\\\\\\//foo\\\\bar.html", "file:///C:////foo/bar.html"], + // Three slashes should be non-UNC, even if there is no drive spec (IE + // does this, which makes the resulting request invalid). + ["file:///foo/bar.txt", "file:///foo/bar.txt"], + // TODO(brettw) we should probably fail for invalid host names, which + // would change the expected result on this test. We also currently allow + // colon even though it's probably invalid, because its currently the + // "natural" result of the way the canonicalizer is written. There doesn't + // seem to be a strong argument for why allowing it here would be bad, so + // we just tolerate it and the load will fail later. + ["FILE:/\\\\/\\\\7:\\\\\\\\//foo\\\\bar.html", "file://7:////foo/bar.html"], + ["file:filer/home\\\\me", "file://filer/home/me"], + // Make sure relative paths can't go above the "C:" + ["file:///C:/foo/../../../bar.html", "file:///C:/bar.html"], + // Busted refs shouldn't make the whole thing fail. + ["file:///C:/asdf#\\xc2", "file:///C:/asdf#\\xef\\xbf\\xbd"], + + // Unix-style paths + ["file:///home/me", "file:///home/me"], + // Windowsy ones should get still treated as Unix-style. + ["file:c:\\\\foo\\\\bar.html", "file:///c:/foo/bar.html"], + ["file:c|//foo\\\\bar.html", "file:///c%7C//foo/bar.html"], + // file: tests from WebKit (LayoutTests/fast/loader/url-parse-1.html) + ["//", "file:///"], + ["///", "file:///"], + ["///test", "file:///test"], + ["file://test", "file://test/"], + ["file://localhost", "file://localhost/"], + ["file://localhost/", "file://localhost/"], + ["file://localhost/test", "file://localhost/test"], +]; + +var originalBaseURL = canonicalize("."); +setBaseURL("http://example.com/mock/path"); + +for (var i = 0; i < cases.length; ++i) { + test_vector = cases[i][0]; + expected_result = cases[i][1]; + shouldBe("canonicalize('" + test_vector + "')", + "'" + expected_result + "'"); +} + +setBaseURL(originalBaseURL); + +var successfullyParsed = true; diff --git a/LayoutTests/fast/url/script-tests/file.js b/LayoutTests/fast/url/script-tests/file.js new file mode 100644 index 0000000..ab23d9a --- /dev/null +++ b/LayoutTests/fast/url/script-tests/file.js @@ -0,0 +1,68 @@ +description("Canonicalization of file URLs"); + +cases = [ + // Windows-style paths + ["file:c:\\\\foo\\\\bar.html", "file:///C:/foo/bar.html"], + [" File:c|////foo\\\\bar.html", "file:///C:////foo/bar.html"], + ["file:", "file:///"], + ["file:UNChost/path", "file://unchost/path"], + // CanonicalizeFileURL supports absolute Windows style paths for IE + // compatability. Note that the caller must decide that this is a file + // URL itself so it can call the file canonicalizer. This is usually + // done automatically as part of relative URL resolving. + ["c:\\\\foo\\\\bar", "file:///C:/foo/bar"], + ["C|/foo/bar", "file:///C:/foo/bar"], + ["/C|\\\\foo\\\\bar", "file:///C:/foo/bar"], + ["//C|/foo/bar", "file:///C:/foo/bar"], + ["//server/file", "file://server/file"], + ["\\\\\\\\server\\\\file", "file://server/file"], + ["/\\\\server/file", "file://server/file"], + // We should preserve the number of slashes after the colon for IE + // compatability, except when there is none, in which case we should + // add one. + ["file:c:foo/bar.html", "file:///C:/foo/bar.html"], + ["file:/\\\\/\\\\C:\\\\\\\\//foo\\\\bar.html", "file:///C:////foo/bar.html"], + // Three slashes should be non-UNC, even if there is no drive spec (IE + // does this, which makes the resulting request invalid). + ["file:///foo/bar.txt", "file:///foo/bar.txt"], + // TODO(brettw) we should probably fail for invalid host names, which + // would change the expected result on this test. We also currently allow + // colon even though it's probably invalid, because its currently the + // "natural" result of the way the canonicalizer is written. There doesn't + // seem to be a strong argument for why allowing it here would be bad, so + // we just tolerate it and the load will fail later. + ["FILE:/\\\\/\\\\7:\\\\\\\\//foo\\\\bar.html", "file://7:////foo/bar.html"], + ["file:filer/home\\\\me", "file://filer/home/me"], + // Make sure relative paths can't go above the "C:" + ["file:///C:/foo/../../../bar.html", "file:///C:/bar.html"], + // Busted refs shouldn't make the whole thing fail. + ["file:///C:/asdf#\\xc2", "file:///C:/asdf#\\xef\\xbf\\xbd"], + + // Unix-style paths + ["file:///home/me", "file:///home/me"], + // Windowsy ones should get still treated as Unix-style. + ["file:c:\\\\foo\\\\bar.html", "file:///c:/foo/bar.html"], + ["file:c|//foo\\\\bar.html", "file:///c%7C//foo/bar.html"], + // file: tests from WebKit (LayoutTests/fast/loader/url-parse-1.html) + ["//", "file:///"], + ["///", "file:///"], + ["///test", "file:///test"], + ["file://test", "file://test/"], + ["file://localhost", "file://localhost/"], + ["file://localhost/", "file://localhost/"], + ["file://localhost/test", "file://localhost/test"], +]; + +var originalBaseURL = canonicalize("."); +setBaseURL("file:///tmp/mock/path"); + +for (var i = 0; i < cases.length; ++i) { + test_vector = cases[i][0]; + expected_result = cases[i][1]; + shouldBe("canonicalize('" + test_vector + "')", + "'" + expected_result + "'"); +} + +setBaseURL(originalBaseURL); + +var successfullyParsed = true; diff --git a/LayoutTests/fast/url/script-tests/host.js b/LayoutTests/fast/url/script-tests/host.js new file mode 100644 index 0000000..2f7ee87 --- /dev/null +++ b/LayoutTests/fast/url/script-tests/host.js @@ -0,0 +1,72 @@ +description("Canonicalization of host names."); + +cases = [ + // Basic canonicalization, uppercase should be converted to lowercase. + ["GoOgLe.CoM", "google.com"], + // Spaces and some other characters should be escaped. + ["Goo%20 goo%7C|.com", "goo%20%20goo%7C%7C.com"], + // Exciting different types of spaces! + ["GOO\u00a0\u3000goo.com", "goo%20%20goo.com"], + // Other types of space (no-break, zero-width, zero-width-no-break) are + // name-prepped away to nothing. + ["GOO\u200b\u2060\ufeffgoo.com", "googoo.com"], + // Ideographic full stop (full-width period for Chinese, etc.) should be + // treated as a dot. + ["www.foo\u3002" + "bar.com", "www.foo.bar.com"], + // Invalid unicode characters should fail... + // ...In wide input, ICU will barf and we'll end up with the input as + // escaped UTF-8 (the invalid character should be replaced with the + // replacement character). + ["\ufdd0zyx.com", "%EF%BF%BDzyx.com"], + // ...This is the same as previous but with with escaped. + ["%ef%b7%90zyx.com", "%EF%BF%BDzyx.com"], + // Test name prepping, fullwidth input should be converted to ASCII and NOT + // IDN-ized. This is "Go" in fullwidth UTF-8/UTF-16. + ["\uff27\uff4f.com", "go.com"], + // Test that fullwidth escaped values are properly name-prepped, + // then converted or rejected. + // ...%41 in fullwidth = 'A' (also as escaped UTF-8 input) + ["\uff05\uff14\uff11.com", "a.com"], + ["%ef%bc%85%ef%bc%94%ef%bc%91.com", "a.com"], + // ...%00 in fullwidth should fail (also as escaped UTF-8 input) + ["\uff05\uff10\uff10.com", "%00.com"], + ["%ef%bc%85%ef%bc%90%ef%bc%90.com", "%00.com"], + // Basic IDN support, UTF-8 and UTF-16 input should be converted to IDN + ["\u4f60\u597d\u4f60\u597d", "xn--6qqa088eba"], + // Mixed UTF-8 and escaped UTF-8 (narrow case) and UTF-16 and escaped + // UTF-8 (wide case). The output should be equivalent to the true wide + // character input above). + ["%E4%BD%A0%E5%A5%BD\u4f60\u597d", "xn--6qqa088eba"], + // Invalid escaped characters should fail and the percents should be + // escaped. + ["%zz%66%a", "%25zzf%25a"], + // If we get an invalid character that has been escaped. + ["%25", "%25"], + ["hello%00", "hello%00"], + // Escaped numbers should be treated like IP addresses if they are. + ["%30%78%63%30%2e%30%32%35%30.01", "192.168.0.1"], + ["%30%78%63%30%2e%30%32%35%30.01%2e", "192.168.0.1"], + // Invalid escaping should trigger the regular host error handling. + ["%3g%78%63%30%2e%30%32%35%30%2E.01", "%253gxc0.0250..01"], + // Something that isn't exactly an IP should get treated as a host and + // spaces escaped. + ["192.168.0.1 hello", "192.168.0.1%20hello"], + // Fullwidth and escaped UTF-8 fullwidth should still be treated as IP. + // These are "0Xc0.0250.01" in fullwidth. + ["\uff10\uff38\uff43\uff10\uff0e\uff10\uff12\uff15\uff10\uff0e\uff10\uff11", "192.168.0.1"], + // Broken IP addresses get marked as such. + ["192.168.0.257", "192.168.0.257"], + ["[google.com]", "[google.com]"], + // Cyrillic letter followed buy ( should return punicode for ( escaped before punicode string was created. I.e. + // if ( is escaped after punicode is created we would get xn--%28-8tb (incorrect). + ["\u0442(", "xn--%28-7ed"] +]; + +for (var i = 0; i < cases.length; ++i) { + test_vector = cases[i][0]; + expected_result = cases[i][1]; + shouldBe("canonicalize('http://" + test_vector + "/')", + "'http://" + expected_result + "/'"); +} + +var successfullyParsed = true; diff --git a/LayoutTests/fast/url/script-tests/ipv4.js b/LayoutTests/fast/url/script-tests/ipv4.js new file mode 100644 index 0000000..4b20d63 --- /dev/null +++ b/LayoutTests/fast/url/script-tests/ipv4.js @@ -0,0 +1,104 @@ +description("Canonicalization of IPv4 addresses."); + +cases = [ + [".", ""], + + // Regular IP addresses in different bases. + ["192.168.0.1", "192.168.0.1"], + ["0300.0250.00.01", "192.168.0.1"], + ["0xC0.0Xa8.0x0.0x1", "192.168.0.1"], + + // Non-IP addresses due to invalid characters. + ["192.168.9.com", ""], + + // Invalid characters for the base should be rejected. + ["19a.168.0.1", ""], + ["0308.0250.00.01", ""], + ["0xCG.0xA8.0x0.0x1", ""], + + // If there are not enough components, the last one should fill them out. + ["192", "0.0.0.192"], + ["0xC0a80001", "192.168.0.1"], + ["030052000001", "192.168.0.1"], + ["000030052000001", "192.168.0.1"], + ["192.168", "192.0.0.168"], + ["192.0x00A80001", "192.168.0.1"], + ["0xc0.052000001", "192.168.0.1"], + ["192.168.1", "192.168.0.1"], + + // Too many components means not an IP address. + ["192.168.0.0.1", ""], + + // We allow a single trailing dot. + ["192.168.0.1.", "192.168.0.1"], + ["192.168.0.1. hello", ""], + ["192.168.0.1..", ""], + + // Two dots in a row means not an IP address. + ["192.168..1", ""], + + // Any numerical overflow should be marked as BROKEN. + ["0x100.0", ""], + ["0x100.0.0", ""], + ["0x100.0.0.0", ""], + ["0.0x100.0.0", ""], + ["0.0.0x100.0", ""], + ["0.0.0.0x100", ""], + ["0.0.0x10000", ""], + ["0.0x1000000", ""], + ["0x100000000", ""], + + // Repeat the previous tests, minus 1, to verify boundaries. + ["0xFF.0", "255.0.0.0"], + ["0xFF.0.0", "255.0.0.0"], + ["0xFF.0.0.0", "255.0.0.0"], + ["0.0xFF.0.0", "0.255.0.0"], + ["0.0.0xFF.0", "0.0.255.0"], + ["0.0.0.0xFF", "0.0.0.255"], + ["0.0.0xFFFF", "0.0.255.255"], + ["0.0xFFFFFF", "0.255.255.255"], + ["0xFFFFFFFF", "255.255.255.255"], + + // Old trunctations tests. They're all "BROKEN" now. + ["276.256.0xf1a2.077777", ""], + ["192.168.0.257", ""], + ["192.168.0xa20001", ""], + ["192.015052000001", ""], + ["0X12C0a80001", ""], + ["276.1.2", ""], + + // Spaces should be rejected. + ["192.168.0.1 hello", ""], + + // Very large numbers. + ["0000000000000300.0x00000000000000fF.00000000000000001", "192.255.0.1"], + ["0000000000000300.0xffffffffFFFFFFFF.3022415481470977", ""], + + // A number has no length limit, but long numbers can still overflow. + ["00000000000000000001", "0.0.0.1"], + ["0000000000000000100000000000000001", ""], + + // If a long component is non-numeric, it's a hostname, *not* a broken IP. + ["0.0.0.000000000000000000z", ""], + ["0.0.0.100000000000000000z", ""], + + // Truncation of all zeros should still result in 0. + ["0.00.0x.0x0", "0.0.0.0"] +]; + +// We test the empty string individually. +shouldBe("canonicalize('http:///')", "'http:'"); + +for (var i = 0; i < cases.length; ++i) { + test_vector = cases[i][0]; + expected_result = cases[i][1]; + if (expected_result === "") { + // We use "" to represent that the test vector ought not to parse. + // It appears that we're supposed to apply a default canonicalization. + expected_result = escape(test_vector.toLowerCase()); + } + shouldBe("canonicalize('http://" + test_vector + "/')", + "'http://" + expected_result + "/'"); +} + +var successfullyParsed = true; diff --git a/LayoutTests/fast/url/script-tests/ipv6.js b/LayoutTests/fast/url/script-tests/ipv6.js new file mode 100644 index 0000000..38d9e22 --- /dev/null +++ b/LayoutTests/fast/url/script-tests/ipv6.js @@ -0,0 +1,126 @@ +description("Canonicalization of IPv6 addresses."); + +cases = [ + ["[", ""], + ["[:", ""], + ["]", ""], + [":]", ""], + ["[]", ""], + ["[:]", ""], + + // Regular IP address is invalid without bounding '[' and ']'. + ["2001:db8::1", ""], + ["[2001:db8::1", ""], + ["2001:db8::1]", ""], + + // Regular IP addresses. + ["[::]", "[::]"], + ["[::1]", "[::1]"], + ["[1::]", "[1::]"], + ["[::192.168.0.1]", "[::c0a8:1]"], + ["[::ffff:192.168.0.1]", "[::ffff:c0a8:1]"], + + // Leading zeros should be stripped. + ["[000:01:02:003:004:5:6:007]", "[0:1:2:3:4:5:6:7]"], + + // Upper case letters should be lowercased. + ["[A:b:c:DE:fF:0:1:aC]", "[a:b:c:de:ff:0:1:ac]"], + + // The same address can be written with different contractions, but should + // get canonicalized to the same thing. + ["[1:0:0:2::3:0]", "[1::2:0:0:3:0]"], + ["[1::2:0:0:3:0]", "[1::2:0:0:3:0]"], + + // IPv4 addresses + // Only mapped and compat addresses can have IPv4 syntax embedded. + ["[::eeee:192.168.0.1]", ""], + ["[2001::192.168.0.1]", ""], + ["[1:2:192.168.0.1:5:6]", ""], + + // IPv4 with last component missing. + ["[::ffff:192.1.2]", "[::ffff:c001:2]"], + + // IPv4 using hex. + // FIXME: Should this format be disallowed? + ["[::ffff:0xC0.0Xa8.0x0.0x1]", "[::ffff:c0a8:1]"], + + // There may be zeros surrounding the "::" contraction. + ["[0:0::0:0:8]", "[::8]"], + + ["[2001:db8::1]", "[2001:db8::1]"], + + // Can only have one "::" contraction in an IPv6 string literal. + ["[2001::db8::1]", ""], + + // No more than 2 consecutive ':'s. + ["[2001:db8:::1]", ""], + ["[:::]", ""], + + // Non-IP addresses due to invalid characters. + ["[2001::.com]", ""], + + // Too many components means not an IP address. Similarly with too few if using IPv4 compat or mapped addresses. + ["[::192.168.0.0.1]", ""], + ["[::ffff:192.168.0.0.1]", ""], + ["[1:2:3:4:5:6:7:8:9]", ""], + + // Too many bits (even though 8 comonents, the last one holds 32 bits). + ["[0:0:0:0:0:0:0:192.168.0.1]", ""], + + // Too many bits specified -- the contraction would have to be zero-length + // to not exceed 128 bits. + ["[1:2:3:4:5:6::192.168.0.1]", ""], + + // The contraction is for 16 bits of zero. + ["[1:2:3:4:5:6::8]", "[1:2:3:4:5:6:0:8]"], + + // Cannot have a trailing colon. + ["[1:2:3:4:5:6:7:8:]", ""], + ["[1:2:3:4:5:6:192.168.0.1:]", ""], + + // Cannot have negative numbers. + ["[-1:2:3:4:5:6:7:8]", ""], + + // Scope ID -- the URL may contain an optional ["%" ] section. + // The scope_id should be included in the canonicalized URL, and is an + // unsigned decimal number. + + // Don't allow scope-id + ["[1::%1]", ""], + ["[1::%eth0]", ""], + ["[1::%]", ""], + ["[%]", ""], + ["[::%:]", ""], + + // Don't allow leading or trailing colons. + ["[:0:0::0:0:8]", ""], + ["[0:0::0:0:8:]", ""], + ["[:0:0::0:0:8:]", ""], + + // Two dots in a row means not an IP address. + ["[::192.168..1]", ""], + + // Spaces should be rejected. + ["[::1 hello]", ""] +]; + +// We test the empty string individually. +shouldBe("canonicalize('http:///')", "'http:'"); + +for (var i = 0; i < cases.length; ++i) { + test_vector = cases[i][0]; + expected_result = cases[i][1]; + if (expected_result === "") { + // We use "" to represent that the test vector ought not to parse. + // It appears that we're supposed to apply a default canonicalization, + // and the escape function escapes too much! + expected_result = test_vector.toLowerCase(); + ['%', ' '].forEach(function(c){ + expected_result = expected_result.replace(c, escape(c)); + }) + } + shouldBe("canonicalize('http://" + test_vector + "/')", + "'http://" + expected_result + "/'"); +} + +var successfullyParsed = true; diff --git a/LayoutTests/fast/url/script-tests/mailto.js b/LayoutTests/fast/url/script-tests/mailto.js new file mode 100644 index 0000000..7786d7f --- /dev/null +++ b/LayoutTests/fast/url/script-tests/mailto.js @@ -0,0 +1,31 @@ +description("Tests mailto: URL canonicalization"); + +cases = [ + ["addr1", "addr1"], + ["addr1@foo.com", "addr1@foo.com"], + + // Trailing whitespace is stripped. + ["addr1 \t ", "addr1"], + ["addr1?to=jon", "addr1?to=jon"], + ["addr1,addr2", "addr1,addr2"], + ["addr1, addr2", "addr1, addr2"], + ["addr1%2caddr2", "addr1%2caddr2"], + + // U+10300 input as UTF-16 surrogate pair, expected as escaped UTF-8 + ["\uD800\uDF00", "%F0%90%8C%80"], + ["addr1?", "addr1?"], + + // Null character should be escaped to %00 + // Not sure how to test null characters in JavaScript. They appear to get + // stripped out. + // ["addr1\\0addr2?foo", "addr1%00addr2?foo"], +]; + +for (var i = 0; i < cases.length; ++i) { + shouldBe("canonicalize('mailto:" + cases[i][0] + "')", + "'mailto:" + cases[i][1] + "'"); +} + // Invalid -- UTF-8 encoded surrogate value. +shouldBeFalse("canonicalize('mailto:\xed\xa0\x80') == 'mailto:%EF%BF%BD'"); + +var successfullyParsed = true; diff --git a/LayoutTests/fast/url/script-tests/path-url.js b/LayoutTests/fast/url/script-tests/path-url.js new file mode 100644 index 0000000..5398df9 --- /dev/null +++ b/LayoutTests/fast/url/script-tests/path-url.js @@ -0,0 +1,17 @@ +description("Canonicalization of path URLs"); + +cases = [ + ["javascript:", "javascript:"], + ["JavaScript:Foo", "javascript:Foo"], + // Disabled because this gets treated as a relative URL. + // [":\":This /is interesting;?#", ":\":This /is interesting;?#"], +]; + +for (var i = 0; i < cases.length; ++i) { + test_vector = cases[i][0]; + expected_result = cases[i][1]; + shouldBe("canonicalize('" + test_vector + "')", + "'" + expected_result + "'"); +} + +var successfullyParsed = true; diff --git a/LayoutTests/fast/url/script-tests/path.js b/LayoutTests/fast/url/script-tests/path.js new file mode 100644 index 0000000..10aaf4d --- /dev/null +++ b/LayoutTests/fast/url/script-tests/path.js @@ -0,0 +1,81 @@ +description("Canonicalization of paths."); + +cases = [ + ["/././foo", "/foo"], + ["/./.foo", "/.foo"], + ["/foo/.", "/foo/"], + ["/foo/./", "/foo/"], + // double dots followed by a slash or the end of the string count + ["/foo/bar/..", "/foo/"], + ["/foo/bar/../", "/foo/"], + // don't count double dots when they aren't followed by a slash + ["/foo/..bar", "/foo/..bar"], + // some in the middle + ["/foo/bar/../ton", "/foo/ton"], + ["/foo/bar/../ton/../../a", "/a"], + // we should not be able to go above the root + ["/foo/../../..", "/"], + ["/foo/../../../ton", "/ton"], + // escaped dots should be unescaped and treated the same as dots + ["/foo/%2e", "/foo/"], + ["/foo/%2e%2", "/foo/.%2"], + ["/foo/%2e./%2e%2e/.%2e/%2e.bar", "/..bar"], + // Multiple slashes in a row should be preserved and treated like empty + // directory names. + ["////../..", "//"], + + // ----- escaping tests ----- + ["/foo", "/foo"], + // Valid escape sequence + ["/%20foo", "/%20foo"], + // Invalid escape sequence we should pass through unchanged. + ["/foo%", "/foo%"], + ["/foo%2", "/foo%2"], + // Invalid escape sequence: bad characters should be treated the same as + // the sourrounding text, not as escaped (in this case, UTF-8). + ["/foo%2zbar", "/foo%2zbar"], + // (Disabled because requires UTF8) + // ["/foo%2\xc2\xa9zbar", "/foo%2%C2%A9zbar"], + ["/foo%2\u00c2\u00a9zbar", "/foo%2%C3%82%C2%A9zbar"], + // Regular characters that are escaped should be unescaped + ["/foo%41%7a", "/fooAz"], + // Funny characters that are unescaped should be escaped + ["/foo\u0009\u0091%91", "/foo%09%C2%91%91"], + // Invalid characters that are escaped should cause a failure. + ["/foo%00%51", "/foo%00Q"], + // Some characters should be passed through unchanged regardless of esc. + ["/(%28:%3A%29)", "/(%28:%3A%29)"], + // Characters that are properly escaped should not have the case changed + // of hex letters. + ["/%3A%3a%3C%3c", "/%3A%3a%3C%3c"], + // Funny characters that are unescaped should be escaped + ["/foo\tbar", "/foo%09bar"], + // Backslashes should get converted to forward slashes + ["\\\\foo\\\\bar", "/foo/bar"], + // Hashes found in paths (possibly only when the caller explicitly sets + // the path on an already-parsed URL) should be escaped. + // (Disabled because requires ability to set path directly.) + // ["/foo#bar", "/foo%23bar"], + // %7f should be allowed and %3D should not be unescaped (these were wrong + // in a previous version). + ["/%7Ffp3%3Eju%3Dduvgw%3Dd", "/%7Ffp3%3Eju%3Dduvgw%3Dd"], + // @ should be passed through unchanged (escaped or unescaped). + ["/@asdf%40", "/@asdf%40"], + + // ----- encoding tests ----- + // Basic conversions + ["/\u4f60\u597d\u4f60\u597d", "/%E4%BD%A0%E5%A5%BD%E4%BD%A0%E5%A5%BD"], + // Invalid unicode characters should fail. We only do validation on + // UTF-16 input, so this doesn't happen on 8-bit. + ["/\ufdd0zyx", "/%EF%BF%BDzyx"], + +]; + +for (var i = 0; i < cases.length; ++i) { + test_vector = cases[i][0]; + expected_result = cases[i][1]; + shouldBe("canonicalize('http://example.com" + test_vector + "')", + "'http://example.com" + expected_result + "'"); +} + +var successfullyParsed = true; diff --git a/LayoutTests/fast/url/script-tests/port.js b/LayoutTests/fast/url/script-tests/port.js new file mode 100644 index 0000000..b3228b1 --- /dev/null +++ b/LayoutTests/fast/url/script-tests/port.js @@ -0,0 +1,21 @@ +description("Test URLs that have a port number."); + +cases = [ + // Invalid input should be copied w/ failure. + ["as df", ":as%20df"], + ["-2", ":-2"], + // Default port should be omitted. + ["80", ""], + ["8080", ":8080"], +]; + +for (var i = 0; i < cases.length; ++i) { + shouldBe("canonicalize('http://www.example.com:" + cases[i][0] + "/')", + "'http://www.example.com" + cases[i][1] + "/'"); +} + +// Unspecified port should mean always keep the port. +shouldBe("canonicalize('foobar://www.example.com:80/')", + "'foobar://www.example.com:80/'"); + +var successfullyParsed = true; diff --git a/LayoutTests/fast/url/script-tests/query.js b/LayoutTests/fast/url/script-tests/query.js new file mode 100644 index 0000000..a0468e2 --- /dev/null +++ b/LayoutTests/fast/url/script-tests/query.js @@ -0,0 +1,30 @@ +description("Test URLs that have a query string."); + +cases = [ + // Regular ASCII case in some different encodings. + ["foo=bar", "foo=bar"], + // Allow question marks in the query without escaping + ["as?df", "as?df"], + // Always escape '#' since it would mark the ref. + // Disabled because this test requires being able to set the query directly. + // ["as#df", "as%23df"], + // Escape some questionable 8-bit characters, but never unescape. + ["\\x02hello\x7f bye", "%02hello%7F%20bye"], + ["%40%41123", "%40%41123"], + // Chinese input/output + ["q=\u4F60\u597D", "q=%26%2320320%3B%26%2322909%3B"], + // Invalid UTF-8/16 input should be replaced with invalid characters. + ["q=\\ud800\\ud800", "q=%26%2355296%3B%26%2355296%3B"], + // Don't allow < or > because sometimes they are used for XSS if the + // URL is echoed in content. Firefox does this, IE doesn't. + ["q=", "q=%3Casdf%3E"], + // Escape double quotemarks in the query. + ["q=\"asdf\"", "q=%22asdf%22"], +]; + +for (var i = 0; i < cases.length; ++i) { + shouldBe("canonicalize('http://www.example.com/?" + cases[i][0] + "')", + "'http://www.example.com/?" + cases[i][1] + "'"); +} + +var successfullyParsed = true; diff --git a/LayoutTests/fast/url/script-tests/relative-unix.js b/LayoutTests/fast/url/script-tests/relative-unix.js new file mode 100644 index 0000000..0002485 --- /dev/null +++ b/LayoutTests/fast/url/script-tests/relative-unix.js @@ -0,0 +1,28 @@ +description("Test resolution of relative UNIX-like URLs."); + +cases = [ + // Format: [baseURL, relativeURL, expectedURL], + // On Unix we fall back to relative behavior since there's nothing else + // reasonable to do. + ["http://host/a", "\\\\\\\\Another\\\\path", "http://another/path"], + + // Even on Windows, we don't allow relative drive specs when the base + // is not file. + ["http://host/a", "/c:\\\\foo", "http://host/c:/foo"], + ["http://host/a", "//c:\\\\foo", "http://c/foo"], +]; + +var originalBaseURL = canonicalize("."); + +for (var i = 0; i < cases.length; ++i) { + baseURL = cases[i][0]; + relativeURL = cases[i][1]; + expectedURL = cases[i][2]; + setBaseURL(baseURL); + shouldBe("canonicalize('" + relativeURL + "')", + "'" + expectedURL + "'"); +} + +setBaseURL(originalBaseURL); + +var successfullyParsed = true; diff --git a/LayoutTests/fast/url/script-tests/relative-win.js b/LayoutTests/fast/url/script-tests/relative-win.js new file mode 100644 index 0000000..13ac7af --- /dev/null +++ b/LayoutTests/fast/url/script-tests/relative-win.js @@ -0,0 +1,48 @@ +description("Test resolution of relative Windows-like URLs."); + +cases = [ + // Format: [baseURL, relativeURL, expectedURL], + // Resolving against Windows file base URLs. + ["file:///C:/foo", "http://host/", "http://host/"], + ["file:///C:/foo", "bar", "file:///C:/bar"], + ["file:///C:/foo", "../../../bar.html", "file:///C:/bar.html"], + ["file:///C:/foo", "/../bar.html", "file:///C:/bar.html"], + // But two backslashes on Windows should be UNC so should be treated + // as absolute. + ["http://host/a", "\\\\\\\\another\\\\path", ""], + // IE doesn't support drive specs starting with two slashes. It fails + // immediately and doesn't even try to load. We fix it up to either + // an absolute path or UNC depending on what it looks like. + ["file:///C:/something", "//c:/foo", "file:///C:/foo"], + ["file:///C:/something", "//localhost/c:/foo", "file:///C:/foo"], + // Windows drive specs should be allowed and treated as absolute. + ["file:///C:/foo", "c:", ""], + ["file:///C:/foo", "c:/foo", ""], + ["http://host/a", "c:\\\\foo", ""], + // Relative paths with drive letters should be allowed when the base is + // also a file. + ["file:///C:/foo", "/z:/bar", "file:///Z:/bar"], + // Treat absolute paths as being off of the drive. + ["file:///C:/foo", "/bar", "file:///C:/bar"], + ["file://localhost/C:/foo", "/bar", "file://localhost/C:/bar"], + ["file:///C:/foo/com/", "/bar", "file:///C:/bar"], + // On Windows, two slashes without a drive letter when the base is a file + // means that the path is UNC. + ["file:///C:/something", "//somehost/path", "file://somehost/path"], + ["file:///C:/something", "/\\\\//somehost/path", "file://somehost/path"], +]; + +var originalBaseURL = canonicalize("."); + +for (var i = 0; i < cases.length; ++i) { + baseURL = cases[i][0]; + relativeURL = cases[i][1]; + expectedURL = cases[i][2]; + setBaseURL(baseURL); + shouldBe("canonicalize('" + relativeURL + "')", + "'" + expectedURL + "'"); +} + +setBaseURL(originalBaseURL); + +var successfullyParsed = true; diff --git a/LayoutTests/fast/url/script-tests/relative.js b/LayoutTests/fast/url/script-tests/relative.js new file mode 100644 index 0000000..7966288 --- /dev/null +++ b/LayoutTests/fast/url/script-tests/relative.js @@ -0,0 +1,94 @@ +description("Test resolution of relative URLs."); + +cases = [ + // Format: [baseURL, relativeURL, expectedURL], + // Basic absolute input. + ["http://host/a", "http://another/", "http://another/"], + ["http://host/a", "http:////another/", "http://another/"], + // Empty relative URLs should only remove the ref part of the URL, + // leaving the rest unchanged. + ["http://foo/bar", "", "http://foo/bar"], + ["http://foo/bar#ref", "", "http://foo/bar"], + ["http://foo/bar#", "", "http://foo/bar"], + // Spaces at the ends of the relative path should be ignored. + ["http://foo/bar", " another ", "http://foo/another"], + ["http://foo/bar", " . ", "http://foo/"], + ["http://foo/bar", " \t ", "http://foo/bar"], + // Matching schemes without two slashes are treated as relative. + ["http://host/a", "http:path", "http://host/path"], + ["http://host/a/", "http:path", "http://host/a/path"], + ["http://host/a", "http:/path", "http://host/path"], + ["http://host/a", "HTTP:/path", "http://host/path"], + // Nonmatching schemes are absolute. + ["http://host/a", "https:host2", "https://host2/"], + ["http://host/a", "htto:/host2", "htto:/host2"], + // Absolute path input + ["http://host/a", "/b/c/d", "http://host/b/c/d"], + ["http://host/a", "\\\\b\\\\c\\\\d", "http://host/b/c/d"], + ["http://host/a", "/b/../c", "http://host/c"], + ["http://host/a?b#c", "/b/../c", "http://host/c"], + ["http://host/a", "\\\\b/../c?x#y", "http://host/c?x#y"], + ["http://host/a?b#c", "/b/../c?x#y", "http://host/c?x#y"], + // Relative path input + ["http://host/a", "b", "http://host/b"], + ["http://host/a", "bc/de", "http://host/bc/de"], + ["http://host/a/", "bc/de?query#ref", "http://host/a/bc/de?query#ref"], + ["http://host/a/", ".", "http://host/a/"], + ["http://host/a/", "..", "http://host/"], + ["http://host/a/", "./..", "http://host/"], + ["http://host/a/", "../.", "http://host/"], + ["http://host/a/", "././.", "http://host/a/"], + ["http://host/a?query#ref", "../../../foo", "http://host/foo"], + // Query input + ["http://host/a", "?foo=bar", "http://host/a?foo=bar"], + ["http://host/a?x=y#z", "?", "http://host/a?"], + ["http://host/a?x=y#z", "?foo=bar#com", "http://host/a?foo=bar#com"], + // Ref input + ["http://host/a", "#ref", "http://host/a#ref"], + ["http://host/a#b", "#", "http://host/a#"], + ["http://host/a?foo=bar#hello", "#bye", "http://host/a?foo=bar#bye"], + // Non-hierarchical base: no relative handling. Relative input should + // error, and if a scheme is present, it should be treated as absolute. + ["data:foobar", "baz.html", ""], + ["data:foobar", "data:baz", "data:baz"], + ["data:foobar", "data:/base", "data:/base"], + // Non-hierarchical base: absolute input should succeed. + ["data:foobar", "http://host/", "http://host/"], + ["data:foobar", "http:host", "http://host/"], + // Invalid schemes should be treated as relative. + ["http://foo/bar", "./asd:fgh", "http://foo/asd:fgh"], + ["http://foo/bar", ":foo", "http://foo/:foo"], + ["http://foo/bar", " hello world", "http://foo/hello%20world"], + ["data:asdf", ":foo", ""], + // We should treat semicolons like any other character in URL resolving + ["http://host/a", ";foo", "http://host/;foo"], + ["http://host/a;", ";foo", "http://host/;foo"], + ["http://host/a", ";/../bar", "http://host/bar"], + // Relative URLs can also be written as "//foo/bar" which is relative to + // the scheme. In this case, it would take the old scheme, so for http + // the example would resolve to "http://foo/bar". + ["http://host/a", "//another", "http://another/"], + ["http://host/a", "//another/path?query#ref", "http://another/path?query#ref"], + ["http://host/a", "///another/path", "http://another/path"], + ["http://host/a", "//Another\\\\path", "http://another/path"], + ["http://host/a", "//", "http:"], + // IE will also allow one or the other to be a backslash to get the same + // behavior. + ["http://host/a", "\\\\/another/path", "http://another/path"], + ["http://host/a", "/\\\\Another\\\\path", "http://another/path"], +]; + +var originalBaseURL = canonicalize("."); + +for (var i = 0; i < cases.length; ++i) { + baseURL = cases[i][0]; + relativeURL = cases[i][1]; + expectedURL = cases[i][2]; + setBaseURL(baseURL); + shouldBe("canonicalize('" + relativeURL + "')", + "'" + expectedURL + "'"); +} + +setBaseURL(originalBaseURL); + +var successfullyParsed = true; diff --git a/LayoutTests/fast/url/script-tests/scheme.js b/LayoutTests/fast/url/script-tests/scheme.js new file mode 100644 index 0000000..fb5b26b --- /dev/null +++ b/LayoutTests/fast/url/script-tests/scheme.js @@ -0,0 +1,22 @@ +description("Canonicalization of URL schemes."); + +cases = [ + ["http", "http"], + ["HTTP", "http"], + // These tests trigger the relative URL resolving behavior of + // HTMLAnchorElement.href. In order to test absolute URL parsing, we'd need + // an API that always maps to absolute URLs. If you know of one, please + // enable these tests! + // [" HTTP ", "%20http%20"], + // ["htt: ", "htt%3A%20"], + // ["\xe4\xbd\xa0\xe5\xa5\xbdhttp", "%E4%BD%A0%E5%A5%BDhttp"], + // ["ht%3Atp", "ht%3atp"], +]; + +for (var i = 0; i < cases.length; ++i) { + test_vector = cases[i][0]; + expected_result = cases[i][1]; + shouldBe("canonicalize('" + test_vector + "://example.com/')", + "'" + expected_result + "://example.com/'"); +} +var successfullyParsed = true; diff --git a/LayoutTests/fast/url/script-tests/segments-from-data-url.js b/LayoutTests/fast/url/script-tests/segments-from-data-url.js new file mode 100644 index 0000000..8fc3013 --- /dev/null +++ b/LayoutTests/fast/url/script-tests/segments-from-data-url.js @@ -0,0 +1,83 @@ +description("Test URL segmentation"); + +cases = [ + // [URL, [SCHEME, HOST, PORT, PATH, QUERY, REF]] + ["http://user:pass@foo:21/bar;par?b#c", ["http:","foo","21","/bar;par","?b","#c"]], + ["http:foo.com", ["http:","foo.com","0","/","",""]], + ["\\t :foo.com \\n", [":","","0","","",""]], + [" foo.com ", [":","","0","","",""]], + ["a:\\t foo.com", ["a:","","0"," foo.com","",""]], + ["http://f:21/ b ? d # e ", ["http:","f","21","/%20b%20","?%20d%20","# e"]], + ["http://f:/c", ["http:","f","0","/c","",""]], + ["http://f:0/c", ["http:","f","0","/c","",""]], + ["http://f:00000000000000/c", ["http:","f","0","/c","",""]], + ["http://f:00000000000000000000080/c", ["http:","f","0","/c","",""]], + ["http://f:b/c", [":","","0","","",""]], + ["http://f: /c", [":","","0","","",""]], + ["http://f:\\n/c", ["http:","f","0","/c","",""]], + ["http://f:fifty-two/c", [":","","0","","",""]], + ["http://f:999999/c", [":","","0","","",""]], + ["http://f: 21 / b ? d # e ", [":","","0","","",""]], + ["", ["data:","","0","text/plain,baseURL","",""]], + [" \\t", ["data:","","0","text/plain,baseURL","",""]], + [":foo.com/", [":","","0","","",""]], + [":foo.com\\\\", [":","","0","","",""]], + [":", [":","","0","","",""]], + [":a", [":","","0","","",""]], + [":/", [":","","0","","",""]], + [":\\\\", [":","","0","","",""]], + [":#", [":","","0","","",""]], + ["#", [":","","0","","",""]], + ["#/", [":","","0","","",""]], + ["#\\\\", [":","","0","","",""]], + ["#;?", [":","","0","","",""]], + ["?", [":","","0","","",""]], + ["/", [":","","0","","",""]], + [":23", [":","","0","","",""]], + ["/:23", ["data:","","0","/:23","",""]], + ["//", [":","","0","","",""]], + ["::", [":","","0","","",""]], + ["::23", [":","","0","","",""]], + ["foo://", ["foo:","","0","//","",""]], + ["http://a:b@c:29/d", ["http:","c","29","/d","",""]], + ["http::@c:29", ["http:","c","29","/","",""]], + ["http://&a:foo(b]c@d:2/", ["http:","d","2","/","",""]], + ["http://::@c@d:2", ["http:","d","2","/","",""]], + ["http://foo.com:b@d/", ["http:","d","0","/","",""]], + ["http://foo.com/\\\\@", ["http:","foo.com","0","//@","",""]], + ["http:\\\\\\\\foo.com\\\\", ["http:","foo.com","0","/","",""]], + ["http:\\\\\\\\a\\\\b:c\\\\d@foo.com\\\\", ["http:","a","0","/b:c/d@foo.com/","",""]], + ["foo:/", ["foo:","","0","/","",""]], + ["foo:/bar.com/", ["foo:","","0","/bar.com/","",""]], + ["foo://///////", ["foo:","","0","/////////","",""]], + ["foo://///////bar.com/", ["foo:","","0","/////////bar.com/","",""]], + ["foo:////://///", ["foo:","","0","////://///","",""]], + ["c:/foo", ["c:","","0","/foo","",""]], + ["//foo/bar", [":","","0","","",""]], + ["http://foo/path;a??e#f#g", ["http:","foo","0","/path;a","??e","#f#g"]], + ["http://foo/abcd?efgh?ijkl", ["http:","foo","0","/abcd","?efgh?ijkl",""]], + ["http://foo/abcd#foo?bar", ["http:","foo","0","/abcd","","#foo?bar"]], + ["[61:24:74]:98", ["data:","","0","text/[61:24:74]:98","",""]], + ["http://[61:27]:98", [":","","0","","",""]], + ["http:[61:27]/:foo", [":","","0","","",""]], + ["http://[1::2]:3:4", [":","","0","","",""]], + ["http://2001::1", [":","","0","","",""]], + ["http://[2001::1", [":","","0","","",""]], + ["http://2001::1]", [":","","0","","",""]], + ["http://2001::1]:80", [":","","0","","",""]], + ["http://[2001::1]", ["http:","[2001::1]","0","/","",""]], + ["http://[2001::1]:80", ["http:","[2001::1]","0","/","",""]], + ["http://[[::]]", [":","","0","","",""]], +]; + +var originalBaseURL = canonicalize("."); +setBaseURL("data:text/plain,baseURL"); + +for (var i = 0; i < cases.length; ++i) { + shouldBe("segments('" + cases[i][0] + "')", + "'" + JSON.stringify(cases[i][1]) + "'"); +} + +setBaseURL(originalBaseURL); + +var successfullyParsed = true; diff --git a/LayoutTests/fast/url/script-tests/segments.js b/LayoutTests/fast/url/script-tests/segments.js new file mode 100644 index 0000000..c0c6fa1 --- /dev/null +++ b/LayoutTests/fast/url/script-tests/segments.js @@ -0,0 +1,83 @@ +description("Test URL segmentation"); + +cases = [ + // [URL, [SCHEME, HOST, PORT, PATH, QUERY, REF]] + ["http://user:pass@foo:21/bar;par?b#c", ["http:","foo","21","/bar;par","?b","#c"]], + ["http:foo.com", ["http:","example.org","0","/foo/foo.com","",""]], + ["\\t :foo.com \\n", ["http:","example.org","0","/foo/:foo.com","",""]], + [" foo.com ", ["http:","example.org","0","/foo/foo.com","",""]], + ["a:\\t foo.com", ["a:","","0"," foo.com","",""]], + ["http://f:21/ b ? d # e ", ["http:","f","21","/%20b%20","?%20d%20","# e"]], + ["http://f:/c", ["http:","f","0","/c","",""]], + ["http://f:0/c", ["http:","f","0","/c","",""]], + ["http://f:00000000000000/c", ["http:","f","0","/c","",""]], + ["http://f:00000000000000000000080/c", ["http:","f","0","/c","",""]], + ["http://f:b/c", [":","","0","","",""]], + ["http://f: /c", [":","","0","","",""]], + ["http://f:\\n/c", ["http:","f","0","/c","",""]], + ["http://f:fifty-two/c", [":","","0","","",""]], + ["http://f:999999/c", [":","","0","","",""]], + ["http://f: 21 / b ? d # e ", [":","","0","","",""]], + ["", ["http:","example.org","0","/foo/bar","",""]], + [" \\t", ["http:","example.org","0","/foo/bar","",""]], + [":foo.com/", ["http:","example.org","0","/foo/:foo.com/","",""]], + [":foo.com\\\\", ["http:","example.org","0","/foo/:foo.com/","",""]], + [":", ["http:","example.org","0","/foo/:","",""]], + [":a", ["http:","example.org","0","/foo/:a","",""]], + [":/", ["http:","example.org","0","/foo/:/","",""]], + [":\\\\", ["http:","example.org","0","/foo/:/","",""]], + [":#", ["http:","example.org","0","/foo/:","",""]], + ["#", ["http:","example.org","0","/foo/bar","",""]], + ["#/", ["http:","example.org","0","/foo/bar","","#/"]], + ["#\\\\", ["http:","example.org","0","/foo/bar","","#\\\\"]], + ["#;?", ["http:","example.org","0","/foo/bar","","#;?"]], + ["?", ["http:","example.org","0","/foo/bar","",""]], + ["/", ["http:","example.org","0","/","",""]], + [":23", ["http:","example.org","0","/foo/:23","",""]], + ["/:23", ["http:","example.org","0","/:23","",""]], + ["//", [":","","0","","",""]], + ["::", ["http:","example.org","0","/foo/::","",""]], + ["::23", ["http:","example.org","0","/foo/::23","",""]], + ["foo://", ["foo:","","0","//","",""]], + ["http://a:b@c:29/d", ["http:","c","29","/d","",""]], + ["http::@c:29", ["http:","example.org","0","/foo/:@c:29","",""]], + ["http://&a:foo(b]c@d:2/", ["http:","d","2","/","",""]], + ["http://::@c@d:2", ["http:","d","2","/","",""]], + ["http://foo.com:b@d/", ["http:","d","0","/","",""]], + ["http://foo.com/\\\\@", ["http:","foo.com","0","//@","",""]], + ["http:\\\\\\\\foo.com\\\\", ["http:","foo.com","0","/","",""]], + ["http:\\\\\\\\a\\\\b:c\\\\d@foo.com\\\\", ["http:","a","0","/b:c/d@foo.com/","",""]], + ["foo:/", ["foo:","","0","/","",""]], + ["foo:/bar.com/", ["foo:","","0","/bar.com/","",""]], + ["foo://///////", ["foo:","","0","/////////","",""]], + ["foo://///////bar.com/", ["foo:","","0","/////////bar.com/","",""]], + ["foo:////://///", ["foo:","","0","////://///","",""]], + ["c:/foo", ["c:","","0","/foo","",""]], + ["//foo/bar", ["http:","foo","0","/bar","",""]], + ["http://foo/path;a??e#f#g", ["http:","foo","0","/path;a","??e","#f#g"]], + ["http://foo/abcd?efgh?ijkl", ["http:","foo","0","/abcd","?efgh?ijkl",""]], + ["http://foo/abcd#foo?bar", ["http:","foo","0","/abcd","","#foo?bar"]], + ["[61:24:74]:98", ["http:","example.org","0","/foo/[61:24:74]:98","",""]], + ["http://[61:27]:98", [":","","0","","",""]], + ["http:[61:27]/:foo", ["http:","example.org","0","/foo/[61:27]/:foo","",""]], + ["http://[1::2]:3:4", [":","","0","","",""]], + ["http://2001::1", [":","","0","","",""]], + ["http://[2001::1", [":","","0","","",""]], + ["http://2001::1]", [":","","0","","",""]], + ["http://2001::1]:80", [":","","0","","",""]], + ["http://[2001::1]", ["http:","[2001::1]","0","/","",""]], + ["http://[2001::1]:80", ["http:","[2001::1]","0","/","",""]], + ["http://[[::]]", [":","","0","","",""]], +]; + +var originalBaseURL = canonicalize("."); +setBaseURL("http://example.org/foo/bar"); + +for (var i = 0; i < cases.length; ++i) { + shouldBe("segments('" + cases[i][0] + "')", + "'" + JSON.stringify(cases[i][1]) + "'"); +} + +setBaseURL(originalBaseURL); + +var successfullyParsed = true; diff --git a/LayoutTests/fast/url/script-tests/standard-url.js b/LayoutTests/fast/url/script-tests/standard-url.js new file mode 100644 index 0000000..03808a8 --- /dev/null +++ b/LayoutTests/fast/url/script-tests/standard-url.js @@ -0,0 +1,47 @@ +description("Canonicalization of standard URLs"); + +cases = [ + ["http://www.google.com/foo?bar=baz#", "http://www.google.com/foo?bar=baz#"], + ["http://[www.google.com]/", "http://[www.google.com]/"], + // Disabled because whitespace gets treated different in this API. + // ["ht\ttp:@www.google.com:80/;p?#", "ht%09tp://www.google.com:80/;p?#"], + ["http:////////user:@google.com:99?foo", "http://user@google.com:99/?foo"], + // Disabled because this gets treated as a relative URL. + // ["www.google.com", ":www.google.com/"], + ["http://192.0x00A80001", "http://192.168.0.1/"], + ["http://www/foo%2Ehtml", "http://www/foo.html"], + ["http://user:pass@/", "http://user:pass@/"], + ["http://%25DOMAIN:foobar@foodomain.com/", "http://%25DOMAIN:foobar@foodomain.com/"], + // Backslashes should get converted to forward slashes. + ["http:\\\\\\\\www.google.com\\\\foo", "http://www.google.com/foo"], + // Busted refs shouldn't make the whole thing fail. + ["http://www.google.com/asdf#\\ud800", "http://www.google.com/asdf#\\uFFFD"], + // Basic port tests. + ["http://foo:80/", "http://foo/"], + ["http://foo:81/", "http://foo:81/"], + ["httpa://foo:80/", "httpa://foo:80/"], + ["http://foo:-80/", "http://foo:-80/"], + ["https://foo:443/", "https://foo/"], + ["https://foo:80/", "https://foo:80/"], + ["ftp://foo:21/", "ftp://foo/"], + ["ftp://foo:80/", "ftp://foo:80/"], + ["gopher://foo:70/", "gopher://foo/"], + ["gopher://foo:443/", "gopher://foo:443/"], + ["ws://foo:80/", "ws://foo/"], + ["ws://foo:81/", "ws://foo:81/"], + ["ws://foo:443/", "ws://foo:443/"], + ["ws://foo:815/", "ws://foo:815/"], + ["wss://foo:80/", "wss://foo:80/"], + ["wss://foo:81/", "wss://foo:81/"], + ["wss://foo:443/", "wss://foo/"], + ["wss://foo:815/", "wss://foo:815/"], +]; + +for (var i = 0; i < cases.length; ++i) { + test_vector = cases[i][0]; + expected_result = cases[i][1]; + shouldBe("canonicalize('" + test_vector + "')", + "'" + expected_result + "'"); +} + +var successfullyParsed = true; diff --git a/LayoutTests/fast/url/script-tests/trivial-segments.js b/LayoutTests/fast/url/script-tests/trivial-segments.js new file mode 100644 index 0000000..81edfd1 --- /dev/null +++ b/LayoutTests/fast/url/script-tests/trivial-segments.js @@ -0,0 +1,18 @@ +description("Test basic features of URL segmentation"); + +cases = [ + // [URL, [SCHEME, HOST, PORT, PATH, QUERY, REF]] + ["http://example.com/", ["http:", "example.com", "0", "/", "", ""]], +]; + +var originalBaseURL = canonicalize("."); +setBaseURL("http://example.org/foo/bar"); + +for (var i = 0; i < cases.length; ++i) { + shouldBe("segments('" + cases[i][0] + "')", + "'" + JSON.stringify(cases[i][1]) + "'"); +} + +setBaseURL(originalBaseURL); + +var successfullyParsed = true; diff --git a/LayoutTests/fast/url/script-tests/trivial.js b/LayoutTests/fast/url/script-tests/trivial.js new file mode 100644 index 0000000..738cf17 --- /dev/null +++ b/LayoutTests/fast/url/script-tests/trivial.js @@ -0,0 +1,18 @@ +description("Test basic features of URL canonicalization"); + +cases = [ + ["http://example.com/", "http://example.com/"], + ["/", "http://example.org/"] +]; + +var originalBaseURL = canonicalize("."); +setBaseURL("http://example.org/foo/bar"); + +for (var i = 0; i < cases.length; ++i) { + shouldBe("canonicalize('" + cases[i][0] + "')", + "'" + cases[i][1] + "'"); +} + +setBaseURL(originalBaseURL); + +var successfullyParsed = true; diff --git a/LayoutTests/fast/url/segments-expected.txt b/LayoutTests/fast/url/segments-expected.txt new file mode 100644 index 0000000..3833f36 --- /dev/null +++ b/LayoutTests/fast/url/segments-expected.txt @@ -0,0 +1,75 @@ +Test URL segmentation + +On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". + + +PASS segments('http://user:pass@foo:21/bar;par?b#c') is '["http:","foo","21","/bar;par","?b","#c"]' +PASS segments('http:foo.com') is '["http:","example.org","0","/foo/foo.com","",""]' +PASS segments('\t :foo.com \n') is '["http:","example.org","0","/foo/:foo.com","",""]' +PASS segments(' foo.com ') is '["http:","example.org","0","/foo/foo.com","",""]' +PASS segments('a:\t foo.com') is '["a:","","0"," foo.com","",""]' +FAIL segments('http://f:21/ b ? d # e ') should be ["http:","f","21","/%20b%20","?%20d%20","# e"]. Was ["http:","f","21","/ b ","?%20d%20","#%20e"]. +PASS segments('http://f:/c') is '["http:","f","0","/c","",""]' +PASS segments('http://f:0/c') is '["http:","f","0","/c","",""]' +PASS segments('http://f:00000000000000/c') is '["http:","f","0","/c","",""]' +FAIL segments('http://f:00000000000000000000080/c') should be ["http:","f","0","/c","",""]. Was ["http:","f","80","/c","",""]. +PASS segments('http://f:b/c') is '[":","","0","","",""]' +PASS segments('http://f: /c') is '[":","","0","","",""]' +PASS segments('http://f:\n/c') is '["http:","f","0","/c","",""]' +PASS segments('http://f:fifty-two/c') is '[":","","0","","",""]' +FAIL segments('http://f:999999/c') should be [":","","0","","",""]. Was ["http:","f","65535","/c","",""]. +PASS segments('http://f: 21 / b ? d # e ') is '[":","","0","","",""]' +PASS segments('') is '["http:","example.org","0","/foo/bar","",""]' +PASS segments(' \t') is '["http:","example.org","0","/foo/bar","",""]' +PASS segments(':foo.com/') is '["http:","example.org","0","/foo/:foo.com/","",""]' +PASS segments(':foo.com\\') is '["http:","example.org","0","/foo/:foo.com/","",""]' +PASS segments(':') is '["http:","example.org","0","/foo/:","",""]' +PASS segments(':a') is '["http:","example.org","0","/foo/:a","",""]' +PASS segments(':/') is '["http:","example.org","0","/foo/:/","",""]' +PASS segments(':\\') is '["http:","example.org","0","/foo/:/","",""]' +PASS segments(':#') is '["http:","example.org","0","/foo/:","",""]' +PASS segments('#') is '["http:","example.org","0","/foo/bar","",""]' +PASS segments('#/') is '["http:","example.org","0","/foo/bar","","#/"]' +PASS segments('#\\') is '["http:","example.org","0","/foo/bar","","#\\\\"]' +PASS segments('#;?') is '["http:","example.org","0","/foo/bar","","#;?"]' +PASS segments('?') is '["http:","example.org","0","/foo/bar","",""]' +PASS segments('/') is '["http:","example.org","0","/","",""]' +PASS segments(':23') is '["http:","example.org","0","/foo/:23","",""]' +PASS segments('/:23') is '["http:","example.org","0","/:23","",""]' +FAIL segments('//') should be [":","","0","","",""]. Was ["http:","","0","/","",""]. +PASS segments('::') is '["http:","example.org","0","/foo/::","",""]' +PASS segments('::23') is '["http:","example.org","0","/foo/::23","",""]' +PASS segments('foo://') is '["foo:","","0","//","",""]' +PASS segments('http://a:b@c:29/d') is '["http:","c","29","/d","",""]' +PASS segments('http::@c:29') is '["http:","example.org","0","/foo/:@c:29","",""]' +FAIL segments('http://&a:foo(b]c@d:2/') should be ["http:","d","2","/","",""]. Was [":","","0","","",""]. +FAIL segments('http://::@c@d:2') should be ["http:","d","2","/","",""]. Was [":","","0","","",""]. +PASS segments('http://foo.com:b@d/') is '["http:","d","0","/","",""]' +PASS segments('http://foo.com/\\@') is '["http:","foo.com","0","//@","",""]' +PASS segments('http:\\\\foo.com\\') is '["http:","foo.com","0","/","",""]' +PASS segments('http:\\\\a\\b:c\\d@foo.com\\') is '["http:","a","0","/b:c/d@foo.com/","",""]' +PASS segments('foo:/') is '["foo:","","0","/","",""]' +PASS segments('foo:/bar.com/') is '["foo:","","0","/bar.com/","",""]' +PASS segments('foo://///////') is '["foo:","","0","/////////","",""]' +PASS segments('foo://///////bar.com/') is '["foo:","","0","/////////bar.com/","",""]' +PASS segments('foo:////://///') is '["foo:","","0","////://///","",""]' +PASS segments('c:/foo') is '["c:","","0","/foo","",""]' +PASS segments('//foo/bar') is '["http:","foo","0","/bar","",""]' +FAIL segments('http://foo/path;a??e#f#g') should be ["http:","foo","0","/path;a","??e","#f#g"]. Was ["http:","foo","0","/path;a","??e","#f%23g"]. +PASS segments('http://foo/abcd?efgh?ijkl') is '["http:","foo","0","/abcd","?efgh?ijkl",""]' +PASS segments('http://foo/abcd#foo?bar') is '["http:","foo","0","/abcd","","#foo?bar"]' +PASS segments('[61:24:74]:98') is '["http:","example.org","0","/foo/[61:24:74]:98","",""]' +FAIL segments('http://[61:27]:98') should be [":","","0","","",""]. Was ["http:","[61:27]","98","/","",""]. +PASS segments('http:[61:27]/:foo') is '["http:","example.org","0","/foo/[61:27]/:foo","",""]' +PASS segments('http://[1::2]:3:4') is '[":","","0","","",""]' +PASS segments('http://2001::1') is '[":","","0","","",""]' +PASS segments('http://[2001::1') is '[":","","0","","",""]' +PASS segments('http://2001::1]') is '[":","","0","","",""]' +PASS segments('http://2001::1]:80') is '[":","","0","","",""]' +PASS segments('http://[2001::1]') is '["http:","[2001::1]","0","/","",""]' +FAIL segments('http://[2001::1]:80') should be ["http:","[2001::1]","0","/","",""]. Was ["http:","[2001::1]","80","/","",""]. +PASS segments('http://[[::]]') is '[":","","0","","",""]' +PASS successfullyParsed is true + +TEST COMPLETE + diff --git a/LayoutTests/fast/url/segments-from-data-url-expected.txt b/LayoutTests/fast/url/segments-from-data-url-expected.txt new file mode 100644 index 0000000..5d102ef --- /dev/null +++ b/LayoutTests/fast/url/segments-from-data-url-expected.txt @@ -0,0 +1,75 @@ +Test URL segmentation + +On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". + + +PASS segments('http://user:pass@foo:21/bar;par?b#c') is '["http:","foo","21","/bar;par","?b","#c"]' +FAIL segments('http:foo.com') should be ["http:","foo.com","0","/","",""]. Was ["http:","","0","foo.com","",""]. +PASS segments('\t :foo.com \n') is '[":","","0","","",""]' +PASS segments(' foo.com ') is '[":","","0","","",""]' +PASS segments('a:\t foo.com') is '["a:","","0"," foo.com","",""]' +FAIL segments('http://f:21/ b ? d # e ') should be ["http:","f","21","/%20b%20","?%20d%20","# e"]. Was ["http:","f","21","/ b ","?%20d%20","#%20e"]. +PASS segments('http://f:/c') is '["http:","f","0","/c","",""]' +PASS segments('http://f:0/c') is '["http:","f","0","/c","",""]' +PASS segments('http://f:00000000000000/c') is '["http:","f","0","/c","",""]' +FAIL segments('http://f:00000000000000000000080/c') should be ["http:","f","0","/c","",""]. Was ["http:","f","80","/c","",""]. +PASS segments('http://f:b/c') is '[":","","0","","",""]' +PASS segments('http://f: /c') is '[":","","0","","",""]' +PASS segments('http://f:\n/c') is '["http:","f","0","/c","",""]' +PASS segments('http://f:fifty-two/c') is '[":","","0","","",""]' +FAIL segments('http://f:999999/c') should be [":","","0","","",""]. Was ["http:","f","65535","/c","",""]. +PASS segments('http://f: 21 / b ? d # e ') is '[":","","0","","",""]' +FAIL segments('') should be ["data:","","0","text/plain,baseURL","",""]. Was [":","","0","","",""]. +FAIL segments(' \t') should be ["data:","","0","text/plain,baseURL","",""]. Was [":","","0","","",""]. +PASS segments(':foo.com/') is '[":","","0","","",""]' +PASS segments(':foo.com\\') is '[":","","0","","",""]' +PASS segments(':') is '[":","","0","","",""]' +PASS segments(':a') is '[":","","0","","",""]' +PASS segments(':/') is '[":","","0","","",""]' +PASS segments(':\\') is '[":","","0","","",""]' +PASS segments(':#') is '[":","","0","","",""]' +FAIL segments('#') should be [":","","0","","",""]. Was ["data:","","0","text/plain,baseURL","",""]. +FAIL segments('#/') should be [":","","0","","",""]. Was ["data:","","0","text/plain,baseURL","","#/"]. +FAIL segments('#\\') should be [":","","0","","",""]. Was ["data:","","0","text/plain,baseURL","","#\\"]. +FAIL segments('#;?') should be [":","","0","","",""]. Was ["data:","","0","text/plain,baseURL","","#;?"]. +PASS segments('?') is '[":","","0","","",""]' +PASS segments('/') is '[":","","0","","",""]' +PASS segments(':23') is '[":","","0","","",""]' +FAIL segments('/:23') should be ["data:","","0","/:23","",""]. Was [":","","0","","",""]. +PASS segments('//') is '[":","","0","","",""]' +PASS segments('::') is '[":","","0","","",""]' +PASS segments('::23') is '[":","","0","","",""]' +PASS segments('foo://') is '["foo:","","0","//","",""]' +PASS segments('http://a:b@c:29/d') is '["http:","c","29","/d","",""]' +FAIL segments('http::@c:29') should be ["http:","c","29","/","",""]. Was ["http:","","0",":@c:29","",""]. +FAIL segments('http://&a:foo(b]c@d:2/') should be ["http:","d","2","/","",""]. Was [":","","0","","",""]. +FAIL segments('http://::@c@d:2') should be ["http:","d","2","/","",""]. Was [":","","0","","",""]. +PASS segments('http://foo.com:b@d/') is '["http:","d","0","/","",""]' +PASS segments('http://foo.com/\\@') is '["http:","foo.com","0","//@","",""]' +PASS segments('http:\\\\foo.com\\') is '["http:","foo.com","0","/","",""]' +PASS segments('http:\\\\a\\b:c\\d@foo.com\\') is '["http:","a","0","/b:c/d@foo.com/","",""]' +PASS segments('foo:/') is '["foo:","","0","/","",""]' +PASS segments('foo:/bar.com/') is '["foo:","","0","/bar.com/","",""]' +PASS segments('foo://///////') is '["foo:","","0","/////////","",""]' +PASS segments('foo://///////bar.com/') is '["foo:","","0","/////////bar.com/","",""]' +PASS segments('foo:////://///') is '["foo:","","0","////://///","",""]' +PASS segments('c:/foo') is '["c:","","0","/foo","",""]' +PASS segments('//foo/bar') is '[":","","0","","",""]' +FAIL segments('http://foo/path;a??e#f#g') should be ["http:","foo","0","/path;a","??e","#f#g"]. Was ["http:","foo","0","/path;a","??e","#f%23g"]. +PASS segments('http://foo/abcd?efgh?ijkl') is '["http:","foo","0","/abcd","?efgh?ijkl",""]' +PASS segments('http://foo/abcd#foo?bar') is '["http:","foo","0","/abcd","","#foo?bar"]' +FAIL segments('[61:24:74]:98') should be ["data:","","0","text/[61:24:74]:98","",""]. Was [":","","0","","",""]. +FAIL segments('http://[61:27]:98') should be [":","","0","","",""]. Was ["http:","[61:27]","98","/","",""]. +FAIL segments('http:[61:27]/:foo') should be [":","","0","","",""]. Was ["http:","","0","[61:27]/:foo","",""]. +PASS segments('http://[1::2]:3:4') is '[":","","0","","",""]' +PASS segments('http://2001::1') is '[":","","0","","",""]' +PASS segments('http://[2001::1') is '[":","","0","","",""]' +PASS segments('http://2001::1]') is '[":","","0","","",""]' +PASS segments('http://2001::1]:80') is '[":","","0","","",""]' +PASS segments('http://[2001::1]') is '["http:","[2001::1]","0","/","",""]' +FAIL segments('http://[2001::1]:80') should be ["http:","[2001::1]","0","/","",""]. Was ["http:","[2001::1]","80","/","",""]. +PASS segments('http://[[::]]') is '[":","","0","","",""]' +PASS successfullyParsed is true + +TEST COMPLETE + diff --git a/LayoutTests/fast/url/segments-from-data-url.html b/LayoutTests/fast/url/segments-from-data-url.html new file mode 100644 index 0000000..55be754 --- /dev/null +++ b/LayoutTests/fast/url/segments-from-data-url.html @@ -0,0 +1,14 @@ + + + + + + + + +

+
+ + + + diff --git a/LayoutTests/fast/url/segments.html b/LayoutTests/fast/url/segments.html new file mode 100644 index 0000000..5cc2f82 --- /dev/null +++ b/LayoutTests/fast/url/segments.html @@ -0,0 +1,14 @@ + + + + + + + + +

+
+ + + + diff --git a/LayoutTests/fast/url/standard-url-expected.txt b/LayoutTests/fast/url/standard-url-expected.txt new file mode 100644 index 0000000..18a5117 --- /dev/null +++ b/LayoutTests/fast/url/standard-url-expected.txt @@ -0,0 +1,36 @@ +Canonicalization of standard URLs + +On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". + + +PASS canonicalize('http://www.google.com/foo?bar=baz#') is 'http://www.google.com/foo?bar=baz#' +PASS canonicalize('http://[www.google.com]/') is 'http://[www.google.com]/' +FAIL canonicalize('http:////////user:@google.com:99?foo') should be http://user@google.com:99/?foo. Was http://////user:@google.com:99?foo. +FAIL canonicalize('http://192.0x00A80001') should be http://192.168.0.1/. Was http://192.0x00A80001/. +FAIL canonicalize('http://www/foo%2Ehtml') should be http://www/foo.html. Was http://www/foo%2Ehtml. +PASS canonicalize('http://user:pass@/') is 'http://user:pass@/' +PASS canonicalize('http://%25DOMAIN:foobar@foodomain.com/') is 'http://%25DOMAIN:foobar@foodomain.com/' +PASS canonicalize('http:\\\\www.google.com\\foo') is 'http://www.google.com/foo' +FAIL canonicalize('http://www.google.com/asdf#\ud800') should be http://www.google.com/asdf#�. Was http://www.google.com/asdf#%26%2355296%3B. +FAIL canonicalize('http://foo:80/') should be http://foo/. Was http://foo:80/. +PASS canonicalize('http://foo:81/') is 'http://foo:81/' +PASS canonicalize('httpa://foo:80/') is 'httpa://foo:80/' +PASS canonicalize('http://foo:-80/') is 'http://foo:-80/' +FAIL canonicalize('https://foo:443/') should be https://foo/. Was https://foo:443/. +PASS canonicalize('https://foo:80/') is 'https://foo:80/' +FAIL canonicalize('ftp://foo:21/') should be ftp://foo/. Was ftp://foo:21/. +PASS canonicalize('ftp://foo:80/') is 'ftp://foo:80/' +FAIL canonicalize('gopher://foo:70/') should be gopher://foo/. Was gopher://foo:70/. +PASS canonicalize('gopher://foo:443/') is 'gopher://foo:443/' +FAIL canonicalize('ws://foo:80/') should be ws://foo/. Was ws://foo:80/. +PASS canonicalize('ws://foo:81/') is 'ws://foo:81/' +PASS canonicalize('ws://foo:443/') is 'ws://foo:443/' +PASS canonicalize('ws://foo:815/') is 'ws://foo:815/' +PASS canonicalize('wss://foo:80/') is 'wss://foo:80/' +PASS canonicalize('wss://foo:81/') is 'wss://foo:81/' +FAIL canonicalize('wss://foo:443/') should be wss://foo/. Was wss://foo:443/. +PASS canonicalize('wss://foo:815/') is 'wss://foo:815/' +PASS successfullyParsed is true + +TEST COMPLETE + diff --git a/LayoutTests/fast/url/standard-url.html b/LayoutTests/fast/url/standard-url.html new file mode 100644 index 0000000..6f1b1d4 --- /dev/null +++ b/LayoutTests/fast/url/standard-url.html @@ -0,0 +1,14 @@ + + + + + + + + +

+
+ + + + diff --git a/LayoutTests/fast/url/trivial-expected.txt b/LayoutTests/fast/url/trivial-expected.txt new file mode 100644 index 0000000..6d9a628 --- /dev/null +++ b/LayoutTests/fast/url/trivial-expected.txt @@ -0,0 +1,11 @@ +Test basic features of URL canonicalization + +On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". + + +PASS canonicalize('http://example.com/') is 'http://example.com/' +PASS canonicalize('/') is 'http://example.org/' +PASS successfullyParsed is true + +TEST COMPLETE + diff --git a/LayoutTests/fast/url/trivial-segments-expected.txt b/LayoutTests/fast/url/trivial-segments-expected.txt new file mode 100644 index 0000000..882ff73 --- /dev/null +++ b/LayoutTests/fast/url/trivial-segments-expected.txt @@ -0,0 +1,10 @@ +Test basic features of URL segmentation + +On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". + + +PASS segments('http://example.com/') is '["http:","example.com","0","/","",""]' +PASS successfullyParsed is true + +TEST COMPLETE + diff --git a/LayoutTests/fast/url/trivial-segments.html b/LayoutTests/fast/url/trivial-segments.html new file mode 100644 index 0000000..4973b98 --- /dev/null +++ b/LayoutTests/fast/url/trivial-segments.html @@ -0,0 +1,14 @@ + + + + + + + + +

+
+ + + + diff --git a/LayoutTests/fast/url/trivial.html b/LayoutTests/fast/url/trivial.html new file mode 100644 index 0000000..30a976a --- /dev/null +++ b/LayoutTests/fast/url/trivial.html @@ -0,0 +1,14 @@ + + + + + + + + +

+
+ + + + -- cgit v1.1