Bug 1555627 - Set a learn more link on net error pages. r=prathiksha

Bug 1284835 removed the hard-coded learn more link on cert and net error pages, which worked
for cert error pages because they explicitly set their own learn more links, but net error
pages were relying on the default href to be set. This wasn't revealed until bug 1530348
made about:neterror part of the new error pages.

The solution is simply to explicitly set the correct learn more link to net error pages.

Note that in the case of PR_END_OF_FILE errors, we were not previously showing a "learn more"
link. That was not intentional, as far as I can tell, but was caused by the bug fixed in bug 1477875.

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Johann Hofmann 2019-06-20 23:26:43 +00:00
Родитель c3a19591ea
Коммит 926df091cf
2 изменённых файлов: 43 добавлений и 4 удалений

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

@ -189,6 +189,10 @@ class NetErrorChild extends ActorChild {
id.textContent = msg;
}
}
let learnMoreLink = win.document.getElementById("learnMoreLink");
let baseURL = Services.urlFormatter.formatURLPref("app.support.baseURL");
learnMoreLink.setAttribute("href", baseURL + "connection-not-secure");
}
let automatic = Services.prefs.getBoolPref("security.ssl.errorReporting.automatic");

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

@ -3,14 +3,15 @@
"use strict";
// Set ourselves up for TLS error
Services.prefs.setIntPref("security.tls.version.max", 3);
Services.prefs.setIntPref("security.tls.version.min", 3);
const LOW_TLS_VERSION = "https://tls1.example.com/";
add_task(async function checkReturnToPreviousPage() {
info("Loading a TLS page that isn't supported, ensure we have a fix button and clicking it then loads the page");
// Set ourselves up for TLS error
Services.prefs.setIntPref("security.tls.version.max", 3);
Services.prefs.setIntPref("security.tls.version.min", 3);
let browser;
let pageLoaded;
await BrowserTestUtils.openNewForegroundTab(gBrowser, () => {
@ -43,3 +44,37 @@ add_task(async function checkReturnToPreviousPage() {
BrowserTestUtils.removeTab(gBrowser.selectedTab);
});
add_task(async function checkLearnMoreLink() {
info("Loading a TLS page that isn't supported and checking the learn more link");
// Set ourselves up for TLS error
Services.prefs.setIntPref("security.tls.version.max", 3);
Services.prefs.setIntPref("security.tls.version.min", 3);
let browser;
let pageLoaded;
await BrowserTestUtils.openNewForegroundTab(gBrowser, () => {
gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser, LOW_TLS_VERSION);
browser = gBrowser.selectedBrowser;
pageLoaded = BrowserTestUtils.waitForErrorPage(browser);
}, false);
info("Loading and waiting for the net error");
await pageLoaded;
let baseURL = Services.urlFormatter.formatURLPref("app.support.baseURL");
await ContentTask.spawn(browser, baseURL, function(_baseURL) {
ok(content.document.documentURI.startsWith("about:neterror"), "Should be showing error page");
let doc = content.document;
let learnMoreLink = doc.getElementById("learnMoreLink");
ok(ContentTaskUtils.is_visible(learnMoreLink), "Learn More link is visible");
is(learnMoreLink.getAttribute("href"), _baseURL + "connection-not-secure");
});
Services.prefs.clearUserPref("security.tls.version.max");
Services.prefs.clearUserPref("security.tls.version.min");
BrowserTestUtils.removeTab(gBrowser.selectedTab);
});