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