Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
/* Any copyright is dedicated to the Public Domain.
// Checks certain sequences of characters encoded properly in the URL
// As completely duplicating the list in losslessDecodeURI wouldn't make sense
// we just test a few examples from it.
add_task(async function () {
let enc = encodeURIComponent;
let tests = [
[
],
[
],
[
],
[
],
[
],
[
"javascript: (() => { alert('test'); } })();",
"javascript: (() => { alert('test'); } })();",
],
[
],
[
],
[
],
];
await BrowserTestUtils.withNewTab(
{
gBrowser,
url: "about:robots",
},
function () {
for (let [url, expected] of tests) {
info("testing: " + url);
gURLBar.setURI({
uri: Services.io.newURI(url),
dueToSessionRestore: true,
});
Assert.equal(gURLBar.untrimmedValue, expected);
}
}
);
});