Bug 1028588 - Fix dangerous public destructors in docshell/ - r=smaug
authorBenoit Jacob <bjacob@mozilla.com>
Mon, 23 Jun 2014 14:49:08 -0400
changeset 190265 4ccc78ad6d2ac2d92684501ee74d11e4d52135f8
parent 190264 477fcc7c9f603649c4b15b90b2ababd40a87b8cc
child 190266 31aa508e8c6d2a72bcf4406b034ba4432da0e898
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewerssmaug
bugs1028588
milestone33.0a1
Bug 1028588 - Fix dangerous public destructors in docshell/ - r=smaug
docshell/base/LoadContext.h
docshell/base/nsAboutRedirector.h
docshell/base/nsDocShell.cpp
docshell/base/nsDocShell.h
docshell/base/nsDocShellEnumerator.h
docshell/base/nsDocShellTransferableHooks.h
docshell/base/nsDownloadHistory.h
docshell/shistory/src/nsSHEntryShared.h
--- a/docshell/base/LoadContext.h
+++ b/docshell/base/LoadContext.h
@@ -101,16 +101,18 @@ public:
     , mUseRemoteTabs(false)
     , mIsInBrowserElement(false)
 #ifdef DEBUG
     , mIsNotNull(true)
 #endif
   {}
 
 private:
+  ~LoadContext() {}
+
   nsWeakPtr     mTopFrameElement;
   uint64_t      mNestedFrameId;
   uint32_t      mAppId;
   bool          mIsContent;
   bool          mUsePrivateBrowsing;
   bool          mUseRemoteTabs;
   bool          mIsInBrowserElement;
 #ifdef DEBUG
--- a/docshell/base/nsAboutRedirector.h
+++ b/docshell/base/nsAboutRedirector.h
@@ -11,22 +11,22 @@
 class nsAboutRedirector : public nsIAboutModule
 {
 public:
     NS_DECL_ISUPPORTS
 
     NS_DECL_NSIABOUTMODULE
 
     nsAboutRedirector() {}
-    virtual ~nsAboutRedirector() {}
 
     static nsresult
     Create(nsISupports *aOuter, REFNSIID aIID, void **aResult);
 
 protected:
+    virtual ~nsAboutRedirector() {}
 };
 
 #define NS_ABOUT_REDIRECTOR_MODULE_CID               \
 { /*  f0acde16-1dd1-11b2-9e35-f5786fff5a66*/         \
     0xf0acde16,                                      \
     0x1dd1,                                          \
     0x11b2,                                          \
     {0x9e, 0x35, 0xf5, 0x78, 0x6f, 0xff, 0x5a, 0x66} \
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -425,21 +425,21 @@ public:
   NS_DECL_NSICHANNELEVENTSINK
 
   nsPingListener(bool requireSameHost, nsIContent* content, nsILoadGroup* loadGroup)
     : mRequireSameHost(requireSameHost),
       mContent(content),
       mLoadGroup(loadGroup)
   {}
 
-  ~nsPingListener();
-
   nsresult StartTimeout();
 
 private:
+  ~nsPingListener();
+
   bool mRequireSameHost;
   nsCOMPtr<nsIContent> mContent;
   nsCOMPtr<nsILoadGroup> mLoadGroup;
   nsCOMPtr<nsITimer> mTimer;
 };
 
 NS_IMPL_ISUPPORTS(nsPingListener, nsIStreamListener, nsIRequestObserver,
                   nsIInterfaceRequestor, nsIChannelEventSink)
@@ -8759,16 +8759,18 @@ public:
                                                  false,
                                                  mInPrivateBrowsing ?
                                                    nsIFaviconService::FAVICON_LOAD_PRIVATE :
                                                    nsIFaviconService::FAVICON_LOAD_NON_PRIVATE,
                                                  nullptr);
     }
 
 private:
+    ~nsCopyFaviconCallback() {}
+
     nsCOMPtr<nsIURI> mNewURI;
     bool mInPrivateBrowsing;
 };
 
 NS_IMPL_ISUPPORTS(nsCopyFaviconCallback, nsIFaviconDataCallback)
 #endif
 
 // Tell the favicon service that aNewURI has the same favicon as aOldURI.
