2007-04-27 09:20:26 -07:00
|
|
|
const Cc = Components.classes;
|
|
|
|
const Ci = Components.interfaces;
|
2008-05-05 14:00:59 -07:00
|
|
|
const Cr = Components.results;
|
2007-04-27 09:20:26 -07:00
|
|
|
|
|
|
|
function run_test() {
|
|
|
|
var ios = Cc["@mozilla.org/network/io-service;1"].
|
|
|
|
getService(Ci.nsIIOService);
|
|
|
|
|
|
|
|
var newURI = ios.newURI("http://foo.com", null, null);
|
|
|
|
|
|
|
|
var success = false;
|
|
|
|
try {
|
2008-05-05 14:00:59 -07:00
|
|
|
newURI.spec = "http: //foo.com";
|
2007-04-27 09:20:26 -07:00
|
|
|
}
|
|
|
|
catch (e) {
|
2008-05-05 14:00:59 -07:00
|
|
|
success = e.result == Cr.NS_ERROR_MALFORMED_URI;
|
|
|
|
}
|
2008-09-14 11:15:06 -07:00
|
|
|
if (!success)
|
|
|
|
do_throw("We didn't throw NS_ERROR_MALFORMED_URI when a space was passed in the hostname!");
|
2007-04-27 09:20:26 -07:00
|
|
|
|
|
|
|
success = false;
|
|
|
|
try {
|
2008-05-05 14:00:59 -07:00
|
|
|
newURI.host = " foo.com";
|
2007-04-27 09:20:26 -07:00
|
|
|
}
|
|
|
|
catch (e) {
|
2008-05-05 14:00:59 -07:00
|
|
|
success = e.result == Cr.NS_ERROR_MALFORMED_URI;
|
2007-04-27 09:20:26 -07:00
|
|
|
}
|
|
|
|
if (!success)
|
2008-05-05 14:00:59 -07:00
|
|
|
do_throw("We didn't throw NS_ERROR_MALFORMED_URI when a space was passed in the hostname!");
|
2007-04-27 09:20:26 -07:00
|
|
|
}
|