Bug 1734818 - clean out browsingContext thunderbird 78 compat layer. r=kaie

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

--HG--
extra : amend_source : e4026eb1b359384d40fa10bd4a102914a18aff47
This commit is contained in:
Magnus Melin 2021-10-13 13:26:02 +03:00
Родитель e7fef4865f
Коммит 6c13df12ae
4 изменённых файлов: 18 добавлений и 58 удалений

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

@ -539,23 +539,14 @@ function openDeviceManager() {
* Open the OpenPGP Key Manager.
*/
function openKeyManager() {
// Bug 1638153: The rootTreeItem object has been removed after 78. We need to
// the availability of "browsingContext" to use the right DOM window in 79+.
let w =
"browsingContext" in window
? window.browsingContext.topChromeWindow
: window.docShell.rootTreeItem.domWindow;
let args = {
cancelCallback: reloadOpenPgpUI,
okCallback: reloadOpenPgpUI,
};
w.openDialog(
window.browsingContext.topChromeWindow.openDialog(
"chrome://openpgp/content/ui/enigmailKeyManager.xhtml",
"enigmail:KeyManager",
"dialog,centerscreen,resizable",
args
{
cancelCallback: reloadOpenPgpUI,
okCallback: reloadOpenPgpUI,
}
);
}
@ -1429,16 +1420,7 @@ async function openPgpExportSecretKey(keyId, keyFpr) {
fprArray: [keyFpr],
};
let w;
if ("browsingContext" in window) {
// 79+
w = window.browsingContext.topChromeWindow;
} else {
// 78
w = window.docShell.rootTreeItem.domWindow;
}
w.openDialog(
window.browsingContext.topChromeWindow.openDialog(
"chrome://openpgp/content/ui/backupKeyPassword.xhtml",
"",
"dialog,modal,centerscreen,resizable",

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

@ -446,27 +446,22 @@ var EnigmailDialog = {
* Asks user to confirm the import of the given public keys.
* User is allowed to automatically accept new/undecided keys.
*
* @param {?nsIDOMWindow} parent - Parent window.
* @param {nsIDOMWindow} parentWindow - Parent window.
* @param {Object[]} keyPreview - Key details. See EnigmailKey.getKeyListFromKeyBlock().
* @param {EnigmailKeyObj[]} - Array of key objects.
* @param {Object} outputParams - Out parameters. If confirmed,
* outputParams.acceptance {String} contains the decision.
* @return: Boolean - true if user confirms import
* @param {Object} outputParams - Out parameters.
* @param {String} outputParams.acceptance contains the decision. If confirmed.
* @returns {boolean} true if user confirms import
*
*/
confirmPubkeyImport(parentWindow, keyPreview, outputParams) {
// For TB 78 compatibility
let w =
"browsingContext" in parentWindow
? parentWindow.browsingContext.topChromeWindow
: parentWindow.docShell.rootTreeItem.domWindow;
let args = {
keys: keyPreview,
confirmed: false,
acceptance: "",
};
w.openDialog(
parentWindow.browsingContext.topChromeWindow.openDialog(
"chrome://openpgp/content/ui/confirmPubkeyImport.xhtml",
"",
"dialog,modal,centerscreen,resizable",
@ -476,7 +471,6 @@ var EnigmailDialog = {
if (args.confirmed && outputParams) {
outputParams.acceptance = args.acceptance;
}
return args.confirmed;
},
};

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

@ -1242,13 +1242,6 @@ function getSortColumn() {
* the import or create screen as requested by the user.
*/
function openKeyWizard(isImport = false) {
// Bug 1638153: The rootTreeItem object has been removed after 78. We need to
// the availability of "browsingContext" to use the right DOM window in 79+.
let w =
"browsingContext" in window
? window.browsingContext.topChromeWindow
: window.docShell.rootTreeItem.domWindow;
let args = {
gSubDialog: null,
cancelCallback: clearKeyCache,
@ -1260,7 +1253,7 @@ function openKeyWizard(isImport = false) {
isImport,
};
w.openDialog(
window.browsingContext.topChromeWindow.openDialog(
"chrome://openpgp/content/ui/keyWizard.xhtml",
"enigmail:KeyWizard",
"dialog,modal,centerscreen,resizable",

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

@ -380,22 +380,13 @@ function updateMailPaneUI() {
* Open the OpenPGP Key Manager from outside the Account Settings.
*/
function openKeyManager() {
// Bug 1638153: The rootTreeItem object has been removed after 78. We need to
// the availability of "browsingContext" to use the right DOM window in 79+.
let w =
"browsingContext" in window
? window.browsingContext.topChromeWindow
: window.docShell.rootTreeItem.domWindow;
let args = {
cancelCallback: null,
okCallback: null,
};
w.openDialog(
window.browsingContext.topChromeWindow.openDialog(
"chrome://openpgp/content/ui/enigmailKeyManager.xhtml",
"enigmail:KeyManager",
"dialog,centerscreen,resizable",
args
{
cancelCallback: null,
okCallback: null,
}
);
}