Bug 1351453 - Part 2: Deprecate the prettiestName attribute of nsIMsgFolder. r=aceman
☠☠ backed out by 68f3ff4e37c9 ☠ ☠
authorKushal Singh <kushal.spiderman.singh@gmail.com>
Mon, 29 May 2017 03:05:06 +0530
changeset 28241 069cc93a3e3bd88d682e7899dc5b53722a174d2b
parent 28240 2662981ddb0984098f4e74844ac7e973ac7fab80
child 28242 68f3ff4e37c98cef894272dff35e851d3dbcb772
push id1966
push userclokep@gmail.com
push dateMon, 12 Jun 2017 16:57:35 +0000
treeherdercomm-beta@32d9b8d10da1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersaceman
bugs1351453
Bug 1351453 - Part 2: Deprecate the prettiestName attribute of nsIMsgFolder. r=aceman
mailnews/base/public/nsIMsgFolder.idl
mailnews/base/util/nsMsgDBFolder.cpp
--- a/mailnews/base/public/nsIMsgFolder.idl
+++ b/mailnews/base/public/nsIMsgFolder.idl
@@ -41,16 +41,17 @@ interface nsIMsgFolder : nsISupports {
   readonly attribute nsISimpleEnumerator messages;
 
   void startFolderLoading();
   void endFolderLoading();
 
   /* get new headers for db */
   void updateFolder(in nsIMsgWindow aWindow);
 
+  // [deprecated]
   readonly attribute AString prettiestName;
 
   /**
    * URL for this folder
    */
   readonly attribute ACString folderURL;
 
   /**
--- a/mailnews/base/util/nsMsgDBFolder.cpp
+++ b/mailnews/base/util/nsMsgDBFolder.cpp
@@ -64,16 +64,18 @@
 #include <algorithm>
 #define oneHour 3600000000U
 #include "nsMsgUtils.h"
 #include "nsIMsgFilterService.h"
 #include "nsDirectoryServiceUtils.h"
 #include "mozilla/Services.h"
 #include "nsMimeTypes.h"
 #include "nsIMsgFilter.h"
+#include "nsIConsoleService.h"
+#include "nsIScriptError.h"
 
 static PRTime gtimeOfLastPurgeCheck;    //variable to know when to check for purge_threshhold
 
 #define PREF_MAIL_PROMPT_PURGE_THRESHOLD "mail.prompt_purge_threshhold"
 #define PREF_MAIL_PURGE_THRESHOLD "mail.purge_threshhold"
 #define PREF_MAIL_PURGE_THRESHOLD_MB "mail.purge_threshhold_mb"
 #define PREF_MAIL_PURGE_MIGRATED "mail.purge_threshold_migrated"
 #define PREF_MAIL_PURGE_ASK "mail.purge.ask"
@@ -3530,16 +3532,33 @@ NS_IMETHODIMP nsMsgDBFolder::GetChildWit
       }
     }
   }
   return NS_OK;
 }
 
 NS_IMETHODIMP nsMsgDBFolder::GetPrettiestName(nsAString& name)
 {
+  if (NS_IsMainThread()) {
+    nsCOMPtr<nsIConsoleService> cs = do_GetService(NS_CONSOLESERVICE_CONTRACTID);
+
+    if (cs) {
+      nsCString msg(__FUNCTION__);
+      msg.AppendLiteral(" is deprecated and will be removed soon.");
+
+      nsCOMPtr<nsIScriptError> e = do_CreateInstance(NS_SCRIPTERROR_CONTRACTID);
+      if (e && NS_SUCCEEDED(e->Init(NS_ConvertUTF8toUTF16(msg), EmptyString(),
+                                    EmptyString(), 0, 0,
+                                    nsIScriptError::warningFlag, "mailnews"))) {
+        cs->LogMessage(e);
+      }
+    }
+  }
+  NS_WARNING("You are trying to use the deprecated attribute 'prettiestName'.");
+
   if (NS_SUCCEEDED(GetPrettyName(name)))
     return NS_OK;
   return GetName(name);
 }
 
 
 NS_IMETHODIMP nsMsgDBFolder::GetShowDeletedMessages(bool *showDeletedMessages)
 {