Combine html and js parts fast/url script-tests
authorap@apple.com <ap@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 7 May 2013 17:58:45 +0000 (17:58 +0000)
committerap@apple.com <ap@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 7 May 2013 17:58:45 +0000 (17:58 +0000)
        https://bugs.webkit.org/show_bug.cgi?id=115739

        Rubber-stamped by Brady Eidson.

        * fast/url/anchor.html:
        * fast/url/file-http-base.html:
        * fast/url/file.html:
        * fast/url/host-lowercase-per-scheme.html:
        * fast/url/host.html:
        * fast/url/idna2003.html:
        * fast/url/idna2008.html:
        * fast/url/invalid-urls-utf8.html:
        * fast/url/ipv4.html:
        * fast/url/ipv6.html:
        * fast/url/mailto.html:
        * fast/url/path-url.html:
        * fast/url/path.html:
        * fast/url/port.html:
        * fast/url/query.html:
        * fast/url/relative-unix.html:
        * fast/url/relative-win.html:
        * fast/url/relative.html:
        * fast/url/safari-extension.html:
        * fast/url/scheme.html:
        * fast/url/script-tests: Removed.
        * fast/url/script-tests/TEMPLATE.html: Removed.
        * fast/url/script-tests/anchor.js: Removed.
        * fast/url/script-tests/file-http-base.js: Removed.
        * fast/url/script-tests/file.js: Removed.
        * fast/url/script-tests/host.js: Removed.
        * fast/url/script-tests/idna2003.js: Removed.
        * fast/url/script-tests/idna2008.js: Removed.
        * fast/url/script-tests/ipv4.js: Removed.
        * fast/url/script-tests/ipv6.js: Removed.
        * fast/url/script-tests/mailto.js: Removed.
        * fast/url/script-tests/path-url.js: Removed.
        * fast/url/script-tests/path.js: Removed.
        * fast/url/script-tests/port.js: Removed.
        * fast/url/script-tests/query.js: Removed.
        * fast/url/script-tests/relative-unix.js: Removed.
        * fast/url/script-tests/relative-win.js: Removed.
        * fast/url/script-tests/relative.js: Removed.
        * fast/url/script-tests/scheme.js: Removed.
        * fast/url/script-tests/segments-from-data-url.js: Removed.
        * fast/url/script-tests/segments.js: Removed.
        * fast/url/script-tests/standard-url.js: Removed.
        * fast/url/script-tests/trivial-segments.js: Removed.
        * fast/url/script-tests/trivial.js: Removed.
        * fast/url/segments-from-data-url.html:
        * fast/url/segments.html:
        * fast/url/standard-url.html:
        * fast/url/trivial-segments.html:
        * fast/url/trivial.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@149681 268f45cc-cd09-0410-ab3c-d52691b4dbfc

49 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/url/anchor.html
LayoutTests/fast/url/file-http-base.html
LayoutTests/fast/url/file.html
LayoutTests/fast/url/host-lowercase-per-scheme.html
LayoutTests/fast/url/host.html
LayoutTests/fast/url/idna2003.html
LayoutTests/fast/url/idna2008.html
LayoutTests/fast/url/invalid-urls-utf8.html
LayoutTests/fast/url/ipv4.html
LayoutTests/fast/url/ipv6.html
LayoutTests/fast/url/mailto.html
LayoutTests/fast/url/path-url.html
LayoutTests/fast/url/path.html
LayoutTests/fast/url/port.html
LayoutTests/fast/url/query.html
LayoutTests/fast/url/relative-unix.html
LayoutTests/fast/url/relative-win.html
LayoutTests/fast/url/relative.html
LayoutTests/fast/url/safari-extension.html
LayoutTests/fast/url/scheme.html
LayoutTests/fast/url/script-tests/TEMPLATE.html [deleted file]
LayoutTests/fast/url/script-tests/anchor.js [deleted file]
LayoutTests/fast/url/script-tests/file-http-base.js [deleted file]
LayoutTests/fast/url/script-tests/file.js [deleted file]
LayoutTests/fast/url/script-tests/host.js [deleted file]
LayoutTests/fast/url/script-tests/idna2003.js [deleted file]
LayoutTests/fast/url/script-tests/idna2008.js [deleted file]
LayoutTests/fast/url/script-tests/ipv4.js [deleted file]
LayoutTests/fast/url/script-tests/ipv6.js [deleted file]
LayoutTests/fast/url/script-tests/mailto.js [deleted file]
LayoutTests/fast/url/script-tests/path-url.js [deleted file]
LayoutTests/fast/url/script-tests/path.js [deleted file]
LayoutTests/fast/url/script-tests/port.js [deleted file]
LayoutTests/fast/url/script-tests/query.js [deleted file]
LayoutTests/fast/url/script-tests/relative-unix.js [deleted file]
LayoutTests/fast/url/script-tests/relative-win.js [deleted file]
LayoutTests/fast/url/script-tests/relative.js [deleted file]
LayoutTests/fast/url/script-tests/scheme.js [deleted file]
LayoutTests/fast/url/script-tests/segments-from-data-url.js [deleted file]
LayoutTests/fast/url/script-tests/segments.js [deleted file]
LayoutTests/fast/url/script-tests/standard-url.js [deleted file]
LayoutTests/fast/url/script-tests/trivial-segments.js [deleted file]
LayoutTests/fast/url/script-tests/trivial.js [deleted file]
LayoutTests/fast/url/segments-from-data-url.html
LayoutTests/fast/url/segments.html
LayoutTests/fast/url/standard-url.html
LayoutTests/fast/url/trivial-segments.html
LayoutTests/fast/url/trivial.html

index 2f02545..a1f321e 100644 (file)
@@ -1,3 +1,60 @@
+2013-05-07  Alexey Proskuryakov  <ap@apple.com>
+
+        Combine html and js parts fast/url script-tests
+        https://bugs.webkit.org/show_bug.cgi?id=115739
+
+        Rubber-stamped by Brady Eidson.
+
+        * fast/url/anchor.html:
+        * fast/url/file-http-base.html:
+        * fast/url/file.html:
+        * fast/url/host-lowercase-per-scheme.html:
+        * fast/url/host.html:
+        * fast/url/idna2003.html:
+        * fast/url/idna2008.html:
+        * fast/url/invalid-urls-utf8.html:
+        * fast/url/ipv4.html:
+        * fast/url/ipv6.html:
+        * fast/url/mailto.html:
+        * fast/url/path-url.html:
+        * fast/url/path.html:
+        * fast/url/port.html:
+        * fast/url/query.html:
+        * fast/url/relative-unix.html:
+        * fast/url/relative-win.html:
+        * fast/url/relative.html:
+        * fast/url/safari-extension.html:
+        * fast/url/scheme.html:
+        * fast/url/script-tests: Removed.
+        * fast/url/script-tests/TEMPLATE.html: Removed.
+        * fast/url/script-tests/anchor.js: Removed.
+        * fast/url/script-tests/file-http-base.js: Removed.
+        * fast/url/script-tests/file.js: Removed.
+        * fast/url/script-tests/host.js: Removed.
+        * fast/url/script-tests/idna2003.js: Removed.
+        * fast/url/script-tests/idna2008.js: Removed.
+        * fast/url/script-tests/ipv4.js: Removed.
+        * fast/url/script-tests/ipv6.js: Removed.
+        * fast/url/script-tests/mailto.js: Removed.
+        * fast/url/script-tests/path-url.js: Removed.
+        * fast/url/script-tests/path.js: Removed.
+        * fast/url/script-tests/port.js: Removed.
+        * fast/url/script-tests/query.js: Removed.
+        * fast/url/script-tests/relative-unix.js: Removed.
+        * fast/url/script-tests/relative-win.js: Removed.
+        * fast/url/script-tests/relative.js: Removed.
+        * fast/url/script-tests/scheme.js: Removed.
+        * fast/url/script-tests/segments-from-data-url.js: Removed.
+        * fast/url/script-tests/segments.js: Removed.
+        * fast/url/script-tests/standard-url.js: Removed.
+        * fast/url/script-tests/trivial-segments.js: Removed.
+        * fast/url/script-tests/trivial.js: Removed.
+        * fast/url/segments-from-data-url.html:
+        * fast/url/segments.html:
+        * fast/url/standard-url.html:
+        * fast/url/trivial-segments.html:
+        * fast/url/trivial.html:
+
 2013-05-07  Radu Stavila  <stavila@adobe.com>
 
         [CSS Regions] Convert remaining fast/regions/webkit-flow* pixel tests to reftests
index ae53270..30ba2ad 100644 (file)
@@ -1,11 +1,30 @@
-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<!DOCTYPE html>
 <html>
 <head>
 <script src="../js/resources/js-test-pre.js"></script>
 <script src="resources/utilities.js"></script>
 </head>
 <body>
-<script src="script-tests/anchor.js"></script>
+<script>
+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"],
+  ["a\\nb\\rc\\td", "abcd"],
+];
+
+for (var i = 0; i < cases.length; ++i) {
+  shouldBe("canonicalize('http://www.example.com/#" + cases[i][0] + "')",
+           "'http://www.example.com/#" + cases[i][1] + "'");
+}
+</script>
 <script src="../js/resources/js-test-post.js"></script>
 </body>
 </html>
