Bug 813459 - convert OnItemIntPropertyChanged listener to 64bit. r=irving, r=Neil, a=me
authoraceman <acelists@atlas.sk>
Mon, 17 Nov 2014 03:48:00 +0200
changeset 21314 f54859b9c9d3dc9abbb756f2ad4c4da09234f4a3
parent 21313 93f4e62465fdaff4ab6192e98694d89557e040af
child 21315 f406c1f5ded742a46bb55fc0e3a2d0b7b2915e6d
push id1274
push usermbanner@mozilla.com
push dateMon, 12 Jan 2015 19:54:49 +0000
treeherdercomm-beta@baea280adc1c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersirving, Neil, me
bugs813459
Bug 813459 - convert OnItemIntPropertyChanged listener to 64bit. r=irving, r=Neil, a=me
mailnews/base/public/nsIFolderListener.idl
mailnews/base/public/nsIMsgFolder.idl
mailnews/base/public/nsMsgFolderFlags.idl
mailnews/base/src/nsMessenger.cpp
mailnews/base/src/nsMessengerOSXIntegration.mm
mailnews/base/src/nsMessengerUnixIntegration.cpp
mailnews/base/src/nsMessengerWinIntegration.cpp
mailnews/base/src/nsMsgAccountManager.cpp
mailnews/base/src/nsMsgAccountManagerDS.cpp
mailnews/base/src/nsMsgFolderDataSource.cpp
mailnews/base/src/nsMsgMailSession.cpp
mailnews/base/src/nsStatusBarBiffManager.cpp
mailnews/base/util/nsMsgDBFolder.cpp
mailnews/compose/src/nsMsgSendLater.cpp
mailnews/local/src/nsLocalUndoTxn.cpp
--- a/mailnews/base/public/nsIFolderListener.idl
+++ b/mailnews/base/public/nsIFolderListener.idl
@@ -6,37 +6,39 @@
 #include "nsISupports.idl"
 #include "nsIAtom.idl"
 
 interface nsIMsgFolder;
 interface nsIMsgDBHdr;
 
 typedef unsigned long folderListenerNotifyFlagValue;
 
-[scriptable, uuid(f60ee1a2-6d81-422c-958f-d408b1b2daa6)]
+[scriptable, uuid(f60ee1a2-6d81-422c-958f-d408b1b2daa7)]
 interface nsIFolderListener : nsISupports {
   const folderListenerNotifyFlagValue added = 0x1;
   void OnItemAdded(in nsIMsgFolder aParentItem,
                    in nsISupports aItem);
   
   const folderListenerNotifyFlagValue removed = 0x2;
   void OnItemRemoved(in nsIMsgFolder aParentItem,
                      in nsISupports aItem);
   
   const folderListenerNotifyFlagValue propertyChanged = 0x4;
   void OnItemPropertyChanged(in nsIMsgFolder aItem,
                              in nsIAtom aProperty,
                              in string aOldValue,
                              in string aNewValue);
   
   const folderListenerNotifyFlagValue intPropertyChanged = 0x8;
+  // While this property handles long long (64bit wide) values,
+  // the Javascript engine will only pass values up to 2^53 to the consumers.
   void OnItemIntPropertyChanged(in nsIMsgFolder aItem,
                                 in nsIAtom aProperty,
-                                in long aOldValue,
-                                in long aNewValue);
+                                in long long aOldValue,
+                                in long long aNewValue);
   
   const folderListenerNotifyFlagValue boolPropertyChanged = 0x10;
   void OnItemBoolPropertyChanged(in nsIMsgFolder aItem,
                                  in nsIAtom aProperty,
                                  in boolean aOldValue,
                                  in boolean aNewValue);
   
   const folderListenerNotifyFlagValue unicharPropertyChanged = 0x20;
--- a/mailnews/base/public/nsIMsgFolder.idl
+++ b/mailnews/base/public/nsIMsgFolder.idl
@@ -24,17 +24,17 @@ interface nsIMsgThread;
 interface nsIArray;
 interface nsIMutableArray;
 interface nsIMsgPluggableStore;
 
 typedef long nsMsgBiffState;
 
 // enumerated type for determining if a message has been replied to, forwarded, etc.
 typedef long nsMsgDispositionState;
