зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1853418 - Prepare Site-Identity and Statuspanel Tests.r=dao
Differential Revision: https://phabricator.services.mozilla.com/D190553
This commit is contained in:
Родитель
04d7ba785a
Коммит
d779ded2b1
|
@ -3,6 +3,10 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
ChromeUtils.defineESModuleGetters(this, {
|
||||
UrlbarTestUtils: "resource://testing-common/UrlbarTestUtils.sys.mjs",
|
||||
});
|
||||
|
||||
const TEST_PATH = getRootDirectory(gTestPath).replace(
|
||||
"chrome://mochitests/content",
|
||||
// eslint-disable-next-line @microsoft/sdl/no-insecure-url
|
||||
|
@ -64,12 +68,17 @@ add_task(async function test_identityBlock_inherited_blank() {
|
|||
await otherTabPromise;
|
||||
|
||||
ok(
|
||||
gURLBar.value.startsWith("example.org/"),
|
||||
gURLBar.value.startsWith(
|
||||
// eslint-disable-next-line @microsoft/sdl/no-insecure-url
|
||||
UrlbarTestUtils.trimURL("http://example.org/")
|
||||
),
|
||||
"URL bar value should be correct, was " + gURLBar.value
|
||||
);
|
||||
is(
|
||||
identityBox.className,
|
||||
"notSecure",
|
||||
Services.prefs.getBoolPref("security.insecure_connection_text.enabled")
|
||||
? "notSecure notSecureText"
|
||||
: "notSecure",
|
||||
"Identity box should have been updated."
|
||||
);
|
||||
|
||||
|
|
|
@ -706,3 +706,12 @@ add_task(async function test_pb_mode() {
|
|||
|
||||
await SpecialPowers.popPrefEnv();
|
||||
});
|
||||
|
||||
add_setup(() => {
|
||||
SpecialPowers.pushPrefEnv({
|
||||
set: [
|
||||
["security.insecure_connection_text.enabled", false],
|
||||
["security.insecure_connection_text.pbmode.enabled", false],
|
||||
],
|
||||
});
|
||||
});
|
||||
|
|
|
@ -57,6 +57,11 @@ add_task(async function test_pdf_blobURI() {
|
|||
* Test site identity state for PDFs served via HTTP.
|
||||
*/
|
||||
add_task(async function test_pdf_http() {
|
||||
let expectedIdentity = Services.prefs.getBoolPref(
|
||||
"security.insecure_connection_text.enabled"
|
||||
)
|
||||
? "notSecure notSecureText"
|
||||
: "notSecure";
|
||||
const PDF_URI_NOSCHEME =
|
||||
getRootDirectory(gTestPath).replace(
|
||||
"chrome://mochitests/content",
|
||||
|
@ -66,8 +71,8 @@ add_task(async function test_pdf_http() {
|
|||
await testIdentityMode(
|
||||
// eslint-disable-next-line @microsoft/sdl/no-insecure-url
|
||||
"http://" + PDF_URI_NOSCHEME,
|
||||
"notSecure",
|
||||
"Identity should be notSecure for a PDF served via HTTP."
|
||||
expectedIdentity,
|
||||
`Identity should be ${expectedIdentity} for a PDF served via HTTP.`
|
||||
);
|
||||
await testIdentityMode(
|
||||
"https://" + PDF_URI_NOSCHEME,
|
||||
|
|
|
@ -15,6 +15,12 @@ const SECURE_TEST_URI = ROOT_URI + "iframe_navigation.html";
|
|||
// eslint-disable-next-line @microsoft/sdl/no-insecure-url
|
||||
const INSECURE_TEST_URI = SECURE_TEST_URI.replace("https://", "http://");
|
||||
|
||||
const NOT_SECURE_LABEL = Services.prefs.getBoolPref(
|
||||
"security.insecure_connection_text.enabled"
|
||||
)
|
||||
? "notSecure notSecureText"
|
||||
: "notSecure";
|
||||
|
||||
// From a secure URI, navigate the iframe to about:blank (should still be
|
||||
// secure).
|
||||
add_task(async function () {
|
||||
|
@ -71,7 +77,11 @@ add_task(async function () {
|
|||
let uri = INSECURE_TEST_URI + "#blank";
|
||||
await BrowserTestUtils.withNewTab(uri, async browser => {
|
||||
let identityMode = window.document.getElementById("identity-box").className;
|
||||
is(identityMode, "notSecure", "identity should be 'not secure' before");
|
||||
is(
|
||||
identityMode,
|
||||
NOT_SECURE_LABEL,
|
||||
"identity should be 'not secure' before"
|
||||
);
|
||||
|
||||
await SpecialPowers.spawn(browser, [], async () => {
|
||||
content.postMessage("", "*"); // This kicks off the navigation.
|
||||
|
@ -82,7 +92,11 @@ add_task(async function () {
|
|||
|
||||
let newIdentityMode =
|
||||
window.document.getElementById("identity-box").className;
|
||||
is(newIdentityMode, "notSecure", "identity should be 'not secure' after");
|
||||
is(
|
||||
newIdentityMode,
|
||||
NOT_SECURE_LABEL,
|
||||
"identity should be 'not secure' after"
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -92,7 +106,11 @@ add_task(async function () {
|
|||
let uri = INSECURE_TEST_URI + "#secure";
|
||||
await BrowserTestUtils.withNewTab(uri, async browser => {
|
||||
let identityMode = window.document.getElementById("identity-box").className;
|
||||
is(identityMode, "notSecure", "identity should be 'not secure' before");
|
||||
is(
|
||||
identityMode,
|
||||
NOT_SECURE_LABEL,
|
||||
"identity should be 'not secure' before"
|
||||
);
|
||||
|
||||
await SpecialPowers.spawn(browser, [], async () => {
|
||||
content.postMessage("", "*"); // This kicks off the navigation.
|
||||
|
@ -103,6 +121,10 @@ add_task(async function () {
|
|||
|
||||
let newIdentityMode =
|
||||
window.document.getElementById("identity-box").className;
|
||||
is(newIdentityMode, "notSecure", "identity should be 'not secure' after");
|
||||
is(
|
||||
newIdentityMode,
|
||||
NOT_SECURE_LABEL,
|
||||
"identity should be 'not secure' after"
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -7,6 +7,12 @@
|
|||
// insecure in terms of the site identity panel. We achieve this by running an
|
||||
// HTTP-over-TLS "proxy" and having Firefox request an http:// URI over it.
|
||||
|
||||
const NOT_SECURE_LABEL = Services.prefs.getBoolPref(
|
||||
"security.insecure_connection_text.enabled"
|
||||
)
|
||||
? "notSecure notSecureText"
|
||||
: "notSecure";
|
||||
|
||||
/**
|
||||
* Tests that the page info dialog "security" section labels a
|
||||
* connection as unencrypted and does not show certificate.
|
||||
|
@ -177,7 +183,11 @@ add_task(async function () {
|
|||
// eslint-disable-next-line @microsoft/sdl/no-insecure-url
|
||||
await BrowserTestUtils.withNewTab("http://example.com/", async browser => {
|
||||
let identityMode = window.document.getElementById("identity-box").className;
|
||||
is(identityMode, "notSecure", "identity should be 'not secure'");
|
||||
is(
|
||||
identityMode,
|
||||
NOT_SECURE_LABEL,
|
||||
`identity should be '${NOT_SECURE_LABEL}'`
|
||||
);
|
||||
|
||||
// eslint-disable-next-line @microsoft/sdl/no-insecure-url
|
||||
await testPageInfoNotEncrypted("http://example.com");
|
||||
|
|
|
@ -3,10 +3,15 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
ChromeUtils.defineESModuleGetters(this, {
|
||||
UrlbarTestUtils: "resource://testing-common/UrlbarTestUtils.sys.mjs",
|
||||
});
|
||||
|
||||
const TEST_PAGE_URL = encodeURI(
|
||||
`data:text/html;charset=utf-8,<a id="foo" href="http://nic.xn--rhqv96g/">abc</a><span id="bar">def</span>`
|
||||
);
|
||||
const TEST_STATUS_TEXT = "nic.\u4E16\u754C";
|
||||
// eslint-disable-next-line @microsoft/sdl/no-insecure-url
|
||||
const TEST_STATUS_TEXT = UrlbarTestUtils.trimURL("http://nic.\u4E16\u754C");
|
||||
|
||||
/**
|
||||
* Test that if the StatusPanel displays an IDN
|
||||
|
|
Загрузка…
Ссылка в новой задаче