netwerk/test/unit/test_bug429347.js

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:545460637fff
1 function run_test() {
2 var ios = Cc["@mozilla.org/network/io-service;1"].
3 getService(Ci.nsIIOService);
4
5 var uri1 = ios.newURI("http://example.com#bar", null, null);
6 var uri2 = ios.newURI("http://example.com/#bar", null, null);
7 do_check_true(uri1.equals(uri2));
8
9 uri1.spec = "http://example.com?bar";
10 uri2.spec = "http://example.com/?bar";
11 do_check_true(uri1.equals(uri2));
12
13 // see https://bugzilla.mozilla.org/show_bug.cgi?id=665706
14 // ";" is not parsed as special anymore and thus ends up
15 // in the authority component (see RFC 3986)
16 uri1.spec = "http://example.com;bar";
17 uri2.spec = "http://example.com/;bar";
18 do_check_false(uri1.equals(uri2));
19
20 uri1.spec = "http://example.com#";
21 uri2.spec = "http://example.com/#";
22 do_check_true(uri1.equals(uri2));
23
24 uri1.spec = "http://example.com?";
25 uri2.spec = "http://example.com/?";
26 do_check_true(uri1.equals(uri2));
27
28 // see https://bugzilla.mozilla.org/show_bug.cgi?id=665706
29 // ";" is not parsed as special anymore and thus ends up
30 // in the authority component (see RFC 3986)
31 uri1.spec = "http://example.com;";
32 uri2.spec = "http://example.com/;";
33 do_check_false(uri1.equals(uri2));
34
35 uri1.spec = "http://example.com";
36 uri2.spec = "http://example.com/";
37 do_check_true(uri1.equals(uri2));
38 }

mercurial