Bug 1028588 - Fix dangerous public destructors in toolkit/ - r=ehsan
authorBenoit Jacob <bjacob@mozilla.com>
Mon, 23 Jun 2014 18:40:02 -0400
changeset 190273 461ad7d4f1ef5c99b4817b2ec3c9dbf8681e0b5e
parent 190272 97477a6da3b18642ea72637c408f69b49ac057dc
child 190274 12985d7bd06a6fb901b7c2fb55a5b86353d57660
push id45278
push userbjacob@mozilla.com
push dateMon, 23 Jun 2014 22:40:31 +0000
treeherdermozilla-inbound@fc66d632e573 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan
bugs1028588
milestone33.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1028588 - Fix dangerous public destructors in toolkit/ - r=ehsan
toolkit/components/alerts/nsAlertsService.h
toolkit/components/alerts/nsXULAlerts.h
toolkit/components/autocomplete/nsAutoCompleteController.h
toolkit/components/downloads/ApplicationReputation.cpp
toolkit/components/downloads/SQLFunctions.h
toolkit/components/downloads/nsDownloadManager.h
toolkit/components/downloads/nsDownloadProxy.h
toolkit/components/filepicker/nsFileView.cpp
toolkit/components/finalizationwitness/FinalizationWitnessService.h
toolkit/components/find/nsFindService.h
toolkit/components/jsdownloads/src/DownloadPlatform.h
toolkit/components/osfile/NativeOSFileInternals.cpp
toolkit/components/osfile/NativeOSFileInternals.h
toolkit/components/parentalcontrols/nsParentalControlsService.h
toolkit/components/places/Database.cpp
toolkit/components/places/Helpers.h
toolkit/components/places/History.cpp
toolkit/components/places/PlaceInfo.h
toolkit/components/places/SQLFunctions.cpp
toolkit/components/places/SQLFunctions.h
toolkit/components/places/VisitInfo.cpp
toolkit/components/places/VisitInfo.h
toolkit/components/places/nsAnnotationService.cpp
toolkit/components/places/nsAnnotationService.h
toolkit/components/places/nsNavBookmarks.h
toolkit/components/places/nsNavHistoryQuery.h
toolkit/components/places/nsNavHistoryResult.h
toolkit/components/places/tests/cpp/mock_Link.h
toolkit/components/places/tests/cpp/places_test_harness.h
toolkit/components/places/tests/cpp/test_IHistory.cpp
toolkit/components/satchel/nsFormFillController.h
toolkit/components/startup/nsUserInfo.h
toolkit/components/statusfilter/nsBrowserStatusFilter.h
toolkit/components/telemetry/Telemetry.cpp
toolkit/components/typeaheadfind/nsTypeAheadFind.h
toolkit/components/url-classifier/nsUrlClassifierDBService.cpp
toolkit/components/url-classifier/nsUrlClassifierPrefixSet.h
toolkit/components/url-classifier/nsUrlClassifierProxies.h
toolkit/components/url-classifier/nsUrlClassifierUtils.h
toolkit/identity/IdentityCryptoService.cpp
toolkit/mozapps/extensions/AddonPathService.h
toolkit/profile/nsToolkitProfileService.cpp
toolkit/system/dbus/nsDBusService.h
toolkit/system/dbus/nsNetworkManagerListener.h
toolkit/system/gnome/nsGIOService.cpp
toolkit/system/gnome/nsGIOService.h
toolkit/system/gnome/nsGSettingsService.cpp
toolkit/xre/nsAppRunner.cpp
toolkit/xre/nsNativeAppSupportBase.h
toolkit/xre/nsUpdateDriver.cpp
toolkit/xre/nsUpdateDriver.h
--- a/toolkit/components/alerts/nsAlertsService.h
+++ b/toolkit/components/alerts/nsAlertsService.h
@@ -1,9 +1,9 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+// /* -*- Mode: C++; 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/. */
 
 #ifndef nsAlertsService_h__
 #define nsAlertsService_h__
 
 #include "nsIAlertsService.h"
@@ -31,16 +31,17 @@ class nsAlertsService : public nsIAlerts
                         public nsIAlertsProgressListener
 {
 public:
   NS_DECL_NSIALERTSPROGRESSLISTENER
   NS_DECL_NSIALERTSSERVICE
   NS_DECL_ISUPPORTS
 
   nsAlertsService();
+
+protected:
   virtual ~nsAlertsService();
 
-protected:
   bool ShouldShowAlert();
   nsXULAlerts mXULAlerts;
 };
 
 #endif /* nsAlertsService_h__ */
--- a/toolkit/components/alerts/nsXULAlerts.h
+++ b/toolkit/components/alerts/nsXULAlerts.h
@@ -44,18 +44,19 @@ public:
 
   nsXULAlertObserver(nsXULAlerts* aXULAlerts, const nsAString& aAlertName,
                      nsIObserver* aObserver)
     : mXULAlerts(aXULAlerts), mAlertName(aAlertName),
       mObserver(aObserver) {}
 
   void SetAlertWindow(nsIDOMWindow* aWindow) { mAlertWindow = aWindow; }
 
+protected:
   virtual ~nsXULAlertObserver() {}
-protected:
+
   nsXULAlerts* mXULAlerts;
   nsString mAlertName;
   nsCOMPtr<nsIDOMWindow> mAlertWindow;
   nsCOMPtr<nsIObserver> mObserver;
 };
 
 #endif /* nsXULAlerts_h__ */
 
--- a/toolkit/components/autocomplete/nsAutoCompleteController.h
+++ b/toolkit/components/autocomplete/nsAutoCompleteController.h
@@ -30,19 +30,20 @@ public:
   NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsAutoCompleteController,
                                            nsIAutoCompleteController)
   NS_DECL_NSIAUTOCOMPLETECONTROLLER
   NS_DECL_NSIAUTOCOMPLETEOBSERVER
   NS_DECL_NSITREEVIEW
   NS_DECL_NSITIMERCALLBACK
    
   nsAutoCompleteController();
-  virtual ~nsAutoCompleteController();
   
 protected:
+  virtual ~nsAutoCompleteController();
+
   nsresult OpenPopup();
   nsresult ClosePopup();
 
   nsresult StartSearch(uint16_t aSearchType);
 
   nsresult BeforeSearches();
   nsresult StartSearches();
   void AfterSearches();
--- a/toolkit/components/downloads/ApplicationReputation.cpp
+++ b/toolkit/components/downloads/ApplicationReputation.cpp
@@ -79,26 +79,27 @@ class PendingLookup MOZ_FINAL : public n
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIREQUESTOBSERVER
   NS_DECL_NSISTREAMLISTENER
 
   // Constructor and destructor.
   PendingLookup(nsIApplicationReputationQuery* aQuery,
                 nsIApplicationReputationCallback* aCallback);
-  ~PendingLookup();
 
   // Start the lookup. The lookup may have 2 parts: local and remote. In the
   // local lookup, PendingDBLookups are created to query the local allow and
   // blocklists for various URIs associated with this downloaded file. In the
   // event that no results are found, a remote lookup is sent to the Application
   // Reputation server.
   nsresult StartLookup();
 
 private:
