зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1499685 - Fix browser_aboutCertError.js test cases for the old cert error pages. r=nhnt11
Two of these tests simply require the new pref to be set, while there was some actual breakage that required me to put some more code behind another gate. Differential Revision: https://phabricator.services.mozilla.com/D8978 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
cf9e76636e
Коммит
e55a046d93
|
@ -27,7 +27,7 @@
|
|||
<link rel="icon" id="favicon" href="chrome://global/skin/icons/warning.svg"/>
|
||||
</head>
|
||||
|
||||
<body dir="&locale.dir;">
|
||||
<body data-new-error-pages-enabled="true" dir="&locale.dir;">
|
||||
<!-- ERROR ITEM CONTAINER (removed during loading to avoid bug 39098) -->
|
||||
<div id="errorContainer">
|
||||
<div id="errorPageTitlesContainer">
|
||||
|
|
|
@ -15,6 +15,7 @@ let searchParams = new URLSearchParams(document.documentURI.split("?")[1]);
|
|||
|
||||
// Set to true on init if the error code is nssBadCert.
|
||||
let gIsCertError;
|
||||
let gNewErrorPagesEnabled;
|
||||
|
||||
function getErrorCode() {
|
||||
return searchParams.get("e");
|
||||
|
@ -129,9 +130,11 @@ function disallowCertOverridesIfNeeded() {
|
|||
if (cssClass == "badStsCert") {
|
||||
document.getElementById("badStsCertExplanation").removeAttribute("hidden");
|
||||
|
||||
let stsReturnButtonText = document.getElementById("stsReturnButtonText").textContent;
|
||||
document.getElementById("returnButton").textContent = stsReturnButtonText;
|
||||
document.getElementById("advancedPanelReturnButton").textContent = stsReturnButtonText;
|
||||
if (gNewErrorPagesEnabled) {
|
||||
let stsReturnButtonText = document.getElementById("stsReturnButtonText").textContent;
|
||||
document.getElementById("returnButton").textContent = stsReturnButtonText;
|
||||
document.getElementById("advancedPanelReturnButton").textContent = stsReturnButtonText;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -150,6 +153,7 @@ function initPage() {
|
|||
}
|
||||
|
||||
gIsCertError = (err == "nssBadCert");
|
||||
gNewErrorPagesEnabled = !!document.body.dataset.newErrorPagesEnabled;
|
||||
// Only worry about captive portals if this is a cert error.
|
||||
let showCaptivePortalUI = isCaptive() && gIsCertError;
|
||||
if (showCaptivePortalUI) {
|
||||
|
@ -162,7 +166,7 @@ function initPage() {
|
|||
document.body.classList.add(className);
|
||||
}
|
||||
|
||||
if (gIsCertError && className == "badStsCert") {
|
||||
if (gNewErrorPagesEnabled && gIsCertError && className == "badStsCert") {
|
||||
l10nErrId += "_sts";
|
||||
}
|
||||
|
||||
|
|
|
@ -458,6 +458,7 @@ add_task(async function checkUnknownIssuerLearnMoreLink() {
|
|||
});
|
||||
|
||||
add_task(async function checkCautionClass() {
|
||||
Services.prefs.setBoolPref("browser.security.newcerterrorpage.enabled", true);
|
||||
info("Checking that are potentially more dangerous get a 'caution' class");
|
||||
for (let useFrame of [false, true]) {
|
||||
let tab = await openErrorPage(UNKNOWN_ISSUER, useFrame);
|
||||
|
@ -480,9 +481,11 @@ add_task(async function checkCautionClass() {
|
|||
|
||||
BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
||||
}
|
||||
Services.prefs.clearUserPref("browser.security.newcerterrorpage.enabled");
|
||||
});
|
||||
|
||||
add_task(async function checkViewCertificate() {
|
||||
Services.prefs.setBoolPref("browser.security.newcerterrorpage.enabled", true);
|
||||
info("Loading a cert error and checking that the certificate can be shown.");
|
||||
for (let useFrame of [false, true]) {
|
||||
let tab = await openErrorPage(UNKNOWN_ISSUER, useFrame);
|
||||
|
@ -506,6 +509,7 @@ add_task(async function checkViewCertificate() {
|
|||
|
||||
BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
||||
}
|
||||
Services.prefs.clearUserPref("browser.security.newcerterrorpage.enabled");
|
||||
});
|
||||
|
||||
function getCertChain(securityInfoAsString) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче