Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- Manifest: netwerk/test/unit/xpcshell.toml
"use strict";
function run_test() {
function makeURI(aURLSpec, aCharset) {
return Services.io.newURI(aURLSpec, aCharset);
}
Assert.equal(-1, httpURI.port);
// Setting to default shouldn't cause a change
httpURI = httpURI.mutate().setPort(80).finalize();
Assert.equal(-1, httpURI.port);
httpURI = httpURI.mutate().setPort(123).finalize();
Assert.equal(123, httpURI.port);
httpURI = httpURI.mutate().setPort(80).finalize();
Assert.equal(-1, httpURI.port);
Assert.ok(!/80/.test(httpURI.spec));
Assert.equal(81, httpURI.port);
Assert.equal(-1, httpURI.port);
Assert.ok(!/80/.test(httpURI.spec));
Assert.equal(-1, httpURI.port);
Assert.ok(!/80/.test(httpURI.spec));
Assert.equal(-1, httpURI.port);
Assert.ok(!/80/.test(httpURI.spec));
Assert.equal(-1, httpURI.port);
Assert.ok(!/80/.test(httpURI.spec));
Assert.equal(-1, httpURI.port);
Assert.ok(!/443/.test(httpURI.spec));
Assert.equal(-1, httpURI.port);
Assert.ok(!/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
//do_check_eq(-1, httpURI.port);
}