Bug 1028588 - Fix dangerous public destructors in extensions/ - r=ehsan
authorBenoit Jacob <bjacob@mozilla.com>
Mon, 23 Jun 2014 18:40:02 -0400
changeset 190358 97477a6da3b18642ea72637c408f69b49ac057dc
parent 190357 438751141e7c3e7c6a8c4eb419eb99b1f7464cf2
child 190359 461ad7d4f1ef5c99b4817b2ec3c9dbf8681e0b5e
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 extensions/ - r=ehsan
extensions/auth/nsHttpNegotiateAuth.h
extensions/cookie/nsCookiePermission.h
extensions/cookie/nsCookiePromptService.h
extensions/cookie/nsPermission.h
extensions/cookie/nsPermissionManager.cpp
extensions/cookie/nsPermissionManager.h
extensions/cookie/nsPopupWindowManager.h
extensions/gio/nsGIOProtocolHandler.cpp
extensions/pref/autoconfig/src/nsAutoConfig.h
extensions/pref/autoconfig/src/nsReadConfig.h
extensions/spellcheck/hunspell/src/mozHunspell.h
extensions/spellcheck/hunspell/src/mozHunspellDirProvider.h
extensions/spellcheck/src/mozEnglishWordUtils.h
extensions/spellcheck/src/mozGenericWordUtils.h
extensions/spellcheck/src/mozInlineSpellChecker.cpp
extensions/spellcheck/src/mozInlineSpellChecker.h
extensions/spellcheck/src/mozPersonalDictionary.h
extensions/spellcheck/src/mozSpellChecker.h
extensions/spellcheck/src/mozSpellI18NManager.h
extensions/universalchardet/src/xpcom/nsUdetXPCOMWrapper.h
--- a/extensions/auth/nsHttpNegotiateAuth.h
+++ b/extensions/auth/nsHttpNegotiateAuth.h
@@ -16,16 +16,18 @@
 
 class nsHttpNegotiateAuth MOZ_FINAL : public nsIHttpAuthenticator
 {
 public:
     NS_DECL_ISUPPORTS
     NS_DECL_NSIHTTPAUTHENTICATOR
 
 private:
+    ~nsHttpNegotiateAuth() {}
+
     // returns the value of the given boolean pref
     bool TestBoolPref(const char *pref);
 
     // tests if the host part of an uri is fully qualified
     bool TestNonFqdn(nsIURI *uri);
 
     // returns true if URI is accepted by the list of hosts in the pref
     bool TestPref(nsIURI *, const char *pref);
--- a/extensions/cookie/nsCookiePermission.h
+++ b/extensions/cookie/nsCookiePermission.h
@@ -21,23 +21,24 @@ public:
   NS_DECL_NSICOOKIEPERMISSION
   NS_DECL_NSIOBSERVER
 
   nsCookiePermission()
     : mCookiesLifetimeSec(INT64_MAX)
     , mCookiesLifetimePolicy(0) // ACCEPT_NORMALLY
     , mCookiesAlwaysAcceptSession(false)
     {}
-  virtual ~nsCookiePermission() {}
 
   bool Init();
   void PrefChanged(nsIPrefBranch *, const char *);
 
 private:
-   bool EnsureInitialized() { return (mPermMgr != nullptr && mThirdPartyUtil != nullptr) || Init(); };
+  virtual ~nsCookiePermission() {}
+
+  bool EnsureInitialized() { return (mPermMgr != nullptr && mThirdPartyUtil != nullptr) || Init(); };
 
   nsCOMPtr<nsIPermissionManager> mPermMgr;
   nsCOMPtr<mozIThirdPartyUtil> mThirdPartyUtil;
 
   int64_t      mCookiesLifetimeSec;            // lifetime limit specified in seconds
   uint8_t      mCookiesLifetimePolicy;         // pref for how long cookies are stored
   bool mCookiesAlwaysAcceptSession;    // don't prompt for session cookies
 };