-[scriptable, uuid(25cbee16-95bc-11e3-9320-00269e4fddc1)]
+[scriptable, uuid(2e9227f3-5aaf-47c1-8103-411768287f8c)]
 interface nsIMsgFolder : nsISupports {
 
   const nsMsgBiffState nsMsgBiffState_NewMail = 0; // User has new mail waiting.
   const nsMsgBiffState nsMsgBiffState_NoMail =  1; // No new mail is waiting.
   const nsMsgBiffState nsMsgBiffState_Unknown = 2; // We dunno whether there is new mail.
 
   /// Returns an enumerator containing the messages within the current database.
   readonly attribute nsISimpleEnumerator messages;
@@ -650,18 +650,18 @@ interface nsIMsgFolder : nsISupports {
   nsIMsgFolder findSubFolder(in ACString escapedSubFolderName);
 
   void AddFolderListener(in nsIFolderListener listener);
   void RemoveFolderListener(in nsIFolderListener listener);
   void NotifyPropertyChanged(in nsIAtom property,
                              in ACString oldValue,
                              in ACString newValue);
   void NotifyIntPropertyChanged(in nsIAtom property,
-                                in long oldValue,
-                                in long newValue);
+                                in long long oldValue,
+                                in long long newValue);
   void NotifyBoolPropertyChanged(in nsIAtom property,
                                  in boolean oldValue,
                                  in boolean newValue);
   void NotifyPropertyFlagChanged(in nsIMsgDBHdr item,
                                  in nsIAtom property,
                                  in unsigned long oldValue,
                                  in unsigned long newValue);
   void NotifyUnicharPropertyChanged(in nsIAtom property,
--- a/mailnews/base/public/nsMsgFolderFlags.idl
+++ b/mailnews/base/public/nsMsgFolderFlags.idl
@@ -1,13 +1,18 @@
 /*-*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* 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/. */
 
+// This must be limited to unsigned long (uint32_t, no uint64_t)
+// as long as nsIMsgFolder exposes the 'flags' property which contains
+// all the flags values. The callers are used to do
+// (folder.flags & nsMsgFolderFlags.<flagname>) in Javascript
+// which cuts the value to 32bit only. See bug 813459.
 typedef unsigned long nsMsgFolderFlagType;
 
 /// Flags about a folder or a newsgroup.
 [scriptable,uuid(fbe7cba8-3141-4c44-9660-99af6b53f27e)]
 interface nsMsgFolderFlags {
   /**
    * @name Folder Type Flags
    * These flags define the type of folder. Exactly one will be set.
--- a/mailnews/base/src/nsMessenger.cpp
+++ b/mailnews/base/src/nsMessenger.cpp
@@ -2188,18 +2188,18 @@ NS_IMETHODIMP nsMessenger::OnItemRemoved
 }
 
 /* void OnItemPropertyChanged (in nsIMsgFolder item, in nsIAtom property, in string oldValue, in string newValue); */
 NS_IMETHODIMP nsMessenger::OnItemPropertyChanged(nsIMsgFolder *item, nsIAtom *property, const char *oldValue, const char *newValue)
 {
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
-/* void OnItemIntPropertyChanged (in nsIMsgFolder item, in nsIAtom property, in long oldValue, in long newValue); */
-NS_IMETHODIMP nsMessenger::OnItemIntPropertyChanged(nsIMsgFolder *item, nsIAtom *property, int32_t oldValue, int32_t newValue)
+/* void OnItemIntPropertyChanged (in nsIMsgFolder item, in nsIAtom property, in long long oldValue, in long long newValue); */
+NS_IMETHODIMP nsMessenger::OnItemIntPropertyChanged(nsIMsgFolder *item, nsIAtom *property, int64_t oldValue, int64_t newValue)
 {
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 /* void OnItemBoolPropertyChanged (in nsIMsgFolder item, in nsIAtom property, in boolean oldValue, in boolean newValue); */
 NS_IMETHODIMP nsMessenger::OnItemBoolPropertyChanged(nsIMsgFolder *item, nsIAtom *property, bool oldValue, bool newValue)
 {
   return NS_ERROR_NOT_IMPLEMENTED;
--- a/mailnews/base/src/nsMessengerOSXIntegration.mm
+++ b/mailnews/base/src/nsMessengerOSXIntegration.mm
@@ -412,18 +412,18 @@ nsMessengerOSXIntegration::ShowAlertMess
     OnAlertFinished();
 
   return rv;
 }
 
 NS_IMETHODIMP
 nsMessengerOSXIntegration::OnItemIntPropertyChanged(nsIMsgFolder *aFolder,
                                                     nsIAtom *aProperty,
-                                                    int32_t aOldValue,
-                                                    int32_t aNewValue)
+                                                    int64_t aOldValue,
+                                                    int64_t aNewValue)
 {
   // if we got new mail show an alert
   if (aNewValue == nsIMsgFolder::nsMsgBiffState_NewMail)
   {
     bool performingBiff = false;
     nsCOMPtr<nsIMsgIncomingServer> server;
     aFolder->GetServer(getter_AddRefs(server));
     if (server)
--- a/mailnews/base/src/nsMessengerUnixIntegration.cpp
+++ b/mailnews/base/src/nsMessengerUnixIntegration.cpp
@@ -650,17 +650,17 @@ nsMessengerUnixIntegration::OnItemBoolPr
 
 NS_IMETHODIMP
 nsMessengerUnixIntegration::OnItemEvent(nsIMsgFolder *, nsIAtom *)
 {
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsMessengerUnixIntegration::OnItemIntPropertyChanged(nsIMsgFolder *aItem, nsIAtom *aProperty, int32_t aOldValue, int32_t aNewValue)
+nsMessengerUnixIntegration::OnItemIntPropertyChanged(nsIMsgFolder *aItem, nsIAtom *aProperty, int64_t aOldValue, int64_t aNewValue)
 {
   nsCString atomName;
   // if we got new mail show an icon in the system tray
   if (mBiffStateAtom == aProperty && mFoldersWithNewMail)
   {
     nsCOMPtr<nsIWeakReference> weakFolder = do_GetWeakReference(aItem);
     uint32_t indexInNewArray;
     nsresult rv = mFoldersWithNewMail->IndexOf(0, weakFolder, &indexInNewArray);
--- a/mailnews/base/src/nsMessengerWinIntegration.cpp
+++ b/mailnews/base/src/nsMessengerWinIntegration.cpp
@@ -889,17 +889,17 @@ nsMessengerWinIntegration::OnItemBoolPro
 
 NS_IMETHODIMP
 nsMessengerWinIntegration::OnItemEvent(nsIMsgFolder *, nsIAtom *)
 {
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsMessengerWinIntegration::OnItemIntPropertyChanged(nsIMsgFolder *aItem, nsIAtom *aProperty, int32_t aOldValue, int32_t aNewValue)
+nsMessengerWinIntegration::OnItemIntPropertyChanged(nsIMsgFolder *aItem, nsIAtom *aProperty, int64_t aOldValue, int64_t aNewValue)
 {
   // if we got new mail show a icon in the system tray
   if (mBiffStateAtom == aProperty && mFoldersWithNewMail)
   {
     nsCOMPtr<nsIWeakReference> weakFolder = do_GetWeakReference(aItem);
     uint32_t indexInNewArray;
     nsresult rv = mFoldersWithNewMail->IndexOf(0, weakFolder, &indexInNewArray);
     bool folderFound = NS_SUCCEEDED(rv);
--- a/mailnews/base/src/nsMsgAccountManager.cpp
+++ b/mailnews/base/src/nsMsgAccountManager.cpp
@@ -3557,18 +3557,18 @@ NS_IMETHODIMP nsMsgAccountManager::OnIte
 NS_IMETHODIMP nsMsgAccountManager::OnItemPropertyChanged(nsIMsgFolder *item, nsIAtom *property, const char *oldValue, const char *newValue)
 {
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 NS_IMETHODIMP
 nsMsgAccountManager::OnItemIntPropertyChanged(nsIMsgFolder *aFolder,
                                               nsIAtom *aProperty,
-                                              int32_t oldValue,
-                                              int32_t newValue)
+                                              int64_t oldValue,
+                                              int64_t newValue)
 {
   if (aProperty == mFolderFlagAtom)
   {
     uint32_t smartFlagsChanged = (oldValue ^ newValue) &
       (nsMsgFolderFlags::SpecialUse & ~nsMsgFolderFlags::Queue);
     if (smartFlagsChanged)
     {
       if (smartFlagsChanged & newValue)
--- a/mailnews/base/src/nsMsgAccountManagerDS.cpp
+++ b/mailnews/base/src/nsMsgAccountManagerDS.cpp
@@ -1164,17 +1164,17 @@ nsMsgAccountManagerDataSource::OnItemBoo
 
 nsresult
 nsMsgAccountManagerDataSource::OnItemEvent(nsIMsgFolder *, nsIAtom *)
 {
   return NS_OK;
 }
 
 nsresult
-nsMsgAccountManagerDataSource::OnItemIntPropertyChanged(nsIMsgFolder *, nsIAtom *, int32_t, int32_t)
+nsMsgAccountManagerDataSource::OnItemIntPropertyChanged(nsIMsgFolder *, nsIAtom *, int64_t, int64_t)
 {
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsMsgAccountManagerDataSource::Observe(nsISupports *aSubject, const char *aTopic, const char16_t *aData)
 {
   nsMsgRDFDataSource::Observe(aSubject, aTopic, aData);
--- a/mailnews/base/src/nsMsgFolderDataSource.cpp
+++ b/mailnews/base/src/nsMsgFolderDataSource.cpp
@@ -801,18 +801,18 @@ nsMsgFolderDataSource::OnItemPropertyCha
 
 {
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsMsgFolderDataSource::OnItemIntPropertyChanged(nsIMsgFolder *folder,
                                                 nsIAtom *property,
-                                                int32_t oldValue,
-                                                int32_t newValue)
+                                                int64_t oldValue,
+                                                int64_t newValue)
 {
   nsCOMPtr<nsIRDFResource> resource(do_QueryInterface(folder));
   if (kTotalMessagesAtom == property)
     OnTotalMessagePropertyChanged(resource, oldValue, newValue);
   else if (kTotalUnreadMessagesAtom == property)
     OnUnreadMessagePropertyChanged(resource, oldValue, newValue);
   else if (kFolderSizeAtom == property)
     OnFolderSizePropertyChanged(resource, oldValue, newValue);
--- a/mailnews/base/src/nsMsgMailSession.cpp
+++ b/mailnews/base/src/nsMsgMailSession.cpp
@@ -113,18 +113,18 @@ nsMsgMailSession::OnItemUnicharPropertyC
   NOTIFY_FOLDER_LISTENERS(unicharPropertyChanged, OnItemUnicharPropertyChanged,
                           (aItem, aProperty, aOldValue, aNewValue));
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsMsgMailSession::OnItemIntPropertyChanged(nsIMsgFolder *aItem,
                                            nsIAtom *aProperty,
-                                           int32_t aOldValue,
-                                           int32_t aNewValue)
+                                           int64_t aOldValue,
+                                           int64_t aNewValue)
 {
   NOTIFY_FOLDER_LISTENERS(intPropertyChanged, OnItemIntPropertyChanged,
                           (aItem, aProperty, aOldValue, aNewValue));
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsMsgMailSession::OnItemBoolPropertyChanged(nsIMsgFolder *aItem,
--- a/mailnews/base/src/nsStatusBarBiffManager.cpp
+++ b/mailnews/base/src/nsStatusBarBiffManager.cpp
@@ -177,17 +177,17 @@ nsStatusBarBiffManager::OnItemRemoved(ns
 
 NS_IMETHODIMP 
 nsStatusBarBiffManager::OnItemPropertyChanged(nsIMsgFolder *item, nsIAtom *property, const char *oldValue, const char *newValue)
 {
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsStatusBarBiffManager::OnItemIntPropertyChanged(nsIMsgFolder *item, nsIAtom *property, int32_t oldValue, int32_t newValue)
+nsStatusBarBiffManager::OnItemIntPropertyChanged(nsIMsgFolder *item, nsIAtom *property, int64_t oldValue, int64_t newValue)
 {
   if (kBiffStateAtom == property && mCurrentBiffState != newValue) {
     // if we got new mail, attempt to play a sound.
     // if we fail along the way, don't return.
     // we still need to update the UI.    
     if (newValue == nsIMsgFolder::nsMsgBiffState_NewMail) {
       // Get the folder's server type.
       nsCOMPtr<nsIMsgIncomingServer> server;
--- a/mailnews/base/util/nsMsgDBFolder.cpp
+++ b/mailnews/base/util/nsMsgDBFolder.cpp
@@ -4941,18 +4941,18 @@ nsMsgDBFolder::NotifyUnicharPropertyChan
   NS_ENSURE_SUCCESS(rv, rv);
   return folderListenerManager->OnItemUnicharPropertyChanged(this,
                                                  aProperty,
                                                  nsString(aOldValue).get(),
                                                  nsString(aNewValue).get());
 }
 
 NS_IMETHODIMP
-nsMsgDBFolder::NotifyIntPropertyChanged(nsIAtom *aProperty, int32_t aOldValue,
-                                        int32_t aNewValue)
+nsMsgDBFolder::NotifyIntPropertyChanged(nsIAtom *aProperty, int64_t aOldValue,
+                                        int64_t aNewValue)
 {
   // Don't send off count notifications if they are turned off.
   if (!mNotifyCountChanges &&
       ((aProperty == kTotalMessagesAtom) ||
        (aProperty == kTotalUnreadMessagesAtom)))
     return NS_OK;
 
   NS_OBSERVER_ARRAY_NOTIFY_OBSERVERS(mListeners, nsIFolderListener,
--- a/mailnews/compose/src/nsMsgSendLater.cpp
+++ b/mailnews/compose/src/nsMsgSendLater.cpp
@@ -1498,17 +1498,17 @@ nsMsgSendLater::OnItemPropertyChanged(ns
                                       const char* aOldValue,
                                       const char* aNewValue)
 {
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsMsgSendLater::OnItemIntPropertyChanged(nsIMsgFolder *aItem, nsIAtom *aProperty,
-                                         int32_t aOldValue, int32_t aNewValue)
+                                         int64_t aOldValue, int64_t aNewValue)
 {
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsMsgSendLater::OnItemBoolPropertyChanged(nsIMsgFolder *aItem, nsIAtom *aProperty,
                                           bool aOldValue, bool aNewValue)
 {
--- a/mailnews/local/src/nsLocalUndoTxn.cpp
+++ b/mailnews/local/src/nsLocalUndoTxn.cpp
@@ -455,17 +455,17 @@ NS_IMETHODIMP nsLocalMoveCopyMsgTxn::OnI
   return NS_OK;
 }
 
 NS_IMETHODIMP nsLocalMoveCopyMsgTxn::OnItemPropertyChanged(nsIMsgFolder *item, nsIAtom *property, const char *oldValue, const char *newValue)
 {
   return NS_OK;
 }
 
-NS_IMETHODIMP nsLocalMoveCopyMsgTxn::OnItemIntPropertyChanged(nsIMsgFolder *item, nsIAtom *property, int32_t oldValue, int32_t newValue)
+NS_IMETHODIMP nsLocalMoveCopyMsgTxn::OnItemIntPropertyChanged(nsIMsgFolder *item, nsIAtom *property, int64_t oldValue, int64_t newValue)
 {
   return NS_OK;
 }
 
 NS_IMETHODIMP nsLocalMoveCopyMsgTxn::OnItemBoolPropertyChanged(nsIMsgFolder *item, nsIAtom *property, bool oldValue, bool newValue)
 {
   return NS_OK;
 }
@@ -507,17 +507,17 @@ NS_IMETHODIMP nsLocalUndoFolderListener:
     return NS_OK;
 }
 
 NS_IMETHODIMP nsLocalUndoFolderListener::OnItemPropertyChanged(nsIMsgFolder *item, nsIAtom *property, const char *oldValue, const char *newValue)
 {
     return NS_OK;
 }
 
-NS_IMETHODIMP nsLocalUndoFolderListener::OnItemIntPropertyChanged(nsIMsgFolder *item, nsIAtom *property, int32_t oldValue, int32_t newValue)
+NS_IMETHODIMP nsLocalUndoFolderListener::OnItemIntPropertyChanged(nsIMsgFolder *item, nsIAtom *property, int64_t oldValue, int64_t newValue)
 {
     return NS_OK;
 }
 
 NS_IMETHODIMP nsLocalUndoFolderListener::OnItemBoolPropertyChanged(nsIMsgFolder *item, nsIAtom *property, bool oldValue, bool newValue)
 {
     return NS_OK;
 }