summaryrefslogtreecommitdiff
path: root/netwerk/test
diff options
context:
space:
mode:
authorNew Tobin Paradigm <email@mattatobin.com>2018-04-16 08:31:05 -0400
committerGitHub <noreply@github.com>2018-04-16 08:31:05 -0400
commit597526252914484974583e68744492b86a6c291e (patch)
treea6123133b2347a723ecf1f99260c0738a369a97e /netwerk/test
parent18df5ba2828402816ba61fbed697e84b9cf99d2f (diff)
parenta54132e028bde7dc034d2be55891c3e3e04b7366 (diff)
downloaduxp-597526252914484974583e68744492b86a6c291e.tar.gz
Merge pull request #175 from janekptacijarabaci/url_parser_2
moebius#131: URL parser - stop preserving empty passwords
Diffstat (limited to 'netwerk/test')
-rw-r--r--netwerk/test/unit/test_URIs.js2
-rw-r--r--netwerk/test/unit/test_standardurl.js20
2 files changed, 21 insertions, 1 deletions
diff --git a/netwerk/test/unit/test_URIs.js b/netwerk/test/unit/test_URIs.js
index 5bc7fe432d..1cad7768f7 100644
--- a/netwerk/test/unit/test_URIs.js
+++ b/netwerk/test/unit/test_URIs.js
@@ -109,7 +109,7 @@ var gTests = [
nsIURL: true, nsINestedURI: false },
{ spec: "ftp://foo:@ftp.mozilla.org:100/pub/mozilla.org/README",
scheme: "ftp",
- prePath: "ftp://foo:@ftp.mozilla.org:100",
+ prePath: "ftp://foo@ftp.mozilla.org:100",
port: 100,
username: "foo",
password: "",
diff --git a/netwerk/test/unit/test_standardurl.js b/netwerk/test/unit/test_standardurl.js
index c2b4dd3650..4cc2f393ee 100644
--- a/netwerk/test/unit/test_standardurl.js
+++ b/netwerk/test/unit/test_standardurl.js
@@ -472,3 +472,23 @@ add_test(function test_invalidHostChars() {
// hostname separators, so there is no way to set them and fail.
run_next_test();
});
+
+add_test(function test_emptyPassword() {
+ var url = stringToURL("http://a:@example.com");
+ do_check_eq(url.spec, "http://a@example.com/");
+ url.password = "pp";
+ do_check_eq(url.spec, "http://a:pp@example.com/");
+ url.password = "";
+ do_check_eq(url.spec, "http://a@example.com/");
+ url.userPass = "xxx:";
+ do_check_eq(url.spec, "http://xxx@example.com/");
+ url.password = "zzzz";
+ do_check_eq(url.spec, "http://xxx:zzzz@example.com/");
+ url.userPass = "xxxxx:yyyyyy";
+ do_check_eq(url.spec, "http://xxxxx:yyyyyy@example.com/");
+ url.userPass = "z:";
+ do_check_eq(url.spec, "http://z@example.com/");
+ url.password = "ppppppppppp";
+ do_check_eq(url.spec, "http://z:ppppppppppp@example.com/");
+ run_next_test();
+});