--- a/extensions/cookie/nsCookiePromptService.h
+++ b/extensions/cookie/nsCookiePromptService.h
@@ -4,20 +4,21 @@
 
 #ifndef nsCookiePromptService_h__
 #define nsCookiePromptService_h__
 
 #include "nsICookiePromptService.h"
 
 class nsCookiePromptService : public nsICookiePromptService {
 
+  virtual ~nsCookiePromptService();
+
 public:
 
   nsCookiePromptService();
-  virtual ~nsCookiePromptService();
 
   NS_DECL_NSICOOKIEPROMPTSERVICE
   NS_DECL_ISUPPORTS
 
 private:
 
 };
 
--- a/extensions/cookie/nsPermission.h
+++ b/extensions/cookie/nsPermission.h
@@ -21,19 +21,19 @@ public:
   nsPermission(const nsACString &aHost,
                uint32_t aAppId,
                bool aIsInBrowserElement,
                const nsACString &aType,
                uint32_t aCapability,
                uint32_t aExpireType,
                int64_t aExpireTime);
 
+protected:
   virtual ~nsPermission() {};
 
-protected:
   nsCString mHost;
   nsCString mType;
   uint32_t  mCapability;
   uint32_t  mExpireType;
   int64_t   mExpireTime;
   uint32_t  mAppId;
   bool      mIsInBrowserElement;
 };