index f83a25d..b4d3eb9 100644 (file)
@@ -1,11 +1,79 @@
-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<!DOCTYPE html>
 <html>
 <head>
 <script src="../js/resources/js-test-pre.js"></script>
 <script src="resources/utilities.js"></script>
 </head>
 <body>
-<script src="script-tests/file-http-base.js"></script>
+<script>
+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#\\xc2"],
+    ["file:///C:/asdf#\xc2", "file:///C:/asdf#\xc2"],
+
+    // 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);
+</script>
 <script src="../js/resources/js-test-post.js"></script>
 </body>
 </html>
index 2c08b4d..1c08ad1 100644 (file)
@@ -1,11 +1,78 @@
-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<!DOCTYPE html>
 <html>
 <head>
 <script src="../js/resources/js-test-pre.js"></script>
 <script src="resources/utilities.js"></script>
 </head>
 <body>
-<script src="script-tests/file.js"></script>
+<script>
+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);
+</script>
 <script src="../js/resources/js-test-post.js"></script>
 </body>
 </html>
index 091111c..61d5c93 100644 (file)
@@ -1,4 +1,4 @@
-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<!DOCTYPE html>
 <html>
 <head>
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
index 3a8bb1d..e88b474 100644 (file)
@@ -1,11 +1,99 @@
-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<!DOCTYPE html>
 <html>
 <head>
 <script src="../js/resources/js-test-pre.js"></script>
 <script src="resources/utilities.js"></script>
 </head>
 <body>
-<script src="script-tests/host.js"></script>
+<script>
+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"],
+  ["go\\\\@ogle.com","go/@ogle.com"],
+  ["go/@ogle.com","go/@ogle.com"],
+  ["www.lookout.net::==80::==443::","www.lookout.net::%3D%3D80::%3D%3D443:"],
+  ["www.lookout.net::80::443","www.lookout.net::80::443"],
+  // From http://eaea.sirdarckcat.net/uritest.html
+  ["\\./","./"],
+  ["//:@/","/"],
+  ["\\google.com/foo","google.com/foo"],
+  ["\\\\google.com/foo","google.com/foo"],
+  ["//asdf@/","asdf@/"],
+  ["//:81",":81"],
+  ["://","//"],
+  ["c:","c"],
+  ["xxxx:","xxxx"],
+  [".:.",".:."],
+  ["////@google.com/","google.com/"],
+  ["@google.com","google.com"]
+];
+
+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 + "/'");
+}
+</script>
 <script src="../js/resources/js-test-post.js"></script>
 </body>
 </html>
index 7d7fa9b..bbf60f1 100644 (file)
@@ -1,11 +1,82 @@
-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<!DOCTYPE html>
 <html>
 <head>
 <script src="../js/resources/js-test-pre.js"></script>
 <script src="resources/utilities.js"></script>
 </head>
 <body>
-<script src="script-tests/idna2003.js"></script>
+<script>
+description("IDNA2003 handling in domain name labels.");
+
+debug("The PASS/FAIL results of this test are set to the behavior in IDNA2003.");
+
+cases = [ 
+  // For IDNA Compatibility test material see
+  // http://www.unicode.org/reports/tr46/
+  // 1) Deviant character tests (deviant from IDNA2008)
+  // U+00DF normalizes to "ss" during IDNA2003's mapping phase
+  ["fa\u00DF.de","fass.de"],
+  // The ς U+03C2 GREEK SMALL LETTER FINAL SIGMA
+  ["\u03B2\u03CC\u03BB\u03BF\u03C2.com","xn--nxasmq6b.com"],
+  // The ZWJ U+200D ZERO WIDTH JOINER
+  ["\u0DC1\u0DCA\u200D\u0DBB\u0DD3.com","xn--10cl1a0b.com"],
+  // The ZWNJ U+200C ZERO WIDTH NON-JOINER
+  ["\u0646\u0627\u0645\u0647\u200C\u0627\u06CC.com","xn--mgba3gch31f.com"],
+  // 2) Normalization tests
+  ["www.loo\u0138out.net","www.xn--looout-5bb.net"],
+  ["\u15EF\u15EF\u15EF.lookout.net","xn--1qeaa.lookout.net"],
+  ["www.lookout.\u0441\u043E\u043C","www.lookout.xn--l1adi"],
+  ["www.lookout.net\uFF1A80","www.lookout.net:80"],
+  ["www\u2025lookout.net","www..lookout.net"],
+  ["www.lookout\u2027net","www.xn--lookoutnet-406e"],
+  // using Latin letter kra ‘ĸ’ in domain
+  ["www.loo\u0138out.net","www.xn--looout-5bb.net"],
+  // \u2A74 decomposes into ::=
+  ["www.lookout.net\u2A7480","www.lookout.net::%3D80"],
+  // 3) Prohibited code points 
+  //   Using prohibited high-ASCII \u00A0
+  ["www\u00A0.lookout.net","www%20.lookout.net"],
+  //   using prohibited non-ASCII space chars 1680 (Ogham space mark)
+  ["\u1680lookout.net","%E1%9A%80lookout.net"],
+  //   Using prohibited lower ASCII control character \u001F
+  ["\u001Flookout.net","%1Flookout.net"],
+  //   Using prohibited U+06DD ARABIC END OF AYAH
+  ["look\u06DDout.net","look%DB%9Dout.net"],
+  //   Using prohibited U+180E MONGOLIAN VOWEL SEPARATOR
+  ["look\u180Eout.net","look%E1%A0%8Eout.net"],
+  //   Using prohibited U+2060 WORD JOINER
+  ["look\u2060out.net","look%E2%81%A0out.net"],
+  //   Using prohibited U+FEFF ZERO WIDTH NO-BREAK SPACE
+  ["look\uFEFFout.net","look%EF%BB%BFout.net"],
+  //   Using prohibited Non-character code points 1FFFE [NONCHARACTER CODE POINTS]
+  ["look\uD83F\uDFFEout.net","look%F0%9F%BF%BEout.net"],
+  //   Using prohibited U+DEAD half surrogate code point
+  // FIXME: ["look\uDEADout.net","look%ED%BA%ADout.net"],
+  //   Using prohibited Inappropriate for plain text U+FFFA; INTERLINEAR ANNOTATION SEPARATOR
+  ["look\uFFFAout.net","look%EF%BF%BAout.net"],
+  //   Using prohibited Inappropriate for canonical representation 2FF0-2FFB; [IDEOGRAPHIC DESCRIPTION CHARACTERS]
+  ["look\u2FF0out.net","look%E2%BF%B0out.net"],
+  //   Using prohibited Change display properties or are deprecated 0341; COMBINING ACUTE TONE MARK
+  ["look\u0341out.net","look%CD%81out.net"],
+  //   Using prohibited Change display properties or are deprecated 202E; RIGHT-TO-LEFT OVERRIDE
+  ["look\u202Eout.net","look%E2%80%AEout.net"],
+  //   Using prohibited Change display properties or are deprecated 206B; ACTIVATE SYMMETRIC SWAPPING
+  ["look\u206Bout.net","look%E2%81%ABout.net"],
+  //   Using prohibited Tagging characters E0001; LANGUAGE TAG
+  ["look\uDB40\uDC01out.net","look%F3%A0%80%81out.net"],
+  //   Using prohibited Tagging characters E0020-E007F; [TAGGING CHARACTERS]
+  ["look\uDB40\uDC20out.net","look%F3%A0%80%A0out.net"],
+  //   Using prohibited Characters with bidirectional property 05BE
+  ["look\u05BEout.net","look%D6%BEout.net"]
+];
+
+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 + "/'");
+}
+</script>
 <script src="../js/resources/js-test-post.js"></script>
 </body>
 </html>
index 078dedd..8b3f002 100644 (file)
@@ -1,11 +1,62 @@
-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<!DOCTYPE html>
 <html>
 <head>
 <script src="../js/resources/js-test-pre.js"></script>
 <script src="resources/utilities.js"></script>
 </head>
 <body>
