Follow-on fix for bug 457825. Use sheet principal for agent and user sheets. r=dbaron...
[wine-gecko.git] / netwerk / test / unit / test_standardurl_port.js
blobcc0016964c6a042ebdd77efa08ae3ff2b176e012
1 var Cc = Components.classes;
2 var Ci = Components.interfaces;
4 function run_test() {
5 function makeURI(aURLSpec, aCharset) {
6 var ios = Cc["@mozilla.org/network/io-service;1"].
7 getService(Ci.nsIIOService);
8 return ios.newURI(aURLSpec, aCharset, null);
11 var httpURI = makeURI("http://foo.com");
12 do_check_eq(-1, httpURI.port);
14 // Setting to default shouldn't cause a change
15 httpURI.port = 80;
16 do_check_eq(-1, httpURI.port);
18 // Setting to default after setting to non-default shouldn't cause a change (bug 403480)
19 httpURI.port = 123;
20 do_check_eq(123, httpURI.port);
21 httpURI.port = 80;
22 do_check_eq(-1, httpURI.port);
23 do_check_false(/80/.test(httpURI.spec));
25 // URL parsers shouldn't set ports to default value (bug 407538)
26 httpURI.spec = "http://foo.com:81";
27 do_check_eq(81, httpURI.port);
28 httpURI.spec = "http://foo.com:80";
29 do_check_eq(-1, httpURI.port);
30 do_check_false(/80/.test(httpURI.spec));
32 httpURI = makeURI("http://foo.com");
33 do_check_eq(-1, httpURI.port);
34 do_check_false(/80/.test(httpURI.spec));
36 httpURI = makeURI("http://foo.com:80");
37 do_check_eq(-1, httpURI.port);
38 do_check_false(/80/.test(httpURI.spec));
40 httpURI = makeURI("http://foo.com:80");
41 do_check_eq(-1, httpURI.port);
42 do_check_false(/80/.test(httpURI.spec));
44 httpURI = makeURI("https://foo.com");
45 do_check_eq(-1, httpURI.port);
46 do_check_false(/443/.test(httpURI.spec));
48 httpURI = makeURI("https://foo.com:443");
49 do_check_eq(-1, httpURI.port);
50 do_check_false(/443/.test(httpURI.spec));
52 // XXX URL parsers shouldn't set ports to default value, even when changing scheme?
53 // not really possible given current nsIURI impls
54 //httpURI.spec = "https://foo.com:443";
55 //do_check_eq(-1, httpURI.port);