Bug 758992 - Make the classes which use the XPCOM nsISupports implementation macros final, to avoid the warning about deleting using a pointer to a base class with virtual functions and no virtual dtor (XPCOM parts); r=bsmedberg
authorEhsan Akhgari <ehsan@mozilla.com>
Tue, 05 Jun 2012 19:51:58 -0400
changeset 96502 d3b12cb2c877b24c8b077ce6e1866000304ed214
parent 96501 eac2f63bc41477a0ca6422a6f82cf18757f74b88
child 96503 604347b8d2155998b7f02211e0cb94bc8eb13047
push id22910
push usermbrubeck@mozilla.com
push dateWed, 13 Jun 2012 01:26:32 +0000
treeherdermozilla-central@964b11fea7f1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbsmedberg
bugs758992
milestone16.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 758992 - Make the classes which use the XPCOM nsISupports implementation macros final, to avoid the warning about deleting using a pointer to a base class with virtual functions and no virtual dtor (XPCOM parts); r=bsmedberg
intl/uconv/src/nsConverterOutputStream.h
intl/uconv/src/nsUnicodeToUTF8.h
xpcom/base/nsCycleCollector.cpp
xpcom/base/nsInterfaceRequestorAgg.cpp
xpcom/base/nsMacUtilsImpl.h
xpcom/base/nsMemoryReporterManager.cpp
xpcom/base/nsMemoryReporterManager.h
xpcom/components/nsComponentManager.h
xpcom/ds/nsArray.h
xpcom/ds/nsAtomService.h
xpcom/ds/nsAtomTable.cpp
xpcom/ds/nsHashPropertyBag.cpp
xpcom/ds/nsINIParserImpl.cpp
xpcom/ds/nsINIParserImpl.h
xpcom/ds/nsObserverList.h
xpcom/ds/nsObserverService.h
xpcom/ds/nsPersistentProperties.h
xpcom/ds/nsProperties.h
xpcom/ds/nsStringEnumerator.cpp
xpcom/ds/nsSupportsArray.cpp
xpcom/ds/nsSupportsArray.h
xpcom/ds/nsSupportsArrayEnumerator.h
xpcom/ds/nsUnicharBuffer.h
xpcom/ds/nsVariant.h
xpcom/glue/nsEnumeratorUtils.cpp
xpcom/io/nsAppFileLocationProvider.h
xpcom/io/nsDirectoryService.h
xpcom/io/nsIOUtil.h
xpcom/io/nsInputStreamTee.cpp
xpcom/io/nsLocalFileUnix.cpp
xpcom/io/nsLocalFileUnix.h
xpcom/io/nsMultiplexInputStream.cpp
xpcom/io/nsPipe3.cpp
xpcom/io/nsScriptableBase64Encoder.h
xpcom/io/nsScriptableInputStream.h
xpcom/io/nsStorageStream.cpp
xpcom/io/nsStorageStream.h
xpcom/io/nsStreamUtils.cpp
xpcom/io/nsStringStream.cpp
xpcom/io/nsUnicharInputStream.cpp
xpcom/reflect/xptcall/src/xptcprivate.h
xpcom/reflect/xptinfo/src/xptiprivate.h
xpcom/threads/TimerThread.h
xpcom/threads/nsEnvironment.h
xpcom/threads/nsProcess.h
xpcom/threads/nsThread.h
xpcom/threads/nsThreadPool.h
xpcom/threads/nsTimerImpl.h
--- a/intl/uconv/src/nsConverterOutputStream.h
+++ b/intl/uconv/src/nsConverterOutputStream.h
@@ -4,26 +4,27 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef NSCONVERTEROUTPUTSTREAM_H_
 #define NSCONVERTEROUTPUTSTREAM_H_
 
 #include "nsIOutputStream.h"
 #include "nsIConverterOutputStream.h"
 #include "nsCOMPtr.h"
+#include "mozilla/Attributes.h"
 
 class nsIUnicodeEncoder;
 class nsIOutputStream;
 
 /* ff8780a5-bbb1-4bc5-8ee7-057e7bc5c925 */
 #define NS_CONVERTEROUTPUTSTREAM_CID \
 { 0xff8780a5, 0xbbb1, 0x4bc5, \
   { 0x8e, 0xe7, 0x05, 0x7e, 0x7b, 0xc5, 0xc9, 0x25 } }
 