-<script src="script-tests/idna2008.js"></script>
+<script>
+description("IDNA2008 handling in domain name labels.");
+
+debug("The PASS/FAIL results of this test are set to the behavior in IDNA2008.");
+
+cases = [ 
+  // For IDNA Compatibility test material see
+  // http://www.unicode.org/reports/tr46/
+  // http://www.unicode.org/Public/idna/latest/IdnaMappingTable.txt 
+  // We are testing disallowed, ignored, mapped, deviant, and valid cases.
+  // 1) Deviant character tests (deviant processing behavior from IDNA2003)
+  ["B\u00FCcher.de","xn--bcher-kva.de"],
+  // The ß U+00DF LATIN SMALL LETTER SHARP S does NOT normalize to "ss" like it does during IDNA2003's mapping phase
+  ["fa\u00DF.de","xn--fa-hia.de"],
+  // The ς U+03C2 GREEK SMALL LETTER FINAL SIGMA using βόλος.com
+  ["\u03B2\u03CC\u03BB\u03BF\u03C2.com","xn--nxasmm1c.com"],
+  // The ZWJ U+200D ZERO WIDTH JOINER
+  ["\u0DC1\u0DCA\u200D\u0DBB\u0DD3.com","xn--10cl1a0b660p.com"],
+  // The ZWNJ U+200C ZERO WIDTH NON-JOINER
+  ["\u0646\u0627\u0645\u0647\u200C\u0627\u06CC.com","xn--mgba3gch31f060k.com"],
+  // 2) Disallowed characters in IDNA2008
+  // U+2665 BLACK HEART SUIT
+  ["\u2665.net","\uFFFD.net"],
+  // U+0378 <reserved>
+  ["\u0378.net","\uFFFD.net"],
+  ["\u04C0.com","\uFFFD.com"],
+  ["\uD87E\uDC68.com","\uFFFD.com"],
+  ["\u2183.com","\uFFFD.com"],
+  // 3) Ignored characters should be removed * security risk
+  // U+034F COMBINING GRAPHEME JOINER
+  ["look\u034Fout.net","lookout.net"],
+  // 4) Mapped characters
+  ["gOoGle.com","google.com"],
+  ["\u09dc.com","\u09A1\u09BC.com"],
+  // 1E9E; mapped; 0073 0073
+  ["\u1E9E.com","ss.com"],
+  ["\u1E9E.foo.com","ss.foo.com"],
+  // 5) Validity FAIL cases - these should each cause an error.
+  ["-foo.bar.com",""],
+  ["foo-.bar.com",""],
+  ["ab--cd.com",""],
+  ["xn--0.com",""],
+  ["foo\u0300.bar.com","foo%CC%80.bar.com"]
+];
+
+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 + "/'");
+}
+</script>
 <script src="../js/resources/js-test-post.js"></script>
 </body>
 </html>
index f6ce186..b923a58 100644 (file)
@@ -1,4 +1,4 @@
-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<!DOCTYPE html>
 <html>
 <head>
 <script src="../js/resources/js-test-pre.js"></script>
index 9dbc1ab..46cbd92 100644 (file)
-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<!DOCTYPE html>
 <html>
 <head>
 <script src="../js/resources/js-test-pre.js"></script>
 <script src="resources/utilities.js"></script>
 </head>
 <body>
-<script src="script-tests/ipv4.js"></script>
+<script>
+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"]
+];
+
+for (var i = 0; i < cases.length; ++i) {
+  test_vector = cases[i][0];
+  expected_result = cases[i][1];
+  if (expected_result === "")
+    expected_result = test_vector.toLowerCase();
+  shouldBe("canonicalize('http://" + test_vector + "/')",
+           "'http://" + expected_result + "/'");
+}
+</script>
 <script src="../js/resources/js-test-post.js"></script>
 </body>
 </html>
index e5fbe5f..daea267 100644 (file)
-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<!DOCTYPE html>
 <html>
 <head>
 <script src="../js/resources/js-test-pre.js"></script>
 <script src="resources/utilities.js"></script>
 </head>
 <body>
-<script src="script-tests/ipv6.js"></script>
+<script>
+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. RFC 5952, Section 4.2.2.
+    ["[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 ["%" <scope_id>] 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]", ""]
+];
+
+for (var i = 0; i < cases.length; ++i) {
+  test_vector = cases[i][0];
+  expected_result = cases[i][1];
+  if (expected_result === "")
+    expected_result = test_vector;
+  shouldBe("canonicalize('http://" + test_vector + "/')",
+           "'http://" + expected_result + "/'");
+}
+</script>
 <script src="../js/resources/js-test-post.js"></script>
 </body>
 </html>
index 9aba34c..5b1aff5 100644 (file)
@@ -1,11 +1,41 @@
-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<!DOCTYPE html>
 <html>
 <head>
 <script src="../js/resources/js-test-pre.js"></script>
 <script src="resources/utilities.js"></script>
 </head>
 <body>
-<script src="script-tests/mailto.js"></script>
+<script>
+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'");
+</script>
 <script src="../js/resources/js-test-post.js"></script>
 </body>
 </html>
index eb3743c..ed2afe6 100644 (file)
@@ -1,11 +1,27 @@
-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<!DOCTYPE html>
 <html>
 <head>
 <script src="../js/resources/js-test-pre.js"></script>
 <script src="resources/utilities.js"></script>
 </head>
 <body>
-<script src="script-tests/path-url.js"></script>
+<script>
+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 + "'");
+}
+</script>
 <script src="../js/resources/js-test-post.js"></script>
 </body>
 </html>
index ec4128e..41899c8 100644 (file)
-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<!DOCTYPE html>
 <html>
 <head>
 <script src="../js/resources/js-test-pre.js"></script>
 <script src="resources/utilities.js"></script>
 </head>
 <body>
-<script src="script-tests/path.js"></script>
+<script>
+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.
+  ["////../..", "//"],
+  ["/foo/bar//../..", "/foo/"],
+  ["/foo/bar//..", "/foo/bar/"],
+  ["/foo/bar/..", "/foo/"],
+
+  // ----- 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%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", "/foobar"],
+  // 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"],
+  // U+2025 TWO DOT LEADER should not be normalized to .. in the path
+  ["/\u2025/foo", "/%E2%80%A5/foo"],
+  // A half-surrogate is an error by itself U+DEAD
+  // FIXME: ["/\uDEAD/foo", "/\uFFFD/foo"],
+  // BOM code point with special meaning U+FEFF ZERO WIDTH NO-BREAK SPACE
+  ["/\uFEFF/foo", "/%EF%BB%BF/foo"],
+  // The BIDI override code points RLO and LRO
+  ["/\u202E/foo/\u202D/bar", "/%E2%80%AE/foo/%E2%80%AD/bar"],
+  // U+FF0F FULLWIDTH SOLIDUS should normalize to / in a hostname
+  ["\uFF0Ffoo/", "%2Ffoo/"],
+
+];
+
+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 + "'");
+}
+</script>
 <script src="../js/resources/js-test-post.js"></script>
 </body>
 </html>
index d7a2483..d9ca4eb 100644 (file)
@@ -1,11 +1,37 @@
-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<!DOCTYPE html>
 <html>
 <head>
 <script src="../js/resources/js-test-pre.js"></script>
 <script src="resources/utilities.js"></script>
 </head>
 <body>
-<script src="script-tests/port.js"></script>
+<script>
+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"],
+  // Empty ports (just a colon) should also be removed
+  ["", ""],
+  // Code point with a numeric value U+1369 ETHIOPIC DIGIT ONE
+  ["\u1369", ":%E1%8D%A9"],
+  // Code point with a numerical mapping and value U+1D7D6 MATHEMATICAL BOLD DIGIT EIGHT
+  ["\uD835\uDFD6", ":%F0%9D%9F%96"],
+];
+
+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/'");
+</script>
 <script src="../js/resources/js-test-post.js"></script>
 </body>
 </html>
index b1d520d..7dd66d7 100644 (file)
@@ -1,11 +1,40 @@
-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<!DOCTYPE html>
 <html>
 <head>
 <script src="../js/resources/js-test-pre.js"></script>
 <script src="resources/utilities.js"></script>
 </head>
 <body>
-<script src="script-tests/query.js"></script>
+<script>
+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=<asdf>", "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] + "'");
+}
+</script>
 <script src="../js/resources/js-test-post.js"></script>
 </body>
 </html>
index b2f4764..e264b4f 100644 (file)
@@ -1,11 +1,38 @@
-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<!DOCTYPE html>
 <html>
 <head>
 <script src="../js/resources/js-test-pre.js"></script>
 <script src="resources/utilities.js"></script>
 </head>
 <body>
-<script src="script-tests/relative-unix.js"></script>
+<script>
+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);
+</script>
 <script src="../js/resources/js-test-post.js"></script>
 </body>
 </html>
index 870ab48..2b00a5e 100644 (file)
@@ -1,11 +1,58 @@
-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<!DOCTYPE html>
 <html>
 <head>
 <script src="../js/resources/js-test-pre.js"></script>
 <script src="resources/utilities.js"></script>
 </head>
 <body>
-<script src="script-tests/relative-win.js"></script>
+<script>
+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);
+</script>
 <script src="../js/resources/js-test-post.js"></script>
 </body>
 </html>
index e0944ea..633655d 100644 (file)
-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<!DOCTYPE html>
 <html>
 <head>
 <script src="../js/resources/js-test-pre.js"></script>
 <script src="resources/utilities.js"></script>
 </head>
 <body>
-<script src="script-tests/relative.js"></script>
+<script>
+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);
+</script>
 <script src="../js/resources/js-test-post.js"></script>
 </body>
 </html>
index d0c5661..b105725 100644 (file)
@@ -1,4 +1,4 @@
-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<!DOCTYPE html>
 <html>
 <head>
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
index 33615e5..3c249e2 100644 (file)
@@ -1,11 +1,33 @@
-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<!DOCTYPE html>
 <html>
 <head>
 <script src="../js/resources/js-test-pre.js"></script>
 <script src="resources/utilities.js"></script>
 </head>
 <body>
-<script src="script-tests/scheme.js"></script>
+<script>
+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/'");
+}
+</script>
 <script src="../js/resources/js-test-post.js"></script>
 </body>
 </html>