--- a/docshell/base/nsDocShell.h
+++ b/docshell/base/nsDocShell.h
@@ -918,19 +918,19 @@ private:
     // We're counting the number of |nsDocShells| to help find leaks
     static unsigned long gNumberOfDocShells;
 #endif /* DEBUG */
 
 public:
     class InterfaceRequestorProxy : public nsIInterfaceRequestor {
     public:
         InterfaceRequestorProxy(nsIInterfaceRequestor* p);
-        virtual ~InterfaceRequestorProxy();
         NS_DECL_THREADSAFE_ISUPPORTS
         NS_DECL_NSIINTERFACEREQUESTOR
  
     protected:
+        virtual ~InterfaceRequestorProxy();
         InterfaceRequestorProxy() {}
         nsWeakPtr mWeakPtr;
     };
 };
 
 #endif /* nsDocShell_h__ */
--- a/docshell/base/nsDocShellEnumerator.h
+++ b/docshell/base/nsDocShellEnumerator.h
@@ -32,21 +32,22 @@ class nsIDocShellTreeItem;
 class nsDocShellEnumerator : public nsISimpleEnumerator
 {
 protected:
 
   enum {
     enumerateForwards,
     enumerateBackwards
   };
-  
+
+  virtual                     ~nsDocShellEnumerator();
+
 public:
 
                               nsDocShellEnumerator(int32_t inEnumerationDirection);
-  virtual                     ~nsDocShellEnumerator();
 
   // nsISupports
   NS_DECL_ISUPPORTS
   
   // nsISimpleEnumerator
   NS_DECL_NSISIMPLEENUMERATOR
   
 public:
--- a/docshell/base/nsDocShellTransferableHooks.h
+++ b/docshell/base/nsDocShellTransferableHooks.h
@@ -9,17 +9,18 @@
 #include "nsCOMArray.h"
 
 class nsIClipboardDragDropHooks;
 
 class nsTransferableHookData : public nsIClipboardDragDropHookList
 {
 public:
     nsTransferableHookData();
-    virtual ~nsTransferableHookData();
     NS_DECL_ISUPPORTS
     NS_DECL_NSICLIPBOARDDRAGDROPHOOKLIST
 
 protected:
+    virtual ~nsTransferableHookData();
+
     nsCOMArray<nsIClipboardDragDropHooks> mHookList;
 };
 
 #endif // nsDocShellTransferableHooks_h__
--- a/docshell/base/nsDownloadHistory.h
+++ b/docshell/base/nsDownloadHistory.h
@@ -15,11 +15,14 @@
 
 class nsDownloadHistory MOZ_FINAL : public nsIDownloadHistory
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIDOWNLOADHISTORY
 
   NS_DEFINE_STATIC_CID_ACCESSOR(NS_DOWNLOADHISTORY_CID)
+
+private:
+  ~nsDownloadHistory() {}
 };
 
 #endif // __nsDownloadHistory_h__
--- a/docshell/shistory/src/nsSHEntryShared.h
+++ b/docshell/shistory/src/nsSHEntryShared.h
@@ -33,23 +33,24 @@ class nsISupportsArray;
 class nsSHEntryShared MOZ_FINAL : public nsIBFCacheEntry,
                                   public nsIMutationObserver
 {
   public:
     static void Startup();
     static void Shutdown();
 
     nsSHEntryShared();
-    ~nsSHEntryShared();
 
     NS_DECL_ISUPPORTS
     NS_DECL_NSIMUTATIONOBSERVER
     NS_DECL_NSIBFCACHEENTRY
 
   private:
+    ~nsSHEntryShared();
+
     friend class nsSHEntry;
 
     friend class HistoryTracker;
     friend class nsExpirationTracker<nsSHEntryShared, 3>;
     nsExpirationState *GetExpirationState() { return &mExpirationState; }
 
     static already_AddRefed<nsSHEntryShared> Duplicate(nsSHEntryShared *aEntry);