From af22c7c5f07fa436ce2d2f6c6018e6f22d28c37c Mon Sep 17 00:00:00 2001 From: Valentin Gosu Date: Wed, 18 Nov 2020 09:29:56 +0000 Subject: [PATCH] Bug 1648493 - tests r=necko-reviewers,kershaw Differential Revision: https://phabricator.services.mozilla.com/D88299 --- dom/url/tests/test_url.html | 10 ++++++++++ netwerk/test/unit/test_standardurl.js | 26 ++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/dom/url/tests/test_url.html b/dom/url/tests/test_url.html index 481573ef25a9..74bdf0f38257 100644 --- a/dom/url/tests/test_url.html +++ b/dom/url/tests/test_url.html @@ -487,5 +487,15 @@ is(u.toJSON(), "http://www.example.org/", "URL.toJSON()"); is(JSON.stringify(u), "\"http://www.example.org/\"", "JSON.stringify(u) works"); + + diff --git a/netwerk/test/unit/test_standardurl.js b/netwerk/test/unit/test_standardurl.js index 74d3c530ee76..f862ad3997f7 100644 --- a/netwerk/test/unit/test_standardurl.js +++ b/netwerk/test/unit/test_standardurl.js @@ -1271,3 +1271,29 @@ add_task(async function test_emptyHostWithURLType() { "A pseudo-empty host is not allowed for URLTYPE_AUTHORITY" ); }); + +add_task(async function test_bug1648493() { + let url = stringToURL("https://example.com/"); + url = url + .mutate() + .setScheme("file") + .finalize(); + url = url + .mutate() + .setScheme("resource") + .finalize(); + url = url + .mutate() + .setPassword("ê") + .finalize(); + url = url + .mutate() + .setUsername("ç") + .finalize(); + url = url + .mutate() + .setScheme("t") + .finalize(); + equal(url.spec, "t://%C3%83%C2%A7:%C3%83%C2%AA@example.com/"); + equal(url.username, "%C3%83%C2%A7"); +});