netwerk/test/unit/test_bug429347.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/netwerk/test/unit/test_bug429347.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,38 @@
     1.4 +function run_test() {
     1.5 +  var ios = Cc["@mozilla.org/network/io-service;1"].
     1.6 +    getService(Ci.nsIIOService);
     1.7 +
     1.8 +  var uri1 = ios.newURI("http://example.com#bar", null, null);
     1.9 +  var uri2 = ios.newURI("http://example.com/#bar", null, null);
    1.10 +  do_check_true(uri1.equals(uri2));
    1.11 +
    1.12 +  uri1.spec = "http://example.com?bar";
    1.13 +  uri2.spec = "http://example.com/?bar";
    1.14 +  do_check_true(uri1.equals(uri2));
    1.15 +
    1.16 +  // see https://bugzilla.mozilla.org/show_bug.cgi?id=665706
    1.17 +  // ";" is not parsed as special anymore and thus ends up
    1.18 +  // in the authority component (see RFC 3986)
    1.19 +  uri1.spec = "http://example.com;bar";
    1.20 +  uri2.spec = "http://example.com/;bar";
    1.21 +  do_check_false(uri1.equals(uri2));
    1.22 +
    1.23 +  uri1.spec = "http://example.com#";
    1.24 +  uri2.spec = "http://example.com/#";
    1.25 +  do_check_true(uri1.equals(uri2));
    1.26 +
    1.27 +  uri1.spec = "http://example.com?";
    1.28 +  uri2.spec = "http://example.com/?";
    1.29 +  do_check_true(uri1.equals(uri2));
    1.30 +
    1.31 +  // see https://bugzilla.mozilla.org/show_bug.cgi?id=665706
    1.32 +  // ";" is not parsed as special anymore and thus ends up
    1.33 +  // in the authority component (see RFC 3986)
    1.34 +  uri1.spec = "http://example.com;";
    1.35 +  uri2.spec = "http://example.com/;";
    1.36 +  do_check_false(uri1.equals(uri2));
    1.37 +
    1.38 +  uri1.spec = "http://example.com";
    1.39 +  uri2.spec = "http://example.com/";
    1.40 +  do_check_true(uri1.equals(uri2));
    1.41 +}

mercurial