-class nsConverterOutputStream : public nsIConverterOutputStream {
+class nsConverterOutputStream MOZ_FINAL : public nsIConverterOutputStream {
     public:
         nsConverterOutputStream() {}
 
         NS_DECL_ISUPPORTS
         NS_DECL_NSIUNICHAROUTPUTSTREAM
         NS_DECL_NSICONVERTEROUTPUTSTREAM
 
     private:
--- a/intl/uconv/src/nsUnicodeToUTF8.h
+++ b/intl/uconv/src/nsUnicodeToUTF8.h
@@ -1,16 +1,18 @@
 /* -*- 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 nsUnicodeToUTF8_h___
 #define nsUnicodeToUTF8_h___
 
+#include "mozilla/Attributes.h"
+
 // Class ID for our UnicodeToUTF8 charset converter
 // {7C657D18-EC5E-11d2-8AAC-00600811A836}
 #define NS_UNICODETOUTF8_CID \
   { 0x7c657d18, 0xec5e, 0x11d2, {0x8a, 0xac, 0x0, 0x60, 0x8, 0x11, 0xa8, 0x36}}
 
 #define NS_UNICODETOUTF8_CONTRACTID "@mozilla.org/intl/unicode/encoder;1?charset=UTF-8"
 
 //#define NS_ERROR_UCONV_NOUNICODETOUTF8  
@@ -20,17 +22,17 @@
 // Class nsUnicodeToUTF8 [declaration]
 
 /**
  * A character set converter from Unicode to UTF8.
  *
  * @created         05/Apr/1999
  * @author  Catalin Rotaru [CATA]
  */
-class nsUnicodeToUTF8 : public nsIUnicodeEncoder
+class nsUnicodeToUTF8 MOZ_FINAL : public nsIUnicodeEncoder
 {
   NS_DECL_ISUPPORTS
 
 public:
 
   /**
    * Class constructor.
    */
--- a/xpcom/base/nsCycleCollector.cpp
+++ b/xpcom/base/nsCycleCollector.cpp
@@ -111,16 +111,17 @@
 #include "nsPrintfCString.h"
 #include "nsTArray.h"
 #include "nsIObserverService.h"
 #include "nsIConsoleService.h"
 #include "nsServiceManagerUtils.h"
 #include "nsThreadUtils.h"
 #include "nsTArray.h"
 #include "mozilla/Services.h"
+#include "mozilla/Attributes.h"
 #include "nsICycleCollectorListener.h"
 #include "nsIXPConnect.h"
 #include "nsIJSRuntimeService.h"
 #include "nsIMemoryReporter.h"
 #include "xpcpublic.h"
 #include "nsXPCOMPrivate.h"
 #include "sampler.h"
 #include <stdio.h>
@@ -1259,17 +1260,17 @@ struct CCGraphDescriber
 
   nsCString mAddress;
   nsCString mToAddress;
   nsCString mName;
   PRUint32 mCnt;
   Type mType;
 };
 
-class nsCycleCollectorLogger : public nsICycleCollectorListener
+class nsCycleCollectorLogger MOZ_FINAL : public nsICycleCollectorListener
 {
 public:
     nsCycleCollectorLogger() :
       mStream(nsnull), mWantAllTraces(false),
       mDisableLog(false), mWantAfterProcessing(false),
       mNextIndex(0)
     {
     }
--- a/xpcom/base/nsInterfaceRequestorAgg.cpp
+++ b/xpcom/base/nsInterfaceRequestorAgg.cpp
@@ -1,16 +1,17 @@
 /* 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/. */
 
 #include "nsInterfaceRequestorAgg.h"
 #include "nsCOMPtr.h"
+#include "mozilla/Attributes.h"
 
-class nsInterfaceRequestorAgg : public nsIInterfaceRequestor
+class nsInterfaceRequestorAgg MOZ_FINAL : public nsIInterfaceRequestor
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIINTERFACEREQUESTOR
 
   nsInterfaceRequestorAgg(nsIInterfaceRequestor *aFirst,
                           nsIInterfaceRequestor *aSecond)
     : mFirst(aFirst)
--- a/xpcom/base/nsMacUtilsImpl.h
+++ b/xpcom/base/nsMacUtilsImpl.h
@@ -3,18 +3,19 @@
  * 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 nsMacUtilsImpl_h___
 #define nsMacUtilsImpl_h___
 
 #include "nsIMacUtils.h"
 #include "nsString.h"
+#include "mozilla/Attributes.h"
 
-class nsMacUtilsImpl : public nsIMacUtils
+class nsMacUtilsImpl MOZ_FINAL : public nsIMacUtils
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIMACUTILS
 
   nsMacUtilsImpl() {}
 
 private:
--- a/xpcom/base/nsMemoryReporterManager.cpp
+++ b/xpcom/base/nsMemoryReporterManager.cpp
@@ -6,16 +6,17 @@
 #include "nsAtomTable.h"
 #include "nsAutoPtr.h"
 #include "nsCOMPtr.h"
 #include "nsServiceManagerUtils.h"
 #include "nsMemoryReporterManager.h"
 #include "nsArrayEnumerator.h"
 #include "nsISimpleEnumerator.h"
 #include "mozilla/Telemetry.h"
+#include "mozilla/Attributes.h"
 
 using namespace mozilla;
 
 #if defined(MOZ_MEMORY)
 #  define HAVE_JEMALLOC_STATS 1
 #  include "jemalloc.h"
 #endif  // MOZ_MEMORY
 
@@ -682,25 +683,25 @@ struct MemoryReport {
     }
     const nsCString path;
     PRInt64 amount;
 };
 
 #ifdef DEBUG
 // This is just a wrapper for PRInt64 that implements nsISupports, so it can be
 // passed to nsIMemoryMultiReporter::CollectReports.
-class PRInt64Wrapper : public nsISupports {
+class PRInt64Wrapper MOZ_FINAL : public nsISupports {
 public:
     NS_DECL_ISUPPORTS
     PRInt64Wrapper() : mValue(0) { }
     PRInt64 mValue;
 };
 NS_IMPL_ISUPPORTS0(PRInt64Wrapper)
 
-class ExplicitNonHeapCountingCallback : public nsIMemoryMultiReporterCallback
+class ExplicitNonHeapCountingCallback MOZ_FINAL : public nsIMemoryMultiReporterCallback
 {
 public:
     NS_DECL_ISUPPORTS
 
     NS_IMETHOD Callback(const nsACString &aProcess, const nsACString &aPath,
                         PRInt32 aKind, PRInt32 aUnits, PRInt64 aAmount,
                         const nsACString &aDescription,
                         nsISupports *aWrappedExplicitNonHeap)
--- a/xpcom/base/nsMemoryReporterManager.h
+++ b/xpcom/base/nsMemoryReporterManager.h
@@ -1,21 +1,22 @@
 /* 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/. */
 
 
 #include "nsIMemoryReporter.h"
 #include "nsCOMArray.h"
 #include "mozilla/Mutex.h"
+#include "mozilla/Attributes.h"
 #include "nsString.h"
 
 using mozilla::Mutex;
 
-class nsMemoryReporter : public nsIMemoryReporter
+class nsMemoryReporter MOZ_FINAL : public nsIMemoryReporter
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIMEMORYREPORTER
 
   nsMemoryReporter(nsACString& process,
                    nsACString& path, 
                    PRInt32 kind,
--- a/xpcom/components/nsComponentManager.h
+++ b/xpcom/components/nsComponentManager.h
@@ -29,16 +29,17 @@
 #include "plarena.h"
 #include "nsCOMArray.h"
 #include "nsDataHashtable.h"
 #include "nsInterfaceHashtable.h"
 #include "nsClassHashtable.h"
 #include "nsTArray.h"
 
 #include "mozilla/Omnijar.h"
+#include "mozilla/Attributes.h"
 
 struct nsFactoryEntry;
 class nsIServiceManager;
 struct PRThread;
 
 #define NS_COMPONENTMANAGER_CID                      \
 { /* 91775d60-d5dc-11d2-92fb-00e09805570f */         \
     0x91775d60,                                      \
@@ -63,17 +64,17 @@ extern const char staticComponentType[];
 extern const mozilla::Module kXPCOMModule;
 
 // Array of Loaders and their type strings
 struct nsLoaderdata {
     nsCOMPtr<mozilla::ModuleLoader> loader;
     nsCString                 type;
 };
 
-class nsComponentManagerImpl
+class nsComponentManagerImpl MOZ_FINAL
     : public nsIComponentManager
     , public nsIServiceManager
     , public nsSupportsWeakReference
     , public nsIComponentRegistrar
     , public nsIInterfaceRequestor
 {
 public:
     NS_DECL_ISUPPORTS
--- a/xpcom/ds/nsArray.h
+++ b/xpcom/ds/nsArray.h
@@ -5,16 +5,17 @@
 
 #ifndef nsArray_h__
 #define nsArray_h__
 
 #include "nsIMutableArray.h"
 #include "nsCOMArray.h"
 #include "nsCOMPtr.h"
 #include "nsCycleCollectionParticipant.h"
+#include "mozilla/Attributes.h"
 
 #define NS_ARRAY_CLASSNAME \
   "nsIArray implementation"
 
 // {35C66FD1-95E9-4e0a-80C5-C3BD2B375481}
 #define NS_ARRAY_CID \
 { 0x35c66fd1, 0x95e9, 0x4e0a, \
   { 0x80, 0xc5, 0xc3, 0xbd, 0x2b, 0x37, 0x54, 0x81 } }
@@ -31,22 +32,22 @@ public:
     nsArray(const nsCOMArray_base& aBaseArray) : mArray(aBaseArray)
     { }
     
     NS_DECL_ISUPPORTS
     NS_DECL_NSIARRAY
     NS_DECL_NSIMUTABLEARRAY
 
 protected:
-    ~nsArray();
+    virtual ~nsArray(); // nsArrayCC inherits from this
 
     nsCOMArray_base mArray;
 };
 
-class nsArrayCC : public nsArray
+class nsArrayCC MOZ_FINAL : public nsArray
 {
 public:
     nsArrayCC() : nsArray() { }
     nsArrayCC(const nsCOMArray_base& aBaseArray) : nsArray(aBaseArray)
     { }
     
     NS_DECL_CYCLE_COLLECTING_ISUPPORTS
     NS_DECL_CYCLE_COLLECTION_CLASS(nsArrayCC)
--- a/xpcom/ds/nsAtomService.h
+++ b/xpcom/ds/nsAtomService.h
@@ -2,18 +2,19 @@
 /* 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 __nsAtomService_h
 #define __nsAtomService_h
 
 #include "nsIAtomService.h"
+#include "mozilla/Attributes.h"
 
-class nsAtomService : public nsIAtomService
+class nsAtomService MOZ_FINAL : public nsIAtomService
 {
  public:
   nsAtomService();
   NS_DECL_ISUPPORTS
     
   NS_DECL_NSIATOMSERVICE
 
  private:
--- a/xpcom/ds/nsAtomTable.cpp
+++ b/xpcom/ds/nsAtomTable.cpp
@@ -1,15 +1,16 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 // vim:cindent:ts=2:et:sw=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/. */
 
 #include "mozilla/Assertions.h"
+#include "mozilla/Attributes.h"
 #include "mozilla/HashFunctions.h"
 
 #include "nsAtomTable.h"
 #include "nsStaticAtom.h"
 #include "nsString.h"
 #include "nsReadableUtils.h"
 #include "nsUTF8Utils.h"
 #include "nsCRT.h"
@@ -97,17 +98,17 @@ public:
 
   size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const;
 };
 
 /**
  * A non-refcounted implementation of nsIAtom.
  */
 
-class PermanentAtomImpl : public AtomImpl {
+class PermanentAtomImpl MOZ_FINAL : public AtomImpl {
 public:
   PermanentAtomImpl(const nsAString& aString, PLDHashNumber aKeyHash)
     : AtomImpl(aString, aKeyHash)
   {}
   PermanentAtomImpl(nsStringBuffer* aData, PRUint32 aLength,
                     PLDHashNumber aKeyHash)
     : AtomImpl(aData, aLength, aKeyHash)
   {}
--- a/xpcom/ds/nsHashPropertyBag.cpp
+++ b/xpcom/ds/nsHashPropertyBag.cpp
@@ -6,16 +6,17 @@
 
 #include "nsHashPropertyBag.h"
 #include "nsArray.h"
 #include "nsArrayEnumerator.h"
 #include "nsComponentManagerUtils.h"
 #include "nsIVariant.h"
 #include "nsIProperty.h"
 #include "nsVariant.h"
+#include "mozilla/Attributes.h"
 
 nsresult
 NS_NewHashPropertyBag(nsIWritablePropertyBag* *_retval)
 {
     nsHashPropertyBag *hpb = new nsHashPropertyBag();
     if (!hpb)
         return NS_ERROR_OUT_OF_MEMORY;
 
@@ -105,17 +106,17 @@ nsHashPropertyBag::DeleteProperty(const 
     return NS_OK;
 }
 
 
 //
 // nsSimpleProperty class and impl; used for GetEnumerator
 //
 
-class nsSimpleProperty : public nsIProperty {
+class nsSimpleProperty MOZ_FINAL : public nsIProperty {
 public:
     nsSimpleProperty(const nsAString& aName, nsIVariant* aValue)
         : mName(aName), mValue(aValue)
     {
     }
 
     NS_DECL_ISUPPORTS
     NS_DECL_NSIPROPERTY
--- a/xpcom/ds/nsINIParserImpl.cpp
+++ b/xpcom/ds/nsINIParserImpl.cpp
@@ -4,18 +4,19 @@
 
 #include "nsINIParserImpl.h"
 
 #include "nsIFile.h"
 
 #include "nsINIParser.h"
 #include "nsStringEnumerator.h"
 #include "nsTArray.h"
+#include "mozilla/Attributes.h"
 
-class nsINIParserImpl :
+class nsINIParserImpl MOZ_FINAL :
   public nsIINIParser
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIINIPARSER
 
   nsresult Init(nsIFile* aINIFile) {
     return mParser.Init(aINIFile);
--- a/xpcom/ds/nsINIParserImpl.h
+++ b/xpcom/ds/nsINIParserImpl.h
@@ -2,25 +2,26 @@
  * 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 nsINIParserImpl_h__
 #define nsINIParserImpl_h__
 
 #include "nsIINIParser.h"
 #include "nsIFactory.h"
+#include "mozilla/Attributes.h"
 
 #define NS_INIPARSERFACTORY_CID \
 { 0xdfac10a9, 0xdd24, 0x43cf, \
   { 0xa0, 0x95, 0x6f, 0xfa, 0x2e, 0x4b, 0x6a, 0x6c } }
 
 #define NS_INIPARSERFACTORY_CONTRACTID \
   "@mozilla.org/xpcom/ini-parser-factory;1"
 
-class nsINIParserFactory :
+class nsINIParserFactory MOZ_FINAL :
   public nsIINIParserFactory,
   public nsIFactory
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIINIPARSERFACTORY
   NS_DECL_NSIFACTORY
 };
--- a/xpcom/ds/nsObserverList.h
+++ b/xpcom/ds/nsObserverList.h
@@ -9,16 +9,17 @@
 #include "nsISupports.h"
 #include "nsTArray.h"
 #include "nsCOMPtr.h"
 #include "nsCOMArray.h"
 #include "nsIObserver.h"
 #include "nsIWeakReference.h"
 #include "nsHashKeys.h"
 #include "nsISimpleEnumerator.h"
+#include "mozilla/Attributes.h"
 
 struct ObserverRef
 {
   ObserverRef(const ObserverRef& o) :
     isWeakRef(o.isWeakRef), ref(o.ref) { }
   
   ObserverRef(nsIObserver* aObserver) : isWeakRef(false), ref(aObserver) { }
   ObserverRef(nsIWeakReference* aWeak) : isWeakRef(true), ref(aWeak) { }
@@ -62,17 +63,17 @@ public:
   // Unmark any strongly held observers implemented in JS so the cycle
   // collector will not traverse them.
   void UnmarkGrayStrongObservers();
 
 private:
   nsTArray<ObserverRef> mObservers;
 };
 
-class nsObserverEnumerator : public nsISimpleEnumerator
+class nsObserverEnumerator MOZ_FINAL : public nsISimpleEnumerator
 {
 public:
     NS_DECL_ISUPPORTS
     NS_DECL_NSISIMPLEENUMERATOR
 
     nsObserverEnumerator(nsObserverList* aObserverList);
 
 private:
--- a/xpcom/ds/nsObserverService.h
+++ b/xpcom/ds/nsObserverService.h
@@ -4,24 +4,25 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef nsObserverService_h___
 #define nsObserverService_h___
 
 #include "nsIObserverService.h"
 #include "nsObserverList.h"
 #include "nsTHashtable.h"
+#include "mozilla/Attributes.h"
 
 #define NS_OBSERVERSERVICE_CLASSNAME "Observer Service"
 
 // {D07F5195-E3D1-11d2-8ACD-00105A1B8860}
 #define NS_OBSERVERSERVICE_CID \
     { 0xd07f5195, 0xe3d1, 0x11d2, { 0x8a, 0xcd, 0x0, 0x10, 0x5a, 0x1b, 0x88, 0x60 } }
 
-class nsObserverService : public nsIObserverService {
+class nsObserverService MOZ_FINAL : public nsIObserverService {
 public:
   NS_DECLARE_STATIC_IID_ACCESSOR(NS_OBSERVERSERVICE_CID)
 
   nsObserverService();
 
   NS_DECL_ISUPPORTS
   NS_DECL_NSIOBSERVERSERVICE
   
--- a/xpcom/ds/nsPersistentProperties.h
+++ b/xpcom/ds/nsPersistentProperties.h
@@ -6,21 +6,22 @@
 #ifndef nsPersistentProperties_h___
 #define nsPersistentProperties_h___
 
 #include "nsIPersistentProperties2.h"
 #include "pldhash.h"
 #include "plarena.h"
 #include "nsString.h"
 #include "nsCOMPtr.h"
+#include "mozilla/Attributes.h"
 
 #include "nsIUnicharInputStream.h"
 
 
-class nsPersistentProperties : public nsIPersistentProperties
+class nsPersistentProperties MOZ_FINAL : public nsIPersistentProperties
 {
 public:
   nsPersistentProperties();
   nsresult Init();
 
   NS_DECL_ISUPPORTS
   NS_DECL_NSIPROPERTIES
   NS_DECL_NSIPERSISTENTPROPERTIES
@@ -34,17 +35,17 @@ private:
 protected:
   nsCOMPtr<nsIUnicharInputStream> mIn;
 
   nsIPersistentProperties* mSubclass;
   struct PLDHashTable mTable;
   PLArenaPool mArena;
 };
 
-class nsPropertyElement : public nsIPropertyElement
+class nsPropertyElement MOZ_FINAL : public nsIPropertyElement
 {
 public:
   nsPropertyElement()
   {
   }
 
   nsPropertyElement(const nsACString& aKey, const nsAString& aValue)
     : mKey(aKey), mValue(aValue)
--- a/xpcom/ds/nsProperties.h
+++ b/xpcom/ds/nsProperties.h
@@ -5,32 +5,33 @@
 
 #ifndef nsProperties_h___
 #define nsProperties_h___
 
 #include "nsIProperties.h"
 #include "nsInterfaceHashtable.h"
 #include "nsHashKeys.h"
 #include "nsAgg.h"
+#include "mozilla/Attributes.h"
 
 #define NS_PROPERTIES_CID                            \
 { /* 4de2bc90-b1bf-11d3-93b6-00104ba0fd40 */         \
     0x4de2bc90,                                      \
     0xb1bf,                                          \
     0x11d3,                                          \
     {0x93, 0xb6, 0x00, 0x10, 0x4b, 0xa0, 0xfd, 0x40} \
 }
 
 class nsIUnicharInputStream;
 
 typedef nsInterfaceHashtable<nsCharPtrHashKey, nsISupports>
         nsProperties_HashBase;
 
-class nsProperties : public nsIProperties,
-                     public nsProperties_HashBase {
+class nsProperties MOZ_FINAL : public nsIProperties,
+                               public nsProperties_HashBase {
 public:
 
   NS_DECL_AGGREGATED
   NS_DECL_NSIPROPERTIES
 
   nsProperties(nsISupports *aOuter) { NS_INIT_AGGREGATED(aOuter); }
   nsresult Init() { nsProperties_HashBase::Init(); return NS_OK; }
 
--- a/xpcom/ds/nsStringEnumerator.cpp
+++ b/xpcom/ds/nsStringEnumerator.cpp
@@ -6,24 +6,25 @@
 
 #include "nsStringEnumerator.h"
 #include "prtypes.h"
 #include "nsCRT.h"
 #include "nsString.h"
 #include "nsReadableUtils.h"
 #include "nsISimpleEnumerator.h"
 #include "nsSupportsPrimitives.h"
+#include "mozilla/Attributes.h"
 
 //
 // nsStringEnumerator
 //
 
-class nsStringEnumerator : public nsIStringEnumerator,
-                           public nsIUTF8StringEnumerator,
-                           public nsISimpleEnumerator
+class nsStringEnumerator MOZ_FINAL : public nsIStringEnumerator,
+                                     public nsIUTF8StringEnumerator,
+                                     public nsISimpleEnumerator
 {
 public:
     nsStringEnumerator(const nsTArray<nsString>* aArray, bool aOwnsArray) :
         mArray(aArray), mIndex(0), mOwnsArray(aOwnsArray), mIsUnicode(true)
     {}
     
     nsStringEnumerator(const nsTArray<nsCString>* aArray, bool aOwnsArray) :
         mCArray(aArray), mIndex(0), mOwnsArray(aOwnsArray), mIsUnicode(false)
--- a/xpcom/ds/nsSupportsArray.cpp
+++ b/xpcom/ds/nsSupportsArray.cpp
@@ -643,17 +643,17 @@ nsresult
 NS_NewISupportsArray(nsISupportsArray** aInstancePtrResult)
 {
   nsresult rv;
   rv = nsSupportsArray::Create(NULL, NS_GET_IID(nsISupportsArray),
                                (void**)aInstancePtrResult);
   return rv;
 }
 
-class nsArrayEnumerator : public nsISimpleEnumerator
+class nsArrayEnumerator MOZ_FINAL : public nsISimpleEnumerator
 {
 public:
     // nsISupports interface
     NS_DECL_ISUPPORTS
 
     // nsISimpleEnumerator interface
     NS_IMETHOD HasMoreElements(bool* aResult);
     NS_IMETHOD GetNext(nsISupports** aResult);
--- a/xpcom/ds/nsSupportsArray.h
+++ b/xpcom/ds/nsSupportsArray.h
@@ -4,20 +4,21 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef nsSupportsArray_h__
 #define nsSupportsArray_h__
 
 //#define DEBUG_SUPPORTSARRAY 1
 
 #include "nsISupportsArray.h"
+#include "mozilla/Attributes.h"
 
 static const PRUint32 kAutoArraySize = 8;
 
-class nsSupportsArray : public nsISupportsArray {
+class nsSupportsArray MOZ_FINAL : public nsISupportsArray {
 public:
   nsSupportsArray(void);
   ~nsSupportsArray(void); // nonvirtual since we're not subclassed
 
   static nsresult
   Create(nsISupports *aOuter, REFNSIID aIID, void **aResult);
 
   NS_DECL_ISUPPORTS
--- a/xpcom/ds/nsSupportsArrayEnumerator.h
+++ b/xpcom/ds/nsSupportsArrayEnumerator.h
@@ -2,20 +2,21 @@
 /* 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 nsSupportsArrayEnumerator_h___
 #define nsSupportsArrayEnumerator_h___
 
 #include "nsIEnumerator.h"
+#include "mozilla/Attributes.h"
 
 class nsISupportsArray;
 
-class nsSupportsArrayEnumerator : public nsIBidirectionalEnumerator {
+class nsSupportsArrayEnumerator MOZ_FINAL : public nsIBidirectionalEnumerator {
 public:
   NS_DECL_ISUPPORTS
 
   nsSupportsArrayEnumerator(nsISupportsArray* array);
 
   // nsIEnumerator methods:
   NS_DECL_NSIENUMERATOR
 
--- a/xpcom/ds/nsUnicharBuffer.h
+++ b/xpcom/ds/nsUnicharBuffer.h
@@ -2,18 +2,19 @@
 /* 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 nsUnicharBuffer_h__
 #define nsUnicharBuffer_h__
 
 #include "nsIUnicharBuffer.h"
+#include "mozilla/Attributes.h"
 
-class UnicharBufferImpl : public nsIUnicharBuffer {
+class UnicharBufferImpl MOZ_FINAL : public nsIUnicharBuffer {
 public:
   UnicharBufferImpl();
 
   static NS_METHOD
   Create(nsISupports *aOuter, REFNSIID aIID, void **aResult);
 
   NS_DECL_ISUPPORTS
   NS_IMETHOD Init(PRUint32 aBufferSize);
--- a/xpcom/ds/nsVariant.h
+++ b/xpcom/ds/nsVariant.h
@@ -7,16 +7,17 @@
 /* The long avoided variant support for xpcom. */
 
 #ifndef nsVariant_h
 #define nsVariant_h
 
 #include "nsIVariant.h"
 #include "nsStringFwd.h"
 #include "xpt_struct.h"
+#include "mozilla/Attributes.h"
 
 class nsCycleCollectionTraversalCallback;
 
 /** 
  * Map the nsAUTF8String, nsUTF8String classes to the nsACString and
  * nsCString classes respectively for now.  These defines need to be removed
  * once Jag lands his nsUTF8String implementation.
  */
@@ -78,17 +79,17 @@ struct nsDiscriminatedUnion
  * these objects. They are created 'empty' and 'writable'. 
  *
  * nsIVariant users won't usually need to see this class.
  *
  * This class also has static helper methods that nsIVariant *implementors* can
  * use to help them do all the 'standard' nsIVariant data conversions.
  */
 
-class nsVariant : public nsIWritableVariant
+class nsVariant MOZ_FINAL : public nsIWritableVariant
 {
 public:
     NS_DECL_ISUPPORTS
     NS_DECL_NSIVARIANT
     NS_DECL_NSIWRITABLEVARIANT
 
     nsVariant();
 
--- a/xpcom/glue/nsEnumeratorUtils.cpp
+++ b/xpcom/glue/nsEnumeratorUtils.cpp
@@ -160,17 +160,17 @@ NS_NewSingletonEnumerator(nsISimpleEnume
         return NS_ERROR_OUT_OF_MEMORY;
     *result = enumer; 
     NS_ADDREF(*result);
     return NS_OK;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 
-class nsUnionEnumerator : public nsISimpleEnumerator
+class nsUnionEnumerator MOZ_FINAL : public nsISimpleEnumerator
 {
 public:
     NS_DECL_ISUPPORTS
 
     // nsISimpleEnumerator methods
     NS_IMETHOD HasMoreElements(bool* aResult);
     NS_IMETHOD GetNext(nsISupports** aResult);
 
--- a/xpcom/io/nsAppFileLocationProvider.h
+++ b/xpcom/io/nsAppFileLocationProvider.h
@@ -1,23 +1,24 @@
 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /* 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/. */
 
 #include "nsIDirectoryService.h"
 #include "nsIFile.h"
+#include "mozilla/Attributes.h"
 
 class nsIFile;
 
 //*****************************************************************************
 // class nsAppFileLocationProvider
 //*****************************************************************************   
 
-class nsAppFileLocationProvider : public nsIDirectoryServiceProvider2
+class nsAppFileLocationProvider MOZ_FINAL : public nsIDirectoryServiceProvider2
 {
 public:
                         nsAppFileLocationProvider();
 
    NS_DECL_ISUPPORTS
    NS_DECL_NSIDIRECTORYSERVICEPROVIDER
    NS_DECL_NSIDIRECTORYSERVICEPROVIDER2
 
--- a/xpcom/io/nsDirectoryService.h
+++ b/xpcom/io/nsDirectoryService.h
@@ -6,24 +6,25 @@
 #ifndef nsDirectoryService_h___
 #define nsDirectoryService_h___
 
 #include "nsIDirectoryService.h"
 #include "nsHashtable.h"
 #include "nsIFile.h"
 #include "nsISupportsArray.h"
 #include "nsIAtom.h"
+#include "mozilla/Attributes.h"
 
 #define NS_XPCOM_INIT_CURRENT_PROCESS_DIR       "MozBinD"   // Can be used to set NS_XPCOM_CURRENT_PROCESS_DIR
                                                             // CANNOT be used to GET a location
 #define NS_DIRECTORY_SERVICE_CID  {0xf00152d0,0xb40b,0x11d3,{0x8c, 0x9c, 0x00, 0x00, 0x64, 0x65, 0x73, 0x74}}
 
-class nsDirectoryService : public nsIDirectoryService,
-                           public nsIProperties,
-                           public nsIDirectoryServiceProvider2
+class nsDirectoryService MOZ_FINAL : public nsIDirectoryService,
+                                     public nsIProperties,
+                                     public nsIDirectoryServiceProvider2
 {
   public:
 
   // nsISupports interface
   NS_DECL_ISUPPORTS
 
   NS_DECL_NSIPROPERTIES  
 
--- a/xpcom/io/nsIOUtil.h
+++ b/xpcom/io/nsIOUtil.h
@@ -8,17 +8,18 @@
 
 #define NS_IOUTIL_CLASSNAME "XPCOM I/O utility class"
 #define NS_IOUTIL_CID                                                \
 { 0xeb833911, 0x4f49, 0x4623,                                        \
     { 0x84, 0x5f, 0xe5, 0x8a, 0x8e, 0x6d, 0xe4, 0xc2 } }
 
 
 #include "nsIIOUtil.h"
+#include "mozilla/Attributes.h"
 
-class nsIOUtil : public nsIIOUtil
+class nsIOUtil MOZ_FINAL : public nsIIOUtil
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIIOUTIL
 };
 
 #endif /* nsIOUtil_h__ */
--- a/xpcom/io/nsInputStreamTee.cpp
+++ b/xpcom/io/nsInputStreamTee.cpp
@@ -2,16 +2,17 @@
 /* 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/. */
 
 #include <stdlib.h>
 #include "prlog.h"
 
 #include "mozilla/Mutex.h"
+#include "mozilla/Attributes.h"
 #include "nsIInputStreamTee.h"
 #include "nsIInputStream.h"
 #include "nsIOutputStream.h"
 #include "nsCOMPtr.h"
 #include "nsAutoPtr.h"
 #include "nsIEventTarget.h"
 #include "nsThreadUtils.h"
 
@@ -19,17 +20,17 @@ using namespace mozilla;
 
 #ifdef PR_LOGGING
 static PRLogModuleInfo* gInputStreamTeeLog = PR_NewLogModule("nsInputStreamTee");
 #define LOG(args) PR_LOG(gInputStreamTeeLog, PR_LOG_DEBUG, args)
 #else
 #define LOG(args)
 #endif
 
-class nsInputStreamTee : public nsIInputStreamTee
+class nsInputStreamTee MOZ_FINAL : public nsIInputStreamTee
 {
 public:
     NS_DECL_ISUPPORTS
     NS_DECL_NSIINPUTSTREAM
     NS_DECL_NSIINPUTSTREAMTEE
 
     nsInputStreamTee();
     bool SinkIsValid();
--- a/xpcom/io/nsLocalFileUnix.cpp
+++ b/xpcom/io/nsLocalFileUnix.cpp
@@ -3,16 +3,17 @@
  * 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/. */
 
 /**
  * Implementation of nsIFile for "unixy" systems.
  */
 
 #include "mozilla/Util.h"
+#include "mozilla/Attributes.h"
 
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <unistd.h>
 #include <fcntl.h>
 #include <errno.h>
 #include <utime.h>
 #include <dirent.h>
@@ -92,18 +93,18 @@ using namespace mozilla;
 #define CHECK_mPath()                           \
     PR_BEGIN_MACRO                              \
         if (mPath.IsEmpty())                    \
             return NS_ERROR_NOT_INITIALIZED;    \
     PR_END_MACRO
 
 /* directory enumerator */
 class
-nsDirEnumeratorUnix : public nsISimpleEnumerator,
-                      public nsIDirectoryEnumerator
+nsDirEnumeratorUnix MOZ_FINAL : public nsISimpleEnumerator,
+                                public nsIDirectoryEnumerator
 {
     public:
     nsDirEnumeratorUnix();
 
     // nsISupports interface
     NS_DECL_ISUPPORTS
 
     // nsISimpleEnumerator interface
--- a/xpcom/io/nsLocalFileUnix.h
+++ b/xpcom/io/nsLocalFileUnix.h
@@ -14,16 +14,17 @@
 #include <sys/types.h>
 #include <unistd.h>
 
 #include "nscore.h"
 #include "nsString.h"
 #include "nsReadableUtils.h"
 #include "nsIHashable.h"
 #include "nsIClassInfoImpl.h"
+#include "mozilla/Attributes.h"
 #ifdef MOZ_WIDGET_COCOA
 #include "nsILocalFileMac.h"
 #endif
 
 /** 
  *  we need these for statfs()
  */
 #ifdef HAVE_SYS_STATVFS_H
@@ -69,17 +70,17 @@
     #define LSTAT lstat64
     #define HAVE_STATS64 1
 #else
     #define STAT stat
     #define LSTAT lstat
 #endif
 
 
-class nsLocalFile :
+class nsLocalFile MOZ_FINAL :
 #ifdef MOZ_WIDGET_COCOA
                            public nsILocalFileMac,
 #else
                            public nsILocalFile,
 #endif
                            public nsIHashable
 {
 public:
--- a/xpcom/io/nsMultiplexInputStream.cpp
+++ b/xpcom/io/nsMultiplexInputStream.cpp
@@ -5,28 +5,29 @@
 
 /**
  * The multiplex stream concatenates a list of input streams into a single
  * stream.
  */
 
 #include "IPC/IPCMessageUtils.h"
 #include "mozilla/net/NeckoMessageUtils.h"
+#include "mozilla/Attributes.h"
 
 #include "nsMultiplexInputStream.h"
 #include "nsIMultiplexInputStream.h"
 #include "nsISeekableStream.h"
 #include "nsCOMPtr.h"
 #include "nsCOMArray.h"
 #include "nsIIPCSerializable.h"
 #include "nsIClassInfoImpl.h"
 
-class nsMultiplexInputStream : public nsIMultiplexInputStream,
-                               public nsISeekableStream,
-                               public nsIIPCSerializable
+class nsMultiplexInputStream MOZ_FINAL : public nsIMultiplexInputStream,
+                                         public nsISeekableStream,
+                                         public nsIIPCSerializable
 {
 public:
     nsMultiplexInputStream();
 
     NS_DECL_ISUPPORTS
     NS_DECL_NSIINPUTSTREAM
     NS_DECL_NSIMULTIPLEXINPUTSTREAM
     NS_DECL_NSISEEKABLESTREAM
--- a/xpcom/io/nsPipe3.cpp
+++ b/xpcom/io/nsPipe3.cpp
@@ -1,12 +1,13 @@
 /* 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/. */
 
+#include "mozilla/Attributes.h"
 #include "mozilla/ReentrantMonitor.h"
 #include "nsIPipe.h"
 #include "nsIEventTarget.h"
 #include "nsISeekableStream.h"
 #include "nsIProgrammingLanguage.h"
 #include "nsSegmentedBuffer.h"
 #include "nsStreamUtils.h"
 #include "nsCOMPtr.h"
@@ -182,17 +183,17 @@ private:
     bool                            mBlocked;
     bool                            mWritable;
     nsCOMPtr<nsIOutputStreamCallback> mCallback;
     PRUint32                        mCallbackFlags;
 };
 
 //-----------------------------------------------------------------------------
 
-class nsPipe : public nsIPipe
+class nsPipe MOZ_FINAL : public nsIPipe
 {
 public:
     friend class nsPipeInputStream;
     friend class nsPipeOutputStream;
 
     NS_DECL_ISUPPORTS
     NS_DECL_NSIPIPE
 
--- a/xpcom/io/nsScriptableBase64Encoder.h
+++ b/xpcom/io/nsScriptableBase64Encoder.h
@@ -2,24 +2,25 @@
 /* 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 nsScriptableBase64Encoder_h__
 #define nsScriptableBase64Encoder_h__
 
 #include "nsIScriptableBase64Encoder.h"
+#include "mozilla/Attributes.h"
 
 #define NS_SCRIPTABLEBASE64ENCODER_CID                 \
   {0xaaf68860, 0xf849, 0x40ee,                         \
    {0xbb, 0x7a, 0xb2, 0x29, 0xbc, 0xe0, 0x36, 0xa3} }
 #define NS_SCRIPTABLEBASE64ENCODER_CONTRACTID \
   "@mozilla.org/scriptablebase64encoder;1"
 
-class nsScriptableBase64Encoder : public nsIScriptableBase64Encoder
+class nsScriptableBase64Encoder MOZ_FINAL : public nsIScriptableBase64Encoder
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSISCRIPTABLEBASE64ENCODER
 private:
   ~nsScriptableBase64Encoder() {}
 };
 
--- a/xpcom/io/nsScriptableInputStream.h
+++ b/xpcom/io/nsScriptableInputStream.h
@@ -4,24 +4,25 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef ___nsscriptableinputstream___h_
 #define ___nsscriptableinputstream___h_
 
 #include "nsIScriptableInputStream.h"
 #include "nsIInputStream.h"
 #include "nsCOMPtr.h"
+#include "mozilla/Attributes.h"
 
 #define NS_SCRIPTABLEINPUTSTREAM_CID        \
 { 0x7225c040, 0xa9bf, 0x11d3, { 0xa1, 0x97, 0x0, 0x50, 0x4, 0x1c, 0xaf, 0x44 } }
 
 #define NS_SCRIPTABLEINPUTSTREAM_CONTRACTID "@mozilla.org/scriptableinputstream;1"
 #define NS_SCRIPTABLEINPUTSTREAM_CLASSNAME "Scriptable Input Stream"
 
-class nsScriptableInputStream : public nsIScriptableInputStream {
+class nsScriptableInputStream MOZ_FINAL : public nsIScriptableInputStream {
 public:
     // nsISupports methods
     NS_DECL_ISUPPORTS
 
     // nsIScriptableInputStream methods
     NS_DECL_NSISCRIPTABLEINPUTSTREAM
 
     // nsScriptableInputStream methods
--- a/xpcom/io/nsStorageStream.cpp
+++ b/xpcom/io/nsStorageStream.cpp
@@ -16,16 +16,17 @@
 #include "nsStorageStream.h"
 #include "nsSegmentedBuffer.h"
 #include "nsStreamUtils.h"
 #include "nsCOMPtr.h"
 #include "prbit.h"
 #include "nsIInputStream.h"
 #include "nsISeekableStream.h"
 #include "prlog.h"
+#include "mozilla/Attributes.h"
 
 #if defined(PR_LOGGING)
 //
 // Log module for StorageStream logging...
 //
 // To enable logging (see prlog.h for full details):
 //
 //    set NSPR_LOG_MODULES=StorageStreamLog:5
@@ -293,18 +294,18 @@ nsStorageStream::Seek(PRInt32 aPosition)
     LOG(("nsStorageStream [%p] Seek mWriteCursor=%x mSegmentEnd=%x\n",
         this, mWriteCursor, mSegmentEnd));
     return NS_OK;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 
 // There can be many nsStorageInputStreams for a single nsStorageStream
-class nsStorageInputStream : public nsIInputStream
-                           , public nsISeekableStream
+class nsStorageInputStream MOZ_FINAL : public nsIInputStream
+                                     , public nsISeekableStream
 {
 public:
     nsStorageInputStream(nsStorageStream *aStorageStream, PRUint32 aSegmentSize)
         : mStorageStream(aStorageStream), mReadCursor(0),
           mSegmentEnd(0), mSegmentNum(0),
           mSegmentSize(aSegmentSize), mLogicalCursor(0),
           mStatus(NS_OK)
 	{
--- a/xpcom/io/nsStorageStream.h
+++ b/xpcom/io/nsStorageStream.h
@@ -12,32 +12,33 @@
  */
 
 #ifndef _nsStorageStream_h_
 #define _nsStorageStream_h_
 
 #include "nsIStorageStream.h"
 #include "nsIOutputStream.h"
 #include "nsMemory.h"
+#include "mozilla/Attributes.h"
 
 #define NS_STORAGESTREAM_CID                       \
 { /* 669a9795-6ff7-4ed4-9150-c34ce2971b63 */       \
   0x669a9795,                                      \
   0x6ff7,                                          \
   0x4ed4,                                          \
   {0x91, 0x50, 0xc3, 0x4c, 0xe2, 0x97, 0x1b, 0x63} \
 }
 
 #define NS_STORAGESTREAM_CONTRACTID "@mozilla.org/storagestream;1"
 #define NS_STORAGESTREAM_CLASSNAME "Storage Stream"
 
 class nsSegmentedBuffer;
 
-class nsStorageStream : public nsIStorageStream,
-                        public nsIOutputStream
+class nsStorageStream MOZ_FINAL : public nsIStorageStream,
+                                  public nsIOutputStream
 {
 public:
     nsStorageStream();
     
     NS_DECL_ISUPPORTS
     NS_DECL_NSISTORAGESTREAM
     NS_DECL_NSIOUTPUTSTREAM
 
--- a/xpcom/io/nsStreamUtils.cpp
+++ b/xpcom/io/nsStreamUtils.cpp
@@ -1,28 +1,29 @@
 /* vim:set ts=4 sw=4 sts=4 et cin: */
 /* 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/. */
 
 #include "mozilla/Mutex.h"
+#include "mozilla/Attributes.h"
 #include "nsStreamUtils.h"
 #include "nsCOMPtr.h"
 #include "nsIPipe.h"
 #include "nsIEventTarget.h"
 #include "nsIRunnable.h"
 #include "nsISafeOutputStream.h"
 #include "nsString.h"
 
 using namespace mozilla;
 
 //-----------------------------------------------------------------------------
 
-class nsInputStreamReadyEvent : public nsIRunnable
-                              , public nsIInputStreamCallback
+class nsInputStreamReadyEvent MOZ_FINAL : public nsIRunnable
+                                        , public nsIInputStreamCallback
 {
 public:
     NS_DECL_ISUPPORTS
 
     nsInputStreamReadyEvent(nsIInputStreamCallback *callback,
                             nsIEventTarget *target)
         : mCallback(callback)
         , mTarget(target)
@@ -90,18 +91,18 @@ private:
     nsCOMPtr<nsIEventTarget>         mTarget;
 };
 
 NS_IMPL_THREADSAFE_ISUPPORTS2(nsInputStreamReadyEvent, nsIRunnable,
                               nsIInputStreamCallback)
 
 //-----------------------------------------------------------------------------
 
-class nsOutputStreamReadyEvent : public nsIRunnable
-                               , public nsIOutputStreamCallback
+class nsOutputStreamReadyEvent MOZ_FINAL : public nsIRunnable
+                                         , public nsIOutputStreamCallback
 {
 public:
     NS_DECL_ISUPPORTS
 
     nsOutputStreamReadyEvent(nsIOutputStreamCallback *callback,
                              nsIEventTarget *target)
         : mCallback(callback)
         , mTarget(target)
@@ -458,17 +459,17 @@ protected:
     nsresult                       mCancelStatus;
 };
 
 NS_IMPL_THREADSAFE_ISUPPORTS3(nsAStreamCopier,
                               nsIInputStreamCallback,
                               nsIOutputStreamCallback,
                               nsIRunnable)
 
-class nsStreamCopierIB : public nsAStreamCopier
+class nsStreamCopierIB MOZ_FINAL : public nsAStreamCopier
 {
 public:
     nsStreamCopierIB() : nsAStreamCopier() {}
     virtual ~nsStreamCopierIB() {}
 
     struct ReadSegmentsState {
         nsIOutputStream *mSink;
         nsresult         mSinkCondition;
@@ -501,17 +502,17 @@ public:
         PRUint32 n;
         *sourceCondition =
             mSource->ReadSegments(ConsumeInputBuffer, &state, mChunkSize, &n);
         *sinkCondition = state.mSinkCondition;
         return n;
     }
 };
 
-class nsStreamCopierOB : public nsAStreamCopier
+class nsStreamCopierOB MOZ_FINAL : public nsAStreamCopier
 {
 public:
     nsStreamCopierOB() : nsAStreamCopier() {}
     virtual ~nsStreamCopierOB() {}
 
     struct WriteSegmentsState {
         nsIInputStream *mSource;
         nsresult        mSourceCondition;
--- a/xpcom/io/nsStringStream.cpp
+++ b/xpcom/io/nsStringStream.cpp
@@ -15,25 +15,26 @@
 #include "nsReadableUtils.h"
 #include "nsISeekableStream.h"
 #include "nsISupportsPrimitives.h"
 #include "nsCRT.h"
 #include "prerror.h"
 #include "plstr.h"
 #include "nsIClassInfoImpl.h"
 #include "nsIIPCSerializable.h"
+#include "mozilla/Attributes.h"
 
 //-----------------------------------------------------------------------------
 // nsIStringInputStream implementation
 //-----------------------------------------------------------------------------
 
-class nsStringInputStream : public nsIStringInputStream
-                          , public nsISeekableStream
-                          , public nsISupportsCString
-                          , public nsIIPCSerializable
+class nsStringInputStream MOZ_FINAL : public nsIStringInputStream
+                                    , public nsISeekableStream
+                                    , public nsISupportsCString
+                                    , public nsIIPCSerializable
 {
 public:
     NS_DECL_ISUPPORTS
     NS_DECL_NSIINPUTSTREAM
     NS_DECL_NSISTRINGINPUTSTREAM
     NS_DECL_NSISEEKABLESTREAM
     NS_DECL_NSISUPPORTSPRIMITIVE
     NS_DECL_NSISUPPORTSCSTRING
--- a/xpcom/io/nsUnicharInputStream.cpp
+++ b/xpcom/io/nsUnicharInputStream.cpp
@@ -7,26 +7,27 @@
 #include "nsIInputStream.h"
 #include "nsIByteBuffer.h"
 #include "nsIUnicharBuffer.h"
 #include "nsIServiceManager.h"
 #include "nsString.h"
 #include "nsAutoPtr.h"
 #include "nsCRT.h"
 #include "nsUTF8Utils.h"
+#include "mozilla/Attributes.h"
 #include <fcntl.h>
 #if defined(XP_WIN)
 #include <io.h>
 #else
 #include <unistd.h>
 #endif
 
 #define STRING_BUFFER_SIZE 8192
 
-class StringUnicharInputStream : public nsIUnicharInputStream {
+class StringUnicharInputStream MOZ_FINAL : public nsIUnicharInputStream {
 public:
   StringUnicharInputStream(const nsAString& aString) :
     mString(aString), mPos(0), mLen(aString.Length()) { }
 
   NS_DECL_ISUPPORTS
   NS_DECL_NSIUNICHARINPUTSTREAM
 
   nsString mString;
@@ -115,17 +116,17 @@ nsresult StringUnicharInputStream::Close
   mPos = mLen;
   return NS_OK;
 }
 
 NS_IMPL_ISUPPORTS1(StringUnicharInputStream, nsIUnicharInputStream)
 
 //----------------------------------------------------------------------
 
-class UTF8InputStream : public nsIUnicharInputStream {
+class UTF8InputStream MOZ_FINAL : public nsIUnicharInputStream {
 public:
   UTF8InputStream();
   nsresult Init(nsIInputStream* aStream);
 
   NS_DECL_ISUPPORTS
   NS_DECL_NSIUNICHARINPUTSTREAM
 
 private:
--- a/xpcom/reflect/xptcall/src/xptcprivate.h
+++ b/xpcom/reflect/xptcall/src/xptcprivate.h
@@ -5,16 +5,17 @@
 
 /* All the xptcall private declarations - only include locally. */
 
 #ifndef xptcprivate_h___
 #define xptcprivate_h___
 
 #include "xptcall.h"
 #include "nsAutoPtr.h"
+#include "mozilla/Attributes.h"
 
 class xptiInterfaceEntry;
 
 #if !defined(__ia64) || (!defined(__hpux) && !defined(__linux__))
 #define STUB_ENTRY(n) NS_IMETHOD Stub##n() = 0;
 #else
 #define STUB_ENTRY(n) NS_IMETHOD Stub##n(PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64) = 0;
 #endif
@@ -33,17 +34,17 @@ public:
 #if !defined(__ia64) || (!defined(__hpux) && !defined(__linux__))
 #define STUB_ENTRY(n) NS_IMETHOD Stub##n();
 #else
 #define STUB_ENTRY(n) NS_IMETHOD Stub##n(PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64,PRUint64);
 #endif
 
 #define SENTINEL_ENTRY(n) NS_IMETHOD Sentinel##n();
 
-class nsXPTCStubBase : public nsIXPTCStubBase
+class nsXPTCStubBase MOZ_FINAL : public nsIXPTCStubBase
 {
 public:
     NS_DECL_ISUPPORTS_INHERITED
 
 #include "xptcstubsdef.inc"
 
     nsXPTCStubBase(nsIXPTCProxy* aOuter, xptiInterfaceEntry *aEntry) :
         mOuter(aOuter), mEntry(aEntry) { }
--- a/xpcom/reflect/xptinfo/src/xptiprivate.h
+++ b/xpcom/reflect/xptinfo/src/xptiprivate.h
@@ -25,16 +25,17 @@
 #include "nsIFile.h"
 #include "nsIDirectoryService.h"
 #include "nsDirectoryServiceDefs.h"
 #include "nsAppDirectoryServiceDefs.h"
 #include "nsIWeakReference.h"
 
 #include "mozilla/ReentrantMonitor.h"
 #include "mozilla/Mutex.h"
+#include "mozilla/Attributes.h"
 
 #include "nsCRT.h"
 #include "nsMemory.h"
 
 #include "nsCOMArray.h"
 #include "nsQuickSort.h"
 
 #include "nsXPIDLString.h"
@@ -322,17 +323,17 @@ private:
 
     xptiInterfaceEntry*     mParent;      // Valid only when fully resolved
 
     xptiInterfaceInfo*      mInfo;        // May come and go.
     xptiInfoFlags           mFlags;
     char                    mName[1];     // Always last. Sized to fit.
 };
 
-class xptiInterfaceInfo : public nsIInterfaceInfo
+class xptiInterfaceInfo MOZ_FINAL : public nsIInterfaceInfo
 {
 public:
     NS_DECL_ISUPPORTS
 
     // Use delegation to implement (most!) of nsIInterfaceInfo.
     NS_IMETHOD GetName(char * *aName) { return !mEntry ? NS_ERROR_UNEXPECTED : mEntry->GetName(aName); }
     NS_IMETHOD GetInterfaceIID(nsIID * *aIID) { return !mEntry ? NS_ERROR_UNEXPECTED : mEntry->GetIID(aIID); }
     NS_IMETHOD IsScriptable(bool *_retval) { return !mEntry ? NS_ERROR_UNEXPECTED : mEntry->IsScriptable(_retval); }
@@ -390,17 +391,17 @@ private:
 
 private:
     xptiInterfaceEntry* mEntry;
     xptiInterfaceInfo*  mParent;
 };
 
 /***************************************************************************/
 
-class xptiInterfaceInfoManager 
+class xptiInterfaceInfoManager MOZ_FINAL
     : public nsIInterfaceInfoSuperManager
 {
     NS_DECL_ISUPPORTS
     NS_DECL_NSIINTERFACEINFOMANAGER
     NS_DECL_NSIINTERFACEINFOSUPERMANAGER
 
     typedef mozilla::ReentrantMonitor ReentrantMonitor;
     typedef mozilla::Mutex Mutex;
--- a/xpcom/threads/TimerThread.h
+++ b/xpcom/threads/TimerThread.h
@@ -9,21 +9,22 @@
 #include "nsIObserver.h"
 #include "nsIRunnable.h"
 #include "nsIThread.h"
 
 #include "nsTimerImpl.h"
 
 #include "nsTArray.h"
 
+#include "mozilla/Attributes.h"
 #include "mozilla/Monitor.h"
 #include "mozilla/TimeStamp.h"
 
-class TimerThread : public nsIRunnable,
-                    public nsIObserver
+class TimerThread MOZ_FINAL : public nsIRunnable,
+                              public nsIObserver
 {
 public:
   typedef mozilla::Monitor Monitor;
   typedef mozilla::TimeStamp TimeStamp;
   typedef mozilla::TimeDuration TimeDuration;
 
   TimerThread();
   NS_HIDDEN_(nsresult) InitLocks();
--- a/xpcom/threads/nsEnvironment.h
+++ b/xpcom/threads/nsEnvironment.h
@@ -1,25 +1,26 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /* 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 nsEnvironment_h__
 #define nsEnvironment_h__
 
+#include "mozilla/Attributes.h"
 #include "mozilla/Mutex.h"
 #include "nsIEnvironment.h"
 
 #define NS_ENVIRONMENT_CID \
   { 0X3D68F92UL, 0X9513, 0X4E25, \
   { 0X9B, 0XE9, 0X7C, 0XB2, 0X39, 0X87, 0X41, 0X72 } }
 #define NS_ENVIRONMENT_CONTRACTID "@mozilla.org/process/environment;1"
 
-class nsEnvironment : public nsIEnvironment
+class nsEnvironment MOZ_FINAL : public nsIEnvironment
 {
 public:
     NS_DECL_ISUPPORTS
     NS_DECL_NSIENVIRONMENT
 
     static nsresult Create(nsISupports *aOuter, REFNSIID aIID,
                            void **aResult);
 
--- a/xpcom/threads/nsProcess.h
+++ b/xpcom/threads/nsProcess.h
@@ -5,16 +5,17 @@
 
 #ifndef _nsPROCESSWIN_H_
 #define _nsPROCESSWIN_H_
 
 #if defined(XP_WIN)
 #define PROCESSMODEL_WINAPI
 #endif
 
+#include "mozilla/Attributes.h"
 #include "mozilla/Mutex.h"
 #include "nsIProcess.h"
 #include "nsIFile.h"
 #include "nsIThread.h"
 #include "nsIObserver.h"
 #include "nsIWeakReferenceUtils.h"
 #include "nsIObserver.h"
 #include "nsString.h"
@@ -25,18 +26,18 @@
 #include <windows.h>
 #include <shellapi.h>
 #endif
 
 #define NS_PROCESS_CID \
 {0x7b4eeb20, 0xd781, 0x11d4, \
    {0x8A, 0x83, 0x00, 0x10, 0xa4, 0xe0, 0xc9, 0xca}}
 
-class nsProcess : public nsIProcess,
-                  public nsIObserver
+class nsProcess MOZ_FINAL : public nsIProcess,
+                            public nsIObserver
 {
 public:
 
   NS_DECL_ISUPPORTS
   NS_DECL_NSIPROCESS
   NS_DECL_NSIOBSERVER
 
   nsProcess();
--- a/xpcom/threads/nsThread.h
+++ b/xpcom/threads/nsThread.h
@@ -9,19 +9,21 @@
 
 #include "mozilla/Mutex.h"
 #include "nsIThreadInternal.h"
 #include "nsISupportsPriority.h"
 #include "nsEventQueue.h"
 #include "nsThreadUtils.h"
 #include "nsString.h"
 #include "nsTObserverArray.h"
+#include "mozilla/Attributes.h"
 
 // A native thread
-class nsThread : public nsIThreadInternal, public nsISupportsPriority
+class nsThread MOZ_FINAL : public nsIThreadInternal,
+                           public nsISupportsPriority
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIEVENTTARGET
   NS_DECL_NSITHREAD
   NS_DECL_NSITHREADINTERNAL
   NS_DECL_NSISUPPORTSPRIORITY
 
--- a/xpcom/threads/nsThreadPool.h
+++ b/xpcom/threads/nsThreadPool.h
@@ -9,18 +9,20 @@
 
 #include "nsIThreadPool.h"
 #include "nsIThread.h"
 #include "nsIRunnable.h"
 #include "nsEventQueue.h"
 #include "nsCOMArray.h"
 #include "nsCOMPtr.h"
 #include "nsThreadUtils.h"
+#include "mozilla/Attributes.h"
 
-class nsThreadPool : public nsIThreadPool, public nsIRunnable
+class nsThreadPool MOZ_FINAL : public nsIThreadPool,
+                               public nsIRunnable
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIEVENTTARGET
   NS_DECL_NSITHREADPOOL
   NS_DECL_NSIRUNNABLE
 
   nsThreadPool();
--- a/xpcom/threads/nsTimerImpl.h
+++ b/xpcom/threads/nsTimerImpl.h
@@ -11,16 +11,17 @@
 #include "nsITimer.h"
 #include "nsIEventTarget.h"
 #include "nsIObserver.h"
 
 #include "nsCOMPtr.h"
 
 #include "prlog.h"
 #include "mozilla/TimeStamp.h"
+#include "mozilla/Attributes.h"
 
 #if defined(PR_LOGGING)
 static PRLogModuleInfo *gTimerLog = PR_NewLogModule("nsTimerImpl");
 #define DEBUG_TIMERS 1
 #else
 #undef DEBUG_TIMERS
 #endif
 
@@ -35,17 +36,17 @@ static PRLogModuleInfo *gTimerLog = PR_N
 
 enum {
   CALLBACK_TYPE_UNKNOWN   = 0,
   CALLBACK_TYPE_INTERFACE = 1,
   CALLBACK_TYPE_FUNC      = 2,
   CALLBACK_TYPE_OBSERVER  = 3
 };
 
-class nsTimerImpl : public nsITimer
+class nsTimerImpl MOZ_FINAL : public nsITimer
 {
 public:
   typedef mozilla::TimeStamp TimeStamp;
 
   nsTimerImpl();
 
   static NS_HIDDEN_(nsresult) Startup();
   static NS_HIDDEN_(void) Shutdown();