Bug 1613920 - Port to bug 1612477 - Remove `nsIDocumentStateListener::NotifyDocumentCreated()` to Thunderbird. r=khushil
authorMagnus Melin <mkmelin+mozilla@iki.fi>
Sun, 09 Feb 2020 21:51:26 +0200
changeset 37267 352a5f7465f3274c51d6cd58952714585396aabc
parent 37266 25e74f6bf106447c569c5fec01c50a2f223be1bd
child 37268 0a9ab01b088ca0f26cdefa1e62fce49c1dc36ed3
push id2552
push userclokep@gmail.com
push dateMon, 10 Feb 2020 21:24:16 +0000
treeherdercomm-beta@f95a6f4408a3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskhushil
bugs1613920, 1612477
Bug 1613920 - Port to bug 1612477 - Remove `nsIDocumentStateListener::NotifyDocumentCreated()` to Thunderbird. r=khushil
mail/components/compose/content/editor.js
mail/extensions/openpgp/content/ui/enigmailMsgComposeOverlay.js
mailnews/compose/src/nsMsgCompose.cpp
--- a/mail/components/compose/content/editor.js
+++ b/mail/components/compose/content/editor.js
@@ -93,38 +93,23 @@ var gFontSizeNames = [
   "xx-large",
 ];
 
 var nsIFilePicker = Ci.nsIFilePicker;
 
 var kUseCssPref = "editor.use_css";
 var kCRInParagraphsPref = "editor.CR_creates_new_p";
 
-const gSourceTextListener = {
-  NotifyDocumentCreated() {},
-  NotifyDocumentWillBeDestroyed() {},
-  NotifyDocumentStateChanged(isChanged) {
-    window.updateCommands("save");
-  },
-};
-
-const gSourceTextObserver = {
-  observe(aSubject, aTopic, aData) {
-    // we currently only use this to update undo
-    window.updateCommands("undo");
-  },
-};
-
 // This should be called by all editor users when they close their window.
 function EditorCleanup() {
   SwitchInsertCharToAnotherEditorOrClose();
 }
 
+/** @implements {nsIDocumentStateListener} */
 var DocumentReloadListener = {
-  NotifyDocumentCreated() {},
   NotifyDocumentWillBeDestroyed() {},
 
   NotifyDocumentStateChanged(isNowDirty) {
     var editor = GetCurrentEditor();
     try {
       // unregister the listener to prevent multiple callbacks
       editor.removeDocumentStateListener(DocumentReloadListener);
 
--- a/mail/extensions/openpgp/content/ui/enigmailMsgComposeOverlay.js
+++ b/mail/extensions/openpgp/content/ui/enigmailMsgComposeOverlay.js
@@ -5240,20 +5240,16 @@ Enigmail.composeStateListener = {
       QueryInterface: function(iid) {
         if (!iid.equals(Components.interfaces.nsIDocumentStateListener) &&
           !iid.equals(Components.interfaces.nsISupports))
           throw Components.results.NS_ERROR_NO_INTERFACE;
 
         return this;
       },
 
-      NotifyDocumentCreated: function() {
-        EnigmailLog.DEBUG("enigmailMsgComposeOverlay.js: EDSL.NotifyDocumentCreated\n");
-      },
-
       NotifyDocumentWillBeDestroyed: function() {
         EnigmailLog.DEBUG("enigmailMsgComposeOverlay.js: EDSL.enigDocStateListener.NotifyDocumentWillBeDestroyed\n");
       },
 
       NotifyDocumentStateChanged: function(nowDirty) {
         EnigmailLog.DEBUG("enigmailMsgComposeOverlay.js: EDSL.enigDocStateListener.NotifyDocumentStateChanged\n");
       }
     };
--- a/mailnews/compose/src/nsMsgCompose.cpp
+++ b/mailnews/compose/src/nsMsgCompose.cpp
@@ -1575,18 +1575,16 @@ MOZ_CAN_RUN_SCRIPT_BOUNDARY NS_IMETHODIM
                     NS_ERROR_FAILURE);
   if (childCV) {
     // SetForceCharacterSet will complain about "UTF-7" or "x-mac-croatian"
     // (see test-charset-edit.js), but we deal with this elsewhere.
     rv = childCV->SetForceCharacterSet(msgCharSet);
     NS_WARNING_ASSERTION(NS_SUCCEEDED(rv), "SetForceCharacterSet() failed");
   }
 
-  // This is what used to be done in mDocumentListener,
-  //   nsMsgDocumentStateListener::NotifyDocumentCreated()
   bool quotingToFollow = false;
   GetQuotingToFollow(&quotingToFollow);
   if (quotingToFollow)
     return BuildQuotedMessageAndSignature();
   else {
     NotifyStateListeners(nsIMsgComposeNotificationType::ComposeFieldsReady,
                          NS_OK);
     rv = BuildBodyMessageAndSignature();