tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

test_bug261425.js (680B)


      1 "use strict";
      2 
      3 function run_test() {
      4  var newURI = Services.io.newURI("http://foo.com");
      5 
      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  }
     17 
     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  }
     29 }