Bug 1028588 - Fix dangerous public destructors in miscellaneous places - r=ehsan
authorBenoit Jacob <bjacob@mozilla.com>
Mon, 23 Jun 2014 18:40:03 -0400
changeset 190361 fdb81eed139712db471a6327ff3f98bb82d2e57e
parent 190360 12985d7bd06a6fb901b7c2fb55a5b86353d57660
child 190362 c928b9f75e7f95c0f60330f7dd0a54a6a0081ad1
push id27004
push useremorley@mozilla.com
push dateTue, 24 Jun 2014 15:52:34 +0000
treeherdermozilla-central@7b174d47f3cc [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 miscellaneous places - r=ehsan
browser/components/about/AboutRedirector.h
browser/components/dirprovider/DirectoryProvider.h
browser/components/feeds/src/nsFeedSniffer.h
caps/include/DomainPolicy.h
caps/src/nsNullPrincipalURI.h
chrome/src/nsChromeProtocolHandler.h
chrome/src/nsChromeRegistry.h
hal/HalWakeLock.cpp
services/crypto/component/nsSyncJPAKE.h
startupcache/StartupCache.h
tools/profiler/SaveProfileTask.h
tools/profiler/nsProfiler.h
--- a/browser/components/about/AboutRedirector.h
+++ b/browser/components/about/AboutRedirector.h
@@ -13,20 +13,20 @@ namespace browser {
 
 class AboutRedirector : public nsIAboutModule
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIABOUTMODULE
  
   AboutRedirector() {}
-  virtual ~AboutRedirector() {}
 
   static nsresult
     Create(nsISupports *aOuter, REFNSIID aIID, void **aResult);
 
 protected:
+  virtual ~AboutRedirector() {}
 };
 
 } // namespace browser
 } // namespace mozilla
 
 #endif // AboutRedirector_h__
--- a/browser/components/dirprovider/DirectoryProvider.h
+++ b/browser/components/dirprovider/DirectoryProvider.h
@@ -20,26 +20,30 @@ namespace browser {
 class DirectoryProvider MOZ_FINAL : public nsIDirectoryServiceProvider2
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIDIRECTORYSERVICEPROVIDER
   NS_DECL_NSIDIRECTORYSERVICEPROVIDER2
 
 private:
+  ~DirectoryProvider() {}
+
   class AppendingEnumerator MOZ_FINAL : public nsISimpleEnumerator
   {
   public:
     NS_DECL_ISUPPORTS
     NS_DECL_NSISIMPLEENUMERATOR
 
     AppendingEnumerator(nsISimpleEnumerator* aBase,
                         char const *const *aAppendList);
 
   private:
+    ~AppendingEnumerator() {}
+
     nsCOMPtr<nsISimpleEnumerator> mBase;
     char const *const *const      mAppendList;
     nsCOMPtr<nsIFile>             mNext;
   };
 };
 
 } // namespace browser
 } // namespace mozilla
--- a/browser/components/feeds/src/nsFeedSniffer.h
+++ b/browser/components/feeds/src/nsFeedSniffer.h
@@ -21,15 +21,17 @@ public:
   static NS_METHOD AppendSegmentToString(nsIInputStream* inputStream,
                                          void* closure,
                                          const char* rawSegment,
                                          uint32_t toOffset,
                                          uint32_t count,
                                          uint32_t* writeCount);
 
 protected:
+  ~nsFeedSniffer() {}
+
   nsresult ConvertEncodedData(nsIRequest* request, const uint8_t* data,
                               uint32_t length);
 
 private:
   nsCString mDecodedData;
 };
 
--- a/caps/include/DomainPolicy.h
+++ b/caps/include/DomainPolicy.h
@@ -14,33 +14,34 @@
 namespace mozilla {
 
 class DomainPolicy : public nsIDomainPolicy
 {
 public:
     NS_DECL_ISUPPORTS
     NS_DECL_NSIDOMAINPOLICY
     DomainPolicy();
+
+private:
     virtual ~DomainPolicy();
 
-private:
     nsCOMPtr<nsIDomainSet> mBlacklist;
     nsCOMPtr<nsIDomainSet> mSuperBlacklist;
     nsCOMPtr<nsIDomainSet> mWhitelist;
     nsCOMPtr<nsIDomainSet> mSuperWhitelist;
 };
 
 class DomainSet : public nsIDomainSet
 {
 public:
     NS_DECL_ISUPPORTS
     NS_DECL_NSIDOMAINSET
 
     DomainSet() {}
-    virtual ~DomainSet() {}
 
 protected:
+    virtual ~DomainSet() {}
     nsTHashtable<nsURIHashKey> mHashTable;
 };
 
 } /* namespace mozilla */
 
 #endif /* DomainPolicy_h__ */
