michael@0: function run_test() { michael@0: var ios = Cc["@mozilla.org/network/io-service;1"]. michael@0: getService(Ci.nsIIOService); michael@0: michael@0: var uri1 = ios.newURI("http://example.com#bar", null, null); michael@0: var uri2 = ios.newURI("http://example.com/#bar", null, null); michael@0: do_check_true(uri1.equals(uri2)); michael@0: michael@0: uri1.spec = "http://example.com?bar"; michael@0: uri2.spec = "http://example.com/?bar"; michael@0: do_check_true(uri1.equals(uri2)); michael@0: michael@0: // see https://bugzilla.mozilla.org/show_bug.cgi?id=665706 michael@0: // ";" is not parsed as special anymore and thus ends up michael@0: // in the authority component (see RFC 3986) michael@0: uri1.spec = "http://example.com;bar"; michael@0: uri2.spec = "http://example.com/;bar"; michael@0: do_check_false(uri1.equals(uri2)); michael@0: michael@0: uri1.spec = "http://example.com#"; michael@0: uri2.spec = "http://example.com/#"; michael@0: do_check_true(uri1.equals(uri2)); michael@0: michael@0: uri1.spec = "http://example.com?"; michael@0: uri2.spec = "http://example.com/?"; michael@0: do_check_true(uri1.equals(uri2)); michael@0: michael@0: // see https://bugzilla.mozilla.org/show_bug.cgi?id=665706 michael@0: // ";" is not parsed as special anymore and thus ends up michael@0: // in the authority component (see RFC 3986) michael@0: uri1.spec = "http://example.com;"; michael@0: uri2.spec = "http://example.com/;"; michael@0: do_check_false(uri1.equals(uri2)); michael@0: michael@0: uri1.spec = "http://example.com"; michael@0: uri2.spec = "http://example.com/"; michael@0: do_check_true(uri1.equals(uri2)); michael@0: }