diff --git a/LayoutTests/fast/url/script-tests/TEMPLATE.html b/LayoutTests/fast/url/script-tests/TEMPLATE.html
deleted file mode 100644 (file)
index 64fd63c..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
-<html>
-<head>
-<script src="../js/resources/js-test-pre.js"></script>
-<script src="resources/utilities.js"></script>
-</head>
-<body>
-<script src="YOUR_JS_FILE_HERE"></script>
-<script src="../js/resources/js-test-post.js"></script>
-</body>
-</html>
diff --git a/LayoutTests/fast/url/script-tests/anchor.js b/LayoutTests/fast/url/script-tests/anchor.js
deleted file mode 100644 (file)
index ef3ce12..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-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"],
-  ["a\\nb\\rc\\td", "abcd"],
-];
-
-for (var i = 0; i < cases.length; ++i) {
-  shouldBe("canonicalize('http://www.example.com/#" + cases[i][0] + "')",
-           "'http://www.example.com/#" + cases[i][1] + "'");
-}
diff --git a/LayoutTests/fast/url/script-tests/file-http-base.js b/LayoutTests/fast/url/script-tests/file-http-base.js
deleted file mode 100644 (file)
index 7a4d686..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-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#\\xc2"],
-    ["file:///C:/asdf#\xc2", "file:///C:/asdf#\xc2"],
-
-    // 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);
diff --git a/LayoutTests/fast/url/script-tests/file.js b/LayoutTests/fast/url/script-tests/file.js
deleted file mode 100644 (file)
index bc13e06..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-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);
diff --git a/LayoutTests/fast/url/script-tests/host.js b/LayoutTests/fast/url/script-tests/host.js
deleted file mode 100644 (file)
index 03e658b..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-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"],
-  ["go\\\\@ogle.com","go/@ogle.com"],
-  ["go/@ogle.com","go/@ogle.com"],
-  ["www.lookout.net::==80::==443::","www.lookout.net::%3D%3D80::%3D%3D443:"],
-  ["www.lookout.net::80::443","www.lookout.net::80::443"],
-  // From http://eaea.sirdarckcat.net/uritest.html
-  ["\\./","./"],
-  ["//:@/","/"],
-  ["\\google.com/foo","google.com/foo"],
-  ["\\\\google.com/foo","google.com/foo"],
-  ["//asdf@/","asdf@/"],
-  ["//:81",":81"],
-  ["://","//"],
-  ["c:","c"],
-  ["xxxx:","xxxx"],
-  [".:.",".:."],
-  ["////@google.com/","google.com/"],
-  ["@google.com","google.com"]
-];
-
-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 + "/'");
-}
diff --git a/LayoutTests/fast/url/script-tests/idna2003.js b/LayoutTests/fast/url/script-tests/idna2003.js
deleted file mode 100644 (file)
index e9c2c31..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-description("IDNA2003 handling in domain name labels.");
-
-debug("The PASS/FAIL results of this test are set to the behavior in IDNA2003.");
-
-cases = [ 
-  // For IDNA Compatibility test material see
-  // http://www.unicode.org/reports/tr46/
-  // 1) Deviant character tests (deviant from IDNA2008)
-  // U+00DF normalizes to "ss" during IDNA2003's mapping phase
-  ["fa\u00DF.de","fass.de"],
-  // The ς U+03C2 GREEK SMALL LETTER FINAL SIGMA
-  ["\u03B2\u03CC\u03BB\u03BF\u03C2.com","xn--nxasmq6b.com"],
-  // The ZWJ U+200D ZERO WIDTH JOINER
-  ["\u0DC1\u0DCA\u200D\u0DBB\u0DD3.com","xn--10cl1a0b.com"],
-  // The ZWNJ U+200C ZERO WIDTH NON-JOINER
-  ["\u0646\u0627\u0645\u0647\u200C\u0627\u06CC.com","xn--mgba3gch31f.com"],
-  // 2) Normalization tests
-  ["www.loo\u0138out.net","www.xn--looout-5bb.net"],
-  ["\u15EF\u15EF\u15EF.lookout.net","xn--1qeaa.lookout.net"],
-  ["www.lookout.\u0441\u043E\u043C","www.lookout.xn--l1adi"],
-  ["www.lookout.net\uFF1A80","www.lookout.net:80"],
-  ["www\u2025lookout.net","www..lookout.net"],
-  ["www.lookout\u2027net","www.xn--lookoutnet-406e"],
-  // using Latin letter kra ‘ĸ’ in domain
-  ["www.loo\u0138out.net","www.xn--looout-5bb.net"],
-  // \u2A74 decomposes into ::=
-  ["www.lookout.net\u2A7480","www.lookout.net::%3D80"],
-  // 3) Prohibited code points 
-  //   Using prohibited high-ASCII \u00A0
-  ["www\u00A0.lookout.net","www%20.lookout.net"],
-  //   using prohibited non-ASCII space chars 1680 (Ogham space mark)
-  ["\u1680lookout.net","%E1%9A%80lookout.net"],
-  //   Using prohibited lower ASCII control character \u001F
-  ["\u001Flookout.net","%1Flookout.net"],
-  //   Using prohibited U+06DD ARABIC END OF AYAH
-  ["look\u06DDout.net","look%DB%9Dout.net"],
-  //   Using prohibited U+180E MONGOLIAN VOWEL SEPARATOR
-  ["look\u180Eout.net","look%E1%A0%8Eout.net"],
-  //   Using prohibited U+2060 WORD JOINER
-  ["look\u2060out.net","look%E2%81%A0out.net"],
-  //   Using prohibited U+FEFF ZERO WIDTH NO-BREAK SPACE
-  ["look\uFEFFout.net","look%EF%BB%BFout.net"],
-  //   Using prohibited Non-character code points 1FFFE [NONCHARACTER CODE POINTS]
-  ["look\uD83F\uDFFEout.net","look%F0%9F%BF%BEout.net"],
-  //   Using prohibited U+DEAD half surrogate code point
-  // FIXME: ["look\uDEADout.net","look%ED%BA%ADout.net"],
-  //   Using prohibited Inappropriate for plain text U+FFFA; INTERLINEAR ANNOTATION SEPARATOR
-  ["look\uFFFAout.net","look%EF%BF%BAout.net"],
-  //   Using prohibited Inappropriate for canonical representation 2FF0-2FFB; [IDEOGRAPHIC DESCRIPTION CHARACTERS]
-  ["look\u2FF0out.net","look%E2%BF%B0out.net"],
-  //   Using prohibited Change display properties or are deprecated 0341; COMBINING ACUTE TONE MARK
-  ["look\u0341out.net","look%CD%81out.net"],
-  //   Using prohibited Change display properties or are deprecated 202E; RIGHT-TO-LEFT OVERRIDE
-  ["look\u202Eout.net","look%E2%80%AEout.net"],
-  //   Using prohibited Change display properties or are deprecated 206B; ACTIVATE SYMMETRIC SWAPPING
-  ["look\u206Bout.net","look%E2%81%ABout.net"],
-  //   Using prohibited Tagging characters E0001; LANGUAGE TAG
-  ["look\uDB40\uDC01out.net","look%F3%A0%80%81out.net"],
-  //   Using prohibited Tagging characters E0020-E007F; [TAGGING CHARACTERS]
-  ["look\uDB40\uDC20out.net","look%F3%A0%80%A0out.net"],
-  //   Using prohibited Characters with bidirectional property 05BE
-  ["look\u05BEout.net","look%D6%BEout.net"]
-];
-
-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 + "/'");
-}
diff --git a/LayoutTests/fast/url/script-tests/idna2008.js b/LayoutTests/fast/url/script-tests/idna2008.js
deleted file mode 100644 (file)
index 3f4540d..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-description("IDNA2008 handling in domain name labels.");
-
-debug("The PASS/FAIL results of this test are set to the behavior in IDNA2008.");
-
-cases = [ 
-  // For IDNA Compatibility test material see
-  // http://www.unicode.org/reports/tr46/
-  // http://www.unicode.org/Public/idna/latest/IdnaMappingTable.txt 
-  // We are testing disallowed, ignored, mapped, deviant, and valid cases.
-  // 1) Deviant character tests (deviant processing behavior from IDNA2003)
-  ["B\u00FCcher.de","xn--bcher-kva.de"],
-  // The ß U+00DF LATIN SMALL LETTER SHARP S does NOT normalize to "ss" like it does during IDNA2003's mapping phase
-  ["fa\u00DF.de","xn--fa-hia.de"],
-  // The ς U+03C2 GREEK SMALL LETTER FINAL SIGMA using βόλος.com
-  ["\u03B2\u03CC\u03BB\u03BF\u03C2.com","xn--nxasmm1c.com"],
-  // The ZWJ U+200D ZERO WIDTH JOINER
-  ["\u0DC1\u0DCA\u200D\u0DBB\u0DD3.com","xn--10cl1a0b660p.com"],
-  // The ZWNJ U+200C ZERO WIDTH NON-JOINER
-  ["\u0646\u0627\u0645\u0647\u200C\u0627\u06CC.com","xn--mgba3gch31f060k.com"],
-  // 2) Disallowed characters in IDNA2008
-  // U+2665 BLACK HEART SUIT
-  ["\u2665.net","\uFFFD.net"],
-  // U+0378 <reserved>
-  ["\u0378.net","\uFFFD.net"],
-  ["\u04C0.com","\uFFFD.com"],
-  ["\uD87E\uDC68.com","\uFFFD.com"],
-  ["\u2183.com","\uFFFD.com"],
-  // 3) Ignored characters should be removed * security risk
-  // U+034F COMBINING GRAPHEME JOINER
-  ["look\u034Fout.net","lookout.net"],
-  // 4) Mapped characters
-  ["gOoGle.com","google.com"],
-  ["\u09dc.com","\u09A1\u09BC.com"],
-  // 1E9E; mapped; 0073 0073
-  ["\u1E9E.com","ss.com"],
-  ["\u1E9E.foo.com","ss.foo.com"],
-  // 5) Validity FAIL cases - these should each cause an error.
-  ["-foo.bar.com",""],
-  ["foo-.bar.com",""],
-  ["ab--cd.com",""],
-  ["xn--0.com",""],
-  ["foo\u0300.bar.com","foo%CC%80.bar.com"]
-];
-
-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 + "/'");
-}
diff --git a/LayoutTests/fast/url/script-tests/ipv4.js b/LayoutTests/fast/url/script-tests/ipv4.js
deleted file mode 100644 (file)
index dcf238f..0000000
+++ /dev/null
@@ -1,96 +0,0 @@
-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"]
-];
-
-for (var i = 0; i < cases.length; ++i) {
-  test_vector = cases[i][0];
-  expected_result = cases[i][1];
-  if (expected_result === "")
-    expected_result = test_vector.toLowerCase();
-  shouldBe("canonicalize('http://" + test_vector + "/')",
-           "'http://" + expected_result + "/'");
-}
diff --git a/LayoutTests/fast/url/script-tests/ipv6.js b/LayoutTests/fast/url/script-tests/ipv6.js
deleted file mode 100644 (file)
index bc007a9..0000000
+++ /dev/null
@@ -1,114 +0,0 @@
-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. RFC 5952, Section 4.2.2.
-    ["[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 ["%" <scope_id>] 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]", ""]
-];
-
-for (var i = 0; i < cases.length; ++i) {
-  test_vector = cases[i][0];
-  expected_result = cases[i][1];
-  if (expected_result === "")
-    expected_result = test_vector;
-  shouldBe("canonicalize('http://" + test_vector + "/')",
-           "'http://" + expected_result + "/'");
-}
diff --git a/LayoutTests/fast/url/script-tests/mailto.js b/LayoutTests/fast/url/script-tests/mailto.js
deleted file mode 100644 (file)
index 73d2d80..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-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'");
diff --git a/LayoutTests/fast/url/script-tests/path-url.js b/LayoutTests/fast/url/script-tests/path-url.js
deleted file mode 100644 (file)
index b53eff7..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-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 + "'");
-}
diff --git a/LayoutTests/fast/url/script-tests/path.js b/LayoutTests/fast/url/script-tests/path.js
deleted file mode 100644 (file)
index f0c5d5c..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-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.
-  ["////../..", "//"],
-  ["/foo/bar//../..", "/foo/"],
-  ["/foo/bar//..", "/foo/bar/"],
-  ["/foo/bar/..", "/foo/"],
-
-  // ----- 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%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", "/foobar"],
-  // 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"],
-  // U+2025 TWO DOT LEADER should not be normalized to .. in the path
-  ["/\u2025/foo", "/%E2%80%A5/foo"],
-  // A half-surrogate is an error by itself U+DEAD
-  // FIXME: ["/\uDEAD/foo", "/\uFFFD/foo"],
-  // BOM code point with special meaning U+FEFF ZERO WIDTH NO-BREAK SPACE
-  ["/\uFEFF/foo", "/%EF%BB%BF/foo"],
-  // The BIDI override code points RLO and LRO
-  ["/\u202E/foo/\u202D/bar", "/%E2%80%AE/foo/%E2%80%AD/bar"],
-  // U+FF0F FULLWIDTH SOLIDUS should normalize to / in a hostname
-  ["\uFF0Ffoo/", "%2Ffoo/"],
-
-];
-
-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 + "'");
-}
diff --git a/LayoutTests/fast/url/script-tests/port.js b/LayoutTests/fast/url/script-tests/port.js
deleted file mode 100644 (file)
index 55658e6..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-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"],
-  // Empty ports (just a colon) should also be removed
-  ["", ""],
-  // Code point with a numeric value U+1369 ETHIOPIC DIGIT ONE
-  ["\u1369", ":%E1%8D%A9"],
-  // Code point with a numerical mapping and value U+1D7D6 MATHEMATICAL BOLD DIGIT EIGHT
-  ["\uD835\uDFD6", ":%F0%9D%9F%96"],
-];
-
-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/'");
diff --git a/LayoutTests/fast/url/script-tests/query.js b/LayoutTests/fast/url/script-tests/query.js
deleted file mode 100644 (file)
index dcb6028..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-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=<asdf>", "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] + "'");
-}
diff --git a/LayoutTests/fast/url/script-tests/relative-unix.js b/LayoutTests/fast/url/script-tests/relative-unix.js
deleted file mode 100644 (file)
index bb6ed6a..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-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);
diff --git a/LayoutTests/fast/url/script-tests/relative-win.js b/LayoutTests/fast/url/script-tests/relative-win.js
deleted file mode 100644 (file)
index f2dfdde..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-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);
diff --git a/LayoutTests/fast/url/script-tests/relative.js b/LayoutTests/fast/url/script-tests/relative.js
deleted file mode 100644 (file)
index 980d37f..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-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);
diff --git a/LayoutTests/fast/url/script-tests/scheme.js b/LayoutTests/fast/url/script-tests/scheme.js
deleted file mode 100644 (file)
index f3b2be3..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-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/'");
-}
diff --git a/LayoutTests/fast/url/script-tests/segments-from-data-url.js b/LayoutTests/fast/url/script-tests/segments-from-data-url.js
deleted file mode 100644 (file)
index 29e648a..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-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","","/","",""]],
-  ["\\t   :foo.com   \\n",                   [":","","","","",""]],
-  [" foo.com  ",                             [":","","","","",""]],
-  ["a:\\t foo.com",                          ["a:","",""," foo.com","",""]],
-  ["http://f:21/ b ? d # e ",                ["http:","f","21","/%20b%20","?%20d%20","# e"]],
-  ["http://f:/c",                            ["http:","f","","/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",                           [":","","","","",""]],
-  ["http://f: /c",                           [":","","","","",""]],
-  ["http://f:\\n/c",                         [":","","","","",""]],
-  ["http://f:fifty-two/c",                   [":","","","","",""]],
-  ["http://f:999999/c",                      [":","","0","","",""]],
-  ["http://f: 21 / b ? d # e ",              [":","","","","",""]],
-  ["",                                       ["data:","","","text/plain,baseURL","",""]],
-  ["  \\t",                                  ["data:","","","text/plain,baseURL","",""]],
-  [":foo.com/",                              [":","","","","",""]],
-  [":foo.com\\\\",                           [":","","","","",""]],
-  [":",                                      [":","","","","",""]],
-  [":a",                                     [":","","","","",""]],
-  [":/",                                     [":","","","","",""]],
-  [":\\\\",                                  [":","","","","",""]],
-  [":#",                                     [":","","","","",""]],
-  ["#",                                      [":","","","","",""]],
-  ["#/",                                     [":","","","","",""]],
-  ["#\\\\",                                  [":","","","","",""]],
-  ["#;?",                                    [":","","","","",""]],
-  ["?",                                      [":","","","","",""]],
-  ["/",                                      [":","","","","",""]],
-  [":23",                                    [":","","","","",""]],
-  ["/:23",                                   ["data:","","","/:23","",""]],
-  ["//",                                     [":","","","","",""]],
-  ["::",                                     [":","","","","",""]],
-  ["::23",                                   [":","","","","",""]],
-  ["foo://",                                 ["foo:","","","//","",""]],
-  ["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","","/","",""]],
-  ["http://foo.com/\\\\@",                   ["http:","foo.com","","//@","",""]],
-  ["http:\\\\\\\\foo.com\\\\",               ["http:","foo.com","","/","",""]],
-  ["http:\\\\\\\\a\\\\b:c\\\\d@foo.com\\\\", ["http:","a","","/b:c/d@foo.com/","",""]],
-  ["foo:/",                                  ["foo:","","","/","",""]],
-  ["foo:/bar.com/",                          ["foo:","","","/bar.com/","",""]],
-  ["foo://///////",                          ["foo:","","","/////////","",""]],
-  ["foo://///////bar.com/",                  ["foo:","","","/////////bar.com/","",""]],
-  ["foo:////://///",                         ["foo:","","","////://///","",""]],
-  ["c:/foo",                                 ["c:","","","/foo","",""]],
-  ["//foo/bar",                              [":","","","","",""]],
-  ["http://foo/path;a??e#f#g",               ["http:","foo","","/path;a","??e","#f#g"]],
-  ["http://foo/abcd?efgh?ijkl",              ["http:","foo","","/abcd","?efgh?ijkl",""]],
-  ["http://foo/abcd#foo?bar",                ["http:","foo","","/abcd","","#foo?bar"]],
-  ["[61:24:74]:98",                          ["data:","","","text/[61:24:74]:98","",""]],
-  ["http://[61:27]:98",                      [":","","0","","",""]],
-  ["http:[61:27]/:foo",                      [":","","","","",""]],
-  ["http://[1::2]:3:4",                      [":","","","","",""]],
-  ["http://2001::1",                         [":","","","","",""]],
-  ["http://[2001::1",                        [":","","","","",""]],
-  ["http://2001::1]",                        [":","","","","",""]],
-  ["http://2001::1]:80",                     [":","","","","",""]],
-  ["http://[2001::1]",                       ["http:","[2001::1]","","/","",""]],
-  ["http://[2001::1]:80",                    ["http:","[2001::1]","","/","",""]],
-  ["http://[[::]]",                          [":","","","","",""]],
-];
-
-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);
diff --git a/LayoutTests/fast/url/script-tests/segments.js b/LayoutTests/fast/url/script-tests/segments.js
deleted file mode 100644 (file)
index 9f87b08..0000000
+++ /dev/null
@@ -1,112 +0,0 @@
-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","","/foo/foo.com","",""]],
-  ["\\t   :foo.com   \\n",                   ["http:","example.org","","/foo/:foo.com","",""]],
-  [" foo.com  ",                             ["http:","example.org","","/foo/foo.com","",""]],
-  ["a:\\t foo.com",                          ["a:","",""," foo.com","",""]],
-  ["http://f:21/ b ? d # e ",                ["http:","f","21","/%20b%20","?%20d%20","# e"]],
-  ["http://f:/c",                            ["http:","f","","/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",                           [":","","","","",""]],
-  ["http://f: /c",                           [":","","","","",""]],
-  ["http://f:\\n/c",                         [":","","","","",""]],
-  ["http://f:fifty-two/c",                   [":","","","","",""]],
-  ["http://f:999999/c",                      [":","","0","","",""]],
-  ["http://f: 21 / b ? d # e ",              [":","","","","",""]],
-  ["",                                       ["http:","example.org","","/foo/bar","",""]],
-  ["  \\t",                                  ["http:","example.org","","/foo/bar","",""]],
-  [":foo.com/",                              ["http:","example.org","","/foo/:foo.com/","",""]],
-  [":foo.com\\\\",                           ["http:","example.org","","/foo/:foo.com/","",""]],
-  [":",                                      ["http:","example.org","","/foo/:","",""]],
-  [":a",                                     ["http:","example.org","","/foo/:a","",""]],
-  [":/",                                     ["http:","example.org","","/foo/:/","",""]],
-  [":\\\\",                                  ["http:","example.org","","/foo/:/","",""]],
-  [":#",                                     ["http:","example.org","","/foo/:","",""]],
-  ["#",                                      ["http:","example.org","","/foo/bar","",""]],
-  ["#/",                                     ["http:","example.org","","/foo/bar","","#/"]],
-  ["#\\\\",                                  ["http:","example.org","","/foo/bar","","#\\\\"]],
-  ["#;?",                                    ["http:","example.org","","/foo/bar","","#;?"]],
-  ["?",                                      ["http:","example.org","","/foo/bar","",""]],
-  ["/",                                      ["http:","example.org","","/","",""]],
-  [":23",                                    ["http:","example.org","","/foo/:23","",""]],
-  ["/:23",                                   ["http:","example.org","","/:23","",""]],
-  ["//",                                     [":","","","","",""]],
-  ["::",                                     ["http:","example.org","","/foo/::","",""]],
-  ["::23",                                   ["http:","example.org","","/foo/::23","",""]],
-  ["foo://",                                 ["foo:","","","//","",""]],
-  ["http://a:b@c:29/d",                      ["http:","c","29","/d","",""]],
-  ["http::@c:29",                            ["http:","example.org","","/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","","/","",""]],
-  ["http://foo.com/\\\\@",                   ["http:","foo.com","","//@","",""]],
-  ["http:\\\\\\\\foo.com\\\\",               ["http:","foo.com","","/","",""]],
-  ["http:\\\\\\\\a\\\\b:c\\\\d@foo.com\\\\", ["http:","a","","/b:c/d@foo.com/","",""]],
-  ["foo:/",                                  ["foo:","","","/","",""]],
-  ["foo:/bar.com/",                          ["foo:","","","/bar.com/","",""]],
-  ["foo://///////",                          ["foo:","","","/////////","",""]],
-  ["foo://///////bar.com/",                  ["foo:","","","/////////bar.com/","",""]],
-  ["foo:////://///",                         ["foo:","","","////://///","",""]],
-  ["c:/foo",                                 ["c:","","","/foo","",""]],
-  ["//foo/bar",                              ["http:","foo","","/bar","",""]],
-  ["http://foo/path;a??e#f#g",               ["http:","foo","","/path;a","??e","#f#g"]],
-  ["http://foo/abcd?efgh?ijkl",              ["http:","foo","","/abcd","?efgh?ijkl",""]],
-  ["http://foo/abcd#foo?bar",                ["http:","foo","","/abcd","","#foo?bar"]],
-  ["[61:24:74]:98",                          ["http:","example.org","","/foo/[61:24:74]:98","",""]],
-  ["http://[61:27]:98",                      [":","","0","","",""]],
-  ["http:[61:27]/:foo",                      ["http:","example.org","","/foo/[61:27]/:foo","",""]],
-  ["http://[1::2]:3:4",                      [":","","","","",""]],
-  ["http://2001::1",                         [":","","","","",""]],
-  ["http://[2001::1",                        [":","","","","",""]],
-  ["http://2001::1]",                        [":","","","","",""]],
-  ["http://2001::1]:80",                     [":","","","","",""]],
-  ["http://[2001::1]",                       ["http:","[2001::1]","","/","",""]],
-  ["http://[2001::1]:80",                    ["http:","[2001::1]","","/","",""]],
-  ["http://[[::]]",                          [":","","","","",""]],
-  ["http:/example.com/",                     ["http:","example.org","","/example.com/","",""]],
-  ["ftp:/example.com/",                      ["ftp:","example.com","","/","",""]],
-  ["https:/example.com/",                    ["https:","example.com","","/","",""]],
-  ["madeupscheme:/example.com/",             ["madeupscheme:","","","/example.com/","",""]],
-  ["file:/example.com/",                     ["file:","","","/example.com/","",""]],
-  ["ftps:/example.com/",                     ["ftps:","","","/example.com/","",""]],
-  ["gopher:/example.com/",                   ["gopher:","example.com","","/","",""]],
-  ["ws:/example.com/",                       ["ws:","example.com","","/","",""]],
-  ["wss:/example.com/",                      ["wss:","example.com","","/","",""]],
-  ["data:/example.com/",                     ["data:","","","/example.com/","",""]],
-  ["javascript:/example.com/",               ["javascript:","","","/example.com/","",""]],
-  ["mailto:/example.com/",                   ["mailto:","","","/example.com/","",""]],
-  ["http:example.com/",                      ["http:","example.org","","/foo/example.com/","",""]],
-  ["ftp:example.com/",                       ["ftp:","example.com","","/","",""]],
-  ["https:example.com/",                     ["https:","example.com","","/","",""]],
-  ["madeupscheme:example.com/",              ["madeupscheme:","","","example.com/","",""]],
-  ["file:example.com/",                      ["file:","","","/example.com/","",""]],
-  ["ftps:example.com/",                      ["ftps:","","","example.com/","",""]],
-  ["gopher:example.com/",                    ["gopher:","example.com","","/","",""]],
-  ["ws:example.com/",                        ["ws:","example.com","","/","",""]],
-  ["wss:example.com/",                       ["wss:","example.com","","/","",""]],
-  ["data:example.com/",                      ["data:","","","example.com/","",""]],
-  ["javascript:example.com/",                ["javascript:","","","example.com/","",""]],
-  ["mailto:example.com/",                    ["mailto:","","","example.com/","",""]],
-
-  ["/a/b/c",                                  ["http:","example.org","","/a/b/c","",""]],
-  ["/a/ /c",                                  ["http:","example.org","","/a/%20/c","",""]],
-  ["/a%2fc",                                  ["http:","example.org","","/a%2fc","",""]],
-  ["/a/%2f/c",                                ["http:","example.org","","/a/%2f/c","",""]],
-
-  ["#\u03B2",                                 ["http:","example.org","","/foo/bar","","#\u03B2"]],
-];
-
-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);
diff --git a/LayoutTests/fast/url/script-tests/standard-url.js b/LayoutTests/fast/url/script-tests/standard-url.js
deleted file mode 100644 (file)
index c63e873..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-description("Canonicalization of standard URLs");
-
-cases = [
-  ["http://www.google.com/foo?bar=baz#", "http://www.google.com/foo?bar=baz#"],
-  ["http://www.google.com/foo?bar=baz# \u00bb", "http://www.google.com/foo?bar=baz# \u00bb"],
-  ["http://[www.google.com]/", "http://[www.google.com]/"],
-  ["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/"],
-  ["http:/example.com/", "http://example.com/"],
-  ["ftp:/example.com/", "ftp://example.com/"],
-  ["https:/example.com/", "https://example.com/"],
-  ["madeupscheme:/example.com/", "madeupscheme:/example.com/"],
-  ["file:/example.com/", "file://localhost/example.com/"],
-  ["ftps:/example.com/", "ftps:/example.com/"],
-  ["gopher:/example.com/", "gopher://example.com/"],
-  ["ws:/example.com/", "ws://example.com/"],
-  ["wss:/example.com/", "wss://example.com/"],
-  ["data:/example.com/", "data:/example.com/"],
-  ["javascript:/example.com/", "javascript:/example.com/"],
-  ["mailto:/example.com/", "mailto:/example.com/"],
-  ["http:example.com/", "http://example.com/"],
-  ["ftp:example.com/", "ftp://example.com/"],
-  ["https:example.com/", "https://example.com/"],
-  ["madeupscheme:example.com/", "madeupscheme:example.com/"],
-  ["ftps:example.com/", "ftps:example.com/"],
-  ["gopher:example.com/", "gopher://example.com/"],
-  ["ws:example.com/", "ws://example.com/"],
-  ["wss:example.com/", "wss://example.com/"],
-  ["data:example.com/", "data:example.com/"],
-  ["javascript:example.com/", "javascript:example.com/"],
-  ["mailto:example.com/", "mailto:example.com/"],
-  // Escaping of non hierarchical URLs
-  ["javascript:alert(\\t 1 \\n\\r)", "javascript:alert( 1 )"],
-  ['javascript:alert(" \1 \u03B2 ")', 'javascript:alert(" %01 %CE%B2 ")'],
-];
-
-for (var i = 0; i < cases.length; ++i) {
-  test_vector = cases[i][0];
-  expected_result = cases[i][1];
-  shouldBe("canonicalize('" + test_vector + "')",
-           "'" + expected_result + "'");
-}
diff --git a/LayoutTests/fast/url/script-tests/trivial-segments.js b/LayoutTests/fast/url/script-tests/trivial-segments.js
deleted file mode 100644 (file)
index 3cae2b1..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-description("Test basic features of URL segmentation");
-
-cases = [ 
-  // [URL, [SCHEME, HOST, PORT, PATH, QUERY, REF]]
-  ["http://example.com/", ["http:", "example.com", "", "/", "", ""]],
-];
-
-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);
diff --git a/LayoutTests/fast/url/script-tests/trivial.js b/LayoutTests/fast/url/script-tests/trivial.js
deleted file mode 100644 (file)
index 67f2b9f..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-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);
index eb7be36..8d7a466 100644 (file)
@@ -1,11 +1,93 @@
-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<!DOCTYPE html>
 <html>
 <head>
 <script src="../js/resources/js-test-pre.js"></script>
 <script src="resources/utilities.js"></script>
 </head>
 <body>
