fune/toolkit/content/resetProfile.js
Doug Thayer ec23c3ca31 Bug 1693133 - Fix resetProfile.xhtml tests r=Gijs
BrowserTestUtils.promiseAlertDialog and friends account for commonDialog.xhtml,
but not other dialogs which go through gDialogBox. This fixes that by adding a
inWindowDialog option to promiseAlertDialog. I don't like this solution very
much - it requires all of these dialogs to fire the event themselves. An
alternative might be putting this code in some file which these all include,
but given how small the code is that feels like overkill. Alternatives welcome.

Differential Revision: https://phabricator.services.mozilla.com/D109674
2021-03-25 17:28:56 +00:00

29 lines
857 B
JavaScript

/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
document.addEventListener("dialogaccept", onResetProfileAccepted);
document
.getElementById("refreshProfileLearnMore")
.addEventListener("click", e => {
e.preventDefault();
let retVals = window.arguments[0];
retVals.learnMore = true;
window.close();
});
document.addEventListener("DOMContentLoaded", function() {
document
.getElementById("resetProfileDialog")
.getButton("accept")
.classList.add("danger-button");
});
function onResetProfileAccepted() {
let retVals = window.arguments[0];
retVals.reset = true;
}