diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /netwerk/test/unit/test_standardurl_port.js | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'netwerk/test/unit/test_standardurl_port.js')
-rw-r--r-- | netwerk/test/unit/test_standardurl_port.js | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/netwerk/test/unit/test_standardurl_port.js b/netwerk/test/unit/test_standardurl_port.js new file mode 100644 index 000000000..cc0016964 --- /dev/null +++ b/netwerk/test/unit/test_standardurl_port.js @@ -0,0 +1,56 @@ +var Cc = Components.classes; +var Ci = Components.interfaces; + +function run_test() { + function makeURI(aURLSpec, aCharset) { + var ios = Cc["@mozilla.org/network/io-service;1"]. + getService(Ci.nsIIOService); + return ios.newURI(aURLSpec, aCharset, null); + } + + var httpURI = makeURI("http://foo.com"); + do_check_eq(-1, httpURI.port); + + // Setting to default shouldn't cause a change + httpURI.port = 80; + do_check_eq(-1, httpURI.port); + + // Setting to default after setting to non-default shouldn't cause a change (bug 403480) + httpURI.port = 123; + do_check_eq(123, httpURI.port); + httpURI.port = 80; + do_check_eq(-1, httpURI.port); + do_check_false(/80/.test(httpURI.spec)); + + // URL parsers shouldn't set ports to default value (bug 407538) + httpURI.spec = "http://foo.com:81"; + do_check_eq(81, httpURI.port); + httpURI.spec = "http://foo.com:80"; + do_check_eq(-1, httpURI.port); + do_check_false(/80/.test(httpURI.spec)); + + httpURI = makeURI("http://foo.com"); + do_check_eq(-1, httpURI.port); + do_check_false(/80/.test(httpURI.spec)); + + httpURI = makeURI("http://foo.com:80"); + do_check_eq(-1, httpURI.port); + do_check_false(/80/.test(httpURI.spec)); + + httpURI = makeURI("http://foo.com:80"); + do_check_eq(-1, httpURI.port); + do_check_false(/80/.test(httpURI.spec)); + + httpURI = makeURI("https://foo.com"); + do_check_eq(-1, httpURI.port); + do_check_false(/443/.test(httpURI.spec)); + + httpURI = makeURI("https://foo.com:443"); + do_check_eq(-1, httpURI.port); + do_check_false(/443/.test(httpURI.spec)); + + // XXX URL parsers shouldn't set ports to default value, even when changing scheme? + // not really possible given current nsIURI impls + //httpURI.spec = "https://foo.com:443"; + //do_check_eq(-1, httpURI.port); +} |