-<script src="script-tests/segments-from-data-url.js"></script>
+<script>
+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","","/","",""]],
+  ["\\t   :foo.com   \\n",                   [":","","","","",""]],
+  [" foo.com  ",                             [":","","","","",""]],
+  ["a:\\t foo.com",                          ["a:","",""," foo.com","",""]],
+  ["http://f:21/ b ? d # e ",                ["http:","f","21","/%20b%20","?%20d%20","# e"]],
+  ["http://f:/c",                            ["http:","f","","/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",                           [":","","","","",""]],
+  ["http://f: /c",                           [":","","","","",""]],
+  ["http://f:\\n/c",                         [":","","","","",""]],
+  ["http://f:fifty-two/c",                   [":","","","","",""]],
+  ["http://f:999999/c",                      [":","","0","","",""]],
+  ["http://f: 21 / b ? d # e ",              [":","","","","",""]],
+  ["",                                       ["data:","","","text/plain,baseURL","",""]],
+  ["  \\t",                                  ["data:","","","text/plain,baseURL","",""]],
+  [":foo.com/",                              [":","","","","",""]],
+  [":foo.com\\\\",                           [":","","","","",""]],
+  [":",                                      [":","","","","",""]],
+  [":a",                                     [":","","","","",""]],
+  [":/",                                     [":","","","","",""]],
+  [":\\\\",                                  [":","","","","",""]],
+  [":#",                                     [":","","","","",""]],
+  ["#",                                      [":","","","","",""]],
+  ["#/",                                     [":","","","","",""]],
+  ["#\\\\",                                  [":","","","","",""]],
+  ["#;?",                                    [":","","","","",""]],
+  ["?",                                      [":","","","","",""]],
+  ["/",                                      [":","","","","",""]],
+  [":23",                                    [":","","","","",""]],
+  ["/:23",                                   ["data:","","","/:23","",""]],
+  ["//",                                     [":","","","","",""]],
+  ["::",                                     [":","","","","",""]],
+  ["::23",                                   [":","","","","",""]],
+  ["foo://",                                 ["foo:","","","//","",""]],
+  ["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","","/","",""]],
+  ["http://foo.com/\\\\@",                   ["http:","foo.com","","//@","",""]],
+  ["http:\\\\\\\\foo.com\\\\",               ["http:","foo.com","","/","",""]],
+  ["http:\\\\\\\\a\\\\b:c\\\\d@foo.com\\\\", ["http:","a","","/b:c/d@foo.com/","",""]],
+  ["foo:/",                                  ["foo:","","","/","",""]],
+  ["foo:/bar.com/",                          ["foo:","","","/bar.com/","",""]],
+  ["foo://///////",                          ["foo:","","","/////////","",""]],
+  ["foo://///////bar.com/",                  ["foo:","","","/////////bar.com/","",""]],
+  ["foo:////://///",                         ["foo:","","","////://///","",""]],
+  ["c:/foo",                                 ["c:","","","/foo","",""]],
+  ["//foo/bar",                              [":","","","","",""]],
+  ["http://foo/path;a??e#f#g",               ["http:","foo","","/path;a","??e","#f#g"]],
+  ["http://foo/abcd?efgh?ijkl",              ["http:","foo","","/abcd","?efgh?ijkl",""]],
+  ["http://foo/abcd#foo?bar",                ["http:","foo","","/abcd","","#foo?bar"]],
+  ["[61:24:74]:98",                          ["data:","","","text/[61:24:74]:98","",""]],
+  ["http://[61:27]:98",                      [":","","0","","",""]],
+  ["http:[61:27]/:foo",                      [":","","","","",""]],
+  ["http://[1::2]:3:4",                      [":","","","","",""]],
+  ["http://2001::1",                         [":","","","","",""]],
+  ["http://[2001::1",                        [":","","","","",""]],
+  ["http://2001::1]",                        [":","","","","",""]],
+  ["http://2001::1]:80",                     [":","","","","",""]],
+  ["http://[2001::1]",                       ["http:","[2001::1]","","/","",""]],
+  ["http://[2001::1]:80",                    ["http:","[2001::1]","","/","",""]],
+  ["http://[[::]]",                          [":","","","","",""]],
+];
+
+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);
+</script>
 <script src="../js/resources/js-test-post.js"></script>
 </body>
 </html>
