michael@0: function run_test() { michael@0: var ios = Cc["@mozilla.org/network/io-service;1"]. michael@0: getService(Ci.nsIIOService); michael@0: michael@0: var newURI = ios.newURI("http://foo.com", null, null); michael@0: michael@0: var success = false; michael@0: try { michael@0: newURI.spec = "http: //foo.com"; michael@0: } michael@0: catch (e) { michael@0: success = e.result == Cr.NS_ERROR_MALFORMED_URI; michael@0: } michael@0: if (!success) michael@0: do_throw("We didn't throw NS_ERROR_MALFORMED_URI when a space was passed in the hostname!"); michael@0: michael@0: success = false; michael@0: try { michael@0: newURI.host = " foo.com"; michael@0: } michael@0: catch (e) { michael@0: success = e.result == Cr.NS_ERROR_MALFORMED_URI; michael@0: } michael@0: if (!success) michael@0: do_throw("We didn't throw NS_ERROR_MALFORMED_URI when a space was passed in the hostname!"); michael@0: }