--- a/caps/src/nsNullPrincipalURI.h
+++ b/caps/src/nsNullPrincipalURI.h
@@ -32,13 +32,15 @@ public:
 
   // nsISizeOf
   virtual size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
   virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
 
   nsNullPrincipalURI(const nsCString &aSpec);
 
 private:
+  ~nsNullPrincipalURI() {}
+
   nsCString mScheme;
   nsCString mPath;
 };
 
 #endif // __nsNullPrincipalURI_h__
--- a/chrome/src/nsChromeProtocolHandler.h
+++ b/chrome/src/nsChromeProtocolHandler.h
@@ -24,12 +24,14 @@ class nsChromeProtocolHandler MOZ_FINAL 
 public:
     NS_DECL_THREADSAFE_ISUPPORTS
 
     // nsIProtocolHandler methods:
     NS_DECL_NSIPROTOCOLHANDLER
 
     // nsChromeProtocolHandler methods:
     nsChromeProtocolHandler() {}
+
+private:
     ~nsChromeProtocolHandler() {}
 };
 
 #endif /* nsChromeProtocolHandler_h___ */
--- a/chrome/src/nsChromeRegistry.h
+++ b/chrome/src/nsChromeRegistry.h
@@ -55,27 +55,28 @@ public:
                                   bool* _retval);
 
   // nsIChromeRegistry methods:
   NS_IMETHOD_(bool) WrappersEnabled(nsIURI *aURI);
   NS_IMETHOD ConvertChromeURL(nsIURI* aChromeURI, nsIURI* *aResult);
 
   // nsChromeRegistry methods:
   nsChromeRegistry() : mInitialized(false) { }
-  virtual ~nsChromeRegistry();
 
   virtual nsresult Init();
 
   static already_AddRefed<nsIChromeRegistry> GetService();
 
   static nsChromeRegistry* gChromeRegistry;
 
   static nsresult Canonify(nsIURL* aChromeURL);
 
 protected:
+  virtual ~nsChromeRegistry();
+
   void FlushSkinCaches();
   void FlushAllCaches();
 
   // Update the selected locale used by the chrome registry, and fire a
   // notification about this change
   virtual nsresult UpdateSelectedLocale() = 0;
 
   static void LogMessage(const char* aMsg, ...);
--- a/hal/HalWakeLock.cpp
+++ b/hal/HalWakeLock.cpp
@@ -92,16 +92,17 @@ RemoveChildFromList(const nsAString& aKe
       NotifyWakeLockChange(WakeLockInfoFromLockCount(aKey, totalCount));
     }
   }
 
   return op;
 }
 
 class ClearHashtableOnShutdown MOZ_FINAL : public nsIObserver {
+  ~ClearHashtableOnShutdown() {}
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIOBSERVER
 };
 
 NS_IMPL_ISUPPORTS(ClearHashtableOnShutdown, nsIObserver)
 
 NS_IMETHODIMP
@@ -111,16 +112,17 @@ ClearHashtableOnShutdown::Observe(nsISup
 
   sIsShuttingDown = true;
   sLockTable = nullptr;
 
   return NS_OK;
 }
 
 class CleanupOnContentShutdown MOZ_FINAL : public nsIObserver {
+  ~CleanupOnContentShutdown() {}
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIOBSERVER
 };
 
 NS_IMPL_ISUPPORTS(CleanupOnContentShutdown, nsIObserver)
 
 NS_IMETHODIMP
--- a/services/crypto/component/nsSyncJPAKE.h
+++ b/services/crypto/component/nsSyncJPAKE.h
@@ -15,16 +15,17 @@
 typedef struct PK11SymKeyStr PK11SymKey;
 
 class nsSyncJPAKE : public nsISyncJPAKE
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSISYNCJPAKE
   nsSyncJPAKE();
