Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

/* Any copyright is dedicated to the Public Domain.
"use strict";
const REDIRECT_URL =
function getErrorDescription(documentURI) {
const query = documentURI.substring(documentURI.indexOf("?"));
return new URLSearchParams(query).get("d");
}
add_task(async function test_scheme_of_redirect_target_is_reported() {
await BrowserTestUtils.withNewTab("about:blank", async browser => {
const errorPageLoaded = BrowserTestUtils.waitForErrorPage(browser);
BrowserTestUtils.startLoadingURIString(browser, REDIRECT_URL);
await errorPageLoaded;
const documentURI = await SpecialPowers.spawn(
browser,
[],
() => content.document.documentURI
);
ok(
documentURI.startsWith("about:neterror"),
`Expected a neterror page, got ${documentURI}`
);
ok(
documentURI.includes("e=unknownProtocolFound"),
`Expected an unknownProtocolFound error, got ${documentURI}`
);
const description = getErrorDescription(documentURI);
ok(
description.includes("hackbotunknownprotocol"),
`Description should name the redirect target scheme, got: ${description}`
);
ok(
!description.includes("(https)"),
`Description should not name the scheme of the redirecting server, got: ${description}`
);
});
});