+  ~PendingLookup();
+
   friend class PendingDBLookup;
 
   // Telemetry states.
   // Status of the remote response (valid or not).
   enum SERVER_RESPONSE_TYPES {
     SERVER_RESPONSE_VALID = 0,
     SERVER_RESPONSE_FAILED = 1,
     SERVER_RESPONSE_INVALID = 2,
@@ -205,23 +206,25 @@ private:
 class PendingDBLookup MOZ_FINAL : public nsIUrlClassifierCallback
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIURLCLASSIFIERCALLBACK
 
   // Constructor and destructor
   PendingDBLookup(PendingLookup* aPendingLookup);
-  ~PendingDBLookup();
 
   // Look up the given URI in the safebrowsing DBs, optionally on both the allow
   // list and the blocklist. If there is a match, call
   // PendingLookup::OnComplete. Otherwise, call PendingLookup::LookupNext.
   nsresult LookupSpec(const nsACString& aSpec, bool aAllowlistOnly);
+
 private:
+  ~PendingDBLookup();
+
   // The download appeared on the allowlist, blocklist, or no list (and thus
   // could trigger a remote query.
   enum LIST_TYPES {
     ALLOW_LIST = 0,
     BLOCK_LIST = 1,
     NO_LIST = 2,
   };
 
--- a/toolkit/components/downloads/SQLFunctions.h
+++ b/toolkit/components/downloads/SQLFunctions.h
@@ -19,16 +19,17 @@ namespace downloads {
  * SQL function to generate a GUID for a place or bookmark item.  This is just
  * a wrapper around GenerateGUID in SQLFunctions.cpp.
  *
  * @return a guid for the item.
  * @see toolkit/components/places/SQLFunctions.h - keep this in sync
  */
 class GenerateGUIDFunction MOZ_FINAL : public mozIStorageFunction
 {
+  ~GenerateGUIDFunction() {}
 public:
   NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_MOZISTORAGEFUNCTION
 
   /**
    * Registers the function with the specified database connection.
    *
    * @param aDBConn
--- a/toolkit/components/downloads/nsDownloadManager.h
+++ b/toolkit/components/downloads/nsDownloadManager.h
@@ -48,25 +48,26 @@ public:
   NS_DECL_NSIDOWNLOADMANAGER
   NS_DECL_NSINAVHISTORYOBSERVER
   NS_DECL_NSIOBSERVER
 
   nsresult Init();
 
   static nsDownloadManager *GetSingleton();
 
-  virtual ~nsDownloadManager();
   nsDownloadManager()
 #ifdef DOWNLOAD_SCANNER
     : mScanner(nullptr)
 #endif
   {
   }
 
 protected:
+  virtual ~nsDownloadManager();
+
   nsresult InitDB();
   nsresult InitFileDB();
   void CloseAllDBs();
   void CloseDB(mozIStorageConnection* aDBConn,
                mozIStorageStatement* aUpdateStmt,
                mozIStorageStatement* aGetIdsStmt);
   nsresult InitPrivateDB();
   already_AddRefed<mozIStorageConnection> GetFileDBConnection(nsIFile *dbFile) const;
@@ -268,26 +269,27 @@ class nsDownload : public nsIDownload
 public:
   NS_DECL_NSIWEBPROGRESSLISTENER
   NS_DECL_NSIWEBPROGRESSLISTENER2
   NS_DECL_NSITRANSFER
   NS_DECL_NSIDOWNLOAD
   NS_DECL_ISUPPORTS
 
   nsDownload();
-  virtual ~nsDownload();
 
   /**
    * This method MUST be called when changing states on a download.  It will
    * notify the download listener when a change happens.  This also updates the
    * database, by calling UpdateDB().
    */
   nsresult SetState(DownloadState aState);
 
 protected:
+  virtual ~nsDownload();
+
   /**
    * Finish up the download by breaking reference cycles and clearing unneeded
    * data. Additionally, the download removes itself from the download
    * manager's list of current downloads.
    *
    * NOTE: This method removes the cycle created when starting the download, so
    * make sure to use kungFuDeathGrip if you want to access member variables.
    */
--- a/toolkit/components/downloads/nsDownloadProxy.h
+++ b/toolkit/components/downloads/nsDownloadProxy.h
@@ -18,20 +18,23 @@
 
 // This class only exists because nsDownload cannot inherit from nsITransfer
 // directly. The reason for this is that nsDownloadManager (incorrectly) keeps
 // an nsCOMArray of nsDownloads, and nsCOMArray is only intended for use with
 // abstract classes. Using a concrete class that multiply inherits from classes
 // deriving from nsISupports will throw ambiguous base class errors.
 class nsDownloadProxy : public nsITransfer
 {
+protected:
+
+  virtual ~nsDownloadProxy() { }
+
 public:
 
   nsDownloadProxy() { }
-  virtual ~nsDownloadProxy() { }
 
   NS_DECL_ISUPPORTS
 
   NS_IMETHODIMP Init(nsIURI* aSource,
                      nsIURI* aTarget,
                      const nsAString& aDisplayName,
                      nsIMIMEInfo *aMIMEInfo,
                      PRTime aStartTime,
--- a/toolkit/components/filepicker/nsFileView.cpp
+++ b/toolkit/components/filepicker/nsFileView.cpp
@@ -42,16 +42,18 @@ public:
   nsFileResult(const nsAString& aSearchString, const nsAString& aSearchParam);
 
   NS_DECL_ISUPPORTS
   NS_DECL_NSIAUTOCOMPLETERESULT
 
   nsTArray<nsString> mValues;
   nsAutoString mSearchString;
   uint16_t mSearchResult;
+private:
+  ~nsFileResult() {}
 };
 
 NS_IMPL_ISUPPORTS(nsFileResult, nsIAutoCompleteResult)
 
 nsFileResult::nsFileResult(const nsAString& aSearchString,
                            const nsAString& aSearchParam):
   mSearchString(aSearchString)
 {
@@ -180,16 +182,17 @@ NS_IMETHODIMP nsFileResult::GetFinalComp
 
 NS_IMETHODIMP nsFileResult::RemoveValueAt(int32_t rowIndex, bool removeFromDb)
 {
   return NS_OK;
 }
 
 class nsFileComplete MOZ_FINAL : public nsIAutoCompleteSearch
 {
+  ~nsFileComplete() {}
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIAUTOCOMPLETESEARCH
 };
 
 NS_IMPL_ISUPPORTS(nsFileComplete, nsIAutoCompleteSearch)
 
 NS_IMETHODIMP
--- a/toolkit/components/finalizationwitness/FinalizationWitnessService.h
+++ b/toolkit/components/finalizationwitness/FinalizationWitnessService.h
@@ -13,14 +13,15 @@ namespace mozilla {
  * XPConnect initializer, for use in the main thread.
  */
 class FinalizationWitnessService MOZ_FINAL : public nsIFinalizationWitnessService
 {
  public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIFINALIZATIONWITNESSSERVICE
  private:
+  ~FinalizationWitnessService() {}
   void operator=(const FinalizationWitnessService* other) MOZ_DELETE;
 };
 
 } // namespace mozilla
 
 #endif // mozilla_finalizationwitnessservice_h__
--- a/toolkit/components/find/nsFindService.h
+++ b/toolkit/components/find/nsFindService.h
@@ -22,24 +22,25 @@
 #define NS_FIND_SERVICE_CONTRACTID \
  "@mozilla.org/find/find_service;1"
 
 
 class nsFindService : public nsIFindService
 {
 public:
 
-                      nsFindService();
-  virtual             ~nsFindService();
+  nsFindService();
 
   NS_DECL_ISUPPORTS
   NS_DECL_NSIFINDSERVICE
  
 protected:
 
+  virtual ~nsFindService();
+
   nsString        mSearchString;
   nsString        mReplaceString;
   
   bool            mFindBackwards;
   bool            mWrapFind;
   bool            mEntireWord;
   bool            mMatchCase;
 };
--- a/toolkit/components/jsdownloads/src/DownloadPlatform.h
+++ b/toolkit/components/jsdownloads/src/DownloadPlatform.h
@@ -9,22 +9,25 @@
 
 #include "nsCOMPtr.h"
 
 class nsIURI;
 class nsIFile;
 
 class DownloadPlatform : public mozIDownloadPlatform
 {
+protected:
+
+  virtual ~DownloadPlatform() { }
+
 public:
 
   NS_DECL_ISUPPORTS
   NS_DECL_MOZIDOWNLOADPLATFORM
 
   DownloadPlatform() { }
-  virtual ~DownloadPlatform() { }
 
   static DownloadPlatform *gDownloadPlatformService;
 
   static DownloadPlatform* GetDownloadPlatform();
 };
 
 #endif
--- a/toolkit/components/osfile/NativeOSFileInternals.cpp
+++ b/toolkit/components/osfile/NativeOSFileInternals.cpp
@@ -172,21 +172,16 @@ public:
    * requested.  Used to collect Telemetry statistics.
    */
   AbstractResult(TimeStamp aStartDate)
     : mStartDate(aStartDate)
   {
     MOZ_ASSERT(NS_IsMainThread());
     mozilla::HoldJSObjects(this);
   }
-  virtual ~AbstractResult() {
-    MOZ_ASSERT(NS_IsMainThread());
-    DropJSData();
-    mozilla::DropJSObjects(this);
-  }
 
   /**
    * Setup the AbstractResult once data is available.
    *
    * @param aDispatchDate The instant at which the IO thread received
    * the operation request. Used to collect Telemetry statistics.
    * @param aExecutionDuration The duration of the operation on the
    * IO thread.
@@ -202,16 +197,22 @@ public:
   /**
    * Drop any data that could lead to a cycle.
    */
   void DropJSData() {
     mCachedResult = JS::UndefinedValue();
   }
 
 protected:
+  virtual ~AbstractResult() {
+    MOZ_ASSERT(NS_IsMainThread());
+    DropJSData();
+    mozilla::DropJSObjects(this);
+  }
+
   virtual nsresult GetCacheableResult(JSContext *cx, JS::MutableHandleValue aResult) = 0;
 
 private:
   TimeStamp mStartDate;
   TimeDuration mDispatchDuration;
   TimeDuration mExecutionDuration;
   JS::Heap<JS::Value> mCachedResult;
 };
--- a/toolkit/components/osfile/NativeOSFileInternals.h
+++ b/toolkit/components/osfile/NativeOSFileInternals.h
@@ -10,15 +10,16 @@
 
 namespace mozilla {
 
 class NativeOSFileInternalsService MOZ_FINAL : public nsINativeOSFileInternalsService {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSINATIVEOSFILEINTERNALSSERVICE
 private:
+  ~NativeOSFileInternalsService() {}
   // Avoid accidental use of built-in operator=
   void operator=(const NativeOSFileInternalsService& other) MOZ_DELETE;
 };
 
 } // namespace mozilla
 
 #endif // mozilla_finalizationwitnessservice_h__
--- a/toolkit/components/parentalcontrols/nsParentalControlsService.h
+++ b/toolkit/components/parentalcontrols/nsParentalControlsService.h
@@ -23,16 +23,18 @@
 
 class nsParentalControlsService : public nsIParentalControlsService
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIPARENTALCONTROLSSERVICE
 
   nsParentalControlsService();
+
+protected:
   virtual ~nsParentalControlsService();
 
 private:
   bool mEnabled;
 #if defined(XP_WIN)
   REGHANDLE mProvider;
   IWindowsParentalControls * mPC;
   void LogFileDownload(bool blocked, nsIURI *aSource, nsIFile *aTarget);
--- a/toolkit/components/places/Database.cpp
+++ b/toolkit/components/places/Database.cpp
@@ -213,16 +213,18 @@ SetJournalMode(nsCOMPtr<mozIStorageConne
   }
 
   return JOURNAL_DELETE;
 }
 
 class ConnectionCloseCallback MOZ_FINAL : public mozIStorageCompletionCallback {
   bool mDone;
 
+  ~ConnectionCloseCallback() {}
+
 public:
   NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_MOZISTORAGECOMPLETIONCALLBACK
   ConnectionCloseCallback();
 };
 
 NS_IMETHODIMP
 ConnectionCloseCallback::Complete(nsresult, nsISupports*)
--- a/toolkit/components/places/Helpers.h
+++ b/toolkit/components/places/Helpers.h
@@ -216,16 +216,17 @@ bool GetHiddenState(bool aIsRedirect,
 class PlacesEvent : public nsRunnable
 {
 public:
   NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIRUNNABLE
 
   PlacesEvent(const char* aTopic);
 protected:
+  ~PlacesEvent() {}
   void Notify();
 
   const char* const mTopic;
 };
 
 /**
  * Used to notify a topic to system observers on async execute completion.
  */
--- a/toolkit/components/places/History.cpp
+++ b/toolkit/components/places/History.cpp
@@ -1516,16 +1516,18 @@ public:
   }
 
   NS_IMETHOD HandleCompletion()
   {
     return NS_OK;
   }
 
 private:
+  ~SetDownloadAnnotations() {}
+
   nsCOMPtr<nsIURI> mDestination;
 
   /**
    * Strong reference to the History object because we do not want it to
    * disappear out from under us.
    */
   nsRefPtr<History> mHistory;
 };
--- a/toolkit/components/places/PlaceInfo.h
+++ b/toolkit/components/places/PlaceInfo.h
@@ -28,16 +28,18 @@ public:
 
   PlaceInfo(int64_t aId, const nsCString& aGUID, already_AddRefed<nsIURI> aURI,
             const nsString& aTitle, int64_t aFrecency);
   PlaceInfo(int64_t aId, const nsCString& aGUID, already_AddRefed<nsIURI> aURI,
             const nsString& aTitle, int64_t aFrecency,
             const VisitsArray& aVisits);
 
 private:
+  ~PlaceInfo() {}
+
   const int64_t mId;
   const nsCString mGUID;
   nsCOMPtr<nsIURI> mURI;
   const nsString mTitle;
   const int64_t mFrecency;
   const VisitsArray mVisits;
   bool mVisitsAvailable;
 };
--- a/toolkit/components/places/SQLFunctions.cpp
+++ b/toolkit/components/places/SQLFunctions.cpp
@@ -177,16 +177,20 @@ namespace mozilla {
 namespace places {
 
 ////////////////////////////////////////////////////////////////////////////////
 //// AutoComplete Matching Function
 
   //////////////////////////////////////////////////////////////////////////////
   //// MatchAutoCompleteFunction
 
+  MatchAutoCompleteFunction::~MatchAutoCompleteFunction()
+  {
+  }
+
   /* static */
   nsresult
   MatchAutoCompleteFunction::create(mozIStorageConnection *aDBConn)
   {
     nsRefPtr<MatchAutoCompleteFunction> function =
       new MatchAutoCompleteFunction();
 
     nsresult rv = aDBConn->CreateFunction(
@@ -411,16 +415,20 @@ namespace places {
 
 
 ////////////////////////////////////////////////////////////////////////////////
 //// Frecency Calculation Function
 
   //////////////////////////////////////////////////////////////////////////////
   //// CalculateFrecencyFunction
 
+  CalculateFrecencyFunction::~CalculateFrecencyFunction()
+  {
+  }
+
   /* static */
   nsresult
   CalculateFrecencyFunction::create(mozIStorageConnection *aDBConn)
   {
     nsRefPtr<CalculateFrecencyFunction> function =
       new CalculateFrecencyFunction();
 
     nsresult rv = aDBConn->CreateFunction(
@@ -603,16 +611,20 @@ namespace places {
     NS_ADDREF(*_result = new IntegerVariant((int32_t) ceilf(fullVisitCount * ceilf(pointsForSampledVisits))));
 
     return NS_OK;
   }
 
 ////////////////////////////////////////////////////////////////////////////////
 //// GUID Creation Function
 
+  GenerateGUIDFunction::~GenerateGUIDFunction()
+  {
+  }
+
   //////////////////////////////////////////////////////////////////////////////
   //// GenerateGUIDFunction
 
   /* static */
   nsresult
   GenerateGUIDFunction::create(mozIStorageConnection *aDBConn)
   {
     nsRefPtr<GenerateGUIDFunction> function = new GenerateGUIDFunction();
@@ -642,16 +654,20 @@ namespace places {
 
     NS_ADDREF(*_result = new UTF8TextVariant(guid));
     return NS_OK;
   }
 
 ////////////////////////////////////////////////////////////////////////////////
 //// Get Unreversed Host Function
 
+  GetUnreversedHostFunction::~GetUnreversedHostFunction()
+  {
+  }
+
   //////////////////////////////////////////////////////////////////////////////
   //// GetUnreversedHostFunction
 
   /* static */
   nsresult
   GetUnreversedHostFunction::create(mozIStorageConnection *aDBConn)
   {
     nsRefPtr<GetUnreversedHostFunction> function = new GetUnreversedHostFunction();
@@ -696,16 +712,20 @@ namespace places {
     }
     NS_ADDREF(*_result = result);
     return NS_OK;
   }
 
 ////////////////////////////////////////////////////////////////////////////////
 //// Fixup URL Function
 
+  FixupURLFunction::~FixupURLFunction()
+  {
+  }
+
   //////////////////////////////////////////////////////////////////////////////
   //// FixupURLFunction
 
   /* static */
   nsresult
   FixupURLFunction::create(mozIStorageConnection *aDBConn)
   {
     nsRefPtr<FixupURLFunction> function = new FixupURLFunction();
@@ -747,16 +767,20 @@ namespace places {
     result->SetAsAString(src);
     NS_ADDREF(*_result = result);
     return NS_OK;
   }
 
 ////////////////////////////////////////////////////////////////////////////////
 //// Frecency Changed Notification Function
 
+  FrecencyNotificationFunction::~FrecencyNotificationFunction()
+  {
+  }
+
   /* static */
   nsresult
   FrecencyNotificationFunction::create(mozIStorageConnection *aDBConn)
   {
     nsRefPtr<FrecencyNotificationFunction> function =
       new FrecencyNotificationFunction();
     nsresult rv = aDBConn->CreateFunction(
       NS_LITERAL_CSTRING("notify_frecency"), 5, function
--- a/toolkit/components/places/SQLFunctions.h
+++ b/toolkit/components/places/SQLFunctions.h
@@ -66,16 +66,18 @@ public:
    * Registers the function with the specified database connection.
    *
    * @param aDBConn
    *        The database connection to register with.
    */
   static nsresult create(mozIStorageConnection *aDBConn);
 
 private:
+  ~MatchAutoCompleteFunction();
+
   /**
    * Argument Indexes
    */
   static const uint32_t kArgSearchString = 0;
   static const uint32_t kArgIndexURL = 1;
   static const uint32_t kArgIndexTitle = 2;
   static const uint32_t kArgIndexTags = 3;
   static const uint32_t kArgIndexVisitCount = 4;
@@ -190,16 +192,17 @@ private:
  *        Whether the page has been typed in.  Default is false.
  * @param [optional] fullVisitCount
  *        Count of all the visits (All types).  Default is 0.
  * @param [optional] isBookmarked
  *        Whether the page is bookmarked. Default is false.
  */
 class CalculateFrecencyFunction MOZ_FINAL : public mozIStorageFunction
 {
+  ~CalculateFrecencyFunction();
 public:
   NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_MOZISTORAGEFUNCTION
 
   /**
    * Registers the function with the specified database connection.
    *
    * @param aDBConn
@@ -211,16 +214,17 @@ public:
 /**
  * SQL function to generate a GUID for a place or bookmark item.  This is just
  * a wrapper around GenerateGUID in Helpers.h.
  *
  * @return a guid for the item.
  */
 class GenerateGUIDFunction MOZ_FINAL : public mozIStorageFunction
 {
+  ~GenerateGUIDFunction();
 public:
   NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_MOZISTORAGEFUNCTION
 
   /**
    * Registers the function with the specified database connection.
    *
    * @param aDBConn
@@ -234,16 +238,17 @@ public:
  *
  * @param rev_host
  *        The rev_host value of the page.
  *
  * @return the unreversed host of the page.
  */
 class GetUnreversedHostFunction MOZ_FINAL : public mozIStorageFunction
 {
+  ~GetUnreversedHostFunction();
 public:
   NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_MOZISTORAGEFUNCTION
 
   /**
    * Registers the function with the specified database connection.
    *
    * @param aDBConn
@@ -262,16 +267,17 @@ public:
  *
  * @param url
  *        A URL.
  * @return
  *        The same URL, with redundant parts removed.
  */
 class FixupURLFunction MOZ_FINAL : public mozIStorageFunction
 {
+  ~FixupURLFunction();
 public:
   NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_MOZISTORAGEFUNCTION
 
   /**
    * Registers the function with the specified database connection.
    *
    * @param aDBConn
@@ -298,16 +304,17 @@ public:
  * @param hidden
  *        The place's hidden boolean.
  * @param lastVisitDate
  *        The place's last visit date.
  * @return newFrecency
  */
 class FrecencyNotificationFunction MOZ_FINAL : public mozIStorageFunction
 {
+  ~FrecencyNotificationFunction();
 public:
   NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_MOZISTORAGEFUNCTION
 
   /**
    * Registers the function with the specified database connection.
    *
    * @param aDBConn
--- a/toolkit/components/places/VisitInfo.cpp
+++ b/toolkit/components/places/VisitInfo.cpp
@@ -17,16 +17,20 @@ VisitInfo::VisitInfo(int64_t aVisitId,
                      already_AddRefed<nsIURI> aReferrer)
 : mVisitId(aVisitId)
 , mVisitDate(aVisitDate)
 , mTransitionType(aTransitionType)
 , mReferrer(aReferrer)
 {
 }
 
+VisitInfo::~VisitInfo()
+{
+}
+
 ////////////////////////////////////////////////////////////////////////////////
 //// mozIVisitInfo
 
 NS_IMETHODIMP
 VisitInfo::GetVisitId(int64_t* _visitId)
 {
   *_visitId = mVisitId;
   return NS_OK;
--- a/toolkit/components/places/VisitInfo.h
+++ b/toolkit/components/places/VisitInfo.h
@@ -19,16 +19,17 @@ class VisitInfo MOZ_FINAL : public mozIV
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_MOZIVISITINFO
 
   VisitInfo(int64_t aVisitId, PRTime aVisitDate, uint32_t aTransitionType,
             already_AddRefed<nsIURI> aReferrer);
 
 private:
+  ~VisitInfo();
   const int64_t mVisitId;
   const PRTime mVisitDate;
   const uint32_t mTransitionType;
   nsCOMPtr<nsIURI> mReferrer;
 };
 
 } // namespace places
 } // namespace mozilla
--- a/toolkit/components/places/nsAnnotationService.cpp
+++ b/toolkit/components/places/nsAnnotationService.cpp
@@ -61,16 +61,20 @@ AnnotatedResult::AnnotatedResult(const n
 : mGUID(aGUID)
 , mURI(aURI)
 , mItemId(aItemId)
 , mAnnotationName(aAnnotationName)
 , mAnnotationValue(aAnnotationValue)
 {
 }
 
+AnnotatedResult::~AnnotatedResult()
+{
+}
+
 NS_IMETHODIMP
 AnnotatedResult::GetGuid(nsACString& _guid)
 {
   _guid = mGUID;
   return NS_OK;
 }
 
 NS_IMETHODIMP
--- a/toolkit/components/places/nsAnnotationService.h
+++ b/toolkit/components/places/nsAnnotationService.h
@@ -26,16 +26,18 @@ public:
   NS_DECL_ISUPPORTS
   NS_DECL_MOZIANNOTATEDRESULT
 
   AnnotatedResult(const nsCString& aGUID, nsIURI* aURI, int64_t aItemd,
                   const nsACString& aAnnotationName,
                   nsIVariant* aAnnotationValue);
 
 private:
+  ~AnnotatedResult();
+
   const nsCString mGUID;
   nsCOMPtr<nsIURI> mURI;
   const int64_t mItemId;
   const nsCString mAnnotationName;
   nsCOMPtr<nsIVariant> mAnnotationValue;
 };
 
 } // namespace places
--- a/toolkit/components/places/nsNavBookmarks.h
+++ b/toolkit/components/places/nsNavBookmarks.h
@@ -410,16 +410,18 @@ private:
     }
 
     NS_IMETHOD Merge(nsITransaction* aTransaction, bool* aResult) {
       *aResult = false;
       return NS_OK;
     }
 
   private:
+    ~RemoveFolderTransaction() {}
+
     int64_t mID;
     int64_t mParent;
     nsCString mTitle;
     int32_t mIndex;
   };
 
   // Used to enable and disable the observer notifications.
   bool mCanNotify;
--- a/toolkit/components/places/nsNavHistoryQuery.h
+++ b/toolkit/components/places/nsNavHistoryQuery.h
@@ -129,16 +129,17 @@ public:
   bool IncludeHidden() const { return mIncludeHidden; }
   uint32_t MaxResults() const { return mMaxResults; }
   uint16_t QueryType() const { return mQueryType; }
   bool AsyncEnabled() const { return mAsyncEnabled; }
 
   nsresult Clone(nsNavHistoryQueryOptions **aResult);
 
 private:
+  ~nsNavHistoryQueryOptions() {}
   nsNavHistoryQueryOptions(const nsNavHistoryQueryOptions& other) {} // no copy
 
   // IF YOU ADD MORE ITEMS:
   //  * Add a new getter for C++ above if it makes sense
   //  * Add to the serialization code (see nsNavHistory::QueriesToQueryString())
   //  * Add to the deserialization code (see nsNavHistory::QueryStringToQueries)
   //  * Add to the nsNavHistoryQueryOptions::Clone() function
   //  * Add to the nsNavHistory.cpp::GetSimpleBookmarksQueryFolder function if applicable
--- a/toolkit/components/places/nsNavHistoryResult.h
+++ b/toolkit/components/places/nsNavHistoryResult.h
@@ -131,17 +131,16 @@ public:
   void RemoveHistoryObserver(nsNavHistoryQueryResultNode* aNode);
   void RemoveBookmarkFolderObserver(nsNavHistoryFolderResultNode* aNode, int64_t aFolder);
   void RemoveAllBookmarksObserver(nsNavHistoryQueryResultNode* aNode);
   void StopObserving();
 
 public:
   // two-stage init, use NewHistoryResult to construct
   nsNavHistoryResult(nsNavHistoryContainerResultNode* mRoot);
-  virtual ~nsNavHistoryResult();
   nsresult Init(nsINavHistoryQuery** aQueries,
                 uint32_t aQueryCount,
                 nsNavHistoryQueryOptions *aOptions);
 
   nsRefPtr<nsNavHistoryContainerResultNode> mRootNode;
 
   nsCOMArray<nsINavHistoryQuery> mQueries;
   nsCOMPtr<nsNavHistoryQueryOptions> mOptions;
@@ -179,16 +178,19 @@ public:
   
   bool mBatchInProgress;
 
   nsMaybeWeakPtrArray<nsINavHistoryResultObserver> mObservers;
   bool mSuppressNotifications;
 
   ContainerObserverList mRefreshParticipants;
   void requestRefresh(nsNavHistoryContainerResultNode* aContainer);
+
+protected:
+  virtual ~nsNavHistoryResult();
 };
 
 NS_DEFINE_STATIC_IID_ACCESSOR(nsNavHistoryResult, NS_NAVHISTORYRESULT_IID)
 
 // nsNavHistoryResultNode
 //
 //    This is the base class for every node in a result set. The result itself
 //    is a node (nsNavHistoryResult inherits from this), as well as every
@@ -252,17 +254,16 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsNavHisto
     { *aId = mItemId; return NS_OK; }
 
 class nsNavHistoryResultNode : public nsINavHistoryResultNode
 {
 public:
   nsNavHistoryResultNode(const nsACString& aURI, const nsACString& aTitle,
                          uint32_t aAccessCount, PRTime aTime,
                          const nsACString& aIconURI);
-  virtual ~nsNavHistoryResultNode() {}
 
   NS_DECLARE_STATIC_IID_ACCESSOR(NS_NAVHISTORYRESULTNODE_IID)
 
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
   NS_DECL_CYCLE_COLLECTION_CLASS(nsNavHistoryResultNode)
 
   NS_IMPLEMENT_SIMPLE_RESULTNODE
   NS_IMETHOD GetIcon(nsACString& aIcon);
@@ -285,16 +286,19 @@ public:
                            bool aIsAnnotationProperty,
                            const nsACString &aValue,
                            PRTime aNewLastModified,
                            uint16_t aItemType,
                            int64_t aParentId,
                            const nsACString& aGUID,
                            const nsACString& aParentGUID);
 
+protected:
+  virtual ~nsNavHistoryResultNode() {}
+
 public:
 
   nsNavHistoryResult* GetResult();
   nsNavHistoryQueryOptions* GetGeneratingOptions();
 
   // These functions test the type. We don't use a virtual function since that
   // would take a vtable slot for every one of (potentially very many) nodes.
   // Note that GetType() already has a vtable slot because its on the iface.
--- a/toolkit/components/places/tests/cpp/mock_Link.h
+++ b/toolkit/components/places/tests/cpp/mock_Link.h
@@ -43,16 +43,17 @@ public:
     mDeathGrip = 0;
   }
 
   virtual size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
   {
     return 0;   // the value shouldn't matter
   }
 
+protected:
   ~mock_Link() {
     // Run the next test if we are supposed to.
     if (mRunNextTest) {
       run_next_test();
     }
   }
 
 private:
--- a/toolkit/components/places/tests/cpp/places_test_harness.h
+++ b/toolkit/components/places/tests/cpp/places_test_harness.h
@@ -131,16 +131,18 @@ public:
     nsCOMPtr<nsIObserverService> observerService =
       do_GetService(NS_OBSERVERSERVICE_CONTRACTID);
     do_check_true(observerService);
     (void)observerService->RemoveObserver(this, aTopic);
     return NS_OK;
   }
 
 private:
+  ~WaitForTopicSpinner() {}
+
   bool mTopicReceived;
   PRIntervalTime mStartTime;
 };
 NS_IMPL_ISUPPORTS(
   WaitForTopicSpinner,
   nsIObserver
 )
 
@@ -153,16 +155,18 @@ public:
   NS_DECL_ISUPPORTS
   NS_DECL_MOZISTORAGESTATEMENTCALLBACK
 
   AsyncStatementSpinner();
   void SpinUntilCompleted();
   uint16_t completionReason;
 
 protected:
+  ~AsyncStatementSpinner() {}
+
   volatile bool mCompleted;
 };
 
 NS_IMPL_ISUPPORTS(AsyncStatementSpinner,
                   mozIStorageStatementCallback)
 
 AsyncStatementSpinner::AsyncStatementSpinner()
 : completionReason(0)
@@ -366,16 +370,19 @@ addURI(nsIURI* aURI)
 }
 
 static const char TOPIC_PROFILE_CHANGE[] = "profile-before-change";
 static const char TOPIC_PLACES_CONNECTION_CLOSED[] = "places-connection-closed";
 
 class WaitForConnectionClosed MOZ_FINAL : public nsIObserver
 {
   nsRefPtr<WaitForTopicSpinner> mSpinner;
+
+  ~WaitForConnectionClosed() {}
+
 public:
   NS_DECL_ISUPPORTS
 
   WaitForConnectionClosed()
   {
     nsCOMPtr<nsIObserverService> os =
       do_GetService(NS_OBSERVERSERVICE_CONTRACTID);
     MOZ_ASSERT(os);
--- a/toolkit/components/places/tests/cpp/test_IHistory.cpp
+++ b/toolkit/components/places/tests/cpp/test_IHistory.cpp
@@ -44,16 +44,18 @@ new_test_uri()
   nsCOMPtr<nsIURI> testURI;
   nsresult rv = NS_NewURI(getter_AddRefs(testURI), spec);
   do_check_success(rv);
   return testURI.forget();
 }
 
 class VisitURIObserver MOZ_FINAL : public nsIObserver
 {
+  ~VisitURIObserver() {}
+
 public:
   NS_DECL_ISUPPORTS
 
   VisitURIObserver(int aExpectedVisits = 1) :
     mVisits(0),
     mExpectedVisits(aExpectedVisits)
   {
     nsCOMPtr<nsIObserverService> observerService =
@@ -300,16 +302,18 @@ test_RegisterVisitedCallback_returns_bef
 }
 
 namespace test_observer_topic_dispatched_helpers {
   #define URI_VISITED "visited"
   #define URI_NOT_VISITED "not visited"
   #define URI_VISITED_RESOLUTION_TOPIC "visited-status-resolution"
   class statusObserver MOZ_FINAL : public nsIObserver
   {
+    ~statusObserver() {}
+
   public:
     NS_DECL_ISUPPORTS
 
     statusObserver(nsIURI* aURI,
                    const bool aExpectVisit,
                    bool& _notified)
     : mURI(aURI)
     , mExpectVisit(aExpectVisit)
--- a/toolkit/components/satchel/nsFormFillController.h
+++ b/toolkit/components/satchel/nsFormFillController.h
@@ -46,19 +46,20 @@ public:
   NS_DECL_NSIDOMEVENTLISTENER
   NS_DECL_NSIMUTATIONOBSERVER
 
   nsresult Focus(nsIDOMEvent* aEvent);
   nsresult KeyPress(nsIDOMEvent* aKeyEvent);
   nsresult MouseDown(nsIDOMEvent* aMouseEvent);
 
   nsFormFillController();
+
+protected:
   virtual ~nsFormFillController();
 
-protected:
   void AddWindowListeners(nsIDOMWindow *aWindow);
   void RemoveWindowListeners(nsIDOMWindow *aWindow);
 
   void AddKeyListener(nsINode* aInput);
   void RemoveKeyListener();
 
   void StartControllingInput(nsIDOMHTMLInputElement *aInput);
   void StopControllingInput();
--- a/toolkit/components/startup/nsUserInfo.h
+++ b/toolkit/components/startup/nsUserInfo.h
@@ -11,12 +11,13 @@ class nsUserInfo: public nsIUserInfo
 
 {
 public:
   nsUserInfo(void);
 
   NS_DECL_ISUPPORTS
   NS_DECL_NSIUSERINFO
 
+protected:
   virtual ~nsUserInfo();
 };
 
 #endif /* __nsUserInfo_h */
--- a/toolkit/components/statusfilter/nsBrowserStatusFilter.h
+++ b/toolkit/components/statusfilter/nsBrowserStatusFilter.h
@@ -20,23 +20,25 @@
 //-----------------------------------------------------------------------------
 
 class nsBrowserStatusFilter : public nsIWebProgress
                             , public nsIWebProgressListener2
                             , public nsSupportsWeakReference
 {
 public:
     nsBrowserStatusFilter();
-    virtual ~nsBrowserStatusFilter();
 
     NS_DECL_ISUPPORTS
     NS_DECL_NSIWEBPROGRESS
     NS_DECL_NSIWEBPROGRESSLISTENER
     NS_DECL_NSIWEBPROGRESSLISTENER2
 
+protected:
+    virtual ~nsBrowserStatusFilter();
+
 private:
     nsresult StartDelayTimer();
     void ProcessTimeout();
     void MaybeSendProgress();
     void MaybeSendStatus();
     void ResetMembers();
     bool DelayInEffect() { return mDelayedStatus || mDelayedProgress; }
 
--- a/toolkit/components/telemetry/Telemetry.cpp
+++ b/toolkit/components/telemetry/Telemetry.cpp
@@ -552,18 +552,16 @@ class TelemetryImpl MOZ_FINAL
   : public nsITelemetry
   , public nsIMemoryReporter
 {
   NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSITELEMETRY
   NS_DECL_NSIMEMORYREPORTER
 
 public:
-  ~TelemetryImpl();
-
   void InitMemoryReporter();
 
   static bool CanRecord();
   static already_AddRefed<nsITelemetry> CreateTelemetryInstance();
   static void ShutdownTelemetry();
   static void RecordSlowStatement(const nsACString &sql, const nsACString &dbName,
                                   uint32_t delay);
 #if defined(MOZ_ENABLE_PROFILER_SPS)
@@ -582,16 +580,17 @@ public:
   struct StmtStats {
     struct Stat mainThread;
     struct Stat otherThreads;
   };
   typedef nsBaseHashtableET<nsCStringHashKey, StmtStats> SlowSQLEntryType;
 
 private:
   TelemetryImpl();
+  ~TelemetryImpl();
 
   static nsCString SanitizeSQL(const nsACString& sql);
 
   enum SanitizedState { Sanitized, Unsanitized };
 
   static void StoreSlowSQL(const nsACString &offender, uint32_t delay,
                            SanitizedState state);
 
--- a/toolkit/components/typeaheadfind/nsTypeAheadFind.h
+++ b/toolkit/components/typeaheadfind/nsTypeAheadFind.h
@@ -25,25 +25,26 @@ class nsPresContext;
         "chrome://global/content/notfound.wav"
 
 class nsTypeAheadFind : public nsITypeAheadFind,
                         public nsIObserver,
                         public nsSupportsWeakReference
 {
 public:
   nsTypeAheadFind();
-  virtual ~nsTypeAheadFind();
 
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
   NS_DECL_NSITYPEAHEADFIND
   NS_DECL_NSIOBSERVER
 
   NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsTypeAheadFind, nsITypeAheadFind)
 
 protected:
+  virtual ~nsTypeAheadFind();
+
   nsresult PrefsReset();
 
   void SaveFind();
   void PlayNotFoundSound(); 
   nsresult GetWebBrowserFind(nsIDocShell *aDocShell,
                              nsIWebBrowserFind **aWebBrowserFind);
 
   void RangeStartsInsideLink(nsIDOMRange *aRange, nsIPresShell *aPresShell, 
--- a/toolkit/components/url-classifier/nsUrlClassifierDBService.cpp
+++ b/toolkit/components/url-classifier/nsUrlClassifierDBService.cpp
@@ -768,19 +768,19 @@ public:
   nsUrlClassifierLookupCallback(nsUrlClassifierDBService *dbservice,
                                 nsIUrlClassifierCallback *c)
     : mDBService(dbservice)
     , mResults(nullptr)
     , mPendingCompletions(0)
     , mCallback(c)
     {}
 
+private:
   ~nsUrlClassifierLookupCallback();
 
-private:
   nsresult HandleResults();
 
   nsRefPtr<nsUrlClassifierDBService> mDBService;
   nsAutoPtr<LookupResultArray> mResults;
 
   // Completed results to send back to the worker for caching.
   nsAutoPtr<CacheResultArray> mCacheResults;
 
@@ -982,16 +982,18 @@ public:
                                   bool checkMalware,
                                   bool checkPhishing)
     : mCallback(c)
     , mCheckMalware(checkMalware)
     , mCheckPhishing(checkPhishing)
     {}
 
 private:
+  ~nsUrlClassifierClassifyCallback() {}
+
   nsCOMPtr<nsIURIClassifierCallback> mCallback;
   bool mCheckMalware;
   bool mCheckPhishing;
 };
 
 NS_IMPL_ISUPPORTS(nsUrlClassifierClassifyCallback,
                   nsIUrlClassifierCallback)
 
--- a/toolkit/components/url-classifier/nsUrlClassifierPrefixSet.h
+++ b/toolkit/components/url-classifier/nsUrlClassifierPrefixSet.h
@@ -21,33 +21,34 @@
 #include "mozilla/FileUtils.h"
 
 class nsUrlClassifierPrefixSet
   : public nsIUrlClassifierPrefixSet
   , public nsIMemoryReporter
 {
 public:
   nsUrlClassifierPrefixSet();
-  virtual ~nsUrlClassifierPrefixSet();
 
   NS_IMETHOD Init(const nsACString& aName);
   NS_IMETHOD SetPrefixes(const uint32_t* aArray, uint32_t aLength);
   NS_IMETHOD GetPrefixes(uint32_t* aCount, uint32_t** aPrefixes);
   NS_IMETHOD Contains(uint32_t aPrefix, bool* aFound);
   NS_IMETHOD IsEmpty(bool* aEmpty);
   NS_IMETHOD LoadFromFile(nsIFile* aFile);
   NS_IMETHOD StoreToFile(nsIFile* aFile);
 
   NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIMEMORYREPORTER
 
   // Return the estimated size of the set on disk and in memory, in bytes.
   size_t SizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf);
 
 protected:
+  virtual ~nsUrlClassifierPrefixSet();
+
   static const uint32_t DELTAS_LIMIT = 100;
   static const uint32_t MAX_INDEX_DIFF = (1 << 16);
   static const uint32_t PREFIXSET_VERSION_MAGIC = 1;
 
   nsresult MakePrefixSet(const uint32_t* aArray, uint32_t aLength);
   uint32_t BinSearch(uint32_t start, uint32_t end, uint32_t target);
   nsresult LoadFromFd(mozilla::AutoFDClose& fileFd);
   nsresult StoreToFd(mozilla::AutoFDClose& fileFd);
--- a/toolkit/components/url-classifier/nsUrlClassifierProxies.h
+++ b/toolkit/components/url-classifier/nsUrlClassifierProxies.h
@@ -146,16 +146,18 @@ public:
     NS_DECL_NSIRUNNABLE
 
   private:
     nsCOMPtr<nsIUrlClassifierDBServiceWorker> mTarget;
     mozilla::safebrowsing::PrefixArray *mEntries;
   };
 
 private:
+  ~UrlClassifierDBServiceWorkerProxy() {}
+
   nsCOMPtr<nsIUrlClassifierDBServiceWorker> mTarget;
 };
 
 // The remaining classes here are all proxies to the main thread
 
 class UrlClassifierLookupCallbackProxy MOZ_FINAL :
   public nsIUrlClassifierLookupCallback
 {
@@ -179,16 +181,18 @@ public:
     NS_DECL_NSIRUNNABLE
 
   private:
     nsMainThreadPtrHandle<nsIUrlClassifierLookupCallback> mTarget;
     mozilla::safebrowsing::LookupResultArray * mResults;
   };
 
 private:
+  ~UrlClassifierLookupCallbackProxy() {}
+
   nsMainThreadPtrHandle<nsIUrlClassifierLookupCallback> mTarget;
 };
 
 class UrlClassifierCallbackProxy MOZ_FINAL : public nsIUrlClassifierCallback
 {
 public:
   UrlClassifierCallbackProxy(nsIUrlClassifierCallback* aTarget)
     : mTarget(new nsMainThreadPtrHolder<nsIUrlClassifierCallback>(aTarget))
@@ -209,16 +213,18 @@ public:
     NS_DECL_NSIRUNNABLE
 
   private:
     nsMainThreadPtrHandle<nsIUrlClassifierCallback> mTarget;
     nsCString mValue;
   };
 
 private:
+  ~UrlClassifierCallbackProxy() {}
+
   nsMainThreadPtrHandle<nsIUrlClassifierCallback> mTarget;
 };
 
 class UrlClassifierUpdateObserverProxy MOZ_FINAL :
   public nsIUrlClassifierUpdateObserver
 {
 public:
   UrlClassifierUpdateObserverProxy(nsIUrlClassifierUpdateObserver* aTarget)
@@ -292,12 +298,14 @@ public:
     NS_DECL_NSIRUNNABLE
 
   private:
     nsMainThreadPtrHandle<nsIUrlClassifierUpdateObserver> mTarget;
     uint32_t mRequestedTimeout;
   };
 
 private:
+  ~UrlClassifierUpdateObserverProxy() {}
+
   nsMainThreadPtrHandle<nsIUrlClassifierUpdateObserver> mTarget;
 };
 
 #endif // nsUrlClassifierProxies_h
--- a/toolkit/components/url-classifier/nsUrlClassifierUtils.h
+++ b/toolkit/components/url-classifier/nsUrlClassifierUtils.h
@@ -41,17 +41,16 @@ private:
   private:
     // Store the 256 bits in an 8 byte array.
     uint32_t mMap[8];
   };
 
 
 public:
   nsUrlClassifierUtils();
-  ~nsUrlClassifierUtils() {}
 
   NS_DECL_ISUPPORTS
   NS_DECL_NSIURLCLASSIFIERUTILS
 
   nsresult Init();
 
   nsresult CanonicalizeHostname(const nsACString & hostname,
                                 nsACString & _retval);
@@ -69,16 +68,18 @@ public:
 
   void ParseIPAddress(const nsACString & host, nsACString & _retval);
   void CanonicalNum(const nsACString & num,
                     uint32_t bytes,
                     bool allowOctal,
                     nsACString & _retval);
 
 private:
+  ~nsUrlClassifierUtils() {}
+
   // Disallow copy constructor
   nsUrlClassifierUtils(const nsUrlClassifierUtils&);
 
   // Function to tell if we should encode a character.
   bool ShouldURLEscape(const unsigned char c) const;
 
   void CleanupHostname(const nsACString & host, nsACString & _retval);
 
--- a/toolkit/identity/IdentityCryptoService.cpp
+++ b/toolkit/identity/IdentityCryptoService.cpp
@@ -200,16 +200,17 @@ public:
     nsCOMPtr<nsISupports> dummyUsedToEnsureNSSIsInitialized
       = do_GetService("@mozilla.org/psm;1", &rv);
     NS_ENSURE_SUCCESS(rv, rv);
 
     return NS_OK;
   }
 
 private:
+  ~IdentityCryptoService() { }
   IdentityCryptoService(const KeyPair &) MOZ_DELETE;
   void operator=(const IdentityCryptoService &) MOZ_DELETE;
 };
 
 NS_IMPL_ISUPPORTS(IdentityCryptoService, nsIIdentityCryptoService)
 
 NS_IMETHODIMP
 IdentityCryptoService::GenerateKeyPair(
--- a/toolkit/mozapps/extensions/AddonPathService.h
+++ b/toolkit/mozapps/extensions/AddonPathService.h
@@ -17,17 +17,16 @@ namespace mozilla {
 
 JSAddonId*
 MapURIToAddonID(nsIURI* aURI);
 
 class AddonPathService MOZ_FINAL : public amIAddonPathService
 {
 public:
   AddonPathService();
-  virtual ~AddonPathService();
 
   static AddonPathService* GetInstance();
 
   JSAddonId* Find(const nsAString& path);
   static JSAddonId* FindAddonId(const nsAString& path);
 
   NS_DECL_ISUPPORTS
   NS_DECL_AMIADDONPATHSERVICE
@@ -38,16 +37,18 @@ public:
     JSAddonId* mAddonId;
 
     PathEntry(const nsAString& aPath, JSAddonId* aAddonId)
      : mPath(aPath), mAddonId(aAddonId)
     {}
   };
 
 private:
+  virtual ~AddonPathService();
+
   // Paths are stored sorted in order of their mPath.
   nsTArray<PathEntry> mPaths;
 
   static AddonPathService* sInstance;
 };
 
 } // namespace mozilla
 
--- a/toolkit/profile/nsToolkitProfileService.cpp
+++ b/toolkit/profile/nsToolkitProfileService.cpp
@@ -48,19 +48,19 @@ class nsToolkitProfile MOZ_FINAL : publi
 public:
     NS_DECL_ISUPPORTS
     NS_DECL_NSITOOLKITPROFILE
 
     friend class nsToolkitProfileService;
     nsRefPtr<nsToolkitProfile> mNext;
     nsToolkitProfile          *mPrev;
 
+private:
     ~nsToolkitProfile() { }
 
-private:
     nsToolkitProfile(const nsACString& aName,
                      nsIFile* aRootDir,
                      nsIFile* aLocalDir,
                      nsToolkitProfile* aPrev,
                      bool aForExternalApp);
 
     friend class nsToolkitProfileLock;
 
@@ -77,28 +77,30 @@ public:
     NS_DECL_ISUPPORTS
     NS_DECL_NSIPROFILELOCK
 
     nsresult Init(nsToolkitProfile* aProfile, nsIProfileUnlocker* *aUnlocker);
     nsresult Init(nsIFile* aDirectory, nsIFile* aLocalDirectory,
                   nsIProfileUnlocker* *aUnlocker);
 
     nsToolkitProfileLock() { }
+
+private:
     ~nsToolkitProfileLock();
 
-private:
     nsRefPtr<nsToolkitProfile> mProfile;
     nsCOMPtr<nsIFile> mDirectory;
     nsCOMPtr<nsIFile> mLocalDirectory;
 
     nsProfileLock mLock;
 };
 
 class nsToolkitProfileFactory MOZ_FINAL : public nsIFactory
 {
+    ~nsToolkitProfileFactory() {}
 public:
     NS_DECL_ISUPPORTS
     NS_DECL_NSIFACTORY
 };
 
 class nsToolkitProfileService MOZ_FINAL : public nsIToolkitProfileService
 {
 public:
--- a/toolkit/system/dbus/nsDBusService.h
+++ b/toolkit/system/dbus/nsDBusService.h
@@ -37,19 +37,21 @@ public:
  * 
  * In the future we could extend this class to talk to other daemons.
  * 
  * Currently all communication is asynchronous. This isn't hard to implement
  * and avoids blocking our main thread.
  */
 class nsDBusService : public nsISupports
 {
+protected:
+  virtual ~nsDBusService();
+
 public:
   nsDBusService();
-  virtual ~nsDBusService();
 
   NS_DECL_ISUPPORTS
   NS_DECLARE_STATIC_IID_ACCESSOR(NS_DBUS_IID)
 
   static already_AddRefed<nsDBusService> Get();
   
   nsresult AddClient(DBusClient* client);
   void RemoveClient(DBusClient* client);
--- a/toolkit/system/dbus/nsNetworkManagerListener.h
+++ b/toolkit/system/dbus/nsNetworkManagerListener.h
@@ -12,31 +12,33 @@
 
 class nsNetworkManagerListener : public nsINetworkLinkService,
                                  public DBusClient {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSINETWORKLINKSERVICE
 
   nsNetworkManagerListener();
-  virtual ~nsNetworkManagerListener();
 
   nsresult Init();
 
   virtual void RegisterWithConnection(DBusConnection* connection);
   virtual void UnregisterWithConnection(DBusConnection* connection);
   virtual bool HandleMessage(DBusMessage* msg);
 
   /**
    * This gets called when NetworkManager sends us a StateChange signal,
    * or when we receive a reply to our inquiry.
    * The message contains the current NMState.
    */
   void UpdateNetworkStatus(DBusMessage* message);
 
+protected:
+  virtual ~nsNetworkManagerListener();
+
 private:
   void NotifyNetworkStatusObservers();
 
   nsCOMPtr<nsDBusService> mDBUS;
   bool                    mLinkUp;
   bool                    mNetworkManagerActive;
   bool                    mOK;
 };
--- a/toolkit/system/gnome/nsGIOService.cpp
+++ b/toolkit/system/gnome/nsGIOService.cpp
@@ -42,19 +42,20 @@ get_content_type_from_mime_type(const ch
 
 class nsGIOMimeApp MOZ_FINAL : public nsIGIOMimeApp
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIGIOMIMEAPP
 
   nsGIOMimeApp(GAppInfo* aApp) : mApp(aApp) {}
+
+private:
   ~nsGIOMimeApp() { g_object_unref(mApp); }
 
-private:
   GAppInfo *mApp;
 };
 
 NS_IMPL_ISUPPORTS(nsGIOMimeApp, nsIGIOMimeApp)
 
 NS_IMETHODIMP
 nsGIOMimeApp::GetId(nsACString& aId)
 {
@@ -102,19 +103,20 @@ nsGIOMimeApp::Launch(const nsACString& a
     return NS_ERROR_FAILURE;
   }
 
   return NS_OK;
 }
 
 class GIOUTF8StringEnumerator MOZ_FINAL : public nsIUTF8StringEnumerator
 {
+  ~GIOUTF8StringEnumerator() { }
+
 public:
   GIOUTF8StringEnumerator() : mIndex(0) { }
-  ~GIOUTF8StringEnumerator() { }
 
   NS_DECL_ISUPPORTS
   NS_DECL_NSIUTF8STRINGENUMERATOR
 
   nsTArray<nsCString> mStrings;
   uint32_t            mIndex;
 };
 
--- a/toolkit/system/gnome/nsGIOService.h
+++ b/toolkit/system/gnome/nsGIOService.h
@@ -8,15 +8,17 @@
 
 #include "nsIGIOService.h"
 
 #define NS_GIOSERVICE_CID \
 {0xe3a1f3c9, 0x3ae1, 0x4b40, {0xa5, 0xe0, 0x7b, 0x45, 0x7f, 0xc9, 0xa9, 0xad}}
 
 class nsGIOService MOZ_FINAL : public nsIGIOService
 {
+  ~nsGIOService() {}
+
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIGIOSERVICE
 };
 
 #endif
 
--- a/toolkit/system/gnome/nsGSettingsService.cpp
+++ b/toolkit/system/gnome/nsGSettingsService.cpp
@@ -80,19 +80,19 @@ static PRLibrary *gioLib = nullptr;
 class nsGSettingsCollection MOZ_FINAL : public nsIGSettingsCollection
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIGSETTINGSCOLLECTION
 
   nsGSettingsCollection(GSettings* aSettings) : mSettings(aSettings),
                                                 mKeys(nullptr) {}
+private:
   ~nsGSettingsCollection();
 
-private:
   bool KeyExists(const nsACString& aKey);
   bool SetValue(const nsACString& aKey,
                   GVariant *aValue);
 
   GSettings *mSettings;
   char **mKeys;
 };
 
--- a/toolkit/xre/nsAppRunner.cpp
+++ b/toolkit/xre/nsAppRunner.cpp
@@ -1279,19 +1279,19 @@ ScopedXPCOMStartup::Initialize()
  */
 class nsSingletonFactory MOZ_FINAL : public nsIFactory
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIFACTORY
 
   nsSingletonFactory(nsISupports* aSingleton);
-  ~nsSingletonFactory() { }
 
 private:
+  ~nsSingletonFactory() { }
   nsCOMPtr<nsISupports> mSingleton;
 };
 
 nsSingletonFactory::nsSingletonFactory(nsISupports* aSingleton)
   : mSingleton(aSingleton)
 {
   NS_ASSERTION(mSingleton, "Singleton was null!");
 }
--- a/toolkit/xre/nsNativeAppSupportBase.h
+++ b/toolkit/xre/nsNativeAppSupportBase.h
@@ -12,15 +12,17 @@
 // nsNativeAppSupportBase
 //
 // This is a default implementation of the nsINativeAppSupport interface
 // declared in mozilla/xpfe/appshell/public/nsINativeAppSupport.h.
 
 class nsNativeAppSupportBase : public nsINativeAppSupport {
 public:
     nsNativeAppSupportBase();
-    virtual ~nsNativeAppSupportBase();
 
     NS_DECL_ISUPPORTS
     NS_DECL_NSINATIVEAPPSUPPORT
+
+protected:
+    virtual ~nsNativeAppSupportBase();
 };
 
 #endif
--- a/toolkit/xre/nsUpdateDriver.cpp
+++ b/toolkit/xre/nsUpdateDriver.cpp
@@ -1009,16 +1009,20 @@ ProcessUpdates(nsIFile *greDir, nsIFile 
 
 NS_IMPL_ISUPPORTS(nsUpdateProcessor, nsIUpdateProcessor)
 
 nsUpdateProcessor::nsUpdateProcessor()
   : mUpdaterPID(0)
 {
 }
 
+nsUpdateProcessor::~nsUpdateProcessor()
+{
+}
+
 NS_IMETHODIMP
 nsUpdateProcessor::ProcessUpdate(nsIUpdate* aUpdate)
 {
   nsCOMPtr<nsIFile> greDir, appDir, updRoot;
   nsAutoCString appVersion;
   int argc;
   char **argv;
 
--- a/toolkit/xre/nsUpdateDriver.h
+++ b/toolkit/xre/nsUpdateDriver.h
@@ -66,16 +66,18 @@ class nsUpdateProcessor MOZ_FINAL : publ
 {
 public:
   nsUpdateProcessor();
 
   NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIUPDATEPROCESSOR
 
 private:
+  ~nsUpdateProcessor();
+
   struct StagedUpdateInfo {
     StagedUpdateInfo()
       : mArgc(0),
         mArgv(nullptr),
         mIsOSUpdate(false)
     {}
     ~StagedUpdateInfo() {
       for (int i = 0; i < mArgc; ++i) {