Bug 1599031 - Add ability to query build time option MOZ_OPENPGP from JS. r=mkmelin DONTBUILD
authorKai Engert <kaie@kuix.de>
Sat, 30 Nov 2019 11:55:10 +0100
changeset 36754 c35cc8809feae83b247ca14d2d6f9e214dbbd476
parent 36753 c006cb1d5b5bdc9c88c05a3dfa9c22a059608c47
child 36755 377bb360e57c7a00db30df65402231f6b901a50f
push id2534
push userclokep@gmail.com
push dateMon, 02 Dec 2019 19:52:51 +0000
treeherdercomm-beta@055c50840778 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmkmelin
bugs1599031
Bug 1599031 - Add ability to query build time option MOZ_OPENPGP from JS. r=mkmelin DONTBUILD Relanding after lint fixes.
.eslintignore
mail/base/content/messageWindow.xul
mail/base/content/messenger.xul
mail/base/content/msgHdrPopup.inc.xul
mail/base/content/msgHdrView.js
mail/base/modules/MailConstants.jsm
mail/base/modules/moz.build
--- a/.eslintignore
+++ b/.eslintignore
@@ -74,16 +74,19 @@ mail/branding/thunderbird/thunderbird-br
 # for documentation purposes (policies.json) but to be accessed by the
 # code as a .jsm (schema.jsm)
 mail/components/enterprisepolicies/schemas/schema.jsm
 mail/components/im/all-im.js
 mail/locales/en-US/all-l10n.js
 mail/components/compose/texzilla/**
 mail/components/compose/composer.js
 
+# exclude MailConstants.jsm because: #filter subtitution
+mail/base/modules/MailConstants.jsm
+
 # openpgp exclusions, should get enabled, tracked in bug 1595319
 mail/extensions/openpgp/**
 
 # calendar/ exclusions
 
 # prefs files
 calendar/lightning/content/lightning.js
 calendar/providers/gdata/defaults/preferences.js
--- a/mail/base/content/messageWindow.xul
+++ b/mail/base/content/messageWindow.xul
@@ -37,16 +37,20 @@
 <!ENTITY % utilityDTD SYSTEM "chrome://communicator/locale/utilityOverlay.dtd">
 %utilityDTD;
 <!ENTITY % charsetDTD SYSTEM "chrome://global/locale/charsetMenu.dtd">
 %charsetDTD;
 <!ENTITY % viewZoomOverlayDTD SYSTEM "chrome://messenger/locale/viewZoomOverlay.dtd">
 %viewZoomOverlayDTD;
 <!ENTITY % msgReadSMIMEDTD SYSTEM "chrome://messenger-smime/locale/msgReadSMIMEOverlay.dtd">
 %msgReadSMIMEDTD;
+#ifdef MOZ_OPENPGP
+<!ENTITY % bondOpenPGPDTD SYSTEM "chrome://openpgp/content/strings/bond.dtd">
+%bondOpenPGPDTD;
+#endif
 <!ENTITY % quickFilterBarDTD SYSTEM "chrome://messenger/locale/quickFilterBar.dtd">
 %quickFilterBarDTD;
 <!ENTITY % msgViewPickerDTD SYSTEM "chrome://messenger/locale/msgViewPickerOverlay.dtd" >
 %msgViewPickerDTD;
 ]>
 
 <!--
   - This window displays a single message.
@@ -94,16 +98,21 @@
   <script src="chrome://communicator/content/contentAreaClick.js"/>
   <script src="chrome://global/content/nsDragAndDrop.js"/>
   <script src="chrome://messenger/content/msgViewNavigation.js"/>
   <script src="chrome://messenger/content/editContactPanel.js"/>
   <script src="chrome://messenger/content/toolbarIconColor.js"/>
   <script src="chrome://messenger/content/msgHdrView.js"/>
   <script src="chrome://messenger-smime/content/msgHdrViewSMIMEOverlay.js"/>
   <script src="chrome://messenger-smime/content/msgReadSMIMEOverlay.js"/>
+#ifdef MOZ_OPENPGP
+  <script src="chrome://openpgp/content/bond.js"/>
+  <script src="chrome://openpgp/content/ui/enigmailMessengerOverlay.js"/>
+  <script src="chrome://openpgp/content/ui/enigmailMsgHdrViewOverlay.js"/>
+#endif
   <script src="chrome://messenger/content/mailCommands.js"/>
   <script src="chrome://messenger/content/junkCommands.js"/>
   <script src="chrome://messenger/content/mailWindowOverlay.js"/>
   <script src="chrome://messenger/content/mailTabs.js"/>
   <script src="chrome://messenger-newsblog/content/newsblogOverlay.js"/>
   <script src="chrome://messenger/content/mail-offline.js"/>
   <script src="chrome://global/content/printUtils.js"/>
   <script src="chrome://messenger/content/msgViewPickerOverlay.js"/>
--- a/mail/base/content/messenger.xul
+++ b/mail/base/content/messenger.xul
@@ -131,16 +131,18 @@
 <script src="chrome://messenger/content/toolbarIconColor.js"/>
 <script src="chrome://messenger/content/jsTreeView.js"/>
 <script src="chrome://messenger/content/msgHdrView.js"/>
 <script src="chrome://global/content/nsDragAndDrop.js"/>
 <script src="chrome://messenger-smime/content/msgHdrViewSMIMEOverlay.js"/>
 <script src="chrome://messenger-smime/content/msgReadSMIMEOverlay.js"/>
 #ifdef MOZ_OPENPGP
 <script src="chrome://openpgp/content/bond.js"/>
+<script src="chrome://openpgp/content/ui/enigmailMessengerOverlay.js"/>
+<script src="chrome://openpgp/content/ui/enigmailMsgHdrViewOverlay.js"/>
 #endif
 <script src="chrome://messenger/content/chat/chat-messenger.js"/>
 <script src="chrome://messenger/content/chat/imStatusSelector.js"/>
 <script src="chrome://messenger/content/chat/imContextMenu.js"/>
 <script src="chrome://messenger/content/chat/chat-conversation.js"/>
 <script src="chrome://messenger/content/preferences/preferencesTab.js"/>
 <script src="chrome://messenger/content/mailCore.js"/>
 <script src="chrome://messenger/content/mailCommands.js"/>
--- a/mail/base/content/msgHdrPopup.inc.xul
+++ b/mail/base/content/msgHdrPopup.inc.xul
@@ -53,16 +53,19 @@
 #ifdef XP_MACOSX
               label="&detachedAttachmentFolder.showMac.label;"
               accesskey="&detachedAttachmentFolder.showMac.accesskey;"
 #else
               label="&detachedAttachmentFolder.show.label;"
               accesskey="&detachedAttachmentFolder.show.accesskey;"
 #endif
               oncommand="HandleMultipleAttachments(this.parentNode.attachments, 'openFolder');"/>
+#ifdef MOZ_OPENPGP
+#include ../../extensions/openpgp/content/ui/attachmentItemContext.inc.xul
+#endif
   </menupopup>
 
   <menupopup id="attachmentListContext"
              onpopupshowing="goUpdateAttachmentCommands();">
     <menuitem id="context-openAllAttachments"
               label="&openAllAttachmentsCmd.label;"
               accesskey="&openAllAttachmentsCmd.accesskey;"
               command="cmd_openAllAttachments"/>
--- a/mail/base/content/msgHdrView.js
+++ b/mail/base/content/msgHdrView.js
@@ -7,20 +7,24 @@
  * message pane.
  */
 
 /* import-globals-from editContactPanel.js */
 /* import-globals-from folderDisplay.js */
 /* import-globals-from mailWindow.js */
 /* import-globals-from messageDisplay.js */
 /* import-globals-from nsDragAndDrop.js */
