summaryrefslogtreecommitdiffstats
path: root/netwerk/test/unit/test_standardurl.js
diff options
context:
space:
mode:
authorjanekptacijarabaci <janekptacijarabaci@seznam.cz>2018-04-15 08:09:17 +0200
committerjanekptacijarabaci <janekptacijarabaci@seznam.cz>2018-04-15 08:09:17 +0200
commitf138ec95d9d2c9faba019e52467beeed2a73b4f5 (patch)
treeb7e48dbe0baaae42a3a059343fcb277424c482ba /netwerk/test/unit/test_standardurl.js
parentae14556114dcae29f679db7c15f0bc9b707bb89a (diff)
downloadUXP-f138ec95d9d2c9faba019e52467beeed2a73b4f5.tar
UXP-f138ec95d9d2c9faba019e52467beeed2a73b4f5.tar.gz
UXP-f138ec95d9d2c9faba019e52467beeed2a73b4f5.tar.lz
UXP-f138ec95d9d2c9faba019e52467beeed2a73b4f5.tar.xz
UXP-f138ec95d9d2c9faba019e52467beeed2a73b4f5.zip
moebius#131: URL parser - stop preserving empty passwords
https://github.com/MoonchildProductions/moebius/issues/131
Diffstat (limited to 'netwerk/test/unit/test_standardurl.js')
-rw-r--r--netwerk/test/unit/test_standardurl.js20
1 files changed, 20 insertions, 0 deletions
diff --git a/netwerk/test/unit/test_standardurl.js b/netwerk/test/unit/test_standardurl.js
index a1a320721..fa9ed6964 100644
--- a/netwerk/test/unit/test_standardurl.js
+++ b/netwerk/test/unit/test_standardurl.js
@@ -461,3 +461,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();
+});