Changeset 149681 in webkit


Ignore:
Timestamp:
May 7, 2013 10:58:45 AM (11 years ago)
Author:
ap@apple.com
Message:

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:
Location:
trunk/LayoutTests
Files:
1 deleted
26 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r149668 r149681  
     12013-05-07  Alexey Proskuryakov  <ap@apple.com>
     2
     3        Combine html and js parts fast/url script-tests
     4        https://bugs.webkit.org/show_bug.cgi?id=115739
     5
     6        Rubber-stamped by Brady Eidson.
     7
     8        * fast/url/anchor.html:
     9        * fast/url/file-http-base.html:
     10        * fast/url/file.html:
     11        * fast/url/host-lowercase-per-scheme.html:
     12        * fast/url/host.html:
     13        * fast/url/idna2003.html:
     14        * fast/url/idna2008.html:
     15        * fast/url/invalid-urls-utf8.html:
     16        * fast/url/ipv4.html:
     17        * fast/url/ipv6.html:
     18        * fast/url/mailto.html:
     19        * fast/url/path-url.html:
     20        * fast/url/path.html:
     21        * fast/url/port.html:
     22        * fast/url/query.html:
     23        * fast/url/relative-unix.html:
     24        * fast/url/relative-win.html:
     25        * fast/url/relative.html:
     26        * fast/url/safari-extension.html:
     27        * fast/url/scheme.html:
     28        * fast/url/script-tests: Removed.
     29        * fast/url/script-tests/TEMPLATE.html: Removed.
     30        * fast/url/script-tests/anchor.js: Removed.
     31        * fast/url/script-tests/file-http-base.js: Removed.
     32        * fast/url/script-tests/file.js: Removed.
     33        * fast/url/script-tests/host.js: Removed.
     34        * fast/url/script-tests/idna2003.js: Removed.
     35        * fast/url/script-tests/idna2008.js: Removed.
     36        * fast/url/script-tests/ipv4.js: Removed.
     37        * fast/url/script-tests/ipv6.js: Removed.
     38        * fast/url/script-tests/mailto.js: Removed.
     39        * fast/url/script-tests/path-url.js: Removed.
     40        * fast/url/script-tests/path.js: Removed.
     41        * fast/url/script-tests/port.js: Removed.
     42        * fast/url/script-tests/query.js: Removed.
     43        * fast/url/script-tests/relative-unix.js: Removed.
     44        * fast/url/script-tests/relative-win.js: Removed.
     45        * fast/url/script-tests/relative.js: Removed.
     46        * fast/url/script-tests/scheme.js: Removed.
     47        * fast/url/script-tests/segments-from-data-url.js: Removed.
     48        * fast/url/script-tests/segments.js: Removed.
     49        * fast/url/script-tests/standard-url.js: Removed.
     50        * fast/url/script-tests/trivial-segments.js: Removed.
     51        * fast/url/script-tests/trivial.js: Removed.
     52        * fast/url/segments-from-data-url.html:
     53        * fast/url/segments.html:
     54        * fast/url/standard-url.html:
     55        * fast/url/trivial-segments.html:
     56        * fast/url/trivial.html:
     57
    1582013-05-07  Radu Stavila  <stavila@adobe.com>
    259
  • trunk/LayoutTests/fast/url/anchor.html

    r97881 r149681  
    1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
     1<!DOCTYPE html>
    22<html>
    33<head>
     
    66</head>
    77<body>
    8 <script src="script-tests/anchor.js"></script>
     8<script>
     9description("Test URLs that have an anchor.");
     10
     11cases = [
     12  ["hello, world", "hello, world"],
     13  ["\xc2\xa9", "\xc2\xa9"],
     14  ["\ud800\udf00ss", "\ud800\udf00ss"],
     15  ["%41%a", "%41%a"],
     16  ["\\ud800\\u597d", "\\uFFFD\\u597D"],
     17  ["a\\uFDD0", "a\\uFDD0"],
     18  ["asdf#qwer", "asdf#qwer"],
     19  ["#asdf", "#asdf"],
     20  ["a\\nb\\rc\\td", "abcd"],
     21];
     22
     23for (var i = 0; i < cases.length; ++i) {
     24  shouldBe("canonicalize('http://www.example.com/#" + cases[i][0] + "')",
     25           "'http://www.example.com/#" + cases[i][1] + "'");
     26}
     27</script>
    928<script src="../js/resources/js-test-post.js"></script>
    1029</body>
  • trunk/LayoutTests/fast/url/file-http-base.html

    r97881 r149681  
    1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
     1<!DOCTYPE html>
    22<html>
    33<head>
     
    66</head>
    77<body>
    8 <script src="script-tests/file-http-base.js"></script>
     8<script>
     9description("Canonicalization of file URLs when the base URL is an http URL");
     10
     11cases = [
     12    // Windows-style paths
     13    ["file:c:\\\\foo\\\\bar.html", "file:///C:/foo/bar.html"],
     14    ["  File:c|////foo\\\\bar.html", "file:///C:////foo/bar.html"],
     15    ["file:", "file:///"],
     16    ["file:UNChost/path", "file://unchost/path"],
     17    // CanonicalizeFileURL supports absolute Windows style paths for IE
     18    // compatability. Note that the caller must decide that this is a file
     19    // URL itself so it can call the file canonicalizer. This is usually
     20    // done automatically as part of relative URL resolving.
     21    ["c:\\\\foo\\\\bar", "file:///C:/foo/bar"],
     22    ["C|/foo/bar", "file:///C:/foo/bar"],
     23    ["/C|\\\\foo\\\\bar", "file:///C:/foo/bar"],
     24    ["//C|/foo/bar", "file:///C:/foo/bar"],
     25    ["//server/file", "file://server/file"],
     26    ["\\\\\\\\server\\\\file", "file://server/file"],
     27    ["/\\\\server/file", "file://server/file"],
     28    // We should preserve the number of slashes after the colon for IE
     29    // compatability, except when there is none, in which case we should
     30    // add one.
     31    ["file:c:foo/bar.html", "file:///C:/foo/bar.html"],
     32    ["file:/\\\\/\\\\C:\\\\\\\\//foo\\\\bar.html", "file:///C:////foo/bar.html"],
     33    // Three slashes should be non-UNC, even if there is no drive spec (IE
     34    // does this, which makes the resulting request invalid).
     35    ["file:///foo/bar.txt", "file:///foo/bar.txt"],
     36    // TODO(brettw) we should probably fail for invalid host names, which
     37    // would change the expected result on this test. We also currently allow
     38    // colon even though it's probably invalid, because its currently the
     39    // "natural" result of the way the canonicalizer is written. There doesn't
     40    // seem to be a strong argument for why allowing it here would be bad, so
     41    // we just tolerate it and the load will fail later.
     42    ["FILE:/\\\\/\\\\7:\\\\\\\\//foo\\\\bar.html", "file://7:////foo/bar.html"],
     43    ["file:filer/home\\\\me", "file://filer/home/me"],
     44    // Make sure relative paths can't go above the "C:"
     45    ["file:///C:/foo/../../../bar.html", "file:///C:/bar.html"],
     46    // Busted refs shouldn't make the whole thing fail.
     47    ["file:///C:/asdf#\\xc2", "file:///C:/asdf#\\xc2"],
     48    ["file:///C:/asdf#\xc2", "file:///C:/asdf#\xc2"],
     49
     50    // Unix-style paths
     51    ["file:///home/me", "file:///home/me"],
     52    // Windowsy ones should get still treated as Unix-style.
     53    ["file:c:\\\\foo\\\\bar.html", "file:///c:/foo/bar.html"],
     54    ["file:c|//foo\\\\bar.html", "file:///c%7C//foo/bar.html"],
     55    // file: tests from WebKit (LayoutTests/fast/loader/url-parse-1.html)
     56    ["//", "file:///"],
     57    ["///", "file:///"],
     58    ["///test", "file:///test"],
     59    ["file://test", "file://test/"],
     60    ["file://localhost",  "file://localhost/"],
     61    ["file://localhost/", "file://localhost/"],
     62    ["file://localhost/test", "file://localhost/test"],
     63];
     64
     65var originalBaseURL = canonicalize(".");
     66setBaseURL("http://example.com/mock/path");
     67
     68for (var i = 0; i < cases.length; ++i) {
     69  test_vector = cases[i][0];
     70  expected_result = cases[i][1];
     71  shouldBe("canonicalize('" + test_vector + "')",
     72           "'" + expected_result + "'");
     73}
     74
     75setBaseURL(originalBaseURL);
     76</script>
    977<script src="../js/resources/js-test-post.js"></script>
    1078</body>
  • trunk/LayoutTests/fast/url/file.html

    r97881 r149681  
    1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
     1<!DOCTYPE html>
    22<html>
    33<head>
     
    66</head>
    77<body>
    8 <script src="script-tests/file.js"></script>
     8<script>
     9description("Canonicalization of file URLs");
     10
     11cases = [
     12    // Windows-style paths
     13    ["file:c:\\\\foo\\\\bar.html", "file:///C:/foo/bar.html"],
     14    ["  File:c|////foo\\\\bar.html", "file:///C:////foo/bar.html"],
     15    ["file:", "file:///"],
     16    ["file:UNChost/path", "file://unchost/path"],
     17    // CanonicalizeFileURL supports absolute Windows style paths for IE
     18    // compatability. Note that the caller must decide that this is a file
     19    // URL itself so it can call the file canonicalizer. This is usually
     20    // done automatically as part of relative URL resolving.
     21    ["c:\\\\foo\\\\bar", "file:///C:/foo/bar"],
     22    ["C|/foo/bar", "file:///C:/foo/bar"],
     23    ["/C|\\\\foo\\\\bar", "file:///C:/foo/bar"],
     24    ["//C|/foo/bar", "file:///C:/foo/bar"],
     25    ["//server/file", "file://server/file"],
     26    ["\\\\\\\\server\\\\file", "file://server/file"],
     27    ["/\\\\server/file", "file://server/file"],
     28    // We should preserve the number of slashes after the colon for IE
     29    // compatability, except when there is none, in which case we should
     30    // add one.
     31    ["file:c:foo/bar.html", "file:///C:/foo/bar.html"],
     32    ["file:/\\\\/\\\\C:\\\\\\\\//foo\\\\bar.html", "file:///C:////foo/bar.html"],
     33    // Three slashes should be non-UNC, even if there is no drive spec (IE
     34    // does this, which makes the resulting request invalid).
     35    ["file:///foo/bar.txt", "file:///foo/bar.txt"],
     36    // TODO(brettw) we should probably fail for invalid host names, which
     37    // would change the expected result on this test. We also currently allow
     38    // colon even though it's probably invalid, because its currently the
     39    // "natural" result of the way the canonicalizer is written. There doesn't
     40    // seem to be a strong argument for why allowing it here would be bad, so
     41    // we just tolerate it and the load will fail later.
     42    ["FILE:/\\\\/\\\\7:\\\\\\\\//foo\\\\bar.html", "file://7:////foo/bar.html"],
     43    ["file:filer/home\\\\me", "file://filer/home/me"],
     44    // Make sure relative paths can't go above the "C:"
     45    ["file:///C:/foo/../../../bar.html", "file:///C:/bar.html"],
     46    // Busted refs shouldn't make the whole thing fail.
     47    ["file:///C:/asdf#\\xc2", "file:///C:/asdf#\\xef\\xbf\\xbd"],
     48
     49    // Unix-style paths
     50    ["file:///home/me", "file:///home/me"],
     51    // Windowsy ones should get still treated as Unix-style.
     52    ["file:c:\\\\foo\\\\bar.html", "file:///c:/foo/bar.html"],
     53    ["file:c|//foo\\\\bar.html", "file:///c%7C//foo/bar.html"],
     54    // file: tests from WebKit (LayoutTests/fast/loader/url-parse-1.html)
     55    ["//", "file:///"],
     56    ["///", "file:///"],
     57    ["///test", "file:///test"],
     58    ["file://test", "file://test/"],
     59    ["file://localhost",  "file://localhost/"],
     60    ["file://localhost/", "file://localhost/"],
     61    ["file://localhost/test", "file://localhost/test"],
     62];
     63
     64var originalBaseURL = canonicalize(".");
     65setBaseURL("file:///tmp/mock/path");
     66
     67for (var i = 0; i < cases.length; ++i) {
     68  test_vector = cases[i][0];
     69  expected_result = cases[i][1];
     70  shouldBe("canonicalize('" + test_vector + "')",
     71           "'" + expected_result + "'");
     72}
     73
     74setBaseURL(originalBaseURL);
     75</script>
    976<script src="../js/resources/js-test-post.js"></script>
    1077</body>
  • trunk/LayoutTests/fast/url/host-lowercase-per-scheme.html

    r104414 r149681  
    1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
     1<!DOCTYPE html>
    22<html>
    33<head>
  • trunk/LayoutTests/fast/url/host.html

    r97881 r149681  
    1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
     1<!DOCTYPE html>
    22<html>
    33<head>
     
    66</head>
    77<body>
    8 <script src="script-tests/host.js"></script>
     8<script>
     9description("Canonicalization of host names.");
     10
     11cases = [
     12  // Basic canonicalization, uppercase should be converted to lowercase.
     13  ["GoOgLe.CoM", "google.com"],
     14  // Spaces and some other characters should be escaped.
     15  ["Goo%20 goo%7C|.com", "goo%20%20goo%7C%7C.com"],
     16  // Exciting different types of spaces!
     17  ["GOO\u00a0\u3000goo.com", "goo%20%20goo.com"],
     18  // Other types of space (no-break, zero-width, zero-width-no-break) are
     19  // name-prepped away to nothing.
     20  ["GOO\u200b\u2060\ufeffgoo.com", "googoo.com"],
     21  // Ideographic full stop (full-width period for Chinese, etc.) should be
     22  // treated as a dot.
     23  ["www.foo\u3002" + "bar.com", "www.foo.bar.com"],
     24  // Invalid unicode characters should fail...
     25  // ...In wide input, ICU will barf and we'll end up with the input as
     26  //    escaped UTF-8 (the invalid character should be replaced with the
     27  //    replacement character).
     28  ["\ufdd0zyx.com", "%EF%BF%BDzyx.com"],
     29  // ...This is the same as previous but with with escaped.
     30  ["%ef%b7%90zyx.com", "%EF%BF%BDzyx.com"],
     31  // Test name prepping, fullwidth input should be converted to ASCII and NOT
     32  // IDN-ized. This is "Go" in fullwidth UTF-8/UTF-16.
     33  ["\uff27\uff4f.com", "go.com"],
     34  // Test that fullwidth escaped values are properly name-prepped,
     35  // then converted or rejected.
     36  // ...%41 in fullwidth = 'A' (also as escaped UTF-8 input)
     37  ["\uff05\uff14\uff11.com", "a.com"],
     38  ["%ef%bc%85%ef%bc%94%ef%bc%91.com", "a.com"],
     39  // ...%00 in fullwidth should fail (also as escaped UTF-8 input)
     40  ["\uff05\uff10\uff10.com", "%00.com"],
     41  ["%ef%bc%85%ef%bc%90%ef%bc%90.com", "%00.com"],
     42  // Basic IDN support, UTF-8 and UTF-16 input should be converted to IDN
     43  ["\u4f60\u597d\u4f60\u597d", "xn--6qqa088eba"],
     44  // Mixed UTF-8 and escaped UTF-8 (narrow case) and UTF-16 and escaped
     45  // UTF-8 (wide case). The output should be equivalent to the true wide
     46  // character input above).
     47  ["%E4%BD%A0%E5%A5%BD\u4f60\u597d", "xn--6qqa088eba"],
     48  // Invalid escaped characters should fail and the percents should be
     49  // escaped.
     50  ["%zz%66%a", "%25zzf%25a"],
     51  // If we get an invalid character that has been escaped.
     52  ["%25", "%25"],
     53  ["hello%00", "hello%00"],
     54  // Escaped numbers should be treated like IP addresses if they are.
     55  ["%30%78%63%30%2e%30%32%35%30.01", "192.168.0.1"],
     56  ["%30%78%63%30%2e%30%32%35%30.01%2e", "192.168.0.1"],
     57  // Invalid escaping should trigger the regular host error handling.
     58  ["%3g%78%63%30%2e%30%32%35%30%2E.01", "%253gxc0.0250..01"],
     59  // Something that isn't exactly an IP should get treated as a host and
     60  // spaces escaped.
     61  ["192.168.0.1 hello", "192.168.0.1%20hello"],
     62  // Fullwidth and escaped UTF-8 fullwidth should still be treated as IP.
     63  // These are "0Xc0.0250.01" in fullwidth.
     64  ["\uff10\uff38\uff43\uff10\uff0e\uff10\uff12\uff15\uff10\uff0e\uff10\uff11", "192.168.0.1"],
     65  // Broken IP addresses get marked as such.
     66  ["192.168.0.257", "192.168.0.257"],
     67  ["[google.com]", "[google.com]"],
     68  // Cyrillic letter followed buy ( should return punicode for ( escaped before punicode string was created. I.e.
     69  // if ( is escaped after punicode is created we would get xn--%28-8tb (incorrect).
     70  ["\u0442(", "xn--%28-7ed"],
     71  ["go\\\\@ogle.com","go/@ogle.com"],
     72  ["go/@ogle.com","go/@ogle.com"],
     73  ["www.lookout.net::==80::==443::","www.lookout.net::%3D%3D80::%3D%3D443:"],
     74  ["www.lookout.net::80::443","www.lookout.net::80::443"],
     75  // From http://eaea.sirdarckcat.net/uritest.html
     76  ["\\./","./"],
     77  ["//:@/","/"],
     78  ["\\google.com/foo","google.com/foo"],
     79  ["\\\\google.com/foo","google.com/foo"],
     80  ["//asdf@/","asdf@/"],
     81  ["//:81",":81"],
     82  ["://","//"],
     83  ["c:","c"],
     84  ["xxxx:","xxxx"],
     85  [".:.",".:."],
     86  ["////@google.com/","google.com/"],
     87  ["@google.com","google.com"]
     88];
     89
     90for (var i = 0; i < cases.length; ++i) {
     91  test_vector = cases[i][0];
     92  expected_result = cases[i][1];
     93  shouldBe("canonicalize('http://" + test_vector + "/')",
     94           "'http://" + expected_result + "/'");
     95}
     96</script>
    997<script src="../js/resources/js-test-post.js"></script>
    1098</body>
  • trunk/LayoutTests/fast/url/idna2003.html

    r97881 r149681  
    1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
     1<!DOCTYPE html>
    22<html>
    33<head>
     
    66</head>
    77<body>
    8 <script src="script-tests/idna2003.js"></script>
     8<script>
     9description("IDNA2003 handling in domain name labels.");
     10
     11debug("The PASS/FAIL results of this test are set to the behavior in IDNA2003.");
     12
     13cases = [
     14  // For IDNA Compatibility test material see
     15  // http://www.unicode.org/reports/tr46/
     16  // 1) Deviant character tests (deviant from IDNA2008)
     17  // U+00DF normalizes to "ss" during IDNA2003's mapping phase
     18  ["fa\u00DF.de","fass.de"],
     19  // The ς U+03C2 GREEK SMALL LETTER FINAL SIGMA
     20  ["\u03B2\u03CC\u03BB\u03BF\u03C2.com","xn--nxasmq6b.com"],
     21  // The ZWJ U+200D ZERO WIDTH JOINER
     22  ["\u0DC1\u0DCA\u200D\u0DBB\u0DD3.com","xn--10cl1a0b.com"],
     23  // The ZWNJ U+200C ZERO WIDTH NON-JOINER
     24  ["\u0646\u0627\u0645\u0647\u200C\u0627\u06CC.com","xn--mgba3gch31f.com"],
     25  // 2) Normalization tests
     26  ["www.loo\u0138out.net","www.xn--looout-5bb.net"],
     27  ["\u15EF\u15EF\u15EF.lookout.net","xn--1qeaa.lookout.net"],
     28  ["www.lookout.\u0441\u043E\u043C","www.lookout.xn--l1adi"],
     29  ["www.lookout.net\uFF1A80","www.lookout.net:80"],
     30  ["www\u2025lookout.net","www..lookout.net"],
     31  ["www.lookout\u2027net","www.xn--lookoutnet-406e"],
     32  // using Latin letter kra ‘ĸ’ in domain
     33  ["www.loo\u0138out.net","www.xn--looout-5bb.net"],
     34  // \u2A74 decomposes into ::=
     35  ["www.lookout.net\u2A7480","www.lookout.net::%3D80"],
     36  // 3) Prohibited code points
     37  //   Using prohibited high-ASCII \u00A0
     38  ["www\u00A0.lookout.net","www%20.lookout.net"],
     39  //   using prohibited non-ASCII space chars 1680 (Ogham space mark)
     40  ["\u1680lookout.net","%E1%9A%80lookout.net"],
     41  //   Using prohibited lower ASCII control character \u001F
     42  ["\u001Flookout.net","%1Flookout.net"],
     43  //   Using prohibited U+06DD ARABIC END OF AYAH
     44  ["look\u06DDout.net","look%DB%9Dout.net"],
     45  //   Using prohibited U+180E MONGOLIAN VOWEL SEPARATOR
     46  ["look\u180Eout.net","look%E1%A0%8Eout.net"],
     47  //   Using prohibited U+2060 WORD JOINER
     48  ["look\u2060out.net","look%E2%81%A0out.net"],
     49  //   Using prohibited U+FEFF ZERO WIDTH NO-BREAK SPACE
     50  ["look\uFEFFout.net","look%EF%BB%BFout.net"],
     51  //   Using prohibited Non-character code points 1FFFE [NONCHARACTER CODE POINTS]
     52  ["look\uD83F\uDFFEout.net","look%F0%9F%BF%BEout.net"],
     53  //   Using prohibited U+DEAD half surrogate code point
     54  // FIXME: ["look\uDEADout.net","look%ED%BA%ADout.net"],
     55  //   Using prohibited Inappropriate for plain text U+FFFA; INTERLINEAR ANNOTATION SEPARATOR
     56  ["look\uFFFAout.net","look%EF%BF%BAout.net"],
     57  //   Using prohibited Inappropriate for canonical representation 2FF0-2FFB; [IDEOGRAPHIC DESCRIPTION CHARACTERS]
     58  ["look\u2FF0out.net","look%E2%BF%B0out.net"],
     59  //   Using prohibited Change display properties or are deprecated 0341; COMBINING ACUTE TONE MARK
     60  ["look\u0341out.net","look%CD%81out.net"],
     61  //   Using prohibited Change display properties or are deprecated 202E; RIGHT-TO-LEFT OVERRIDE
     62  ["look\u202Eout.net","look%E2%80%AEout.net"],
     63  //   Using prohibited Change display properties or are deprecated 206B; ACTIVATE SYMMETRIC SWAPPING
     64  ["look\u206Bout.net","look%E2%81%ABout.net"],
     65  //   Using prohibited Tagging characters E0001; LANGUAGE TAG
     66  ["look\uDB40\uDC01out.net","look%F3%A0%80%81out.net"],
     67  //   Using prohibited Tagging characters E0020-E007F; [TAGGING CHARACTERS]
     68  ["look\uDB40\uDC20out.net","look%F3%A0%80%A0out.net"],
     69  //   Using prohibited Characters with bidirectional property 05BE
     70  ["look\u05BEout.net","look%D6%BEout.net"]
     71];
     72
     73for (var i = 0; i < cases.length; ++i) {
     74  test_vector = cases[i][0];
     75  expected_result = cases[i][1];
     76  shouldBe("canonicalize('http://" + test_vector + "/')",
     77           "'http://" + expected_result + "/'");
     78}
     79</script>
    980<script src="../js/resources/js-test-post.js"></script>
    1081</body>
  • trunk/LayoutTests/fast/url/idna2008.html

    r97881 r149681  
    1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
     1<!DOCTYPE html>
    22<html>
    33<head>
     
    66</head>
    77<body>
    8 <script src="script-tests/idna2008.js"></script>
     8<script>
     9description("IDNA2008 handling in domain name labels.");
     10
     11debug("The PASS/FAIL results of this test are set to the behavior in IDNA2008.");
     12
     13cases = [
     14  // For IDNA Compatibility test material see
     15  // http://www.unicode.org/reports/tr46/
     16  // http://www.unicode.org/Public/idna/latest/IdnaMappingTable.txt
     17  // We are testing disallowed, ignored, mapped, deviant, and valid cases.
     18  // 1) Deviant character tests (deviant processing behavior from IDNA2003)
     19  ["B\u00FCcher.de","xn--bcher-kva.de"],
     20  // The ß U+00DF LATIN SMALL LETTER SHARP S does NOT normalize to "ss" like it does during IDNA2003's mapping phase
     21  ["fa\u00DF.de","xn--fa-hia.de"],
     22  // The ς U+03C2 GREEK SMALL LETTER FINAL SIGMA using βόλος.com
     23  ["\u03B2\u03CC\u03BB\u03BF\u03C2.com","xn--nxasmm1c.com"],
     24  // The ZWJ U+200D ZERO WIDTH JOINER
     25  ["\u0DC1\u0DCA\u200D\u0DBB\u0DD3.com","xn--10cl1a0b660p.com"],
     26  // The ZWNJ U+200C ZERO WIDTH NON-JOINER
     27  ["\u0646\u0627\u0645\u0647\u200C\u0627\u06CC.com","xn--mgba3gch31f060k.com"],
     28  // 2) Disallowed characters in IDNA2008
     29  // U+2665 BLACK HEART SUIT
     30  ["\u2665.net","\uFFFD.net"],
     31  // U+0378 <reserved>
     32  ["\u0378.net","\uFFFD.net"],
     33  ["\u04C0.com","\uFFFD.com"],
     34  ["\uD87E\uDC68.com","\uFFFD.com"],
     35  ["\u2183.com","\uFFFD.com"],
     36  // 3) Ignored characters should be removed * security risk
     37  // U+034F COMBINING GRAPHEME JOINER
     38  ["look\u034Fout.net","lookout.net"],
     39  // 4) Mapped characters
     40  ["gOoGle.com","google.com"],
     41  ["\u09dc.com","\u09A1\u09BC.com"],
     42  // 1E9E; mapped; 0073 0073
     43  ["\u1E9E.com","ss.com"],
     44  ["\u1E9E.foo.com","ss.foo.com"],
     45  // 5) Validity FAIL cases - these should each cause an error.
     46  ["-foo.bar.com",""],
     47  ["foo-.bar.com",""],
     48  ["ab--cd.com",""],
     49  ["xn--0.com",""],
     50  ["foo\u0300.bar.com","foo%CC%80.bar.com"]
     51];
     52
     53for (var i = 0; i < cases.length; ++i) {
     54  test_vector = cases[i][0];
     55  expected_result = cases[i][1];
     56  shouldBe("canonicalize('http://" + test_vector + "/')",
     57           "'http://" + expected_result + "/'");
     58}
     59</script>
    960<script src="../js/resources/js-test-post.js"></script>
    1061</body>
  • trunk/LayoutTests/fast/url/invalid-urls-utf8.html

    r129445 r149681  
    1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
     1<!DOCTYPE html>
    22<html>
    33<head>
  • trunk/LayoutTests/fast/url/ipv4.html

    r97881 r149681  
    1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
     1<!DOCTYPE html>
    22<html>
    33<head>
     
    66</head>
    77<body>
    8 <script src="script-tests/ipv4.js"></script>
     8<script>
     9description("Canonicalization of IPv4 addresses.");
     10
     11cases = [
     12  [".", ""],
     13
     14  // Regular IP addresses in different bases.
     15  ["192.168.0.1", "192.168.0.1"],
     16  ["0300.0250.00.01", "192.168.0.1"],
     17  ["0xC0.0Xa8.0x0.0x1", "192.168.0.1"],
     18
     19  // Non-IP addresses due to invalid characters.
     20  ["192.168.9.com", ""],
     21
     22  // Invalid characters for the base should be rejected.
     23  ["19a.168.0.1", ""],
     24  ["0308.0250.00.01", ""],
     25  ["0xCG.0xA8.0x0.0x1", ""],
     26
     27  // If there are not enough components, the last one should fill them out.
     28  ["192", "0.0.0.192"],
     29  ["0xC0a80001", "192.168.0.1"],
     30  ["030052000001", "192.168.0.1"],
     31  ["000030052000001", "192.168.0.1"],
     32  ["192.168", "192.0.0.168"],
     33  ["192.0x00A80001", "192.168.0.1"],
     34  ["0xc0.052000001", "192.168.0.1"],
     35  ["192.168.1", "192.168.0.1"],
     36
     37  // Too many components means not an IP address.
     38  ["192.168.0.0.1", ""],
     39
     40  // We allow a single trailing dot.
     41  ["192.168.0.1.", "192.168.0.1"],
     42  ["192.168.0.1. hello", ""],
     43  ["192.168.0.1..", ""],
     44
     45  // Two dots in a row means not an IP address.
     46  ["192.168..1", ""],
     47
     48  // Any numerical overflow should be marked as BROKEN.
     49  ["0x100.0", ""],
     50  ["0x100.0.0", ""],
     51  ["0x100.0.0.0", ""],
     52  ["0.0x100.0.0", ""],
     53  ["0.0.0x100.0", ""],
     54  ["0.0.0.0x100", ""],
     55  ["0.0.0x10000", ""],
     56  ["0.0x1000000", ""],
     57  ["0x100000000", ""],
     58
     59  // Repeat the previous tests, minus 1, to verify boundaries.
     60  ["0xFF.0", "255.0.0.0"],
     61  ["0xFF.0.0", "255.0.0.0"],
     62  ["0xFF.0.0.0", "255.0.0.0"],
     63  ["0.0xFF.0.0", "0.255.0.0"],
     64  ["0.0.0xFF.0", "0.0.255.0"],
     65  ["0.0.0.0xFF", "0.0.0.255"],
     66  ["0.0.0xFFFF", "0.0.255.255"],
     67  ["0.0xFFFFFF", "0.255.255.255"],
     68  ["0xFFFFFFFF", "255.255.255.255"],
     69
     70  // Old trunctations tests.  They're all "BROKEN" now.
     71  ["276.256.0xf1a2.077777", ""],
     72  ["192.168.0.257", ""],
     73  ["192.168.0xa20001", ""],
     74  ["192.015052000001", ""],
     75  ["0X12C0a80001", ""],
     76  ["276.1.2", ""],
     77
     78  // Spaces should be rejected.
     79  ["192.168.0.1 hello", ""],
     80
     81  // Very large numbers.
     82  ["0000000000000300.0x00000000000000fF.00000000000000001", "192.255.0.1"],
     83  ["0000000000000300.0xffffffffFFFFFFFF.3022415481470977", ""],
     84
     85  // A number has no length limit, but long numbers can still overflow.
     86  ["00000000000000000001", "0.0.0.1"],
     87  ["0000000000000000100000000000000001", ""],
     88
     89  // If a long component is non-numeric, it's a hostname, *not* a broken IP.
     90  ["0.0.0.000000000000000000z", ""],
     91  ["0.0.0.100000000000000000z", ""],
     92
     93  // Truncation of all zeros should still result in 0.
     94  ["0.00.0x.0x0", "0.0.0.0"]
     95];
     96
     97for (var i = 0; i < cases.length; ++i) {
     98  test_vector = cases[i][0];
     99  expected_result = cases[i][1];
     100  if (expected_result === "")
     101    expected_result = test_vector.toLowerCase();
     102  shouldBe("canonicalize('http://" + test_vector + "/')",
     103           "'http://" + expected_result + "/'");
     104}
     105</script>
    9106<script src="../js/resources/js-test-post.js"></script>
    10107</body>
  • trunk/LayoutTests/fast/url/ipv6.html

    r97881 r149681  
    1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
     1<!DOCTYPE html>
    22<html>
    33<head>
     
    66</head>
    77<body>
    8 <script src="script-tests/ipv6.js"></script>
     8<script>
     9description("Canonicalization of IPv6 addresses.");
     10
     11cases = [
     12    ["[", ""],
     13    ["[:", ""],
     14    ["]", ""],
     15    [":]", ""],
     16    ["[]", ""],
     17    ["[:]", ""],
     18
     19    // Regular IP address is invalid without bounding '[' and ']'.
     20    ["2001:db8::1", ""],
     21    ["[2001:db8::1", ""],
     22    ["2001:db8::1]", ""],
     23
     24    // Regular IP addresses.
     25    ["[::]", "[::]"],
     26    ["[::1]", "[::1]"],
     27    ["[1::]", "[1::]"],
     28    ["[::192.168.0.1]", "[::c0a8:1]"],
     29    ["[::ffff:192.168.0.1]", "[::ffff:c0a8:1]"],
     30
     31    // Leading zeros should be stripped.
     32    ["[000:01:02:003:004:5:6:007]", "[0:1:2:3:4:5:6:7]"],
     33
     34    // Upper case letters should be lowercased.
     35    ["[A:b:c:DE:fF:0:1:aC]", "[a:b:c:de:ff:0:1:ac]"],
     36
     37    // The same address can be written with different contractions, but should
     38    // get canonicalized to the same thing.
     39    ["[1:0:0:2::3:0]", "[1::2:0:0:3:0]"],
     40    ["[1::2:0:0:3:0]", "[1::2:0:0:3:0]"],
     41
     42    // IPv4 addresses
     43    // Only mapped and compat addresses can have IPv4 syntax embedded.
     44    ["[::eeee:192.168.0.1]", ""],
     45    ["[2001::192.168.0.1]", ""],
     46    ["[1:2:192.168.0.1:5:6]", ""],
     47
     48    // IPv4 with last component missing.
     49    ["[::ffff:192.1.2]", "[::ffff:c001:2]"],
     50
     51    // IPv4 using hex.
     52    // FIXME: Should this format be disallowed?
     53    ["[::ffff:0xC0.0Xa8.0x0.0x1]", "[::ffff:c0a8:1]"],
     54
     55    // There may be zeros surrounding the "::" contraction.
     56    ["[0:0::0:0:8]", "[::8]"],
     57
     58    ["[2001:db8::1]", "[2001:db8::1]"],
     59
     60    // Can only have one "::" contraction in an IPv6 string literal.
     61    ["[2001::db8::1]", ""],
     62
     63    // No more than 2 consecutive ':'s.
     64    ["[2001:db8:::1]", ""],
     65    ["[:::]", ""],
     66
     67    // Non-IP addresses due to invalid characters.
     68    ["[2001::.com]", ""],
     69
     70    // Too many components means not an IP address.  Similarly with too few if using IPv4 compat or mapped addresses.
     71    ["[::192.168.0.0.1]", ""],
     72    ["[::ffff:192.168.0.0.1]", ""],
     73    ["[1:2:3:4:5:6:7:8:9]", ""],
     74
     75    // Too many bits (even though 8 comonents, the last one holds 32 bits).
     76    ["[0:0:0:0:0:0:0:192.168.0.1]", ""],
     77
     78    // Too many bits specified -- the contraction would have to be zero-length
     79    // to not exceed 128 bits.
     80    ["[1:2:3:4:5:6::192.168.0.1]", ""],
     81
     82    // The contraction is for 16 bits of zero. RFC 5952, Section 4.2.2.
     83    ["[1:2:3:4:5:6::8]", "[1:2:3:4:5:6:0:8]"],
     84
     85    // Cannot have a trailing colon.
     86    ["[1:2:3:4:5:6:7:8:]", ""],
     87    ["[1:2:3:4:5:6:192.168.0.1:]", ""],
     88
     89    // Cannot have negative numbers.
     90    ["[-1:2:3:4:5:6:7:8]", ""],
     91
     92    // Scope ID -- the URL may contain an optional ["%" <scope_id>] section.
     93    // The scope_id should be included in the canonicalized URL, and is an
     94    // unsigned decimal number.
     95
     96    // Don't allow scope-id
     97    ["[1::%1]", ""],
     98    ["[1::%eth0]", ""],
     99    ["[1::%]", ""],
     100    ["[%]", ""],
     101    ["[::%:]", ""],
     102
     103    // Don't allow leading or trailing colons.
     104    ["[:0:0::0:0:8]", ""],
     105    ["[0:0::0:0:8:]", ""],
     106    ["[:0:0::0:0:8:]", ""],
     107
     108    // Two dots in a row means not an IP address.
     109    ["[::192.168..1]", ""],
     110
     111    // Spaces should be rejected.
     112    ["[::1 hello]", ""]
     113];
     114
     115for (var i = 0; i < cases.length; ++i) {
     116  test_vector = cases[i][0];
     117  expected_result = cases[i][1];
     118  if (expected_result === "")
     119    expected_result = test_vector;
     120  shouldBe("canonicalize('http://" + test_vector + "/')",
     121           "'http://" + expected_result + "/'");
     122}
     123</script>
    9124<script src="../js/resources/js-test-post.js"></script>
    10125</body>
  • trunk/LayoutTests/fast/url/mailto.html

    r97881 r149681  
    1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
     1<!DOCTYPE html>
    22<html>
    33<head>
     
    66</head>
    77<body>
    8 <script src="script-tests/mailto.js"></script>
     8<script>
     9description("Tests mailto: URL canonicalization");
     10
     11cases = [
     12  ["addr1", "addr1"],
     13  ["addr1@foo.com", "addr1@foo.com"],
     14
     15  // Trailing whitespace is stripped.
     16  ["addr1 \t ", "addr1"],
     17  ["addr1?to=jon", "addr1?to=jon"],
     18  ["addr1,addr2", "addr1,addr2"],
     19  ["addr1, addr2", "addr1, addr2"],
     20  ["addr1%2caddr2", "addr1%2caddr2"],
     21
     22  // U+10300 input as UTF-16 surrogate pair, expected as escaped UTF-8
     23  ["\uD800\uDF00", "%F0%90%8C%80"],
     24  ["addr1?", "addr1?"],
     25
     26  // Null character should be escaped to %00
     27  // Not sure how to test null characters in JavaScript.  They appear to get
     28  // stripped out.
     29  // ["addr1\\0addr2?foo", "addr1%00addr2?foo"],
     30];
     31
     32for (var i = 0; i < cases.length; ++i) {
     33  shouldBe("canonicalize('mailto:" + cases[i][0] + "')",
     34           "'mailto:" + cases[i][1] + "'");
     35}
     36  // Invalid -- UTF-8 encoded surrogate value.
     37shouldBeFalse("canonicalize('mailto:\xed\xa0\x80') == 'mailto:%EF%BF%BD'");
     38</script>
    939<script src="../js/resources/js-test-post.js"></script>
    1040</body>
  • trunk/LayoutTests/fast/url/path-url.html

    r97881 r149681  
    1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
     1<!DOCTYPE html>
    22<html>
    33<head>
     
    66</head>
    77<body>
    8 <script src="script-tests/path-url.js"></script>
     8<script>
     9description("Canonicalization of path URLs");
     10
     11cases = [
     12  ["javascript:", "javascript:"],
     13  ["JavaScript:Foo", "javascript:Foo"],
     14  // Disabled because this gets treated as a relative URL.
     15  // [":\":This /is interesting;?#", ":\":This /is interesting;?#"],
     16];
     17
     18for (var i = 0; i < cases.length; ++i) {
     19  test_vector = cases[i][0];
     20  expected_result = cases[i][1];
     21  shouldBe("canonicalize('" + test_vector + "')",
     22           "'" + expected_result + "'");
     23}
     24</script>
    925<script src="../js/resources/js-test-post.js"></script>
    1026</body>
  • trunk/LayoutTests/fast/url/path.html

    r97881 r149681  
    1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
     1<!DOCTYPE html>
    22<html>
    33<head>
     
    66</head>
    77<body>
    8 <script src="script-tests/path.js"></script>
     8<script>
     9description("Canonicalization of paths.");
     10
     11cases = [
     12  ["/././foo", "/foo"],
     13  ["/./.foo", "/.foo"],
     14  ["/foo/.", "/foo/"],
     15  ["/foo/./", "/foo/"],
     16  // double dots followed by a slash or the end of the string count
     17  ["/foo/bar/..", "/foo/"],
     18  ["/foo/bar/../", "/foo/"],
     19  // don't count double dots when they aren't followed by a slash
     20  ["/foo/..bar", "/foo/..bar"],
     21  // some in the middle
     22  ["/foo/bar/../ton", "/foo/ton"],
     23  ["/foo/bar/../ton/../../a", "/a"],
     24  // we should not be able to go above the root
     25  ["/foo/../../..", "/"],
     26  ["/foo/../../../ton", "/ton"],
     27  // escaped dots should be unescaped and treated the same as dots
     28  ["/foo/%2e", "/foo/"],
     29  ["/foo/%2e%2", "/foo/.%2"],
     30  ["/foo/%2e./%2e%2e/.%2e/%2e.bar", "/..bar"],
     31  // Multiple slashes in a row should be preserved and treated like empty
     32  // directory names.
     33  ["////../..", "//"],
     34  ["/foo/bar//../..", "/foo/"],
     35  ["/foo/bar//..", "/foo/bar/"],
     36  ["/foo/bar/..", "/foo/"],
     37
     38  // ----- escaping tests -----
     39  ["/foo", "/foo"],
     40  // Valid escape sequence
     41  ["/%20foo", "/%20foo"],
     42  // Invalid escape sequence we should pass through unchanged.
     43  ["/foo%", "/foo%"],
     44  ["/foo%2", "/foo%2"],
     45  // Invalid escape sequence: bad characters should be treated the same as
     46  // the sourrounding text, not as escaped (in this case, UTF-8).
     47  ["/foo%2zbar", "/foo%2zbar"],
     48  // (Disabled because requires UTF8)
     49  // ["/foo%2\xc2\xa9zbar", "/foo%2%C2%A9zbar"],
     50  ["/foo%2\u00c2\u00a9zbar", "/foo%2%C3%82%C2%A9zbar"],
     51  // Regular characters that are escaped should be unescaped
     52  ["/foo%41%7a", "/fooAz"],
     53  // Funny characters that are unescaped should be escaped
     54  ["/foo\u0009\u0091%91", "/foo%C2%91%91"],
     55  // Invalid characters that are escaped should cause a failure.
     56  ["/foo%00%51", "/foo%00Q"],
     57  // Some characters should be passed through unchanged regardless of esc.
     58  ["/(%28:%3A%29)", "/(%28:%3A%29)"],
     59  // Characters that are properly escaped should not have the case changed
     60  // of hex letters.
     61  ["/%3A%3a%3C%3c", "/%3A%3a%3C%3c"],
     62  // Funny characters that are unescaped should be escaped
     63  ["/foo\tbar", "/foobar"],
     64  // Backslashes should get converted to forward slashes
     65  ["\\\\foo\\\\bar", "/foo/bar"],
     66  // Hashes found in paths (possibly only when the caller explicitly sets
     67  // the path on an already-parsed URL) should be escaped.
     68  // (Disabled because requires ability to set path directly.)
     69  // ["/foo#bar", "/foo%23bar"],
     70  // %7f should be allowed and %3D should not be unescaped (these were wrong
     71  // in a previous version).
     72  ["/%7Ffp3%3Eju%3Dduvgw%3Dd", "/%7Ffp3%3Eju%3Dduvgw%3Dd"],
     73  // @ should be passed through unchanged (escaped or unescaped).
     74  ["/@asdf%40", "/@asdf%40"],
     75
     76  // ----- encoding tests -----
     77  // Basic conversions
     78  ["/\u4f60\u597d\u4f60\u597d", "/%E4%BD%A0%E5%A5%BD%E4%BD%A0%E5%A5%BD"],
     79  // Invalid unicode characters should fail. We only do validation on
     80  // UTF-16 input, so this doesn't happen on 8-bit.
     81  ["/\ufdd0zyx", "/%EF%BF%BDzyx"],
     82  // U+2025 TWO DOT LEADER should not be normalized to .. in the path
     83  ["/\u2025/foo", "/%E2%80%A5/foo"],
     84  // A half-surrogate is an error by itself U+DEAD
     85  // FIXME: ["/\uDEAD/foo", "/\uFFFD/foo"],
     86  // BOM code point with special meaning U+FEFF ZERO WIDTH NO-BREAK SPACE
     87  ["/\uFEFF/foo", "/%EF%BB%BF/foo"],
     88  // The BIDI override code points RLO and LRO
     89  ["/\u202E/foo/\u202D/bar", "/%E2%80%AE/foo/%E2%80%AD/bar"],
     90  // U+FF0F FULLWIDTH SOLIDUS should normalize to / in a hostname
     91  ["\uFF0Ffoo/", "%2Ffoo/"],
     92
     93];
     94
     95for (var i = 0; i < cases.length; ++i) {
     96  test_vector = cases[i][0];
     97  expected_result = cases[i][1];
     98  shouldBe("canonicalize('http://example.com" + test_vector + "')",
     99           "'http://example.com" + expected_result + "'");
     100}
     101</script>
    9102<script src="../js/resources/js-test-post.js"></script>
    10103</body>
  • trunk/LayoutTests/fast/url/port.html

    r97881 r149681  
    1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
     1<!DOCTYPE html>
    22<html>
    33<head>
     
    66</head>
    77<body>
    8 <script src="script-tests/port.js"></script>
     8<script>
     9description("Test URLs that have a port number.");
     10
     11cases = [
     12  // Invalid input should be copied w/ failure.
     13  ["as df", ":as%20df"],
     14  ["-2", ":-2"],
     15  // Default port should be omitted.
     16  ["80", ""],
     17  ["8080", ":8080"],
     18  // Empty ports (just a colon) should also be removed
     19  ["", ""],
     20  // Code point with a numeric value U+1369 ETHIOPIC DIGIT ONE
     21  ["\u1369", ":%E1%8D%A9"],
     22  // Code point with a numerical mapping and value U+1D7D6 MATHEMATICAL BOLD DIGIT EIGHT
     23  ["\uD835\uDFD6", ":%F0%9D%9F%96"],
     24];
     25
     26for (var i = 0; i < cases.length; ++i) {
     27  shouldBe("canonicalize('http://www.example.com:" + cases[i][0] + "/')",
     28           "'http://www.example.com" + cases[i][1] + "/'");
     29}
     30
     31// Unspecified port should mean always keep the port.
     32shouldBe("canonicalize('foobar://www.example.com:80/')",
     33         "'foobar://www.example.com:80/'");
     34</script>
    935<script src="../js/resources/js-test-post.js"></script>
    1036</body>
  • trunk/LayoutTests/fast/url/query.html

    r97881 r149681  
    1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
     1<!DOCTYPE html>
    22<html>
    33<head>
     
    66</head>
    77<body>
    8 <script src="script-tests/query.js"></script>
     8<script>
     9description("Test URLs that have a query string.");
     10
     11cases = [
     12  // Regular ASCII case in some different encodings.
     13  ["foo=bar", "foo=bar"],
     14  // Allow question marks in the query without escaping
     15  ["as?df", "as?df"],
     16  // Always escape '#' since it would mark the ref.
     17  // Disabled because this test requires being able to set the query directly.
     18  // ["as#df", "as%23df"],
     19  // Escape some questionable 8-bit characters, but never unescape.
     20  ["\\x02hello\x7f bye", "%02hello%7F%20bye"],
     21  ["%40%41123", "%40%41123"],
     22  // Chinese input/output
     23  ["q=\u4F60\u597D", "q=%26%2320320%3B%26%2322909%3B"],
     24  // Invalid UTF-8/16 input should be replaced with invalid characters.
     25  ["q=\\ud800\\ud800", "q=%26%2355296%3B%26%2355296%3B"],
     26  // Don't allow < or > because sometimes they are used for XSS if the
     27  // URL is echoed in content. Firefox does this, IE doesn't.
     28  ["q=<asdf>", "q=%3Casdf%3E"],
     29  // Escape double quotemarks in the query.
     30  ["q=\"asdf\"", "q=%22asdf%22"],
     31];
     32
     33for (var i = 0; i < cases.length; ++i) {
     34  shouldBe("canonicalize('http://www.example.com/?" + cases[i][0] + "')",
     35           "'http://www.example.com/?" + cases[i][1] + "'");
     36}
     37</script>
    938<script src="../js/resources/js-test-post.js"></script>
    1039</body>
  • trunk/LayoutTests/fast/url/relative-unix.html

    r97881 r149681  
    1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
     1<!DOCTYPE html>
    22<html>
    33<head>
     
    66</head>
    77<body>
    8 <script src="script-tests/relative-unix.js"></script>
     8<script>
     9description("Test resolution of relative UNIX-like URLs.");
     10
     11cases = [
     12  // Format: [baseURL, relativeURL, expectedURL],
     13  // On Unix we fall back to relative behavior since there's nothing else
     14  // reasonable to do.
     15  ["http://host/a", "\\\\\\\\Another\\\\path", "http://another/path"],
     16
     17  // Even on Windows, we don't allow relative drive specs when the base
     18  // is not file.
     19  ["http://host/a", "/c:\\\\foo", "http://host/c:/foo"],
     20  ["http://host/a", "//c:\\\\foo", "http://c/foo"],
     21];
     22
     23var originalBaseURL = canonicalize(".");
     24
     25for (var i = 0; i < cases.length; ++i) {
     26  baseURL = cases[i][0];
     27  relativeURL = cases[i][1];
     28  expectedURL = cases[i][2];
     29  setBaseURL(baseURL);
     30  shouldBe("canonicalize('" + relativeURL + "')",
     31           "'" + expectedURL + "'");
     32}
     33
     34setBaseURL(originalBaseURL);
     35</script>
    936<script src="../js/resources/js-test-post.js"></script>
    1037</body>
  • trunk/LayoutTests/fast/url/relative-win.html

    r97881 r149681  
    1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
     1<!DOCTYPE html>
    22<html>
    33<head>
     
    66</head>
    77<body>
    8 <script src="script-tests/relative-win.js"></script>
     8<script>
     9description("Test resolution of relative Windows-like URLs.");
     10
     11cases = [
     12  // Format: [baseURL, relativeURL, expectedURL],
     13  // Resolving against Windows file base URLs.
     14  ["file:///C:/foo", "http://host/", "http://host/"],
     15  ["file:///C:/foo", "bar", "file:///C:/bar"],
     16  ["file:///C:/foo", "../../../bar.html", "file:///C:/bar.html"],
     17  ["file:///C:/foo", "/../bar.html", "file:///C:/bar.html"],
     18  // But two backslashes on Windows should be UNC so should be treated
     19  // as absolute.
     20  ["http://host/a", "\\\\\\\\another\\\\path", ""],
     21  // IE doesn't support drive specs starting with two slashes. It fails
     22  // immediately and doesn't even try to load. We fix it up to either
     23  // an absolute path or UNC depending on what it looks like.
     24  ["file:///C:/something", "//c:/foo", "file:///C:/foo"],
     25  ["file:///C:/something", "//localhost/c:/foo", "file:///C:/foo"],
     26  // Windows drive specs should be allowed and treated as absolute.
     27  ["file:///C:/foo", "c:", ""],
     28  ["file:///C:/foo", "c:/foo", ""],
     29  ["http://host/a", "c:\\\\foo", ""],
     30  // Relative paths with drive letters should be allowed when the base is
     31  // also a file.
     32  ["file:///C:/foo", "/z:/bar", "file:///Z:/bar"],
     33  // Treat absolute paths as being off of the drive.
     34  ["file:///C:/foo", "/bar", "file:///C:/bar"],
     35  ["file://localhost/C:/foo", "/bar", "file://localhost/C:/bar"],
     36  ["file:///C:/foo/com/", "/bar", "file:///C:/bar"],
     37  // On Windows, two slashes without a drive letter when the base is a file
     38  // means that the path is UNC.
     39  ["file:///C:/something", "//somehost/path", "file://somehost/path"],
     40  ["file:///C:/something", "/\\\\//somehost/path", "file://somehost/path"],
     41];
     42
     43var originalBaseURL = canonicalize(".");
     44
     45for (var i = 0; i < cases.length; ++i) {
     46  baseURL = cases[i][0];
     47  relativeURL = cases[i][1];
     48  expectedURL = cases[i][2];
     49  setBaseURL(baseURL);
     50  shouldBe("canonicalize('" + relativeURL + "')",
     51           "'" + expectedURL + "'");
     52}
     53
     54setBaseURL(originalBaseURL);
     55</script>
    956<script src="../js/resources/js-test-post.js"></script>
    1057</body>
  • trunk/LayoutTests/fast/url/relative.html

    r97881 r149681  
    1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
     1<!DOCTYPE html>
    22<html>
    33<head>
     
    66</head>
    77<body>
    8 <script src="script-tests/relative.js"></script>
     8<script>
     9description("Test resolution of relative URLs.");
     10
     11cases = [
     12  // Format: [baseURL, relativeURL, expectedURL],
     13  // Basic absolute input.
     14  ["http://host/a", "http://another/", "http://another/"],
     15  ["http://host/a", "http:////another/", "http://another/"],
     16  // Empty relative URLs should only remove the ref part of the URL,
     17  // leaving the rest unchanged.
     18  ["http://foo/bar", "", "http://foo/bar"],
     19  ["http://foo/bar#ref", "", "http://foo/bar"],
     20  ["http://foo/bar#", "", "http://foo/bar"],
     21  // Spaces at the ends of the relative path should be ignored.
     22  ["http://foo/bar", "  another  ", "http://foo/another"],
     23  ["http://foo/bar", "  .  ", "http://foo/"],
     24  ["http://foo/bar", " \t ", "http://foo/bar"],
     25  // Matching schemes without two slashes are treated as relative.
     26  ["http://host/a", "http:path", "http://host/path"],
     27  ["http://host/a/", "http:path", "http://host/a/path"],
     28  ["http://host/a", "http:/path", "http://host/path"],
     29  ["http://host/a", "HTTP:/path", "http://host/path"],
     30  // Nonmatching schemes are absolute.
     31  ["http://host/a", "https:host2", "https://host2/"],
     32  ["http://host/a", "htto:/host2", "htto:/host2"],
     33  // Absolute path input
     34  ["http://host/a", "/b/c/d", "http://host/b/c/d"],
     35  ["http://host/a", "\\\\b\\\\c\\\\d", "http://host/b/c/d"],
     36  ["http://host/a", "/b/../c", "http://host/c"],
     37  ["http://host/a?b#c", "/b/../c", "http://host/c"],
     38  ["http://host/a", "\\\\b/../c?x#y", "http://host/c?x#y"],
     39  ["http://host/a?b#c", "/b/../c?x#y", "http://host/c?x#y"],
     40  // Relative path input
     41  ["http://host/a", "b", "http://host/b"],
     42  ["http://host/a", "bc/de", "http://host/bc/de"],
     43  ["http://host/a/", "bc/de?query#ref", "http://host/a/bc/de?query#ref"],
     44  ["http://host/a/", ".", "http://host/a/"],
     45  ["http://host/a/", "..", "http://host/"],
     46  ["http://host/a/", "./..", "http://host/"],
     47  ["http://host/a/", "../.", "http://host/"],
     48  ["http://host/a/", "././.", "http://host/a/"],
     49  ["http://host/a?query#ref", "../../../foo", "http://host/foo"],
     50  // Query input
     51  ["http://host/a", "?foo=bar", "http://host/a?foo=bar"],
     52  ["http://host/a?x=y#z", "?", "http://host/a?"],
     53  ["http://host/a?x=y#z", "?foo=bar#com", "http://host/a?foo=bar#com"],
     54  // Ref input
     55  ["http://host/a", "#ref", "http://host/a#ref"],
     56  ["http://host/a#b", "#", "http://host/a#"],
     57  ["http://host/a?foo=bar#hello", "#bye", "http://host/a?foo=bar#bye"],
     58  // Non-hierarchical base: no relative handling. Relative input should
     59  // error, and if a scheme is present, it should be treated as absolute.
     60  ["data:foobar", "baz.html", ""],
     61  ["data:foobar", "data:baz", "data:baz"],
     62  ["data:foobar", "data:/base", "data:/base"],
     63  // Non-hierarchical base: absolute input should succeed.
     64  ["data:foobar", "http://host/", "http://host/"],
     65  ["data:foobar", "http:host", "http://host/"],
     66  // Invalid schemes should be treated as relative.
     67  ["http://foo/bar", "./asd:fgh", "http://foo/asd:fgh"],
     68  ["http://foo/bar", ":foo", "http://foo/:foo"],
     69  ["http://foo/bar", " hello world", "http://foo/hello%20world"],
     70  ["data:asdf", ":foo", ""],
     71  // We should treat semicolons like any other character in URL resolving
     72  ["http://host/a", ";foo", "http://host/;foo"],
     73  ["http://host/a;", ";foo", "http://host/;foo"],
     74  ["http://host/a", ";/../bar", "http://host/bar"],
     75  // Relative URLs can also be written as "//foo/bar" which is relative to
     76  // the scheme. In this case, it would take the old scheme, so for http
     77  // the example would resolve to "http://foo/bar".
     78  ["http://host/a", "//another", "http://another/"],
     79  ["http://host/a", "//another/path?query#ref", "http://another/path?query#ref"],
     80  ["http://host/a", "///another/path", "http://another/path"],
     81  ["http://host/a", "//Another\\\\path", "http://another/path"],
     82  ["http://host/a", "//", "http:"],
     83  // IE will also allow one or the other to be a backslash to get the same
     84  // behavior.
     85  ["http://host/a", "\\\\/another/path", "http://another/path"],
     86  ["http://host/a", "/\\\\Another\\\\path", "http://another/path"],
     87];
     88
     89var originalBaseURL = canonicalize(".");
     90
     91for (var i = 0; i < cases.length; ++i) {
     92  baseURL = cases[i][0];
     93  relativeURL = cases[i][1];
     94  expectedURL = cases[i][2];
     95  setBaseURL(baseURL);
     96  shouldBe("canonicalize('" + relativeURL + "')",
     97           "'" + expectedURL + "'");
     98}
     99
     100setBaseURL(originalBaseURL);
     101</script>
    9102<script src="../js/resources/js-test-post.js"></script>
    10103</body>
  • trunk/LayoutTests/fast/url/safari-extension.html

    r104414 r149681  
    1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
     1<!DOCTYPE html>
    22<html>
    33<head>
  • trunk/LayoutTests/fast/url/scheme.html

    r97881 r149681  
    1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
     1<!DOCTYPE html>
    22<html>
    33<head>
     
    66</head>
    77<body>
    8 <script src="script-tests/scheme.js"></script>
     8<script>
     9description("Canonicalization of URL schemes.");
     10
     11cases = [
     12  ["http", "http"],
     13  ["HTTP", "http"],
     14  // These tests trigger the relative URL resolving behavior of
     15  // HTMLAnchorElement.href.  In order to test absolute URL parsing, we'd need
     16  // an API that always maps to absolute URLs.  If you know of one, please
     17  // enable these tests!
     18  // [" HTTP ", "%20http%20"],
     19  // ["htt: ", "htt%3A%20"],
     20  // ["\xe4\xbd\xa0\xe5\xa5\xbdhttp", "%E4%BD%A0%E5%A5%BDhttp"],
     21  // ["ht%3Atp", "ht%3atp"],
     22];
     23
     24for (var i = 0; i < cases.length; ++i) {
     25  test_vector = cases[i][0];
     26  expected_result = cases[i][1];
     27  shouldBe("canonicalize('" + test_vector + "://example.com/')",
     28           "'" + expected_result + "://example.com/'");
     29}
     30</script>
    931<script src="../js/resources/js-test-post.js"></script>
    1032</body>
  • trunk/LayoutTests/fast/url/segments-from-data-url.html

    r97881 r149681  
    1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
     1<!DOCTYPE html>
    22<html>
    33<head>
     
    66</head>
    77<body>
    8 <script src="script-tests/segments-from-data-url.js"></script>
     8<script>
     9description("Test URL segmentation");
     10
     11cases = [
     12  // [URL, [SCHEME, HOST, PORT, PATH, QUERY, REF]]
     13  ["http://user:pass@foo:21/bar;par?b#c",    ["http:","foo","21","/bar;par","?b","#c"]],
     14  ["http:foo.com",                           ["http:","foo.com","","/","",""]],
     15  ["\\t   :foo.com   \\n",                   [":","","","","",""]],
     16  [" foo.com  ",                             [":","","","","",""]],
     17  ["a:\\t foo.com",                          ["a:","",""," foo.com","",""]],
     18  ["http://f:21/ b ? d # e ",                ["http:","f","21","/%20b%20","?%20d%20","# e"]],
     19  ["http://f:/c",                            ["http:","f","","/c","",""]],
     20  ["http://f:0/c",                           ["http:","f","0","/c","",""]],
     21  ["http://f:00000000000000/c",              ["http:","f","0","/c","",""]],
     22  ["http://f:00000000000000000000080/c",     ["http:","f","0","/c","",""]],
     23  ["http://f:b/c",                           [":","","","","",""]],
     24  ["http://f: /c",                           [":","","","","",""]],
     25  ["http://f:\\n/c",                         [":","","","","",""]],
     26  ["http://f:fifty-two/c",                   [":","","","","",""]],
     27  ["http://f:999999/c",                      [":","","0","","",""]],
     28  ["http://f: 21 / b ? d # e ",              [":","","","","",""]],
     29  ["",                                       ["data:","","","text/plain,baseURL","",""]],
     30  ["  \\t",                                  ["data:","","","text/plain,baseURL","",""]],
     31  [":foo.com/",                              [":","","","","",""]],
     32  [":foo.com\\\\",                           [":","","","","",""]],
     33  [":",                                      [":","","","","",""]],
     34  [":a",                                     [":","","","","",""]],
     35  [":/",                                     [":","","","","",""]],
     36  [":\\\\",                                  [":","","","","",""]],
     37  [":#",                                     [":","","","","",""]],
     38  ["#",                                      [":","","","","",""]],
     39  ["#/",                                     [":","","","","",""]],
     40  ["#\\\\",                                  [":","","","","",""]],
     41  ["#;?",                                    [":","","","","",""]],
     42  ["?",                                      [":","","","","",""]],
     43  ["/",                                      [":","","","","",""]],
     44  [":23",                                    [":","","","","",""]],
     45  ["/:23",                                   ["data:","","","/:23","",""]],
     46  ["//",                                     [":","","","","",""]],
     47  ["::",                                     [":","","","","",""]],
     48  ["::23",                                   [":","","","","",""]],
     49  ["foo://",                                 ["foo:","","","//","",""]],
     50  ["http://a:b@c:29/d",                      ["http:","c","29","/d","",""]],
     51  ["http::@c:29",                            ["http:","c","29","/","",""]],
     52  ["http://&a:foo(b]c@d:2/",                 ["http:","d","2","/","",""]],
     53  ["http://::@c@d:2",                        ["http:","d","2","/","",""]],
     54  ["http://foo.com:b@d/",                    ["http:","d","","/","",""]],
     55  ["http://foo.com/\\\\@",                   ["http:","foo.com","","//@","",""]],
     56  ["http:\\\\\\\\foo.com\\\\",               ["http:","foo.com","","/","",""]],
     57  ["http:\\\\\\\\a\\\\b:c\\\\d@foo.com\\\\", ["http:","a","","/b:c/d@foo.com/","",""]],
     58  ["foo:/",                                  ["foo:","","","/","",""]],
     59  ["foo:/bar.com/",                          ["foo:","","","/bar.com/","",""]],
     60  ["foo://///////",                          ["foo:","","","/////////","",""]],
     61  ["foo://///////bar.com/",                  ["foo:","","","/////////bar.com/","",""]],
     62  ["foo:////://///",                         ["foo:","","","////://///","",""]],
     63  ["c:/foo",                                 ["c:","","","/foo","",""]],
     64  ["//foo/bar",                              [":","","","","",""]],
     65  ["http://foo/path;a??e#f#g",               ["http:","foo","","/path;a","??e","#f#g"]],
     66  ["http://foo/abcd?efgh?ijkl",              ["http:","foo","","/abcd","?efgh?ijkl",""]],
     67  ["http://foo/abcd#foo?bar",                ["http:","foo","","/abcd","","#foo?bar"]],
     68  ["[61:24:74]:98",                          ["data:","","","text/[61:24:74]:98","",""]],
     69  ["http://[61:27]:98",                      [":","","0","","",""]],
     70  ["http:[61:27]/:foo",                      [":","","","","",""]],
     71  ["http://[1::2]:3:4",                      [":","","","","",""]],
     72  ["http://2001::1",                         [":","","","","",""]],
     73  ["http://[2001::1",                        [":","","","","",""]],
     74  ["http://2001::1]",                        [":","","","","",""]],
     75  ["http://2001::1]:80",                     [":","","","","",""]],
     76  ["http://[2001::1]",                       ["http:","[2001::1]","","/","",""]],
     77  ["http://[2001::1]:80",                    ["http:","[2001::1]","","/","",""]],
     78  ["http://[[::]]",                          [":","","","","",""]],
     79];
     80
     81var originalBaseURL = canonicalize(".");
     82setBaseURL("data:text/plain,baseURL");
     83
     84for (var i = 0; i < cases.length; ++i) {
     85  shouldBe("segments('" + cases[i][0] + "')",
     86           "'" + JSON.stringify(cases[i][1]) + "'");
     87}
     88
     89setBaseURL(originalBaseURL);
     90</script>
    991<script src="../js/resources/js-test-post.js"></script>
    1092</body>
  • trunk/LayoutTests/fast/url/segments.html

    r97881 r149681  
    77</head>
    88<body>
    9 <script src="script-tests/segments.js"></script>
     9<script>
     10description("Test URL segmentation");
     11
     12cases = [
     13  // [URL, [SCHEME, HOST, PORT, PATH, QUERY, REF]]
     14  ["http://user:pass@foo:21/bar;par?b#c",    ["http:","foo","21","/bar;par","?b","#c"]],
     15  ["http:foo.com",                           ["http:","example.org","","/foo/foo.com","",""]],
     16  ["\\t   :foo.com   \\n",                   ["http:","example.org","","/foo/:foo.com","",""]],
     17  [" foo.com  ",                             ["http:","example.org","","/foo/foo.com","",""]],
     18  ["a:\\t foo.com",                          ["a:","",""," foo.com","",""]],
     19  ["http://f:21/ b ? d # e ",                ["http:","f","21","/%20b%20","?%20d%20","# e"]],
     20  ["http://f:/c",                            ["http:","f","","/c","",""]],
     21  ["http://f:0/c",                           ["http:","f","0","/c","",""]],
     22  ["http://f:00000000000000/c",              ["http:","f","0","/c","",""]],
     23  ["http://f:00000000000000000000080/c",     ["http:","f","0","/c","",""]],
     24  ["http://f:b/c",                           [":","","","","",""]],
     25  ["http://f: /c",                           [":","","","","",""]],
     26  ["http://f:\\n/c",                         [":","","","","",""]],
     27  ["http://f:fifty-two/c",                   [":","","","","",""]],
     28  ["http://f:999999/c",                      [":","","0","","",""]],
     29  ["http://f: 21 / b ? d # e ",              [":","","","","",""]],
     30  ["",                                       ["http:","example.org","","/foo/bar","",""]],
     31  ["  \\t",                                  ["http:","example.org","","/foo/bar","",""]],
     32  [":foo.com/",                              ["http:","example.org","","/foo/:foo.com/","",""]],
     33  [":foo.com\\\\",                           ["http:","example.org","","/foo/:foo.com/","",""]],
     34  [":",                                      ["http:","example.org","","/foo/:","",""]],
     35  [":a",                                     ["http:","example.org","","/foo/:a","",""]],
     36  [":/",                                     ["http:","example.org","","/foo/:/","",""]],
     37  [":\\\\",                                  ["http:","example.org","","/foo/:/","",""]],
     38  [":#",                                     ["http:","example.org","","/foo/:","",""]],
     39  ["#",                                      ["http:","example.org","","/foo/bar","",""]],
     40  ["#/",                                     ["http:","example.org","","/foo/bar","","#/"]],
     41  ["#\\\\",                                  ["http:","example.org","","/foo/bar","","#\\\\"]],
     42  ["#;?",                                    ["http:","example.org","","/foo/bar","","#;?"]],
     43  ["?",                                      ["http:","example.org","","/foo/bar","",""]],
     44  ["/",                                      ["http:","example.org","","/","",""]],
     45  [":23",                                    ["http:","example.org","","/foo/:23","",""]],
     46  ["/:23",                                   ["http:","example.org","","/:23","",""]],
     47  ["//",                                     [":","","","","",""]],
     48  ["::",                                     ["http:","example.org","","/foo/::","",""]],
     49  ["::23",                                   ["http:","example.org","","/foo/::23","",""]],
     50  ["foo://",                                 ["foo:","","","//","",""]],
     51  ["http://a:b@c:29/d",                      ["http:","c","29","/d","",""]],
     52  ["http::@c:29",                            ["http:","example.org","","/foo/:@c:29","",""]],
     53  ["http://&a:foo(b]c@d:2/",                 ["http:","d","2","/","",""]],
     54  ["http://::@c@d:2",                        ["http:","d","2","/","",""]],
     55  ["http://foo.com:b@d/",                    ["http:","d","","/","",""]],
     56  ["http://foo.com/\\\\@",                   ["http:","foo.com","","//@","",""]],
     57  ["http:\\\\\\\\foo.com\\\\",               ["http:","foo.com","","/","",""]],
     58  ["http:\\\\\\\\a\\\\b:c\\\\d@foo.com\\\\", ["http:","a","","/b:c/d@foo.com/","",""]],
     59  ["foo:/",                                  ["foo:","","","/","",""]],
     60  ["foo:/bar.com/",                          ["foo:","","","/bar.com/","",""]],
     61  ["foo://///////",                          ["foo:","","","/////////","",""]],
     62  ["foo://///////bar.com/",                  ["foo:","","","/////////bar.com/","",""]],
     63  ["foo:////://///",                         ["foo:","","","////://///","",""]],
     64  ["c:/foo",                                 ["c:","","","/foo","",""]],
     65  ["//foo/bar",                              ["http:","foo","","/bar","",""]],
     66  ["http://foo/path;a??e#f#g",               ["http:","foo","","/path;a","??e","#f#g"]],
     67  ["http://foo/abcd?efgh?ijkl",              ["http:","foo","","/abcd","?efgh?ijkl",""]],
     68  ["http://foo/abcd#foo?bar",                ["http:","foo","","/abcd","","#foo?bar"]],
     69  ["[61:24:74]:98",                          ["http:","example.org","","/foo/[61:24:74]:98","",""]],
     70  ["http://[61:27]:98",                      [":","","0","","",""]],
     71  ["http:[61:27]/:foo",                      ["http:","example.org","","/foo/[61:27]/:foo","",""]],
     72  ["http://[1::2]:3:4",                      [":","","","","",""]],
     73  ["http://2001::1",                         [":","","","","",""]],
     74  ["http://[2001::1",                        [":","","","","",""]],
     75  ["http://2001::1]",                        [":","","","","",""]],
     76  ["http://2001::1]:80",                     [":","","","","",""]],
     77  ["http://[2001::1]",                       ["http:","[2001::1]","","/","",""]],
     78  ["http://[2001::1]:80",                    ["http:","[2001::1]","","/","",""]],
     79  ["http://[[::]]",                          [":","","","","",""]],
     80  ["http:/example.com/",                     ["http:","example.org","","/example.com/","",""]],
     81  ["ftp:/example.com/",                      ["ftp:","example.com","","/","",""]],
     82  ["https:/example.com/",                    ["https:","example.com","","/","",""]],
     83  ["madeupscheme:/example.com/",             ["madeupscheme:","","","/example.com/","",""]],
     84  ["file:/example.com/",                     ["file:","","","/example.com/","",""]],
     85  ["ftps:/example.com/",                     ["ftps:","","","/example.com/","",""]],
     86  ["gopher:/example.com/",                   ["gopher:","example.com","","/","",""]],
     87  ["ws:/example.com/",                       ["ws:","example.com","","/","",""]],
     88  ["wss:/example.com/",                      ["wss:","example.com","","/","",""]],
     89  ["data:/example.com/",                     ["data:","","","/example.com/","",""]],
     90  ["javascript:/example.com/",               ["javascript:","","","/example.com/","",""]],
     91  ["mailto:/example.com/",                   ["mailto:","","","/example.com/","",""]],
     92  ["http:example.com/",                      ["http:","example.org","","/foo/example.com/","",""]],
     93  ["ftp:example.com/",                       ["ftp:","example.com","","/","",""]],
     94  ["https:example.com/",                     ["https:","example.com","","/","",""]],
     95  ["madeupscheme:example.com/",              ["madeupscheme:","","","example.com/","",""]],
     96  ["file:example.com/",                      ["file:","","","/example.com/","",""]],
     97  ["ftps:example.com/",                      ["ftps:","","","example.com/","",""]],
     98  ["gopher:example.com/",                    ["gopher:","example.com","","/","",""]],
     99  ["ws:example.com/",                        ["ws:","example.com","","/","",""]],
     100  ["wss:example.com/",                       ["wss:","example.com","","/","",""]],
     101  ["data:example.com/",                      ["data:","","","example.com/","",""]],
     102  ["javascript:example.com/",                ["javascript:","","","example.com/","",""]],
     103  ["mailto:example.com/",                    ["mailto:","","","example.com/","",""]],
     104
     105  ["/a/b/c",                                  ["http:","example.org","","/a/b/c","",""]],
     106  ["/a/ /c",                                  ["http:","example.org","","/a/%20/c","",""]],
     107  ["/a%2fc",                                  ["http:","example.org","","/a%2fc","",""]],
     108  ["/a/%2f/c",                                ["http:","example.org","","/a/%2f/c","",""]],
     109
     110  ["#\u03B2",                                 ["http:","example.org","","/foo/bar","","#\u03B2"]],
     111];
     112
     113var originalBaseURL = canonicalize(".");
     114setBaseURL("http://example.org/foo/bar");
     115
     116for (var i = 0; i < cases.length; ++i) {
     117  shouldBe("segments('" + cases[i][0] + "')",
     118           "'" + JSON.stringify(cases[i][1]) + "'");
     119}
     120
     121setBaseURL(originalBaseURL);
     122</script>
    10123<script src="../js/resources/js-test-post.js"></script>
    11124</body>
  • trunk/LayoutTests/fast/url/standard-url.html

    r97881 r149681  
    1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
     1<!DOCTYPE html>
    22<html>
    33<head>
     
    66</head>
    77<body>
    8 <script src="script-tests/standard-url.js"></script>
     8<script>
     9description("Canonicalization of standard URLs");
     10
     11cases = [
     12  ["http://www.google.com/foo?bar=baz#", "http://www.google.com/foo?bar=baz#"],
     13  ["http://www.google.com/foo?bar=baz# \u00bb", "http://www.google.com/foo?bar=baz# \u00bb"],
     14  ["http://[www.google.com]/", "http://[www.google.com]/"],
     15  ["http://www.google.com", "http://www.google.com/"],
     16  // Disabled because whitespace gets treated different in this API.
     17  // ["ht\ttp:@www.google.com:80/;p?#", "ht%09tp://www.google.com:80/;p?#"],
     18  ["http:////////user:@google.com:99?foo", "http://user@google.com:99/?foo"],
     19  // Disabled because this gets treated as a relative URL.
     20  // ["www.google.com", ":www.google.com/"],
     21  ["http://192.0x00A80001", "http://192.168.0.1/"],
     22  ["http://www/foo%2Ehtml", "http://www/foo.html"],
     23  ["http://user:pass@/", "http://user:pass@/"],
     24  ["http://%25DOMAIN:foobar@foodomain.com/", "http://%25DOMAIN:foobar@foodomain.com/"],
     25  // Backslashes should get converted to forward slashes.
     26  ["http:\\\\\\\\www.google.com\\\\foo", "http://www.google.com/foo"],
     27  // Busted refs shouldn't make the whole thing fail.
     28  ["http://www.google.com/asdf#\\ud800", "http://www.google.com/asdf#\\uFFFD"],
     29  // Basic port tests.
     30  ["http://foo:80/", "http://foo/"],
     31  ["http://foo:81/", "http://foo:81/"],
     32  ["httpa://foo:80/", "httpa://foo:80/"],
     33  ["http://foo:-80/", "http://foo:-80/"],
     34  ["https://foo:443/", "https://foo/"],
     35  ["https://foo:80/", "https://foo:80/"],
     36  ["ftp://foo:21/", "ftp://foo/"],
     37  ["ftp://foo:80/", "ftp://foo:80/"],
     38  ["gopher://foo:70/", "gopher://foo/"],
     39  ["gopher://foo:443/", "gopher://foo:443/"],
     40  ["ws://foo:80/", "ws://foo/"],
     41  ["ws://foo:81/", "ws://foo:81/"],
     42  ["ws://foo:443/", "ws://foo:443/"],
     43  ["ws://foo:815/", "ws://foo:815/"],
     44  ["wss://foo:80/", "wss://foo:80/"],
     45  ["wss://foo:81/", "wss://foo:81/"],
     46  ["wss://foo:443/", "wss://foo/"],
     47  ["wss://foo:815/", "wss://foo:815/"],
     48  ["http:/example.com/", "http://example.com/"],
     49  ["ftp:/example.com/", "ftp://example.com/"],
     50  ["https:/example.com/", "https://example.com/"],
     51  ["madeupscheme:/example.com/", "madeupscheme:/example.com/"],
     52  ["file:/example.com/", "file://localhost/example.com/"],
     53  ["ftps:/example.com/", "ftps:/example.com/"],
     54  ["gopher:/example.com/", "gopher://example.com/"],
     55  ["ws:/example.com/", "ws://example.com/"],
     56  ["wss:/example.com/", "wss://example.com/"],
     57  ["data:/example.com/", "data:/example.com/"],
     58  ["javascript:/example.com/", "javascript:/example.com/"],
     59  ["mailto:/example.com/", "mailto:/example.com/"],
     60  ["http:example.com/", "http://example.com/"],
     61  ["ftp:example.com/", "ftp://example.com/"],
     62  ["https:example.com/", "https://example.com/"],
     63  ["madeupscheme:example.com/", "madeupscheme:example.com/"],
     64  ["ftps:example.com/", "ftps:example.com/"],
     65  ["gopher:example.com/", "gopher://example.com/"],
     66  ["ws:example.com/", "ws://example.com/"],
     67  ["wss:example.com/", "wss://example.com/"],
     68  ["data:example.com/", "data:example.com/"],
     69  ["javascript:example.com/", "javascript:example.com/"],
     70  ["mailto:example.com/", "mailto:example.com/"],
     71  // Escaping of non hierarchical URLs
     72  ["javascript:alert(\\t 1 \\n\\r)", "javascript:alert( 1 )"],
     73  ['javascript:alert(" \1 \u03B2 ")', 'javascript:alert(" %01 %CE%B2 ")'],
     74];
     75
     76for (var i = 0; i < cases.length; ++i) {
     77  test_vector = cases[i][0];
     78  expected_result = cases[i][1];
     79  shouldBe("canonicalize('" + test_vector + "')",
     80           "'" + expected_result + "'");
     81}
     82</script>
    983<script src="../js/resources/js-test-post.js"></script>
    1084</body>
  • trunk/LayoutTests/fast/url/trivial-segments.html

    r97881 r149681  
    1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
     1<!DOCTYPE html>
    22<html>
    33<head>
     
    66</head>
    77<body>
    8 <script src="script-tests/trivial-segments.js"></script>
     8<script>
     9description("Test basic features of URL segmentation");
     10
     11cases = [
     12  // [URL, [SCHEME, HOST, PORT, PATH, QUERY, REF]]
     13  ["http://example.com/", ["http:", "example.com", "", "/", "", ""]],
     14];
     15
     16var originalBaseURL = canonicalize(".");
     17setBaseURL("http://example.org/foo/bar");
     18
     19for (var i = 0; i < cases.length; ++i) {
     20  shouldBe("segments('" + cases[i][0] + "')",
     21           "'" + JSON.stringify(cases[i][1]) + "'");
     22}
     23
     24setBaseURL(originalBaseURL);
     25</script>
    926<script src="../js/resources/js-test-post.js"></script>
    1027</body>
  • trunk/LayoutTests/fast/url/trivial.html

    r97881 r149681  
    1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
     1<!DOCTYPE html>
    22<html>
    33<head>
     
    66</head>
    77<body>
    8 <script src="script-tests/trivial.js"></script>
     8<script>
     9description("Test basic features of URL canonicalization");
     10
     11cases = [
     12  ["http://example.com/", "http://example.com/"],
     13  ["/", "http://example.org/"]
     14];
     15
     16var originalBaseURL = canonicalize(".");
     17setBaseURL("http://example.org/foo/bar");
     18
     19for (var i = 0; i < cases.length; ++i) {
     20  shouldBe("canonicalize('" + cases[i][0] + "')",
     21           "'" + cases[i][1] + "'");
     22}
     23
     24setBaseURL(originalBaseURL);
     25</script>
    926<script src="../js/resources/js-test-post.js"></script>
    1027</body>
Note: See TracChangeset for help on using the changeset viewer.