--- a/extensions/cookie/nsPermissionManager.cpp
+++ b/extensions/cookie/nsPermissionManager.cpp
@@ -178,16 +178,18 @@ GetNextSubDomainForHost(const nsACString
   if (NS_FAILED(rv)) {
     return EmptyCString();
   }
 
   return subDomain;
 }
 
 class AppClearDataObserver MOZ_FINAL : public nsIObserver {
+  ~AppClearDataObserver() {}
+
 public:
   NS_DECL_ISUPPORTS
 
   // nsIObserver implementation.
   NS_IMETHODIMP
   Observe(nsISupports *aSubject, const char *aTopic, const char16_t *data)
   {
     MOZ_ASSERT(!nsCRT::strcmp(aTopic, "webapps-clear-data"));
@@ -239,16 +241,18 @@ nsPermissionManager::PermissionKey::Perm
  * Note: Beware that, if you hold onto a |CloseDatabaseListener| from a
  * |nsPermissionManager|, this will create a cycle.
  *
  * Note: Once the callback has been called this DeleteFromMozHostListener cannot
  * be reused.
  */
 class CloseDatabaseListener MOZ_FINAL : public mozIStorageCompletionCallback
 {
+  ~CloseDatabaseListener() {}
+
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_MOZISTORAGECOMPLETIONCALLBACK
   /**
    * @param aManager The owning manager.
    * @param aRebuildOnSuccess If |true|, reinitialize the database once
    * it has been closed. Otherwise, do nothing such.
    */
@@ -288,16 +292,18 @@ CloseDatabaseListener::Complete(nsresult
  * Note: Beware that, if you hold onto a |DeleteFromMozHostListener| from a
  * |nsPermissionManager|, this will create a cycle.
  *
  * Note: Once the callback has been called this DeleteFromMozHostListener cannot
  * be reused.
  */
 class DeleteFromMozHostListener MOZ_FINAL : public mozIStorageStatementCallback
 {
+  ~DeleteFromMozHostListener() {}
+
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_MOZISTORAGESTATEMENTCALLBACK
 
   /**
    * @param aManager The owning manager.
    */
   DeleteFromMozHostListener(nsPermissionManager* aManager);
--- a/extensions/cookie/nsPermissionManager.h
+++ b/extensions/cookie/nsPermissionManager.h
@@ -162,17 +162,16 @@ public:
   };
 
   // nsISupports
   NS_DECL_ISUPPORTS
   NS_DECL_NSIPERMISSIONMANAGER
   NS_DECL_NSIOBSERVER
 
   nsPermissionManager();
-  virtual ~nsPermissionManager();
   static nsIPermissionManager* GetXPCOMSingleton();
   nsresult Init();
 
   // enums for AddInternal()
   enum OperationType {
     eOperationNone,
     eOperationAdding,
     eOperationRemoving,
@@ -202,16 +201,18 @@ public:
    * Initialize the "webapp-uninstall" observing.
    * Will create a nsPermissionManager instance if needed.
    * That way, we can prevent have nsPermissionManager created at startup just
    * to be able to clear data when an application is uninstalled.
    */
   static void AppClearDataObserverInit();
 
 private:
+  virtual ~nsPermissionManager();
+
   int32_t GetTypeIndex(const char *aTypeString,
                        bool        aAdd);
 
   PermissionHashKey* GetPermissionHashKey(const nsACString& aHost,
                                           uint32_t aAppId,
                                           bool aIsInBrowserElement,
                                           uint32_t          aType,
                                           bool              aExactHostMatch);
--- a/extensions/cookie/nsPopupWindowManager.h
+++ b/extensions/cookie/nsPopupWindowManager.h
@@ -18,20 +18,21 @@ class nsPopupWindowManager : public nsIP
                              public nsSupportsWeakReference {
 
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIPOPUPWINDOWMANAGER
   NS_DECL_NSIOBSERVER
 
   nsPopupWindowManager();
-  virtual ~nsPopupWindowManager();
   nsresult Init();
 
 private:
+  virtual ~nsPopupWindowManager();
+
   uint32_t                       mPolicy;
   nsCOMPtr<nsIPermissionManager> mPermissionManager;
 };
 
 // {822bcd11-6432-48be-9e9d-36f7804b7747}
 #define NS_POPUPWINDOWMANAGER_CID \
  {0x822bcd11, 0x6432, 0x48be, {0x9e, 0x9d, 0x36, 0xf7, 0x80, 0x4b, 0x77, 0x47}}
 
--- a/extensions/gio/nsGIOProtocolHandler.cpp
+++ b/extensions/gio/nsGIOProtocolHandler.cpp
@@ -132,16 +132,18 @@ static void mount_operation_ask_password
                                           const char        *default_user,
                                           const char        *default_domain,
                                           GAskPasswordFlags flags,
                                           gpointer          user_data);
 //-----------------------------------------------------------------------------
 
 class nsGIOInputStream MOZ_FINAL : public nsIInputStream
 {
+   ~nsGIOInputStream() { Close(); }
+
   public:
     NS_DECL_THREADSAFE_ISUPPORTS
     NS_DECL_NSIINPUTSTREAM
 
     nsGIOInputStream(const nsCString &uriSpec)
       : mSpec(uriSpec)
       , mChannel(nullptr)
       , mHandle(nullptr)
@@ -149,18 +151,16 @@ class nsGIOInputStream MOZ_FINAL : publi
       , mBytesRemaining(UINT64_MAX)
       , mStatus(NS_OK)
       , mDirList(nullptr)
       , mDirListPtr(nullptr)
       , mDirBufCursor(0)
       , mDirOpen(false)
       , mMonitorMountInProgress("GIOInputStream::MountFinished") { }
 
-   ~nsGIOInputStream() { Close(); }
-
     void SetChannel(nsIChannel *channel)
     {
       // We need to hold an owning reference to our channel.  This is done
       // so we can access the channel's notification callbacks to acquire
       // a reference to a nsIAuthPrompt if we need to handle an interactive
       // mount operation.
       //
       // However, the channel can only be accessed on the main thread, so
@@ -887,16 +887,18 @@ class nsGIOProtocolHandler MOZ_FINAL : p
   public:
     NS_DECL_ISUPPORTS
     NS_DECL_NSIPROTOCOLHANDLER
     NS_DECL_NSIOBSERVER
 
     nsresult Init();
 
   private:
+    ~nsGIOProtocolHandler() {}
+
     void InitSupportedProtocolsPref(nsIPrefBranch *prefs);
     bool IsSupportedProtocol(const nsCString &spec);
 
     nsCString mSupportedProtocols;
 };
 
 NS_IMPL_ISUPPORTS(nsGIOProtocolHandler, nsIProtocolHandler, nsIObserver)
 
--- a/extensions/pref/autoconfig/src/nsAutoConfig.h
+++ b/extensions/pref/autoconfig/src/nsAutoConfig.h
@@ -27,21 +27,21 @@ class nsAutoConfig : public nsIAutoConfi
         NS_DECL_THREADSAFE_ISUPPORTS
         NS_DECL_NSIAUTOCONFIG
         NS_DECL_NSIREQUESTOBSERVER
         NS_DECL_NSISTREAMLISTENER
         NS_DECL_NSIOBSERVER
         NS_DECL_NSITIMERCALLBACK
 
         nsAutoConfig();
-        virtual ~nsAutoConfig();
         nsresult Init();
   
     protected:
   
+        virtual ~nsAutoConfig();
         nsresult downloadAutoConfig();
         nsresult readOfflineFile();
         nsresult evaluateLocalFile(nsIFile *file);
         nsresult writeFailoverFile();
         nsresult getEmailAddr(nsACString & emailAddr);
         nsresult PromptForEMailAddress(nsACString &emailAddress);
         nsCString mBuf;
         nsCOMPtr<nsIPrefBranch> mPrefBranch;
--- a/extensions/pref/autoconfig/src/nsReadConfig.h
+++ b/extensions/pref/autoconfig/src/nsReadConfig.h
@@ -18,22 +18,23 @@ class nsReadConfig : public nsIReadConfi
 
     public:
 
         NS_DECL_THREADSAFE_ISUPPORTS
         NS_DECL_NSIREADCONFIG
         NS_DECL_NSIOBSERVER
 
         nsReadConfig();
-        virtual ~nsReadConfig();
 
         nsresult Init();
 
     protected:
-  
+
+        virtual ~nsReadConfig();
+
         nsresult readConfigFile();
         nsresult openAndEvaluateJSFile(const char *aFileName, int32_t obscureValue, 
                                         bool isEncoded, bool isBinDir);
         bool mRead;
 private:
         nsCOMPtr<nsIAutoConfig> mAutoConfig;
 };
 
--- a/extensions/spellcheck/hunspell/src/mozHunspell.h
+++ b/extensions/spellcheck/hunspell/src/mozHunspell.h
@@ -88,17 +88,16 @@ class mozHunspell : public mozISpellChec
 {
 public:
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
   NS_DECL_MOZISPELLCHECKINGENGINE
   NS_DECL_NSIOBSERVER
   NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(mozHunspell, mozISpellCheckingEngine)
 
   mozHunspell();
-  virtual ~mozHunspell();
 
   nsresult Init();
 
   void LoadDictionaryList();
 
   // helper method for converting a word to the charset of the dictionary
   nsresult ConvertCharset(const char16_t* aStr, char ** aDst);
 
@@ -106,16 +105,17 @@ public:
                             nsISupports* aData, bool aAnonymize)
   {
     return MOZ_COLLECT_REPORT(
       "explicit/spell-check", KIND_HEAP, UNITS_BYTES, HunspellAllocator::MemoryAllocated(),
       "Memory used by the spell-checking engine.");
   }
 
 protected:
+  virtual ~mozHunspell();
 
   nsCOMPtr<mozIPersonalDictionary> mPersonalDictionary;
   nsCOMPtr<nsIUnicodeEncoder>      mEncoder;
   nsCOMPtr<nsIUnicodeDecoder>      mDecoder;
 
   // Hashtable matches dictionary name to .aff file
   nsInterfaceHashtable<nsStringHashKey, nsIFile> mDictionaries;
   nsString  mDictionary;
--- a/extensions/spellcheck/hunspell/src/mozHunspellDirProvider.h
+++ b/extensions/spellcheck/hunspell/src/mozHunspellDirProvider.h
@@ -47,25 +47,29 @@ class mozHunspellDirProvider MOZ_FINAL :
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIDIRECTORYSERVICEPROVIDER
   NS_DECL_NSIDIRECTORYSERVICEPROVIDER2
 
   static char const *const kContractID;
 
 private:
+  ~mozHunspellDirProvider() {}
+
   class AppendingEnumerator MOZ_FINAL : public nsISimpleEnumerator
   {
   public:
     NS_DECL_ISUPPORTS
     NS_DECL_NSISIMPLEENUMERATOR
 
     AppendingEnumerator(nsISimpleEnumerator* aBase);
 
   private:
+    ~AppendingEnumerator() {}
+
     nsCOMPtr<nsISimpleEnumerator> mBase;
     nsCOMPtr<nsIFile>             mNext;
   };
 };
 
 #define HUNSPELLDIRPROVIDER_CID \
 { 0x64d6174c, 0x1496, 0x4ffd, \
   { 0x87, 0xf2, 0xda, 0x26, 0x70, 0xf8, 0x89, 0x34 } }
--- a/extensions/spellcheck/src/mozEnglishWordUtils.h
+++ b/extensions/spellcheck/src/mozEnglishWordUtils.h
@@ -18,23 +18,24 @@
 class mozEnglishWordUtils : public mozISpellI18NUtil
 {
 public:
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
   NS_DECL_MOZISPELLI18NUTIL
   NS_DECL_CYCLE_COLLECTION_CLASS(mozEnglishWordUtils)
 
   mozEnglishWordUtils();
-  virtual ~mozEnglishWordUtils();
   /* additional members */
   enum myspCapitalization{
     NoCap,InitCap,AllCap,HuhCap
   };  
 
 protected:
+  virtual ~mozEnglishWordUtils();
+
   mozEnglishWordUtils::myspCapitalization captype(const nsString &word);
   bool ucIsAlpha(char16_t aChar);
 
   nsString mLanguage;
   nsString mCharset;
   nsCOMPtr<mozITXTToHTMLConv> mURLDetector; // used to detect urls so the spell checker can skip them.
 };
 
--- a/extensions/spellcheck/src/mozGenericWordUtils.h
+++ b/extensions/spellcheck/src/mozGenericWordUtils.h
@@ -7,17 +7,18 @@
 #define mozGenericWordUtils_h__
 
 #include "nsCOMPtr.h"
 #include "mozISpellI18NUtil.h"
 #include "nsCycleCollectionParticipant.h"
 
 class mozGenericWordUtils : public mozISpellI18NUtil
 {
+protected:
+  virtual ~mozGenericWordUtils();
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_MOZISPELLI18NUTIL
 
   mozGenericWordUtils();
-  virtual ~mozGenericWordUtils();
 };
 
 #endif
--- a/extensions/spellcheck/src/mozInlineSpellChecker.cpp
+++ b/extensions/spellcheck/src/mozInlineSpellChecker.cpp
@@ -484,16 +484,17 @@ public:
 private:
   uint32_t mDisabledAsyncToken;
   mozInlineSpellStatus mStatus;
 };
 
 // Used as the nsIEditorSpellCheck::InitSpellChecker callback.
 class InitEditorSpellCheckCallback MOZ_FINAL : public nsIEditorSpellCheckCallback
 {
+  ~InitEditorSpellCheckCallback() {}
 public:
   NS_DECL_ISUPPORTS
 
   explicit InitEditorSpellCheckCallback(mozInlineSpellChecker* aSpellChecker)
     : mSpellChecker(aSpellChecker) {}
 
   NS_IMETHOD EditorSpellCheckDone()
   {
@@ -1996,16 +1997,18 @@ public:
     // Ignore this callback if SetEnableRealTimeSpell(false) was called after
     // the UpdateCurrentDictionary call that triggered it.
     return mSpellChecker->mDisabledAsyncToken > mDisabledAsyncToken ?
            NS_OK :
            mSpellChecker->CurrentDictionaryUpdated();
   }
 
 private:
+  ~UpdateCurrentDictionaryCallback() {}
+
   nsRefPtr<mozInlineSpellChecker> mSpellChecker;
   uint32_t mDisabledAsyncToken;
 };
 NS_IMPL_ISUPPORTS(UpdateCurrentDictionaryCallback, nsIEditorSpellCheckCallback)
 
 NS_IMETHODIMP mozInlineSpellChecker::UpdateCurrentDictionary()
 {
   // mSpellCheck is null and mPendingSpellCheck is nonnull while the spell
--- a/extensions/spellcheck/src/mozInlineSpellChecker.h
+++ b/extensions/spellcheck/src/mozInlineSpellChecker.h
@@ -197,17 +197,16 @@ public:
   // update the cached value whenever the list of available dictionaries changes
   static void UpdateCanEnableInlineSpellChecking();
 
   nsresult Blur(nsIDOMEvent* aEvent);
   nsresult MouseClick(nsIDOMEvent* aMouseEvent);
   nsresult KeyPress(nsIDOMEvent* aKeyEvent);
 
   mozInlineSpellChecker();
-  virtual ~mozInlineSpellChecker();
 
   // spell checks all of the words between two nodes
   nsresult SpellCheckBetweenNodes(nsIDOMNode *aStartNode,
                                   int32_t aStartOffset,
                                   nsIDOMNode *aEndNode,
                                   int32_t aEndOffset);
 
   // examines the dom node in question and returns true if the inline spell
@@ -254,16 +253,17 @@ public:
   nsresult HandleNavigationEvent(bool aForceWordSpellCheck, int32_t aNewPositionOffset = 0);
 
   nsresult GetSpellCheckSelection(nsISelection ** aSpellCheckSelection);
   nsresult SaveCurrentSelectionPosition();
 
   nsresult ResumeCheck(mozInlineSpellStatus* aStatus);
 
 protected:
+  virtual ~mozInlineSpellChecker();
 
   // called when async nsIEditorSpellCheck methods complete
   nsresult EditorSpellCheckInited();
   nsresult CurrentDictionaryUpdated();
 
   // track the number of pending spell checks and async operations that may lead
   // to spell checks, notifying observers accordingly
   void ChangeNumPendingSpellChecks(int32_t aDelta,
--- a/extensions/spellcheck/src/mozPersonalDictionary.h
+++ b/extensions/spellcheck/src/mozPersonalDictionary.h
@@ -32,21 +32,22 @@ class mozPersonalDictionary : public moz
 {
 public:
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
   NS_DECL_MOZIPERSONALDICTIONARY
   NS_DECL_NSIOBSERVER
   NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(mozPersonalDictionary, mozIPersonalDictionary)
 
   mozPersonalDictionary();
-  virtual ~mozPersonalDictionary();
 
   nsresult Init();
 
 protected:
+  virtual ~mozPersonalDictionary();
+
   /* has the dictionary been modified */
   bool mDirty;
 
   /* true if the dictionary has been loaded from disk */
   bool mIsLoaded;
 
   nsCOMPtr<nsIFile> mFile;
   mozilla::Monitor mMonitor;
--- a/extensions/spellcheck/src/mozSpellChecker.h
+++ b/extensions/spellcheck/src/mozSpellChecker.h
@@ -20,17 +20,16 @@
 
 class mozSpellChecker : public nsISpellChecker
 {
 public:
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
   NS_DECL_CYCLE_COLLECTION_CLASS(mozSpellChecker)
 
   mozSpellChecker();
-  virtual ~mozSpellChecker();
 
   nsresult Init();
 
   // nsISpellChecker
   NS_IMETHOD SetDocument(nsITextServicesDocument *aDoc, bool aFromStartofDoc);
   NS_IMETHOD NextMisspelledWord(nsAString &aWord, nsTArray<nsString> *aSuggestions);
   NS_IMETHOD CheckWord(const nsAString &aWord, bool *aIsMisspelled, nsTArray<nsString> *aSuggestions);
   NS_IMETHOD Replace(const nsAString &aOldWord, const nsAString &aNewWord, bool aAllOccurrences);
@@ -41,16 +40,18 @@ public:
   NS_IMETHOD GetPersonalDictionary(nsTArray<nsString> *aWordList);
 
   NS_IMETHOD GetDictionaryList(nsTArray<nsString> *aDictionaryList);
   NS_IMETHOD GetCurrentDictionary(nsAString &aDictionary);
   NS_IMETHOD SetCurrentDictionary(const nsAString &aDictionary);
   NS_IMETHOD CheckCurrentDictionary();
 
 protected:
+  virtual ~mozSpellChecker();
+
   nsCOMPtr<mozISpellI18NUtil> mConverter;
   nsCOMPtr<nsITextServicesDocument> mTsDoc;
   nsCOMPtr<mozIPersonalDictionary> mPersonalDictionary;
 
   nsCOMPtr<mozISpellCheckingEngine>  mSpellCheckingEngine;
   bool mFromStart;
 
   nsresult SetupDoc(int32_t *outBlockOffset);
--- a/extensions/spellcheck/src/mozSpellI18NManager.h
+++ b/extensions/spellcheck/src/mozSpellI18NManager.h
@@ -13,17 +13,18 @@
 #define MOZ_SPELLI18NMANAGER_CONTRACTID "@mozilla.org/spellchecker/i18nmanager;1"
 #define MOZ_SPELLI18NMANAGER_CID         \
 { /* {AEB8936F-219C-4D3C-8385-D9382DAA551A} */  \
 0xaeb8936f, 0x219c, 0x4d3c, \
   { 0x83, 0x85, 0xd9, 0x38, 0x2d, 0xaa, 0x55, 0x1a } }
 
 class mozSpellI18NManager : public mozISpellI18NManager
 {
+protected:
+  virtual ~mozSpellI18NManager();
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_MOZISPELLI18NMANAGER
 
   mozSpellI18NManager();
-  virtual ~mozSpellI18NManager();
 };
 #endif
 
--- a/extensions/universalchardet/src/xpcom/nsUdetXPCOMWrapper.h
+++ b/extensions/universalchardet/src/xpcom/nsUdetXPCOMWrapper.h
@@ -75,39 +75,39 @@
 //=====================================================================
 class nsXPCOMDetector :  
       public nsUniversalDetector,
       public nsICharsetDetector
 {
   NS_DECL_ISUPPORTS
   public:
     nsXPCOMDetector(uint32_t aLanguageFilter);
-    virtual ~nsXPCOMDetector();
     NS_IMETHOD Init(nsICharsetDetectionObserver* aObserver);
     NS_IMETHOD DoIt(const char* aBuf, uint32_t aLen, bool *oDontFeedMe);
     NS_IMETHOD Done();
   protected:
+    virtual ~nsXPCOMDetector();
     virtual void Report(const char* aCharset);
   private:
     nsCOMPtr<nsICharsetDetectionObserver> mObserver;
 };
 
 
 //=====================================================================
 class nsXPCOMStringDetector :  
       public nsUniversalDetector,
       public nsIStringCharsetDetector
 {
   NS_DECL_ISUPPORTS
   public:
     nsXPCOMStringDetector(uint32_t aLanguageFilter);
-    virtual ~nsXPCOMStringDetector();
     NS_IMETHOD DoIt(const char* aBuf, uint32_t aLen, 
                     const char** oCharset, nsDetectionConfident &oConf);
   protected:
+    virtual ~nsXPCOMStringDetector();
     virtual void Report(const char* aCharset);
   private:
     nsCOMPtr<nsICharsetDetectionObserver> mObserver;
     const char* mResult;
 };
 
 //=====================================================================
 class nsUniversalXPCOMDetector : public nsXPCOMDetector