Bug 1977770 - Fix "View…" button in certificate exception dialog. a=RyanVM DONTBUILD

Take two, this time with the right event listener for a XUL button instead of an HTML button. :-(

Original Revision: https://phabricator.services.mozilla.com/D257650

Differential Revision: https://phabricator.services.mozilla.com/D263476
This commit is contained in:
Geoff Lankow
2025-09-02 20:24:48 +00:00
committed by rvandermeulen@mozilla.com
parent 9f8620ad31
commit ed678723ba
2 changed files with 14 additions and 2 deletions

View File

@@ -33,7 +33,7 @@ function initExceptionDialog() {
.addEventListener("input", () => handleTextChange());
document
.getElementById("viewCertButton")
.addEventListener("click", () => viewCertButtonClick());
.addEventListener("command", () => viewCertButtonClick());
var args = window.arguments;
if (args && args[0]) {

View File

@@ -24,15 +24,27 @@ function test() {
Services.obs.removeObserver(onCertUI, "cert-exception-ui-ready");
ok(win.gCert, "The certificate information should be available now");
// Clicking on the View… button should open the certificate viewer.
let viewButton = win.document.getElementById("viewCertButton");
let tabPromise = BrowserTestUtils.waitForNewTab(
gBrowser,
url => url.startsWith("about:certificate?cert="),
true
);
viewButton.click();
EventUtils.synthesizeMouseAtCenter(viewButton, {}, win);
BrowserTestUtils.removeTab(await tabPromise);
if (AppConstants.platform != "macosx") {
// Pressing enter on the View… button should open the certificate viewer.
tabPromise = BrowserTestUtils.waitForNewTab(
gBrowser,
url => url.startsWith("about:certificate?cert="),
true
);
EventUtils.synthesizeKey("KEY_Enter", {}, win);
BrowserTestUtils.removeTab(await tabPromise);
}
let dialog = win.document.getElementById("exceptiondialog");
let confirmButton = dialog.getButton("extra1");
confirmButton.click();