Bug 1903135 - Allow adding an override for certificates with the wrong hostname. r=kaie

Differential Revision: https://phabricator.services.mozilla.com/D217353

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Geoff Lankow 2024-07-24 10:28:58 +00:00
Родитель e25706d42b
Коммит 97a9a9ef48
2 изменённых файлов: 6 добавлений и 21 удалений

Просмотреть файл

@ -54,7 +54,7 @@ add_setup(async function () {
});
add_task(async function testDomainMismatch() {
await subtest("tls", "mitm.test.test", "not valid for");
await subtest("tls", "mitm.test.test", "not valid for", "valid");
});
add_task(async function testExpired() {
@ -188,15 +188,10 @@ async function subsubtest(
await testCallback();
let dialogPromise;
if (expectedCert) {
dialogPromise = BrowserTestUtils.promiseAlertDialogOpen(
"extra1",
"chrome://pippki/content/exceptionDialog.xhtml"
);
} else {
dialogPromise = Promise.resolve();
}
const dialogPromise = BrowserTestUtils.promiseAlertDialogOpen(
"extra1",
"chrome://pippki/content/exceptionDialog.xhtml"
);
const alert = await TestUtils.waitForCondition(
() => MockAlertsService._alert,

Просмотреть файл

@ -128,12 +128,10 @@ export var alertHook = {
let errorString;
const errorArgs = { hostname: url.host };
let isAlertClickable = true;
switch (securityInfo.overridableErrorCategory) {
case Ci.nsITransportSecurityInfo.ERROR_DOMAIN:
errorString = "cert-error-domain-mismatch";
isAlertClickable = false;
break;
case Ci.nsITransportSecurityInfo.ERROR_TIME: {
const cert = securityInfo.serverCert;
@ -163,7 +161,7 @@ export var alertHook = {
"chrome://branding/content/icon48.png",
this.brandShortName,
await l10n.formatValue(errorString, errorArgs),
isAlertClickable /* clickable */,
true /* clickable */,
cookie
);
this.alertService.showAlert(alert, this);
@ -174,14 +172,6 @@ export var alertHook = {
observe(subject, topic, data) {
if (topic == "alertclickcallback") {
const { securityInfo, url } = activeAlerts.get(data);
if (
!securityInfo ||
securityInfo.overridableErrorCategory ==
Ci.nsITransportSecurityInfo.ERROR_DOMAIN
) {
return;
}
const params = {
exceptionAdded: false,
securityInfo,