Bug 1857386 [wpt PR 42383] - Update wpt metadata, a=testonly
[gecko.git] / netwerk / test / unit / test_bug261425.js
blobf58ad62e93f4c6c950684de90389bdded9cfe962
1 "use strict";
3 function run_test() {
4   var newURI = Services.io.newURI("http://foo.com");
6   var success = false;
7   try {
8     newURI = newURI.mutate().setSpec("http: //foo.com").finalize();
9   } catch (e) {
10     success = e.result == Cr.NS_ERROR_MALFORMED_URI;
11   }
12   if (!success) {
13     do_throw(
14       "We didn't throw NS_ERROR_MALFORMED_URI when a space was passed in the hostname!"
15     );
16   }
18   success = false;
19   try {
20     newURI.mutate().setHost(" foo.com").finalize();
21   } catch (e) {
22     success = e.result == Cr.NS_ERROR_MALFORMED_URI;
23   }
24   if (!success) {
25     do_throw(
26       "We didn't throw NS_ERROR_MALFORMED_URI when a space was passed in the hostname!"
27     );
28   }