index d8768fd..24f818a 100644 (file)
@@ -6,7 +6,120 @@
 <script src="resources/utilities.js"></script>
 </head>
 <body>
-<script src="script-tests/segments.js"></script>
+<script>
+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","","/foo/foo.com","",""]],
+  ["\\t   :foo.com   \\n",                   ["http:","example.org","","/foo/:foo.com","",""]],
+  [" foo.com  ",                             ["http:","example.org","","/foo/foo.com","",""]],
+  ["a:\\t foo.com",                          ["a:","",""," foo.com","",""]],
+  ["http://f:21/ b ? d # e ",                ["http:","f","21","/%20b%20","?%20d%20","# e"]],
+  ["http://f:/c",                            ["http:","f","","/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",                           [":","","","","",""]],
+  ["http://f: /c",                           [":","","","","",""]],
+  ["http://f:\\n/c",                         [":","","","","",""]],
+  ["http://f:fifty-two/c",                   [":","","","","",""]],
+  ["http://f:999999/c",                      [":","","0","","",""]],
+  ["http://f: 21 / b ? d # e ",              [":","","","","",""]],
+  ["",                                       ["http:","example.org","","/foo/bar","",""]],
+  ["  \\t",                                  ["http:","example.org","","/foo/bar","",""]],
+  [":foo.com/",                              ["http:","example.org","","/foo/:foo.com/","",""]],
+  [":foo.com\\\\",                           ["http:","example.org","","/foo/:foo.com/","",""]],
+  [":",                                      ["http:","example.org","","/foo/:","",""]],
+  [":a",                                     ["http:","example.org","","/foo/:a","",""]],
+  [":/",                                     ["http:","example.org","","/foo/:/","",""]],
+  [":\\\\",                                  ["http:","example.org","","/foo/:/","",""]],
+  [":#",                                     ["http:","example.org","","/foo/:","",""]],
+  ["#",                                      ["http:","example.org","","/foo/bar","",""]],
+  ["#/",                                     ["http:","example.org","","/foo/bar","","#/"]],
+  ["#\\\\",                                  ["http:","example.org","","/foo/bar","","#\\\\"]],
+  ["#;?",                                    ["http:","example.org","","/foo/bar","","#;?"]],
+  ["?",                                      ["http:","example.org","","/foo/bar","",""]],
+  ["/",                                      ["http:","example.org","","/","",""]],
+  [":23",                                    ["http:","example.org","","/foo/:23","",""]],
+  ["/:23",                                   ["http:","example.org","","/:23","",""]],
+  ["//",                                     [":","","","","",""]],
+  ["::",                                     ["http:","example.org","","/foo/::","",""]],
+  ["::23",                                   ["http:","example.org","","/foo/::23","",""]],
+  ["foo://",                                 ["foo:","","","//","",""]],
+  ["http://a:b@c:29/d",                      ["http:","c","29","/d","",""]],
+  ["http::@c:29",                            ["http:","example.org","","/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","","/","",""]],
+  ["http://foo.com/\\\\@",                   ["http:","foo.com","","//@","",""]],
+  ["http:\\\\\\\\foo.com\\\\",               ["http:","foo.com","","/","",""]],
+  ["http:\\\\\\\\a\\\\b:c\\\\d@foo.com\\\\", ["http:","a","","/b:c/d@foo.com/","",""]],
+  ["foo:/",                                  ["foo:","","","/","",""]],
+  ["foo:/bar.com/",                          ["foo:","","","/bar.com/","",""]],
+  ["foo://///////",                          ["foo:","","","/////////","",""]],
+  ["foo://///////bar.com/",                  ["foo:","","","/////////bar.com/","",""]],
+  ["foo:////://///",                         ["foo:","","","////://///","",""]],
+  ["c:/foo",                                 ["c:","","","/foo","",""]],
+  ["//foo/bar",                              ["http:","foo","","/bar","",""]],
+  ["http://foo/path;a??e#f#g",               ["http:","foo","","/path;a","??e","#f#g"]],
+  ["http://foo/abcd?efgh?ijkl",              ["http:","foo","","/abcd","?efgh?ijkl",""]],
+  ["http://foo/abcd#foo?bar",                ["http:","foo","","/abcd","","#foo?bar"]],
+  ["[61:24:74]:98",                          ["http:","example.org","","/foo/[61:24:74]:98","",""]],
+  ["http://[61:27]:98",                      [":","","0","","",""]],
+  ["http:[61:27]/:foo",                      ["http:","example.org","","/foo/[61:27]/:foo","",""]],
+  ["http://[1::2]:3:4",                      [":","","","","",""]],
+  ["http://2001::1",                         [":","","","","",""]],
+  ["http://[2001::1",                        [":","","","","",""]],
+  ["http://2001::1]",                        [":","","","","",""]],
+  ["http://2001::1]:80",                     [":","","","","",""]],
+  ["http://[2001::1]",                       ["http:","[2001::1]","","/","",""]],
+  ["http://[2001::1]:80",                    ["http:","[2001::1]","","/","",""]],
+  ["http://[[::]]",                          [":","","","","",""]],
+  ["http:/example.com/",                     ["http:","example.org","","/example.com/","",""]],
+  ["ftp:/example.com/",                      ["ftp:","example.com","","/","",""]],
+  ["https:/example.com/",                    ["https:","example.com","","/","",""]],
+  ["madeupscheme:/example.com/",             ["madeupscheme:","","","/example.com/","",""]],
+  ["file:/example.com/",                     ["file:","","","/example.com/","",""]],
+  ["ftps:/example.com/",                     ["ftps:","","","/example.com/","",""]],
+  ["gopher:/example.com/",                   ["gopher:","example.com","","/","",""]],
+  ["ws:/example.com/",                       ["ws:","example.com","","/","",""]],
+  ["wss:/example.com/",                      ["wss:","example.com","","/","",""]],
+  ["data:/example.com/",                     ["data:","","","/example.com/","",""]],
+  ["javascript:/example.com/",               ["javascript:","","","/example.com/","",""]],
+  ["mailto:/example.com/",                   ["mailto:","","","/example.com/","",""]],
+  ["http:example.com/",                      ["http:","example.org","","/foo/example.com/","",""]],
+  ["ftp:example.com/",                       ["ftp:","example.com","","/","",""]],
+  ["https:example.com/",                     ["https:","example.com","","/","",""]],
+  ["madeupscheme:example.com/",              ["madeupscheme:","","","example.com/","",""]],
+  ["file:example.com/",                      ["file:","","","/example.com/","",""]],
+  ["ftps:example.com/",                      ["ftps:","","","example.com/","",""]],
+  ["gopher:example.com/",                    ["gopher:","example.com","","/","",""]],
+  ["ws:example.com/",                        ["ws:","example.com","","/","",""]],
+  ["wss:example.com/",                       ["wss:","example.com","","/","",""]],
+  ["data:example.com/",                      ["data:","","","example.com/","",""]],
+  ["javascript:example.com/",                ["javascript:","","","example.com/","",""]],
+  ["mailto:example.com/",                    ["mailto:","","","example.com/","",""]],
+
+  ["/a/b/c",                                  ["http:","example.org","","/a/b/c","",""]],
+  ["/a/ /c",                                  ["http:","example.org","","/a/%20/c","",""]],
+  ["/a%2fc",                                  ["http:","example.org","","/a%2fc","",""]],
+  ["/a/%2f/c",                                ["http:","example.org","","/a/%2f/c","",""]],
+
+  ["#\u03B2",                                 ["http:","example.org","","/foo/bar","","#\u03B2"]],
+];
+
+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);
+</script>
 <script src="../js/resources/js-test-post.js"></script>
 </body>
 </html>