+/* global Enigmail */
 
 var { XPCOMUtils } = ChromeUtils.import(
   "resource://gre/modules/XPCOMUtils.jsm"
 );
+var { MailConstants } = ChromeUtils.import(
+  "resource:///modules/MailConstants.jsm"
+);
 var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
 var { DisplayNameUtils } = ChromeUtils.import(
   "resource:///modules/DisplayNameUtils.jsm"
 );
 var { MailServices } = ChromeUtils.import(
   "resource:///modules/MailServices.jsm"
 );
 var { GlodaUtils } = ChromeUtils.import("resource:///modules/gloda/utils.js");
@@ -2293,16 +2297,20 @@ function onShowAttachmentItemContextMenu
   saveMenu.disabled = allSelectedDeleted;
   detachMenu.disabled = !canDetachSelected;
   deleteMenu.disabled = !canDetachSelected;
   copyUrlMenuSep.hidden = copyUrlMenu.hidden = !(
     allSelectedHttp || allSelectedFile
   );
   openFolderMenu.hidden = !allSelectedFile;
   openFolderMenu.disabled = allSelectedDeleted;
+
+  if (MailConstants.MOZ_OPENPGP) {
+    Enigmail.hdrView.onShowAttachmentContextMenu();
+  }
 }
 
 /**
  * Close the attachment item context menu, performing any cleanup as necessary.
  */
 function onHideAttachmentItemContextMenu() {
   let attachmentName = document.getElementById("attachmentName");
   let contextMenu = document.getElementById("attachmentItemContext");
new file mode 100644
--- /dev/null
+++ b/mail/base/modules/MailConstants.jsm
@@ -0,0 +1,20 @@
+#filter substitution
+/* 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";
+
+var EXPORTED_SYMBOLS = ["MailConstants"];
+
+// Immutable for export.
+var MailConstants = Object.freeze({
+
+  MOZ_OPENPGP:
+#ifdef MOZ_OPENPGP
+  true,
+#else
+  false,
+#endif
+
+});
--- a/mail/base/modules/moz.build
+++ b/mail/base/modules/moz.build
@@ -21,16 +21,20 @@ EXTRA_JS_MODULES += [
     'SearchSpec.jsm',
     'SessionStoreManager.jsm',
     'SummaryFrameManager.jsm',
     'TagUtils.jsm',
     'TBDistCustomizer.jsm',
     'Windows8WindowFrameColor.jsm',
 ]
 
+EXTRA_PP_JS_MODULES += [
+    'MailConstants.jsm',
+]
+
 if CONFIG['MOZ_UPDATER']:
     EXTRA_JS_MODULES += [
         'AppUpdateUI.jsm',
     ]
 
 FINAL_TARGET_FILES.modules += [
     'ThemeVariableMap.jsm'
 ]