+protected:
   virtual ~nsSyncJPAKE();
 private:
   enum { JPAKENotStarted, JPAKEBeforeRound2, JPAKEAfterRound2 } round;
   PK11SymKey * key;
 };
 
 NS_IMPL_ISUPPORTS(nsSyncJPAKE, nsISyncJPAKE)
 
--- a/startupcache/StartupCache.h
+++ b/startupcache/StartupCache.h
@@ -88,16 +88,17 @@ struct CacheEntry
     return mallocSizeOf(data);
   }
 };
 
 // We don't want to refcount StartupCache, and ObserverService wants to
 // refcount its listeners, so we'll let it refcount this instead.
 class StartupCacheListener MOZ_FINAL : public nsIObserver
 {
+  ~StartupCacheListener() {}
   NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIOBSERVER
 };
 
 class StartupCache : public nsIMemoryReporter
 {
 
 friend class StartupCacheListener;
@@ -182,17 +183,19 @@ private:
 };
 
 // This debug outputstream attempts to detect if clients are writing multiple
 // references to the same object. We only support that if that object
 // is a singleton.
 #ifdef DEBUG
 class StartupCacheDebugOutputStream MOZ_FINAL
   : public nsIObjectOutputStream
-{  
+{
+  ~StartupCacheDebugOutputStream() {}
+
   NS_DECL_ISUPPORTS
   NS_DECL_NSIOBJECTOUTPUTSTREAM
 
   StartupCacheDebugOutputStream (nsIObjectOutputStream* binaryStream,
                                    nsTHashtable<nsISupportsHashKey>* objectMap)
   : mBinaryStream(binaryStream), mObjectMap(objectMap) { }
   
   NS_FORWARD_SAFE_NSIBINARYOUTPUTSTREAM(mBinaryStream)
@@ -209,16 +212,18 @@ class StartupCacheDebugOutputStream MOZ_
 #define NS_STARTUPCACHE_CID \
       {0xae4505a9, 0x87ab, 0x477c, \
       {0xb5, 0x77, 0xf9, 0x23, 0x57, 0xed, 0xa8, 0x84}}
 // contract id: "@mozilla.org/startupcache/cache;1"
 
 class StartupCacheWrapper MOZ_FINAL
   : public nsIStartupCache
 {
+  ~StartupCacheWrapper() {}
+
   NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSISTARTUPCACHE
 
   static StartupCacheWrapper* GetSingleton();
   static StartupCacheWrapper *gStartupCacheWrapper;
 };
 
 } // namespace scache
--- a/tools/profiler/SaveProfileTask.h
+++ b/tools/profiler/SaveProfileTask.h
@@ -38,18 +38,18 @@ public:
   typedef void (*AddSubProfileFunc)(const char* aProfile, void* aClosure);
   NS_DECL_ISUPPORTS
 
   ProfileSaveEvent(AddSubProfileFunc aFunc, void* aClosure)
     : mFunc(aFunc)
     , mClosure(aClosure)
   {}
 
+  NS_IMETHOD AddSubProfile(const char* aProfile);
+private:
   ~ProfileSaveEvent() {}
 
-  NS_IMETHOD AddSubProfile(const char* aProfile);
-private:
   AddSubProfileFunc mFunc;
   void* mClosure;
 };
 
 #endif
 
--- a/tools/profiler/nsProfiler.h
+++ b/tools/profiler/nsProfiler.h
@@ -9,21 +9,21 @@
 #include "nsIProfiler.h"
 #include "nsIObserver.h"
 #include "mozilla/Attributes.h"
 
 class nsProfiler MOZ_FINAL : public nsIProfiler, public nsIObserver
 {
 public:
     nsProfiler();
-    ~nsProfiler();
 
     NS_DECL_ISUPPORTS
     NS_DECL_NSIOBSERVER
     NS_DECL_NSIPROFILER
 
     nsresult Init();
 private:
+    ~nsProfiler();
     bool mLockedForPrivateBrowsing;
 };
 
 #endif /* _NSPROFILER_H_ */