From 96263a4d4ec1e8fabaa2b4e98431df7444b764d4 Mon Sep 17 00:00:00 2001 From: Benoit Jacob Date: Mon, 23 Jun 2014 14:49:08 -0400 Subject: [PATCH] Bug 1028588 - Fix dangerous public destructors in docshell/ - r=smaug --- docshell/base/LoadContext.h | 2 ++ docshell/base/nsAboutRedirector.h | 2 +- docshell/base/nsDocShell.cpp | 6 ++++-- docshell/base/nsDocShell.h | 2 +- docshell/base/nsDocShellEnumerator.h | 5 +++-- docshell/base/nsDocShellTransferableHooks.h | 3 ++- docshell/base/nsDownloadHistory.h | 3 +++ docshell/shistory/src/nsSHEntryShared.h | 3 ++- 8 files changed, 18 insertions(+), 8 deletions(-) diff --git a/docshell/base/LoadContext.h b/docshell/base/LoadContext.h index 83d997abd26..aae48f78acc 100644 --- a/docshell/base/LoadContext.h +++ b/docshell/base/LoadContext.h @@ -106,6 +106,8 @@ public: {} private: + ~LoadContext() {} + nsWeakPtr mTopFrameElement; uint64_t mNestedFrameId; uint32_t mAppId; diff --git a/docshell/base/nsAboutRedirector.h b/docshell/base/nsAboutRedirector.h index 2640544fe55..20ac16795f3 100644 --- a/docshell/base/nsAboutRedirector.h +++ b/docshell/base/nsAboutRedirector.h @@ -16,12 +16,12 @@ public: NS_DECL_NSIABOUTMODULE nsAboutRedirector() {} - virtual ~nsAboutRedirector() {} static nsresult Create(nsISupports *aOuter, REFNSIID aIID, void **aResult); protected: + virtual ~nsAboutRedirector() {} }; #define NS_ABOUT_REDIRECTOR_MODULE_CID \ diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp index 3a9363fca6d..ef686278516 100644 --- a/docshell/base/nsDocShell.cpp +++ b/docshell/base/nsDocShell.cpp @@ -430,11 +430,11 @@ public: mLoadGroup(loadGroup) {} - ~nsPingListener(); - nsresult StartTimeout(); private: + ~nsPingListener(); + bool mRequireSameHost; nsCOMPtr mContent; nsCOMPtr mLoadGroup; @@ -8764,6 +8764,8 @@ public: } private: + ~nsCopyFaviconCallback() {} + nsCOMPtr mNewURI; bool mInPrivateBrowsing; }; diff --git a/docshell/base/nsDocShell.h b/docshell/base/nsDocShell.h index 6e9b1eefb56..d2116282a22 100644 --- a/docshell/base/nsDocShell.h +++ b/docshell/base/nsDocShell.h @@ -923,11 +923,11 @@ public: class InterfaceRequestorProxy : public nsIInterfaceRequestor { public: InterfaceRequestorProxy(nsIInterfaceRequestor* p); - virtual ~InterfaceRequestorProxy(); NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIINTERFACEREQUESTOR protected: + virtual ~InterfaceRequestorProxy(); InterfaceRequestorProxy() {} nsWeakPtr mWeakPtr; }; diff --git a/docshell/base/nsDocShellEnumerator.h b/docshell/base/nsDocShellEnumerator.h index 52305021824..32256fff4d6 100644 --- a/docshell/base/nsDocShellEnumerator.h +++ b/docshell/base/nsDocShellEnumerator.h @@ -37,11 +37,12 @@ protected: enumerateForwards, enumerateBackwards }; - + + virtual ~nsDocShellEnumerator(); + public: nsDocShellEnumerator(int32_t inEnumerationDirection); - virtual ~nsDocShellEnumerator(); // nsISupports NS_DECL_ISUPPORTS diff --git a/docshell/base/nsDocShellTransferableHooks.h b/docshell/base/nsDocShellTransferableHooks.h index 838511164e5..44b3c72dfc9 100644 --- a/docshell/base/nsDocShellTransferableHooks.h +++ b/docshell/base/nsDocShellTransferableHooks.h @@ -14,11 +14,12 @@ class nsTransferableHookData : public nsIClipboardDragDropHookList { public: nsTransferableHookData(); - virtual ~nsTransferableHookData(); NS_DECL_ISUPPORTS NS_DECL_NSICLIPBOARDDRAGDROPHOOKLIST protected: + virtual ~nsTransferableHookData(); + nsCOMArray mHookList; }; diff --git a/docshell/base/nsDownloadHistory.h b/docshell/base/nsDownloadHistory.h index 61b08fe27ce..c7ea4bc921c 100644 --- a/docshell/base/nsDownloadHistory.h +++ b/docshell/base/nsDownloadHistory.h @@ -20,6 +20,9 @@ public: NS_DECL_NSIDOWNLOADHISTORY NS_DEFINE_STATIC_CID_ACCESSOR(NS_DOWNLOADHISTORY_CID) + +private: + ~nsDownloadHistory() {} }; #endif // __nsDownloadHistory_h__ diff --git a/docshell/shistory/src/nsSHEntryShared.h b/docshell/shistory/src/nsSHEntryShared.h index 5bd757ee427..9e2da8ae1ea 100644 --- a/docshell/shistory/src/nsSHEntryShared.h +++ b/docshell/shistory/src/nsSHEntryShared.h @@ -38,13 +38,14 @@ class nsSHEntryShared MOZ_FINAL : public nsIBFCacheEntry, static void Shutdown(); nsSHEntryShared(); - ~nsSHEntryShared(); NS_DECL_ISUPPORTS NS_DECL_NSIMUTATIONOBSERVER NS_DECL_NSIBFCACHEENTRY private: + ~nsSHEntryShared(); + friend class nsSHEntry; friend class HistoryTracker;