index a3fbcbe..e7185f2 100644 (file)
@@ -1,11 +1,85 @@
-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<!DOCTYPE html>
 <html>
 <head>
 <script src="../js/resources/js-test-pre.js"></script>
 <script src="resources/utilities.js"></script>
 </head>
 <body>
-<script src="script-tests/standard-url.js"></script>
+<script>
+description("Canonicalization of standard URLs");
+
+cases = [
+  ["http://www.google.com/foo?bar=baz#", "http://www.google.com/foo?bar=baz#"],
+  ["http://www.google.com/foo?bar=baz# \u00bb", "http://www.google.com/foo?bar=baz# \u00bb"],
+  ["http://[www.google.com]/", "http://[www.google.com]/"],
+  ["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/"],
+  ["http:/example.com/", "http://example.com/"],
+  ["ftp:/example.com/", "ftp://example.com/"],
+  ["https:/example.com/", "https://example.com/"],
+  ["madeupscheme:/example.com/", "madeupscheme:/example.com/"],
+  ["file:/example.com/", "file://localhost/example.com/"],
+  ["ftps:/example.com/", "ftps:/example.com/"],
+  ["gopher:/example.com/", "gopher://example.com/"],
+  ["ws:/example.com/", "ws://example.com/"],
+  ["wss:/example.com/", "wss://example.com/"],
+  ["data:/example.com/", "data:/example.com/"],
+  ["javascript:/example.com/", "javascript:/example.com/"],
+  ["mailto:/example.com/", "mailto:/example.com/"],
+  ["http:example.com/", "http://example.com/"],
+  ["ftp:example.com/", "ftp://example.com/"],
+  ["https:example.com/", "https://example.com/"],
+  ["madeupscheme:example.com/", "madeupscheme:example.com/"],
+  ["ftps:example.com/", "ftps:example.com/"],
+  ["gopher:example.com/", "gopher://example.com/"],
+  ["ws:example.com/", "ws://example.com/"],
+  ["wss:example.com/", "wss://example.com/"],
+  ["data:example.com/", "data:example.com/"],
+  ["javascript:example.com/", "javascript:example.com/"],
+  ["mailto:example.com/", "mailto:example.com/"],
+  // Escaping of non hierarchical URLs
+  ["javascript:alert(\\t 1 \\n\\r)", "javascript:alert( 1 )"],
+  ['javascript:alert(" \1 \u03B2 ")', 'javascript:alert(" %01 %CE%B2 ")'],
+];
+
+for (var i = 0; i < cases.length; ++i) {
+  test_vector = cases[i][0];
+  expected_result = cases[i][1];
+  shouldBe("canonicalize('" + test_vector + "')",
+           "'" + expected_result + "'");
+}
+</script>
 <script src="../js/resources/js-test-post.js"></script>
 </body>
 </html>
index 6b49702..b0a5242 100644 (file)
@@ -1,11 +1,28 @@
-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<!DOCTYPE html>
 <html>
 <head>
 <script src="../js/resources/js-test-pre.js"></script>
 <script src="resources/utilities.js"></script>
 </head>
 <body>
-<script src="script-tests/trivial-segments.js"></script>
+<script>
+description("Test basic features of URL segmentation");
+
+cases = [ 
+  // [URL, [SCHEME, HOST, PORT, PATH, QUERY, REF]]
+  ["http://example.com/", ["http:", "example.com", "", "/", "", ""]],
+];
+
+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);
+</script>
 <script src="../js/resources/js-test-post.js"></script>
 </body>
 </html>
index 46d0d83..635876e 100644 (file)
@@ -1,11 +1,28 @@
-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<!DOCTYPE html>
 <html>
 <head>
 <script src="../js/resources/js-test-pre.js"></script>
 <script src="resources/utilities.js"></script>
 </head>
 <body>
-<script src="script-tests/trivial.js"></script>
+<script>
+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);
+</script>
 <script src="../js/resources/js-test-post.js"></script>
 </body>
 </html>