Bug 1799764 - Reinstate OpenPGP UI code and enable some tests. r=aleca
Differential Revision: https://phabricator.services.mozilla.com/D162688 --HG-- extra : rebase_source : 056408c81be89568b56e4775809e9a9191b90145 extra : source : d5fa37cb60ce653ed2380b0c292976d1fd20a14e
This commit is contained in:
Родитель
e1019aba91
Коммит
bec832518f
|
@ -295,11 +295,11 @@ window.addEventListener("DOMContentLoaded", event => {
|
|||
}
|
||||
|
||||
if (gFolder.isSpecialFolder(Ci.nsMsgFolderFlags.Drafts, true)) {
|
||||
commandController.doCommand("cmd_editDraftMsg");
|
||||
commandController.doCommand("cmd_editDraftMsg", event);
|
||||
} else if (gFolder.isSpecialFolder(Ci.nsMsgFolderFlags.Templates, true)) {
|
||||
commandController.doCommand("cmd_newMsgFromTemplate");
|
||||
commandController.doCommand("cmd_newMsgFromTemplate", event);
|
||||
} else {
|
||||
commandController.doCommand("cmd_openMessage");
|
||||
commandController.doCommand("cmd_openMessage", event);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* 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/. */
|
||||
|
||||
/* globals MailE10SUtils */
|
||||
/* globals Enigmail, MailE10SUtils */
|
||||
|
||||
// mailCommon.js
|
||||
/* globals commandController, dbViewWrapperListener */
|
||||
|
@ -126,6 +126,9 @@ window.addEventListener("DOMContentLoaded", event => {
|
|||
content = document.querySelector("browser");
|
||||
OnLoadMsgHeaderPane();
|
||||
|
||||
Enigmail.msg.messengerStartup();
|
||||
Enigmail.hdrView.hdrViewLoad();
|
||||
|
||||
// The folder listener only does something interesting if this is a
|
||||
// standalone window or tab, so don't add it if we're inside about:3pane.
|
||||
if (window.browsingContext.parent.currentURI.spec != "about:3pane") {
|
||||
|
|
|
@ -62,6 +62,8 @@
|
|||
<script defer="defer" src="chrome://messenger/content/editContactPanel.js"></script>
|
||||
<script defer="defer" src="chrome://messenger/content/header-fields.js"></script>
|
||||
<script defer="defer" src="chrome://messenger/content/mail-offline.js"></script>
|
||||
<script defer="defer" src="chrome://messenger-smime/content/msgHdrViewSMIMEOverlay.js"></script>
|
||||
<script defer="defer" src="chrome://messenger-smime/content/msgReadSMIMEOverlay.js"></script>
|
||||
<script defer="defer" src="chrome://openpgp/content/ui/enigmailMessengerOverlay.js"></script>
|
||||
<script defer="defer" src="chrome://openpgp/content/ui/enigmailMsgHdrViewOverlay.js"></script>
|
||||
<script defer="defer" src="chrome://messenger/content/msgSecurityPane.js"></script>
|
||||
|
|
|
@ -10,9 +10,6 @@ const EXPORTED_SYMBOLS = ["EnigmailVerify"];
|
|||
* Module for handling PGP/MIME signed messages implemented as JS module.
|
||||
*/
|
||||
|
||||
const { MailServices } = ChromeUtils.import(
|
||||
"resource:///modules/MailServices.jsm"
|
||||
);
|
||||
const { XPCOMUtils } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/XPCOMUtils.sys.mjs"
|
||||
);
|
||||
|
@ -55,7 +52,7 @@ function MimeVerify(protocol) {
|
|||
|
||||
var EnigmailVerify = {
|
||||
_initialized: false,
|
||||
lastMsgWindow: null,
|
||||
lastWindow: null,
|
||||
lastMsgUri: null,
|
||||
manualMsgUri: null,
|
||||
|
||||
|
@ -76,10 +73,10 @@ var EnigmailVerify = {
|
|||
}
|
||||
},
|
||||
|
||||
setMsgWindow(msgWindow, msgUriSpec) {
|
||||
LOCAL_DEBUG("mimeVerify.jsm: setMsgWindow: " + msgUriSpec + "\n");
|
||||
setWindow(window, msgUriSpec) {
|
||||
LOCAL_DEBUG("mimeVerify.jsm: setWindow: " + msgUriSpec + "\n");
|
||||
|
||||
this.lastMsgWindow = msgWindow;
|
||||
this.lastWindow = window;
|
||||
this.lastMsgUri = msgUriSpec;
|
||||
},
|
||||
|
||||
|
@ -154,10 +151,9 @@ MimeVerify.prototype = {
|
|||
dataCount: 0,
|
||||
foundMsg: false,
|
||||
startMsgStr: "",
|
||||
msgWindow: null,
|
||||
window: null,
|
||||
msgUriSpec: null,
|
||||
statusDisplayed: false,
|
||||
window: null,
|
||||
inStream: null,
|
||||
sigFile: null,
|
||||
sigData: "",
|
||||
|
@ -165,36 +161,6 @@ MimeVerify.prototype = {
|
|||
|
||||
QueryInterface: ChromeUtils.generateQI(["nsIStreamListener"]),
|
||||
|
||||
startStreaming(window, msgWindow, msgUriSpec) {
|
||||
LOCAL_DEBUG("mimeVerify.jsm: startStreaming\n");
|
||||
|
||||
this.msgWindow = msgWindow;
|
||||
this.msgUriSpec = msgUriSpec;
|
||||
this.window = window;
|
||||
let msgSvc = MailServices.messageServiceFromURI(this.msgUriSpec);
|
||||
|
||||
msgSvc.streamMessage(
|
||||
this.msgUriSpec,
|
||||
this,
|
||||
this.msgWindow,
|
||||
null,
|
||||
false,
|
||||
null,
|
||||
false
|
||||
);
|
||||
},
|
||||
|
||||
verifyData(window, msgWindow, msgUriSpec, data) {
|
||||
LOCAL_DEBUG("mimeVerify.jsm: streamFromChannel\n");
|
||||
|
||||
this.msgWindow = msgWindow;
|
||||
this.msgUriSpec = msgUriSpec;
|
||||
this.window = window;
|
||||
this.onStartRequest();
|
||||
this.onTextData(data);
|
||||
this.onStopRequest();
|
||||
},
|
||||
|
||||
parseContentType() {
|
||||
let contentTypeLine = this.mimeSvc.contentType;
|
||||
|
||||
|
@ -495,7 +461,7 @@ MimeVerify.prototype = {
|
|||
onStopRequest() {
|
||||
lazy.EnigmailLog.DEBUG("mimeVerify.jsm: onStopRequest\n");
|
||||
|
||||
this.msgWindow = EnigmailVerify.lastMsgWindow;
|
||||
this.window = EnigmailVerify.lastWindow;
|
||||
this.msgUriSpec = EnigmailVerify.lastMsgUri;
|
||||
|
||||
this.backgroundJob = false;
|
||||
|
@ -610,8 +576,7 @@ MimeVerify.prototype = {
|
|||
}
|
||||
|
||||
if (this.protocol === PGPMIME_PROTO) {
|
||||
var windowManager = Services.wm;
|
||||
var win = windowManager.getMostRecentWindow(null);
|
||||
let win = this.window;
|
||||
|
||||
if (!lazy.EnigmailDecryption.isReady(win)) {
|
||||
return;
|
||||
|
@ -678,13 +643,11 @@ MimeVerify.prototype = {
|
|||
this.mimeSvc.outputDecryptedData(data, data.length);
|
||||
},
|
||||
|
||||
setMsgWindow(msgWindow, msgUriSpec) {
|
||||
lazy.EnigmailLog.DEBUG(
|
||||
"mimeVerify.jsm: setMsgWindow: " + msgUriSpec + "\n"
|
||||
);
|
||||
setWindow(window, msgUriSpec) {
|
||||
lazy.EnigmailLog.DEBUG("mimeVerify.jsm: setWindow: " + msgUriSpec + "\n");
|
||||
|
||||
if (!this.msgWindow) {
|
||||
this.msgWindow = msgWindow;
|
||||
if (!this.window) {
|
||||
this.window = window;
|
||||
this.msgUriSpec = msgUriSpec;
|
||||
}
|
||||
},
|
||||
|
@ -693,7 +656,7 @@ MimeVerify.prototype = {
|
|||
lazy.EnigmailLog.DEBUG("mimeVerify.jsm: displayStatus\n");
|
||||
if (
|
||||
this.exitCode === null ||
|
||||
this.msgWindow === null ||
|
||||
this.window === null ||
|
||||
this.statusDisplayed ||
|
||||
this.backgroundJob
|
||||
) {
|
||||
|
|
|
@ -567,10 +567,7 @@ Enigmail.hdrView = {
|
|||
|
||||
try {
|
||||
Enigmail.hdrView.statusBarHide();
|
||||
EnigmailVerify.setMsgWindow(
|
||||
msgWindow,
|
||||
Enigmail.msg.getCurrentMsgUriSpec()
|
||||
);
|
||||
EnigmailVerify.setWindow(window, Enigmail.msg.getCurrentMsgUriSpec());
|
||||
|
||||
let msgFrame = document.getElementById("messagepane").contentDocument;
|
||||
|
||||
|
@ -600,6 +597,7 @@ Enigmail.hdrView = {
|
|||
);
|
||||
|
||||
try {
|
||||
EnigmailVerify.setWindow(null, null);
|
||||
Enigmail.hdrView.statusBarHide();
|
||||
} catch (ex) {}
|
||||
},
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
/* import-globals-from ../../../../mailnews/extensions/smime/msgReadSMIMEOverlay.js */
|
||||
/* import-globals-from ../../../base/content/folderDisplay.js */
|
||||
/* import-globals-from ../../../base/content/mailWindow.js */
|
||||
/* import-globals-from ../../../base/content/msgHdrView.js */
|
||||
|
||||
var gEncryptedURIService = null;
|
||||
|
@ -291,21 +289,22 @@ var smimeHeaderSink = {
|
|||
.GetStringFromName("CantDecryptBody")
|
||||
.replace(/%brand%/g, brand);
|
||||
|
||||
// insert our message
|
||||
msgWindow.displayHTMLInMessagePane(
|
||||
title,
|
||||
"<html>\n" +
|
||||
'<body bgcolor="#fafaee">\n' +
|
||||
"<center><br><br><br>\n" +
|
||||
"<table>\n" +
|
||||
"<tr><td>\n" +
|
||||
'<center><strong><font size="+3">\n' +
|
||||
title +
|
||||
"</font></center><br>\n" +
|
||||
body +
|
||||
"\n" +
|
||||
"</td></tr></table></center></body></html>",
|
||||
false
|
||||
// TODO: This should be replaced with a real page, and made not ugly.
|
||||
HideMessageHeaderPane();
|
||||
MailE10SUtils.loadURI(
|
||||
content,
|
||||
"data:text/html;base64," +
|
||||
btoa(
|
||||
`<html>
|
||||
<head>
|
||||
<title>${title}</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>${title}</h1>
|
||||
${body}
|
||||
</body>
|
||||
</html>`
|
||||
)
|
||||
);
|
||||
break;
|
||||
}
|
||||
|
@ -386,7 +385,7 @@ function msgHdrViewSMIMEOnLoad(event) {
|
|||
|
||||
// we want to register our security header sink as an opaque nsISupports
|
||||
// on the msgHdrSink used by mail.....
|
||||
msgWindow.msgHeaderSink.securityInfo = smimeHeaderSink;
|
||||
top.msgWindow.msgHeaderSink.securityInfo = smimeHeaderSink;
|
||||
|
||||
// Add ourself to the list of message display listeners so we get notified
|
||||
// when we are about to display a message.
|
||||
|
|
|
@ -9,11 +9,12 @@ prefs =
|
|||
mailnews.start_page.url=about:blank
|
||||
subsuite = thunderbird
|
||||
support-files = ../data/**
|
||||
skip-if = true # TODO
|
||||
|
||||
[browser_composeSigned.js]
|
||||
skip-if = debug # Bug 1673652 - L10NRegistry throws NS_ERROR_FILE_UNRECOGNIZED_PATH
|
||||
skip-if = true # TODO
|
||||
# skip-if = debug # Bug 1673652 - L10NRegistry throws NS_ERROR_FILE_UNRECOGNIZED_PATH
|
||||
[browser_composeEncrypted.js]
|
||||
skip-if = debug # Bug 1673652 - L10NRegistry throws NS_ERROR_FILE_UNRECOGNIZED_PATH
|
||||
skip-if = true # TODO
|
||||
# skip-if = debug # Bug 1673652 - L10NRegistry throws NS_ERROR_FILE_UNRECOGNIZED_PATH
|
||||
[browser_composeSwitchIdentity.js]
|
||||
skip-if = debug # Bug 1673652 - L10NRegistry throws NS_ERROR_FILE_UNRECOGNIZED_PATH
|
||||
|
|
|
@ -31,37 +31,14 @@ registerCleanupFunction(function() {
|
|||
load(gDEPTH + "mailnews/resources/mailShutdown.js");
|
||||
});
|
||||
|
||||
function apply_mime_conversion(msgUri, headerSink = {}, msgWindow = undefined) {
|
||||
let stubHeaderSink = {
|
||||
securityInfo: null,
|
||||
QueryInterface: ChromeUtils.generateQI(["nsIMsgHeaderSink"]),
|
||||
};
|
||||
|
||||
// Copy the descriptors from headerSink to stubHeaderSink.
|
||||
let fullHeaderSink = Object.create(headerSink);
|
||||
for (let name of Object.getOwnPropertyNames(stubHeaderSink)) {
|
||||
if (!(name in headerSink)) {
|
||||
Object.defineProperty(
|
||||
fullHeaderSink,
|
||||
name,
|
||||
Object.getOwnPropertyDescriptor(stubHeaderSink, name)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
msgWindow =
|
||||
msgWindow ||
|
||||
Cc["@mozilla.org/messenger/msgwindow;1"].createInstance(Ci.nsIMsgWindow);
|
||||
|
||||
msgWindow.msgHeaderSink = fullHeaderSink;
|
||||
|
||||
function apply_mime_conversion(msgUri, smimeHeaderSink) {
|
||||
let service = MailServices.messageServiceFromURI(msgUri);
|
||||
|
||||
// This is what we listen on in the end.
|
||||
let listener = new PromiseTestUtils.PromiseStreamListener();
|
||||
|
||||
// Make the underlying channel--we need this for the converter parameter.
|
||||
let url = service.getUrlForUri(msgUri, msgWindow);
|
||||
let url = service.getUrlForUri(msgUri);
|
||||
|
||||
let channel = Services.io.newChannelFromURI(
|
||||
url,
|
||||
|
|
|
@ -322,25 +322,15 @@ add_task(async function testMimeDecryptOpenPGPMessages() {
|
|||
let uri = hdr.folder.getUriForMsg(hdr);
|
||||
let sinkPromise = headerSink.expectResults(expectedResultCount);
|
||||
|
||||
let msgWindow = Cc["@mozilla.org/messenger/msgwindow;1"].createInstance(
|
||||
Ci.nsIMsgWindow
|
||||
);
|
||||
|
||||
// Set the message window so displayStatus() invokes the hooks we are
|
||||
// interested in.
|
||||
EnigmailVerify.lastMsgWindow = msgWindow;
|
||||
EnigmailVerify.lastWindow = {};
|
||||
|
||||
// Stub this function so verifyDetached() can get the correct email.
|
||||
EnigmailDecryption.getFromAddr = () => test.from;
|
||||
|
||||
// Trigger the actual mime work.
|
||||
let conversion = apply_mime_conversion(
|
||||
uri,
|
||||
{
|
||||
securityInfo: headerSink,
|
||||
},
|
||||
msgWindow
|
||||
);
|
||||
let conversion = apply_mime_conversion(uri, headerSink);
|
||||
|
||||
await conversion.promise;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче