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 (netwerk parts); r=jduell
authorEhsan Akhgari <ehsan@mozilla.com>
Tue, 05 Jun 2012 23:18:25 -0400
changeset 101383 866b1639131dc195d66705e825be482057c33b80
parent 101382 d9c95c879541ae32aa07adea5a86659d675339f1
child 101384 3dd7e4d5c8f24b023ff11fad3eff24fc2fba83c7
push idunknown
push userunknown
push dateunknown
reviewersjduell
bugs758992
milestone16.0a1
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 (netwerk parts); r=jduell
netwerk/base/public/nsAsyncRedirectVerifyHelper.h
netwerk/base/public/nsStreamListenerWrapper.h
netwerk/base/src/RedirectChannelRegistrar.h
netwerk/base/src/nsAuthInformationHolder.h
netwerk/base/src/nsBase64Encoder.h
netwerk/base/src/nsChannelClassifier.h
netwerk/base/src/nsDNSPrefetch.h
netwerk/base/src/nsIOService.h
netwerk/base/src/nsInputStreamPump.h
netwerk/base/src/nsNetAddr.h
netwerk/base/src/nsPACMan.cpp
netwerk/base/src/nsPACMan.h
netwerk/base/src/nsPreloadedStream.h
netwerk/base/src/nsProtocolProxyService.cpp
netwerk/base/src/nsProtocolProxyService.h
netwerk/base/src/nsProxyInfo.h
netwerk/base/src/nsSerializationHelper.h
netwerk/base/src/nsServerSocket.cpp
netwerk/base/src/nsStandardURL.h
netwerk/base/src/nsStreamLoader.h
netwerk/base/src/nsStreamTransportService.h
netwerk/base/src/nsSyncStreamListener.h
netwerk/base/src/nsURLParsers.cpp
netwerk/base/src/nsURLParsers.h
netwerk/cache/nsApplicationCacheService.h
netwerk/cache/nsCacheService.cpp
netwerk/cache/nsDiskCacheDeviceSQL.cpp
netwerk/cache/nsDiskCacheDeviceSQL.h
netwerk/cookie/nsCookieService.cpp
netwerk/dns/nsDNSService2.cpp
netwerk/dns/nsDNSService2.h
netwerk/dns/nsEffectiveTLDService.h
netwerk/protocol/about/nsAboutProtocolHandler.h
netwerk/protocol/device/nsDeviceProtocolHandler.h
netwerk/protocol/ftp/nsFTPChannel.cpp
netwerk/protocol/ftp/nsFtpControlConnection.h
netwerk/protocol/http/NullHttpTransaction.h
netwerk/protocol/http/SpdySession2.h
netwerk/protocol/http/SpdySession3.h
netwerk/protocol/http/SpdyStream2.h
netwerk/protocol/http/SpdyStream3.h
netwerk/protocol/http/nsHttpChannel.cpp
netwerk/protocol/http/nsHttpConnectionMgr.h
netwerk/protocol/http/nsHttpDigestAuth.h
netwerk/protocol/http/nsHttpNTLMAuth.cpp
netwerk/protocol/viewsource/nsViewSourceChannel.h
netwerk/protocol/viewsource/nsViewSourceHandler.h
netwerk/protocol/websocket/WebSocketChannel.cpp
netwerk/socket/nsUDPSocketProvider.h
netwerk/streamconv/converters/nsDirIndex.h
netwerk/streamconv/converters/nsMultiMixedConv.h
netwerk/streamconv/test/TestStreamConv.cpp
netwerk/test/TestCallbacks.cpp
netwerk/test/TestCommon.h
netwerk/test/TestIncrementalDownload.cpp
netwerk/test/TestProtocols.cpp
netwerk/test/TestStreamLoader.cpp
netwerk/wifi/nsWifiAccessPoint.h
netwerk/wifi/nsWifiMonitor.cpp
netwerk/wifi/nsWifiMonitor.h
--- a/netwerk/base/public/nsAsyncRedirectVerifyHelper.h
+++ b/netwerk/base/public/nsAsyncRedirectVerifyHelper.h
@@ -9,26 +9,27 @@
 #include "nsIRunnable.h"
 #include "nsIThread.h"
 #include "nsIChannelEventSink.h"
 #include "nsIInterfaceRequestor.h"
 #include "nsIAsyncVerifyRedirectCallback.h"
 #include "nsCOMPtr.h"
 #include "nsAutoPtr.h"
 #include "nsCycleCollectionParticipant.h"
+#include "mozilla/Attributes.h"
 
 class nsIChannel;
 
 /**
  * This class simplifies call of OnChannelRedirect of IOService and
  * the sink bound with the channel being redirected while the result of
  * redirect decision is returned through the callback.
  */
-class nsAsyncRedirectVerifyHelper : public nsIRunnable,
-                                    public nsIAsyncVerifyRedirectCallback
+class nsAsyncRedirectVerifyHelper MOZ_FINAL : public nsIRunnable,
+                                              public nsIAsyncVerifyRedirectCallback
 {
     NS_DECL_ISUPPORTS
     NS_DECL_NSIRUNNABLE
     NS_DECL_NSIASYNCVERIFYREDIRECTCALLBACK
 
 public:
     nsAsyncRedirectVerifyHelper();
 
--- a/netwerk/base/public/nsStreamListenerWrapper.h
+++ b/netwerk/base/public/nsStreamListenerWrapper.h
@@ -3,20 +3,21 @@
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef nsStreamListenerWrapper_h__
 #define nsStreamListenerWrapper_h__
 
 #include "nsCOMPtr.h"
 #include "nsIStreamListener.h"
 #include "nsIRequestObserver.h"
+#include "mozilla/Attributes.h"
 
 // Wrapper class to make replacement of nsHttpChannel's listener
 // from JavaScript possible. It is workaround for bug 433711 and 682305.
-class nsStreamListenerWrapper : public nsIStreamListener
+class nsStreamListenerWrapper MOZ_FINAL : public nsIStreamListener
 {
 public:
   nsStreamListenerWrapper(nsIStreamListener *listener)
     : mListener(listener)
   {
     NS_ASSERTION(mListener, "no stream listener specified");
   }
 
--- a/netwerk/base/src/RedirectChannelRegistrar.h
+++ b/netwerk/base/src/RedirectChannelRegistrar.h
@@ -5,21 +5,22 @@
 #ifndef RedirectChannelRegistrar_h__
 #define RedirectChannelRegistrar_h__
 
 #include "nsIRedirectChannelRegistrar.h"
 
 #include "nsIChannel.h"
 #include "nsIParentChannel.h"
 #include "nsClassHashtable.h"
+#include "mozilla/Attributes.h"
 
 namespace mozilla {
 namespace net {
 
-class RedirectChannelRegistrar : public nsIRedirectChannelRegistrar
+class RedirectChannelRegistrar MOZ_FINAL : public nsIRedirectChannelRegistrar
 {
   NS_DECL_ISUPPORTS
   NS_DECL_NSIREDIRECTCHANNELREGISTRAR
 
   RedirectChannelRegistrar();
 
 protected:
   template<class KeyClass, class T>
--- a/netwerk/base/src/nsAuthInformationHolder.h
+++ b/netwerk/base/src/nsAuthInformationHolder.h
@@ -11,16 +11,18 @@
 
 class nsAuthInformationHolder : public nsIAuthInformation {
 public:
     // aAuthType must be ASCII
     nsAuthInformationHolder(PRUint32 aFlags, const nsString& aRealm,
                             const nsCString& aAuthType)
         : mFlags(aFlags), mRealm(aRealm), mAuthType(aAuthType) {}
 
+    virtual ~nsAuthInformationHolder() {}
+
     NS_DECL_ISUPPORTS
     NS_DECL_NSIAUTHINFORMATION
 
     const nsString& User() const { return mUser; }
     const nsString& Password() const { return mPassword; }
     const nsString& Domain() const { return mDomain; }
 
     /**
--- a/netwerk/base/src/nsBase64Encoder.h
+++ b/netwerk/base/src/nsBase64Encoder.h
@@ -2,22 +2,23 @@
  * 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 NSBASE64ENCODER_H_
 #define NSBASE64ENCODER_H_
 
 #include "nsIOutputStream.h"
 #include "nsString.h"
+#include "mozilla/Attributes.h"
 
 /**
  * A base64 encoder. Usage: Instantiate class, write to it using
  * Write(), then call Finish() to get the base64-encoded data.
  */
-class nsBase64Encoder : public nsIOutputStream {
+class nsBase64Encoder MOZ_FINAL : public nsIOutputStream {
   public:
     nsBase64Encoder() {}
 
     NS_DECL_ISUPPORTS
     NS_DECL_NSIOUTPUTSTREAM
 
     nsresult Finish(nsCSubstring& _result);
   private:
--- a/netwerk/base/src/nsChannelClassifier.h
+++ b/netwerk/base/src/nsChannelClassifier.h
@@ -3,21 +3,22 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef nsChannelClassifier_h__
 #define nsChannelClassifier_h__
 
 #include "nsIURIClassifier.h"
 #include "nsIRunnable.h"
 #include "nsCOMPtr.h"
+#include "mozilla/Attributes.h"
 
 class nsIChannel;
 
 
-class nsChannelClassifier : public nsIURIClassifierCallback
+class nsChannelClassifier MOZ_FINAL : public nsIURIClassifierCallback
 {
 public:
     nsChannelClassifier();
 
     NS_DECL_ISUPPORTS
     NS_DECL_NSIURICLASSIFIERCALLBACK
 
     nsresult Start(nsIChannel *aChannel);
--- a/netwerk/base/src/nsDNSPrefetch.h
+++ b/netwerk/base/src/nsDNSPrefetch.h
@@ -4,23 +4,24 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef nsDNSPrefetch_h___
 #define nsDNSPrefetch_h___
 
 #include "nsCOMPtr.h"
 #include "nsString.h"
 #include "mozilla/TimeStamp.h"
+#include "mozilla/Attributes.h"
 
 #include "nsIDNSListener.h"
 
 class nsIURI;
 class nsIDNSService;
 
-class nsDNSPrefetch : public nsIDNSListener
+class nsDNSPrefetch MOZ_FINAL : public nsIDNSListener
 {
 public:
     NS_DECL_ISUPPORTS
     NS_DECL_NSIDNSLISTENER
   
     nsDNSPrefetch(nsIURI *aURI, bool storeTiming);
     bool TimingsValid() const {
         return !mStartTimestamp.IsNull() && !mEndTimestamp.IsNull();
--- a/netwerk/base/src/nsIOService.h
+++ b/netwerk/base/src/nsIOService.h
@@ -22,34 +22,35 @@
 #include "nsWeakReference.h"
 #include "nsINetUtil.h"
 #include "nsIChannelEventSink.h"
 #include "nsIContentSniffer.h"
 #include "nsCategoryCache.h"
 #include "nsINetworkLinkService.h"
 #include "nsAsyncRedirectVerifyHelper.h"
 #include "nsISpeculativeConnect.h"
+#include "mozilla/Attributes.h"
 
 #define NS_N(x) (sizeof(x)/sizeof(*x))
 
 // We don't want to expose this observer topic.
 // Intended internal use only for remoting offline/inline events.
 // See Bug 552829
 #define NS_IPC_IOSERVICE_SET_OFFLINE_TOPIC "ipc:network:set-offline"
 
 static const char gScheme[][sizeof("resource")] =
     {"chrome", "file", "http", "jar", "resource"};
 
 class nsIPrefBranch;
 
-class nsIOService : public nsIIOService2
-                  , public nsIObserver
-                  , public nsINetUtil
-                  , public nsISpeculativeConnect
-                  , public nsSupportsWeakReference
+class nsIOService MOZ_FINAL : public nsIIOService2
+                            , public nsIObserver
+                            , public nsINetUtil
+                            , public nsISpeculativeConnect
+                            , public nsSupportsWeakReference
 {
 public:
     NS_DECL_ISUPPORTS
     NS_DECL_NSIIOSERVICE
     NS_DECL_NSIIOSERVICE2
     NS_DECL_NSIOBSERVER
     NS_DECL_NSINETUTIL
     NS_DECL_NSISPECULATIVECONNECT
--- a/netwerk/base/src/nsInputStreamPump.h
+++ b/netwerk/base/src/nsInputStreamPump.h
@@ -11,19 +11,20 @@
 #include "nsIURI.h"
 #include "nsILoadGroup.h"
 #include "nsIStreamListener.h"
 #include "nsIInterfaceRequestor.h"
 #include "nsIProgressEventSink.h"
 #include "nsIAsyncInputStream.h"
 #include "nsIThread.h"
 #include "nsCOMPtr.h"
+#include "mozilla/Attributes.h"
 
-class nsInputStreamPump : public nsIInputStreamPump
-                        , public nsIInputStreamCallback
+class nsInputStreamPump MOZ_FINAL : public nsIInputStreamPump
+                                  , public nsIInputStreamCallback
 {
 public:
     NS_DECL_ISUPPORTS
     NS_DECL_NSIREQUEST
     NS_DECL_NSIINPUTSTREAMPUMP
     NS_DECL_NSIINPUTSTREAMCALLBACK
 
     nsInputStreamPump(); 
--- a/netwerk/base/src/nsNetAddr.h
+++ b/netwerk/base/src/nsNetAddr.h
@@ -4,18 +4,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 nsNetAddr_h__
 #define nsNetAddr_h__
 
 #include "nsINetAddr.h"
 #include "prio.h"
+#include "mozilla/Attributes.h"
 
-class nsNetAddr : public nsINetAddr
+class nsNetAddr MOZ_FINAL : public nsINetAddr
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSINETADDR
 
   nsNetAddr(PRNetAddr* addr);
 
 private:
--- a/netwerk/base/src/nsPACMan.cpp
+++ b/netwerk/base/src/nsPACMan.cpp
@@ -38,17 +38,18 @@ HttpRequestSucceeded(nsIStreamLoader *lo
 
   return result;
 }
 
 //-----------------------------------------------------------------------------
 
 // These objects are stored in nsPACMan::mPendingQ
 
-class PendingPACQuery : public PRCList, public nsIDNSListener
+class PendingPACQuery MOZ_FINAL : public PRCList,
+                                  public nsIDNSListener
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIDNSLISTENER
 
   PendingPACQuery(nsPACMan *pacMan, nsIURI *uri, nsPACManCallback *callback)
     : mPACMan(pacMan)
     , mURI(uri)
--- a/netwerk/base/src/nsPACMan.h
+++ b/netwerk/base/src/nsPACMan.h
@@ -10,16 +10,17 @@
 #include "nsIStreamLoader.h"
 #include "nsIInterfaceRequestor.h"
 #include "nsIChannelEventSink.h"
 #include "nsIProxyAutoConfig.h"
 #include "nsIURI.h"
 #include "nsCOMPtr.h"
 #include "nsString.h"
 #include "prclist.h"
+#include "mozilla/Attributes.h"
 
 /**
  * This class defines a callback interface used by AsyncGetProxyForURI.
  */
 class NS_NO_VTABLE nsPACManCallback : public nsISupports
 {
 public:
   /**
@@ -33,19 +34,19 @@ public:
    */
   virtual void OnQueryComplete(nsresult status, const nsCString &pacString) = 0;
 };
 
 /**
  * This class provides an abstraction layer above the PAC thread.  The methods
  * defined on this class are intended to be called on the main thread only.
  */
-class nsPACMan : public nsIStreamLoaderObserver
-               , public nsIInterfaceRequestor
-               , public nsIChannelEventSink
+class nsPACMan MOZ_FINAL : public nsIStreamLoaderObserver
+                         , public nsIInterfaceRequestor
+                         , public nsIChannelEventSink
 {
 public:
   NS_DECL_ISUPPORTS
 
   nsPACMan();
 
   /**
    * This method may be called to shutdown the PAC manager.  Any async queries
--- a/netwerk/base/src/nsPreloadedStream.h
+++ b/netwerk/base/src/nsPreloadedStream.h
@@ -17,21 +17,22 @@
  * given to the new protocol handler.
 */
 
 #ifndef nsPreloadedStream_h__
 #define nsPreloadedStream_h__
 
 #include "nsIAsyncInputStream.h"
 #include "nsCOMPtr.h"
+#include "mozilla/Attributes.h"
 
 namespace mozilla {
 namespace net {
 
-class nsPreloadedStream : public nsIAsyncInputStream
+class nsPreloadedStream MOZ_FINAL : public nsIAsyncInputStream
 {
  public:
     NS_DECL_ISUPPORTS
     NS_DECL_NSIINPUTSTREAM
     NS_DECL_NSIASYNCINPUTSTREAM
 
     nsPreloadedStream(nsIAsyncInputStream *aStream, 
                       const char *data, PRUint32 datalen);
--- a/netwerk/base/src/nsProtocolProxyService.cpp
+++ b/netwerk/base/src/nsProtocolProxyService.cpp
@@ -1,14 +1,15 @@
 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /* vim:set ts=4 sw=4 sts=4 et: */
 /* 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/Util.h"
 
 #include "nsProtocolProxyService.h"
 #include "nsProxyInfo.h"
 #include "nsIClassInfoImpl.h"
 #include "nsIServiceManager.h"
 #include "nsXPIDLString.h"
 #include "nsIProxyAutoConfig.h"
@@ -52,19 +53,19 @@ static PRLogModuleInfo *sLog = PR_NewLog
 struct nsProtocolInfo {
     nsCAutoString scheme;
     PRUint32 flags;
     PRInt32 defaultPort;
 };
 
 //----------------------------------------------------------------------------
 
-class nsAsyncResolveRequest : public nsIRunnable
-                            , public nsPACManCallback 
-                            , public nsICancelable
+class nsAsyncResolveRequest MOZ_FINAL : public nsIRunnable
+                                      , public nsPACManCallback
+                                      , public nsICancelable
 {
 public:
     NS_DECL_ISUPPORTS
 
     nsAsyncResolveRequest(nsProtocolProxyService *pps, nsIURI *uri,
                           PRUint32 aResolveFlags,
                           nsIProtocolProxyCallback *callback)
         : mStatus(NS_OK)
--- a/netwerk/base/src/nsProtocolProxyService.h
+++ b/netwerk/base/src/nsProtocolProxyService.h
@@ -18,24 +18,25 @@
 #include "nsIProxyInfo.h"
 #include "nsIObserver.h"
 #include "nsDataHashtable.h"
 #include "nsHashKeys.h"
 #include "nsPACMan.h"
 #include "prtime.h"
 #include "prmem.h"
 #include "prio.h"
+#include "mozilla/Attributes.h"
 
 typedef nsDataHashtable<nsCStringHashKey, PRUint32> nsFailedProxyTable;
 
 class nsProxyInfo;
 struct nsProtocolInfo;
 
-class nsProtocolProxyService : public nsIProtocolProxyService2
-                             , public nsIObserver
+class nsProtocolProxyService MOZ_FINAL : public nsIProtocolProxyService2
+                                       , public nsIObserver
 {
 public:
     NS_DECL_ISUPPORTS
     NS_DECL_NSIPROTOCOLPROXYSERVICE2
     NS_DECL_NSIPROTOCOLPROXYSERVICE
     NS_DECL_NSIOBSERVER
 
     nsProtocolProxyService() NS_HIDDEN;
--- a/netwerk/base/src/nsProxyInfo.h
+++ b/netwerk/base/src/nsProxyInfo.h
@@ -4,29 +4,30 @@
  * 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 nsProxyInfo_h__
 #define nsProxyInfo_h__
 
 #include "nsIProxyInfo.h"
 #include "nsString.h"
+#include "mozilla/Attributes.h"
 
 // Use to support QI nsIProxyInfo to nsProxyInfo
 #define NS_PROXYINFO_IID \
 { /* ed42f751-825e-4cc2-abeb-3670711a8b85 */         \
     0xed42f751,                                      \
     0x825e,                                          \
     0x4cc2,                                          \
     {0xab, 0xeb, 0x36, 0x70, 0x71, 0x1a, 0x8b, 0x85} \
 }
 
 // This class is exposed to other classes inside Necko for fast access
 // to the nsIProxyInfo attributes.
-class nsProxyInfo : public nsIProxyInfo
+class nsProxyInfo MOZ_FINAL : public nsIProxyInfo
 {
 public:
   NS_DECLARE_STATIC_IID_ACCESSOR(NS_PROXYINFO_IID)
 
   NS_DECL_ISUPPORTS
   NS_DECL_NSIPROXYINFO
 
   // Cheap accessors for use within Necko
--- a/netwerk/base/src/nsSerializationHelper.h
+++ b/netwerk/base/src/nsSerializationHelper.h
@@ -6,31 +6,32 @@
  * Helper functions for (de)serializing objects to/from ASCII strings.
  */
 
 #ifndef NSSERIALIZATIONHELPER_H_
 #define NSSERIALIZATIONHELPER_H_
 
 #include "nsStringFwd.h"
 #include "nsISerializationHelper.h"
+#include "mozilla/Attributes.h"
 
 class nsISerializable;
 class nsISupports;
 
 /**
  * Serialize an object to an ASCII string.
  */
 nsresult NS_SerializeToString(nsISerializable* obj,
                               nsCSubstring& str);
 
 /**
  * Deserialize an object.
  */
 nsresult NS_DeserializeObject(const nsCSubstring& str,
                               nsISupports** obj);
 
-class nsSerializationHelper : public nsISerializationHelper
+class nsSerializationHelper MOZ_FINAL : public nsISerializationHelper
 {
   NS_DECL_ISUPPORTS
   NS_DECL_NSISERIALIZATIONHELPER
 };
 
 #endif
--- a/netwerk/base/src/nsServerSocket.cpp
+++ b/netwerk/base/src/nsServerSocket.cpp
@@ -7,16 +7,17 @@
 #include "nsSocketTransport2.h"
 #include "nsServerSocket.h"
 #include "nsProxyRelease.h"
 #include "nsAutoPtr.h"
 #include "nsNetError.h"
 #include "nsNetCID.h"
 #include "prnetdb.h"
 #include "prio.h"
+#include "mozilla/Attributes.h"
 
 using namespace mozilla;
 
 static NS_DEFINE_CID(kSocketTransportServiceCID, NS_SOCKETTRANSPORTSERVICE_CID);
 
 //-----------------------------------------------------------------------------
 
 typedef void (nsServerSocket:: *nsServerSocketFunc)(void);
@@ -325,17 +326,17 @@ nsServerSocket::Close()
       return NS_OK;
     }
   }
   return PostEvent(this, &nsServerSocket::OnMsgClose);
 }
 
 namespace {
 
-class ServerSocketListenerProxy : public nsIServerSocketListener
+class ServerSocketListenerProxy MOZ_FINAL : public nsIServerSocketListener
 {
 public:
   ServerSocketListenerProxy(nsIServerSocketListener* aListener)
     : mListener(aListener)
     , mTargetThread(do_GetCurrentThread())
   { }
 
   NS_DECL_ISUPPORTS
--- a/netwerk/base/src/nsStandardURL.h
+++ b/netwerk/base/src/nsStandardURL.h
@@ -18,16 +18,17 @@
 #include "nsIUnicodeEncoder.h"
 #include "nsIObserver.h"
 #include "nsIIOService.h"
 #include "nsCOMPtr.h"
 #include "nsURLHelper.h"
 #include "nsIClassInfo.h"
 #include "nsISizeOf.h"
 #include "prclist.h"
+#include "mozilla/Attributes.h"
 
 #ifdef NS_BUILD_REFCNT_LOGGING
 #define DEBUG_DUMP_URLS_AT_SHUTDOWN
 #endif
 
 class nsIBinaryInputStream;
 class nsIBinaryOutputStream;
 class nsIIDNService;
@@ -88,17 +89,17 @@ public: /* internal -- HPUX compiler can
                 mLen += 1 + right.mLen;
             }
         }
     };
 
     //
     // Pref observer
     //
-    class nsPrefObserver : public nsIObserver
+    class nsPrefObserver MOZ_FINAL : public nsIObserver
     {
     public:
         NS_DECL_ISUPPORTS
         NS_DECL_NSIOBSERVER
 
         nsPrefObserver() { }
     };
     friend class nsPrefObserver;
--- a/netwerk/base/src/nsStreamLoader.h
+++ b/netwerk/base/src/nsStreamLoader.h
@@ -5,18 +5,19 @@
 
 #ifndef nsStreamLoader_h__
 #define nsStreamLoader_h__
 
 #include "nsIRequest.h"
 #include "nsIStreamLoader.h"
 #include "nsCOMPtr.h"
 #include "nsString.h"
+#include "mozilla/Attributes.h"
 
-class nsStreamLoader : public nsIStreamLoader
+class nsStreamLoader MOZ_FINAL : public nsIStreamLoader
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSISTREAMLOADER
   NS_DECL_NSIREQUESTOBSERVER
   NS_DECL_NSISTREAMLISTENER
 
   nsStreamLoader();
--- a/netwerk/base/src/nsStreamTransportService.h
+++ b/netwerk/base/src/nsStreamTransportService.h
@@ -2,20 +2,21 @@
  * 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 "nsIStreamTransportService.h"
 #include "nsIEventTarget.h"
 #include "nsIThreadPool.h"
 #include "nsIObserver.h"
 #include "nsCOMPtr.h"
+#include "mozilla/Attributes.h"
 
-class nsStreamTransportService : public nsIStreamTransportService
-                               , public nsIEventTarget 
-                               , public nsIObserver
+class nsStreamTransportService MOZ_FINAL : public nsIStreamTransportService
+                                         , public nsIEventTarget
+                                         , public nsIObserver
 {
 public:
     NS_DECL_ISUPPORTS
     NS_DECL_NSISTREAMTRANSPORTSERVICE
     NS_DECL_NSIEVENTTARGET
     NS_DECL_NSIOBSERVER
 
     nsresult Init();
--- a/netwerk/base/src/nsSyncStreamListener.h
+++ b/netwerk/base/src/nsSyncStreamListener.h
@@ -5,21 +5,22 @@
 #ifndef nsSyncStreamListener_h__
 #define nsSyncStreamListener_h__
 
 #include "nsISyncStreamListener.h"
 #include "nsIInputStream.h"
 #include "nsIOutputStream.h"
 #include "nsThreadUtils.h"
 #include "nsCOMPtr.h"
+#include "mozilla/Attributes.h"
 
 //-----------------------------------------------------------------------------
 
-class nsSyncStreamListener : public nsISyncStreamListener
-                           , public nsIInputStream
+class nsSyncStreamListener MOZ_FINAL : public nsISyncStreamListener
+                                     , public nsIInputStream
 {
 public:
     NS_DECL_ISUPPORTS
     NS_DECL_NSIREQUESTOBSERVER
     NS_DECL_NSISTREAMLISTENER
     NS_DECL_NSISYNCSTREAMLISTENER
     NS_DECL_NSIINPUTSTREAM
 
--- a/netwerk/base/src/nsURLParsers.cpp
+++ b/netwerk/base/src/nsURLParsers.cpp
@@ -30,17 +30,18 @@ CountConsecutiveSlashes(const char *str,
 
 //----------------------------------------------------------------------------
 // nsBaseURLParser implementation
 //----------------------------------------------------------------------------
 
 // The URL parser service does not have any internal state; however, it can
 // be called from multiple threads, so we must use a threadsafe AddRef and
 // Release implementation.
-NS_IMPL_THREADSAFE_ISUPPORTS1(nsBaseURLParser, nsIURLParser)
+NS_IMPL_THREADSAFE_ISUPPORTS1(nsAuthURLParser, nsIURLParser)
+NS_IMPL_THREADSAFE_ISUPPORTS1(nsNoAuthURLParser, nsIURLParser)
 
 #define SET_RESULT(component, pos, len) \
     PR_BEGIN_MACRO \
         if (component ## Pos) \
            *component ## Pos = PRUint32(pos); \
         if (component ## Len) \
            *component ## Len = PRInt32(len); \
     PR_END_MACRO
--- a/netwerk/base/src/nsURLParsers.h
+++ b/netwerk/base/src/nsURLParsers.h
@@ -2,25 +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 nsURLParsers_h__
 #define nsURLParsers_h__
 
 #include "nsIURLParser.h"
+#include "mozilla/Attributes.h"
 
 //----------------------------------------------------------------------------
 // base class for url parsers
 //----------------------------------------------------------------------------
 
 class nsBaseURLParser : public nsIURLParser
 {
 public:
-    NS_DECL_ISUPPORTS
     NS_DECL_NSIURLPARSER
 
     nsBaseURLParser() { }
 
 protected:
     // implemented by subclasses
     virtual void ParseAfterScheme(const char *spec, PRInt32 specLen,
                                   PRUint32 *authPos, PRInt32 *authLen,
@@ -35,19 +35,21 @@ protected:
 //     file:///foo/bar.txt
 //
 // eg. file:////foo/bar.txt   (UNC-filepath = \\foo\bar.txt)
 //
 // XXX except in this case:
 //     file://foo/bar.txt     (the authority "foo"  is ignored)
 //----------------------------------------------------------------------------
 
-class nsNoAuthURLParser : public nsBaseURLParser
+class nsNoAuthURLParser MOZ_FINAL : public nsBaseURLParser
 {
-public: 
+public:
+    NS_DECL_ISUPPORTS
+
 #if defined(XP_WIN) || defined(XP_OS2)
     NS_IMETHOD ParseFilePath(const char *, PRInt32,
                              PRUint32 *, PRInt32 *,
                              PRUint32 *, PRInt32 *,
                              PRUint32 *, PRInt32 *);
 #endif
 
     NS_IMETHOD ParseAuthority(const char *auth, PRInt32 authLen,
@@ -67,17 +69,21 @@ public:
 // eg. http:www.foo.com/bar.html
 //     http:/www.foo.com/bar.html
 //     http://www.foo.com/bar.html    (treated equivalently)
 //     http:///www.foo.com/bar.html
 //----------------------------------------------------------------------------
 
 class nsAuthURLParser : public nsBaseURLParser
 {
-public: 
+public:
+    NS_DECL_ISUPPORTS
+
+    virtual ~nsAuthURLParser() {}
+
     NS_IMETHOD ParseAuthority(const char *auth, PRInt32 authLen,
                               PRUint32 *usernamePos, PRInt32 *usernameLen,
                               PRUint32 *passwordPos, PRInt32 *passwordLen,
                               PRUint32 *hostnamePos, PRInt32 *hostnameLen,
                               PRInt32 *port);
 
     NS_IMETHOD ParseUserInfo(const char *userinfo, PRInt32 userinfoLen,
                              PRUint32 *usernamePos, PRInt32 *usernameLen,
--- a/netwerk/cache/nsApplicationCacheService.h
+++ b/netwerk/cache/nsApplicationCacheService.h
@@ -1,16 +1,18 @@
 /* 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 _nsApplicationCacheService_h_
 #define _nsApplicationCacheService_h_
 
-class nsApplicationCacheService : public nsIApplicationCacheService
+#include "mozilla/Attributes.h"
+
+class nsApplicationCacheService MOZ_FINAL : public nsIApplicationCacheService
 {
 public:
     nsApplicationCacheService();
 
     NS_DECL_ISUPPORTS
     NS_DECL_NSIAPPLICATIONCACHESERVICE
 private:
     nsRefPtr<nsCacheService> mCacheService;
--- a/netwerk/cache/nsCacheService.cpp
+++ b/netwerk/cache/nsCacheService.cpp
@@ -1,15 +1,16 @@
 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /* vim: set sw=4 ts=8 et tw=80 : */
 /* 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/Util.h"
+#include "mozilla/Attributes.h"
 
 #include "necko-config.h"
 
 #include "nsCache.h"
 #include "nsCacheService.h"
 #include "nsCacheRequest.h"
 #include "nsCacheEntry.h"
 #include "nsCacheEntryDescriptor.h"
@@ -28,17 +29,16 @@
 #include "nsDirectoryServiceDefs.h"
 #include "nsAppDirectoryServiceDefs.h"
 #include "nsThreadUtils.h"
 #include "nsProxyRelease.h"
 #include "nsVoidArray.h"
 #include "nsDeleteDir.h"
 #include "nsNetCID.h"
 #include <math.h>  // for log()
-#include "mozilla/Util.h" // for DebugOnly
 #include "mozilla/Services.h"
 #include "mozilla/Telemetry.h"
 #include "nsITimer.h"
 
 #include "mozilla/FunctionTimer.h"
 
 #include "mozilla/net/NeckoCommon.h"
 
@@ -179,17 +179,17 @@ private:
     PRInt32                 mCacheCompressionLevel;
 
     bool                    mSanitizeOnShutdown;
     bool                    mClearCacheOnShutdown;
 };
 
 NS_IMPL_THREADSAFE_ISUPPORTS1(nsCacheProfilePrefObserver, nsIObserver)
 
-class nsSetDiskSmartSizeCallback : public nsITimerCallback
+class nsSetDiskSmartSizeCallback MOZ_FINAL : public nsITimerCallback
 {
 public:
     NS_DECL_ISUPPORTS
 
     NS_IMETHOD Notify(nsITimer* aTimer) {
         if (nsCacheService::gService) {
             nsCacheServiceAutoLock autoLock;
             nsCacheService::gService->SetDiskSmartSize_Locked();
--- a/netwerk/cache/nsDiskCacheDeviceSQL.cpp
+++ b/netwerk/cache/nsDiskCacheDeviceSQL.cpp
@@ -1,14 +1,15 @@
 /* vim:set ts=2 sw=2 sts=2 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/Util.h"
+#include "mozilla/Attributes.h"
 
 #include "nsCache.h"
 #include "nsDiskCache.h"
 #include "nsDiskCacheDeviceSQL.h"
 #include "nsCacheService.h"
 #include "nsApplicationCache.h"
 
 #include "nsNetCID.h"
@@ -218,17 +219,17 @@ nsOfflineCacheEvictionFunction::Apply()
 
   Reset();
 }
 
 /******************************************************************************
  * nsOfflineCacheDeviceInfo
  */
 
-class nsOfflineCacheDeviceInfo : public nsICacheDeviceInfo
+class nsOfflineCacheDeviceInfo MOZ_FINAL : public nsICacheDeviceInfo
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSICACHEDEVICEINFO
 
   nsOfflineCacheDeviceInfo(nsOfflineCacheDevice* device)
     : mDevice(device)
   {}
@@ -294,17 +295,17 @@ nsOfflineCacheDeviceInfo::GetMaximumSize
   *aMaximumSize = mDevice->CacheCapacity();
   return NS_OK;
 }
 
 /******************************************************************************
  * nsOfflineCacheBinding
  */
 
-class nsOfflineCacheBinding : public nsISupports
+class nsOfflineCacheBinding MOZ_FINAL : public nsISupports
 {
 public:
   NS_DECL_ISUPPORTS
 
   static nsOfflineCacheBinding *
       Create(nsIFile *cacheDir, const nsCString *key, int generation);
 
   nsCOMPtr<nsIFile> mDataFile;
@@ -443,17 +444,17 @@ CreateCacheEntry(nsOfflineCacheDevice *d
   return entry;
 }
 
 
 /******************************************************************************
  * nsOfflineCacheEntryInfo
  */
 
-class nsOfflineCacheEntryInfo : public nsICacheEntryInfo
+class nsOfflineCacheEntryInfo MOZ_FINAL : public nsICacheEntryInfo
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSICACHEENTRYINFO
 
   nsOfflineCacheRecord *mRec;
 };
 
--- a/netwerk/cache/nsDiskCacheDeviceSQL.h
+++ b/netwerk/cache/nsDiskCacheDeviceSQL.h
@@ -14,35 +14,36 @@
 #include "mozIStorageFunction.h"
 #include "nsIFile.h"
 #include "nsAutoPtr.h"
 #include "nsCOMPtr.h"
 #include "nsCOMArray.h"
 #include "nsInterfaceHashtable.h"
 #include "nsClassHashtable.h"
 #include "nsWeakReference.h"
+#include "mozilla/Attributes.h"
 
 class nsIURI;
 class nsOfflineCacheDevice;
 
-class nsApplicationCacheNamespace : public nsIApplicationCacheNamespace
+class nsApplicationCacheNamespace MOZ_FINAL : public nsIApplicationCacheNamespace
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIAPPLICATIONCACHENAMESPACE
 
   nsApplicationCacheNamespace() : mItemType(0) {}
 
 private:
   PRUint32 mItemType;
   nsCString mNamespaceSpec;
   nsCString mData;
 };
 
-class nsOfflineCacheEvictionFunction : public mozIStorageFunction {
+class nsOfflineCacheEvictionFunction MOZ_FINAL : public mozIStorageFunction {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_MOZISTORAGEFUNCTION
 
   nsOfflineCacheEvictionFunction(nsOfflineCacheDevice *device)
     : mDevice(device)
   {}
 
--- a/netwerk/cookie/nsCookieService.cpp
+++ b/netwerk/cookie/nsCookieService.cpp
@@ -42,16 +42,17 @@
 #include "nsNetUtil.h"
 #include "nsNetCID.h"
 #include "nsAppDirectoryServiceDefs.h"
 #include "nsIPrivateBrowsingService.h"
 #include "nsNetCID.h"
 #include "mozilla/storage.h"
 #include "mozilla/FunctionTimer.h"
 #include "mozilla/Util.h" // for DebugOnly
+#include "mozilla/Attributes.h"
 
 using namespace mozilla;
 using namespace mozilla::net;
 
 /******************************************************************************
  * nsCookieService impl:
  * useful types & constants
  ******************************************************************************/
@@ -320,18 +321,16 @@ LogSuccess(bool aSetCookie, nsIURI *aHos
 class DBListenerErrorHandler : public mozIStorageStatementCallback
 {
 protected:
   DBListenerErrorHandler(DBState* dbState) : mDBState(dbState) { }
   nsRefPtr<DBState> mDBState;
   virtual const char *GetOpType() = 0;
 
 public:
-  NS_DECL_ISUPPORTS
-
   NS_IMETHOD HandleError(mozIStorageError* aError)
   {
     PRInt32 result = -1;
     aError->GetResult(&result);
 
 #ifdef PR_LOGGING
     nsCAutoString message;
     aError->GetMessage(message);
@@ -343,28 +342,28 @@ public:
 
     // Rebuild the database.
     gCookieService->HandleCorruptDB(mDBState);
 
     return NS_OK;
   }
 };
 
-NS_IMPL_ISUPPORTS1(DBListenerErrorHandler, mozIStorageStatementCallback)
-
 /******************************************************************************
  * InsertCookieDBListener impl:
  * mozIStorageStatementCallback used to track asynchronous insertion operations.
  ******************************************************************************/
-class InsertCookieDBListener : public DBListenerErrorHandler
+class InsertCookieDBListener MOZ_FINAL : public DBListenerErrorHandler
 {
 protected:
   virtual const char *GetOpType() { return "INSERT"; }
 
 public:
+  NS_DECL_ISUPPORTS
+
   InsertCookieDBListener(DBState* dbState) : DBListenerErrorHandler(dbState) { }
   NS_IMETHOD HandleResult(mozIStorageResultSet*)
   {
     NS_NOTREACHED("Unexpected call to InsertCookieDBListener::HandleResult");
     return NS_OK;
   }
   NS_IMETHOD HandleCompletion(PRUint16 aReason)
   {
@@ -375,71 +374,83 @@ public:
       COOKIE_LOGSTRING(PR_LOG_DEBUG,
         ("InsertCookieDBListener::HandleCompletion(): rebuild complete"));
       mDBState->corruptFlag = DBState::OK;
     }
     return NS_OK;
   }
 };
 
+NS_IMPL_ISUPPORTS1(InsertCookieDBListener, mozIStorageStatementCallback)
+
 /******************************************************************************
  * UpdateCookieDBListener impl:
  * mozIStorageStatementCallback used to track asynchronous update operations.
  ******************************************************************************/
-class UpdateCookieDBListener : public DBListenerErrorHandler
+class UpdateCookieDBListener MOZ_FINAL : public DBListenerErrorHandler
 {
 protected:
   virtual const char *GetOpType() { return "UPDATE"; }
 
 public:
+  NS_DECL_ISUPPORTS
+
   UpdateCookieDBListener(DBState* dbState) : DBListenerErrorHandler(dbState) { }
   NS_IMETHOD HandleResult(mozIStorageResultSet*)
   {
     NS_NOTREACHED("Unexpected call to UpdateCookieDBListener::HandleResult");
     return NS_OK;
   }
   NS_IMETHOD HandleCompletion(PRUint16 aReason)
   {
     return NS_OK;
   }
 };
 
+NS_IMPL_ISUPPORTS1(UpdateCookieDBListener, mozIStorageStatementCallback)
+
 /******************************************************************************
  * RemoveCookieDBListener impl:
  * mozIStorageStatementCallback used to track asynchronous removal operations.
  ******************************************************************************/
-class RemoveCookieDBListener :  public DBListenerErrorHandler
+class RemoveCookieDBListener MOZ_FINAL : public DBListenerErrorHandler
 {
 protected:
   virtual const char *GetOpType() { return "REMOVE"; }
 
 public:
+  NS_DECL_ISUPPORTS
+
   RemoveCookieDBListener(DBState* dbState) : DBListenerErrorHandler(dbState) { }
   NS_IMETHOD HandleResult(mozIStorageResultSet*)
   {
     NS_NOTREACHED("Unexpected call to RemoveCookieDBListener::HandleResult");
     return NS_OK;
   }
   NS_IMETHOD HandleCompletion(PRUint16 aReason)
   {
     return NS_OK;
   }
 };
 
+NS_IMPL_ISUPPORTS1(RemoveCookieDBListener, mozIStorageStatementCallback)
+
 /******************************************************************************
  * ReadCookieDBListener impl:
  * mozIStorageStatementCallback used to track asynchronous removal operations.
  ******************************************************************************/
-class ReadCookieDBListener :  public DBListenerErrorHandler
+class ReadCookieDBListener MOZ_FINAL : public DBListenerErrorHandler
 {
 protected:
   virtual const char *GetOpType() { return "READ"; }
   bool mCanceled;
 
 public:
+  NS_DECL_ISUPPORTS
+
   ReadCookieDBListener(DBState* dbState)
     : DBListenerErrorHandler(dbState)
     , mCanceled(false)
   {
   }
 
   void Cancel() { mCanceled = true; }
 
@@ -493,22 +504,24 @@ public:
       break;
     default:
       NS_NOTREACHED("invalid reason");
     }
     return NS_OK;
   }
 };
 
+NS_IMPL_ISUPPORTS1(ReadCookieDBListener, mozIStorageStatementCallback)
+
 /******************************************************************************
  * CloseCookieDBListener imp:
  * Static mozIStorageCompletionCallback used to notify when the database is
  * successfully closed.
  ******************************************************************************/
-class CloseCookieDBListener :  public mozIStorageCompletionCallback
+class CloseCookieDBListener MOZ_FINAL :  public mozIStorageCompletionCallback
 {
 public:
   CloseCookieDBListener(DBState* dbState) : mDBState(dbState) { }
   nsRefPtr<DBState> mDBState;
   NS_DECL_ISUPPORTS
 
   NS_IMETHOD Complete()
   {
--- a/netwerk/dns/nsDNSService2.cpp
+++ b/netwerk/dns/nsDNSService2.cpp
@@ -23,16 +23,17 @@
 #include "prnetdb.h"
 #include "prmon.h"
 #include "prio.h"
 #include "plstr.h"
 #include "nsIOService.h"
 #include "nsCharSeparatedTokenizer.h"
 
 #include "mozilla/FunctionTimer.h"
+#include "mozilla/Attributes.h"
 
 using namespace mozilla;
 
 static const char kPrefDnsCacheEntries[]    = "network.dnsCacheEntries";
 static const char kPrefDnsCacheExpiration[] = "network.dnsCacheExpiration";
 static const char kPrefDnsCacheGrace[]      = "network.dnsCacheExpirationGracePeriod";
 static const char kPrefEnableIDN[]          = "network.enableIDN";
 static const char kPrefIPv4OnlyDomains[]    = "network.dns.ipv4OnlyDomains";
@@ -224,18 +225,18 @@ nsDNSRecord::ReportUnusable(PRUint16 aPo
     }
     
     mHostRecord->addr_info_lock.Unlock();
     return NS_OK;
 }
 
 //-----------------------------------------------------------------------------
 
-class nsDNSAsyncRequest : public nsResolveHostCallback
-                        , public nsICancelable
+class nsDNSAsyncRequest MOZ_FINAL : public nsResolveHostCallback
+                                  , public nsICancelable
 {
 public:
     NS_DECL_ISUPPORTS
     NS_DECL_NSICANCELABLE
 
     nsDNSAsyncRequest(nsHostResolver   *res,
                       const nsACString &host,
                       nsIDNSListener   *listener,
@@ -478,17 +479,17 @@ nsDNSService::Shutdown()
     }
     if (res)
         res->Shutdown();
     return NS_OK;
 }
 
 namespace {
 
-class DNSListenerProxy : public nsIDNSListener
+class DNSListenerProxy MOZ_FINAL : public nsIDNSListener
 {
 public:
   DNSListenerProxy(nsIDNSListener* aListener, nsIEventTarget* aTargetThread)
     : mListener(aListener)
     , mTargetThread(aTargetThread)
   { }
 
   ~DNSListenerProxy()
--- a/netwerk/dns/nsDNSService2.h
+++ b/netwerk/dns/nsDNSService2.h
@@ -6,19 +6,20 @@
 #include "nsIIDNService.h"
 #include "nsIObserver.h"
 #include "nsHostResolver.h"
 #include "nsAutoPtr.h"
 #include "nsString.h"
 #include "nsTHashtable.h"
 #include "nsHashKeys.h"
 #include "mozilla/Mutex.h"
+#include "mozilla/Attributes.h"
 
-class nsDNSService : public nsPIDNSService
-                   , public nsIObserver
+class nsDNSService MOZ_FINAL : public nsPIDNSService
+                             , public nsIObserver
 {
 public:
     NS_DECL_ISUPPORTS
     NS_DECL_NSPIDNSSERVICE
     NS_DECL_NSIDNSSERVICE
     NS_DECL_NSIOBSERVER
 
     nsDNSService();
--- a/netwerk/dns/nsEffectiveTLDService.h
+++ b/netwerk/dns/nsEffectiveTLDService.h
@@ -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/. */
 
 #include "nsIEffectiveTLDService.h"
 
 #include "nsTHashtable.h"
 #include "nsString.h"
 #include "nsCOMPtr.h"
+#include "mozilla/Attributes.h"
 
 class nsIIDNService;
 
 // struct for static data generated from effective_tld_names.dat
 struct ETLDEntry {
   const char* domain;
   bool exception;
   bool wild;
@@ -71,17 +72,17 @@ public:
   bool IsNormal() { return mData->wild || !mData->exception; }
   bool IsException() { return mData->exception; }
   bool IsWild() { return mData->wild; }
 
 private:
   const ETLDEntry* mData;
 };
 
-class nsEffectiveTLDService : public nsIEffectiveTLDService
+class nsEffectiveTLDService MOZ_FINAL : public nsIEffectiveTLDService
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIEFFECTIVETLDSERVICE
 
   nsEffectiveTLDService() { }
   nsresult Init();
 
--- a/netwerk/protocol/about/nsAboutProtocolHandler.h
+++ b/netwerk/protocol/about/nsAboutProtocolHandler.h
@@ -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/. */
 
 #ifndef nsAboutProtocolHandler_h___
 #define nsAboutProtocolHandler_h___
 
 #include "nsIProtocolHandler.h"
 #include "nsSimpleNestedURI.h"
+#include "mozilla/Attributes.h"
 
 class nsCString;
 class nsIAboutModule;
 
 class nsAboutProtocolHandler : public nsIProtocolHandler
 {
 public:
     NS_DECL_ISUPPORTS
@@ -20,17 +21,17 @@ public:
     // nsIProtocolHandler methods:
     NS_DECL_NSIPROTOCOLHANDLER
 
     // nsAboutProtocolHandler methods:
     nsAboutProtocolHandler() {}
     virtual ~nsAboutProtocolHandler() {}
 };
 
-class nsSafeAboutProtocolHandler : public nsIProtocolHandler
+class nsSafeAboutProtocolHandler MOZ_FINAL : public nsIProtocolHandler
 {
 public:
     NS_DECL_ISUPPORTS
 
     // nsIProtocolHandler methods:
     NS_DECL_NSIPROTOCOLHANDLER
 
     // nsSafeAboutProtocolHandler methods:
--- a/netwerk/protocol/device/nsDeviceProtocolHandler.h
+++ b/netwerk/protocol/device/nsDeviceProtocolHandler.h
@@ -3,23 +3,24 @@
  * 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 nsDeviceProtocolHandler_h_
 #define nsDeviceProtocolHandler_h_
 
 #include "nsIProtocolHandler.h"
 #include "nsString.h"
+#include "mozilla/Attributes.h"
 
 // {6b0ffe9e-d114-486b-aeb7-da62e7273ed5}
 #define NS_DEVICEPROTOCOLHANDLER_CID                      \
 { 0x60ffe9e, 0xd114, 0x486b,                              \
     {0xae, 0xb7, 0xda, 0x62, 0xe7, 0x27, 0x3e, 0xd5} }
 
-class nsDeviceProtocolHandler : public nsIProtocolHandler {
+class nsDeviceProtocolHandler MOZ_FINAL : public nsIProtocolHandler {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIPROTOCOLHANDLER
 
   nsDeviceProtocolHandler() {}
   ~nsDeviceProtocolHandler() {}
 
   nsresult Init();
--- a/netwerk/protocol/ftp/nsFTPChannel.cpp
+++ b/netwerk/protocol/ftp/nsFTPChannel.cpp
@@ -13,16 +13,17 @@
 #include "nsNetUtil.h"
 #include "nsMimeTypes.h"
 #include "nsReadableUtils.h"
 #include "nsIPrefService.h"
 #include "nsIPrefBranch.h"
 #include "nsIStreamConverterService.h"
 #include "nsISocketTransport.h"
 #include "nsURLHelper.h"
+#include "mozilla/Attributes.h"
 
 #if defined(PR_LOGGING)
 extern PRLogModuleInfo* gFTPLog;
 #endif /* PR_LOGGING */
 
 ////////////// this needs to move to nspr
 static inline PRUint32
 PRTimeToSeconds(PRTime t_usec)
@@ -145,17 +146,17 @@ nsFtpChannel::OnCallbacksChanged()
 {
     mFTPEventSink = nsnull;
 }
 
 //-----------------------------------------------------------------------------
 
 namespace {
 
-class FTPEventSinkProxy : public nsIFTPEventSink
+class FTPEventSinkProxy MOZ_FINAL : public nsIFTPEventSink
 {
 public:
     FTPEventSinkProxy(nsIFTPEventSink* aTarget)
         : mTarget(aTarget)
         , mTargetThread(do_GetCurrentThread())
     { }
         
     NS_DECL_ISUPPORTS
--- a/netwerk/protocol/ftp/nsFtpControlConnection.h
+++ b/netwerk/protocol/ftp/nsFtpControlConnection.h
@@ -12,16 +12,17 @@
 #include "nsIURI.h"
 #include "nsIStreamListener.h"
 #include "nsIRequest.h"
 #include "nsISocketTransport.h"
 #include "nsIOutputStream.h"
 #include "nsIAsyncInputStream.h"
 #include "nsAutoPtr.h"
 #include "nsString.h"
+#include "mozilla/Attributes.h"
 
 class nsIProxyInfo;
 class nsITransportEventSink;
 
 class nsFtpControlConnectionListener : public nsISupports {
 public:
     /**
      * Called when a chunk of data arrives on the control connection.
@@ -35,17 +36,17 @@ public:
     /**
      * Called when an error occurs on the control connection.
      * @param status
      *        A failure code providing more info about the error.
      */
     virtual void OnControlError(nsresult status) = 0;
 };
 
-class nsFtpControlConnection : public nsIInputStreamCallback
+class nsFtpControlConnection MOZ_FINAL : public nsIInputStreamCallback
 {
 public:
     NS_DECL_ISUPPORTS
     NS_DECL_NSIINPUTSTREAMCALLBACK
 
     nsFtpControlConnection(const nsCSubstring& host, PRUint32 port);
     ~nsFtpControlConnection();
 
--- a/netwerk/protocol/http/NullHttpTransaction.h
+++ b/netwerk/protocol/http/NullHttpTransaction.h
@@ -8,25 +8,26 @@
 #define mozilla_net_NullHttpTransaction_h
 
 #include "nsAHttpTransaction.h"
 #include "nsAHttpConnection.h"
 #include "nsIInterfaceRequestor.h"
 #include "nsIEventTarget.h"
 #include "nsHttpConnectionInfo.h"
 #include "nsHttpRequestHead.h"
+#include "mozilla/Attributes.h"
 
 // This is the minimal nsAHttpTransaction implementation. A NullHttpTransaction
 // can be used to drive connection level semantics (such as SSL handshakes
 // tunnels) so that a nsHttpConnection becomes fully established in
 // anticiation of a real transaction needing to use it soon.
 
 namespace mozilla { namespace net {
 
-class NullHttpTransaction : public nsAHttpTransaction
+class NullHttpTransaction MOZ_FINAL : public nsAHttpTransaction
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSAHTTPTRANSACTION
 
   NullHttpTransaction(nsHttpConnectionInfo *ci,
                       nsIInterfaceRequestor *callbacks,
                       nsIEventTarget *target,
--- a/netwerk/protocol/http/SpdySession2.h
+++ b/netwerk/protocol/http/SpdySession2.h
@@ -11,28 +11,29 @@
 // http://www.chromium.org/spdy/spdy-protocol/spdy-protocol-draft2
 
 #include "ASpdySession.h"
 #include "nsClassHashtable.h"
 #include "nsDataHashtable.h"
 #include "nsDeque.h"
 #include "nsHashKeys.h"
 #include "zlib.h"
+#include "mozilla/Attributes.h"
 
 class nsHttpConnection;
 class nsISocketTransport;
 
 namespace mozilla { namespace net {
 
 class SpdyStream2;
 
-class SpdySession2 : public ASpdySession
-                   , public nsAHttpConnection
-                   , public nsAHttpSegmentReader
-                   , public nsAHttpSegmentWriter
+class SpdySession2 MOZ_FINAL : public ASpdySession
+                             , public nsAHttpConnection
+                             , public nsAHttpSegmentReader
+                             , public nsAHttpSegmentWriter
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSAHTTPTRANSACTION
   NS_DECL_NSAHTTPCONNECTION(mConnection)
   NS_DECL_NSAHTTPSEGMENTREADER
   NS_DECL_NSAHTTPSEGMENTWRITER
 
--- a/netwerk/protocol/http/SpdySession3.h
+++ b/netwerk/protocol/http/SpdySession3.h
@@ -10,28 +10,29 @@
 // http://dev.chromium.org/spdy/spdy-protocol/spdy-protocol-draft3
 
 #include "ASpdySession.h"
 #include "nsClassHashtable.h"
 #include "nsDataHashtable.h"
 #include "nsDeque.h"
 #include "nsHashKeys.h"
 #include "zlib.h"
+#include "mozilla/Attributes.h"
 
 class nsHttpConnection;
 class nsISocketTransport;
 
 namespace mozilla { namespace net {
 
 class SpdyStream3;
 
-class SpdySession3 : public ASpdySession
-                   , public nsAHttpConnection
-                   , public nsAHttpSegmentReader
-                   , public nsAHttpSegmentWriter
+class SpdySession3 MOZ_FINAL : public ASpdySession
+                             , public nsAHttpConnection
+                             , public nsAHttpSegmentReader
+                             , public nsAHttpSegmentWriter
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSAHTTPTRANSACTION
   NS_DECL_NSAHTTPCONNECTION(mConnection)
   NS_DECL_NSAHTTPSEGMENTREADER
   NS_DECL_NSAHTTPSEGMENTWRITER
 
--- a/netwerk/protocol/http/SpdyStream2.h
+++ b/netwerk/protocol/http/SpdyStream2.h
@@ -3,21 +3,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/. */
 
 #ifndef mozilla_net_SpdyStream2_h
 #define mozilla_net_SpdyStream2_h
 
 #include "nsAHttpTransaction.h"
+#include "mozilla/Attributes.h"
 
 namespace mozilla { namespace net {
 
-class SpdyStream2 : public nsAHttpSegmentReader
-                  , public nsAHttpSegmentWriter
+class SpdyStream2 MOZ_FINAL : public nsAHttpSegmentReader
+                            , public nsAHttpSegmentWriter
 {
 public:
   NS_DECL_NSAHTTPSEGMENTREADER
   NS_DECL_NSAHTTPSEGMENTWRITER
 
   SpdyStream2(nsAHttpTransaction *,
              SpdySession2 *, nsISocketTransport *,
              PRUint32, z_stream *, PRInt32);
--- a/netwerk/protocol/http/SpdyStream3.h
+++ b/netwerk/protocol/http/SpdyStream3.h
@@ -2,21 +2,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/. */
 
 #ifndef mozilla_net_SpdyStream3_h
 #define mozilla_net_SpdyStream3_h
 
 #include "nsAHttpTransaction.h"
+#include "mozilla/Attributes.h"
 
 namespace mozilla { namespace net {
 
-class SpdyStream3 : public nsAHttpSegmentReader
-                  , public nsAHttpSegmentWriter
+class SpdyStream3 MOZ_FINAL : public nsAHttpSegmentReader
+                            , public nsAHttpSegmentWriter
 {
 public:
   NS_DECL_NSAHTTPSEGMENTREADER
   NS_DECL_NSAHTTPSEGMENTWRITER
 
   SpdyStream3(nsAHttpTransaction *,
              SpdySession3 *, nsISocketTransport *,
              PRUint32, z_stream *, PRInt32);
--- a/netwerk/protocol/http/nsHttpChannel.cpp
+++ b/netwerk/protocol/http/nsHttpChannel.cpp
@@ -28,16 +28,17 @@
 #include "nsIRedirectResultListener.h"
 #include "mozilla/TimeStamp.h"
 #include "nsDOMError.h"
 #include "nsAlgorithm.h"
 #include "sampler.h"
 #include "nsIConsoleService.h"
 #include "base/compiler_specific.h"
 #include "NullHttpTransaction.h"
+#include "mozilla/Attributes.h"
 
 namespace mozilla { namespace net {
  
 namespace {
 
 // Device IDs for various cache types
 const char kDiskDeviceID[] = "disk";
 const char kMemoryDeviceID[] = "memory";
@@ -5189,18 +5190,18 @@ nsHttpChannel::GetOfflineCacheToken(nsIS
 }
 
 NS_IMETHODIMP
 nsHttpChannel::SetOfflineCacheToken(nsISupports *token)
 {
     return NS_ERROR_NOT_IMPLEMENTED;
 }
 
-class nsHttpChannelCacheKey : public nsISupportsPRUint32,
-                              public nsISupportsCString
+class nsHttpChannelCacheKey MOZ_FINAL : public nsISupportsPRUint32,
+                                        public nsISupportsCString
 {
     NS_DECL_ISUPPORTS
 
     NS_DECL_NSISUPPORTSPRIMITIVE
     NS_FORWARD_NSISUPPORTSPRUINT32(mSupportsPRUint32->)
     
     // Both interfaces declares toString method with the same signature.
     // Thus we have to delegate only to nsISupportsPRUint32 implementation.
--- a/netwerk/protocol/http/nsHttpConnectionMgr.h
+++ b/netwerk/protocol/http/nsHttpConnectionMgr.h
@@ -13,16 +13,17 @@
 #include "nsTArray.h"
 #include "nsThreadUtils.h"
 #include "nsClassHashtable.h"
 #include "nsDataHashtable.h"
 #include "nsAutoPtr.h"
 #include "mozilla/ReentrantMonitor.h"
 #include "nsISocketTransportService.h"
 #include "mozilla/TimeStamp.h"
+#include "mozilla/Attributes.h"
 
 #include "nsIObserver.h"
 #include "nsITimer.h"
 #include "nsIX509Cert3.h"
 
 class nsHttpPipeline;
 
 class nsIHttpUpgradeListener;
@@ -352,20 +353,20 @@ private:
         virtual ~nsConnectionHandle();
 
         nsHttpConnection *mConn;
     };
 
     // nsHalfOpenSocket is used to hold the state of an opening TCP socket
     // while we wait for it to establish and bind it to a connection
 
-    class nsHalfOpenSocket : public nsIOutputStreamCallback,
-                             public nsITransportEventSink,
-                             public nsIInterfaceRequestor,
-                             public nsITimerCallback
+    class nsHalfOpenSocket MOZ_FINAL : public nsIOutputStreamCallback,
+                                       public nsITransportEventSink,
+                                       public nsIInterfaceRequestor,
+                                       public nsITimerCallback
     {
     public:
         NS_DECL_ISUPPORTS
         NS_DECL_NSIOUTPUTSTREAMCALLBACK
         NS_DECL_NSITRANSPORTEVENTSINK
         NS_DECL_NSIINTERFACEREQUESTOR
         NS_DECL_NSITIMERCALLBACK
 
--- a/netwerk/protocol/http/nsHttpDigestAuth.h
+++ b/netwerk/protocol/http/nsHttpDigestAuth.h
@@ -6,32 +6,33 @@
 
 #ifndef nsDigestAuth_h__
 #define nsDigestAuth_h__
 
 #include "nsIHttpAuthenticator.h"
 #include "nsICryptoHash.h"
 #include "nsString.h"
 #include "nsCOMPtr.h"
+#include "mozilla/Attributes.h"
 
 #define ALGO_SPECIFIED 0x01
 #define ALGO_MD5 0x02
 #define ALGO_MD5_SESS 0x04
 #define QOP_AUTH 0x01
 #define QOP_AUTH_INT 0x02
 
 #define DIGEST_LENGTH 16
 #define EXPANDED_DIGEST_LENGTH 32
 #define NONCE_COUNT_LENGTH 8
 
 //-----------------------------------------------------------------------------
 // nsHttpDigestAuth
 //-----------------------------------------------------------------------------
 
-class nsHttpDigestAuth : public nsIHttpAuthenticator
+class nsHttpDigestAuth MOZ_FINAL : public nsIHttpAuthenticator
 {
   public:
     NS_DECL_ISUPPORTS
     NS_DECL_NSIHTTPAUTHENTICATOR
 
     nsHttpDigestAuth();
     ~nsHttpDigestAuth();
 
--- a/netwerk/protocol/http/nsHttpNTLMAuth.cpp
+++ b/netwerk/protocol/http/nsHttpNTLMAuth.cpp
@@ -17,16 +17,17 @@
 #include "nsIPrefBranch.h"
 #include "nsIPrefService.h"
 #include "nsIServiceManager.h"
 #include "nsIHttpAuthenticableChannel.h"
 #include "nsIURI.h"
 #include "nsIX509Cert.h"
 #include "nsISSLStatus.h"
 #include "nsISSLStatusProvider.h"
+#include "mozilla/Attributes.h"
 
 static const char kAllowProxies[] = "network.automatic-ntlm-auth.allow-proxies";
 static const char kAllowNonFqdn[] = "network.automatic-ntlm-auth.allow-non-fqdn";
 static const char kTrustedURIs[]  = "network.automatic-ntlm-auth.trusted-uris";
 static const char kForceGeneric[] = "network.auth.force-generic-ntlm";
 
 // XXX MatchesBaseURI and TestPref are duplicated in nsHttpNegotiateAuth.cpp,
 // but since that file lives in a separate library we cannot directly share it.
@@ -202,17 +203,17 @@ CanUseDefaultCredentials(nsIHttpAuthenti
 
     bool isTrustedHost = (uri && TestPref(uri, kTrustedURIs));
     LOG(("Default credentials allowed for host: %d\n", isTrustedHost));
     return isTrustedHost;
 }
 
 // Dummy class for session state object.  This class doesn't hold any data.
 // Instead we use its existence as a flag.  See ChallengeReceived.
-class nsNTLMSessionState : public nsISupports
+class nsNTLMSessionState MOZ_FINAL : public nsISupports
 {
 public:
     NS_DECL_ISUPPORTS
 };
 NS_IMPL_ISUPPORTS0(nsNTLMSessionState)
 
 //-----------------------------------------------------------------------------
 
--- a/netwerk/protocol/viewsource/nsViewSourceChannel.h
+++ b/netwerk/protocol/viewsource/nsViewSourceChannel.h
@@ -14,24 +14,25 @@
 #include "nsIStreamListener.h"
 #include "nsViewSourceHandler.h"
 #include "nsNetCID.h"
 #include "nsIHttpChannel.h"
 #include "nsIHttpChannelInternal.h"
 #include "nsICachingChannel.h"
 #include "nsIApplicationCacheChannel.h"
 #include "nsIUploadChannel.h"
+#include "mozilla/Attributes.h"
 
-class nsViewSourceChannel : public nsIViewSourceChannel,
-                            public nsIStreamListener,
-                            public nsIHttpChannel,
-                            public nsIHttpChannelInternal,
-                            public nsICachingChannel,
-                            public nsIApplicationCacheChannel,
-                            public nsIUploadChannel
+class nsViewSourceChannel MOZ_FINAL : public nsIViewSourceChannel,
+                                      public nsIStreamListener,
+                                      public nsIHttpChannel,
+                                      public nsIHttpChannelInternal,
+                                      public nsICachingChannel,
+                                      public nsIApplicationCacheChannel,
+                                      public nsIUploadChannel
 {
 
 public:
     NS_DECL_ISUPPORTS
     NS_DECL_NSIREQUEST
     NS_DECL_NSICHANNEL
     NS_DECL_NSIVIEWSOURCECHANNEL
     NS_DECL_NSISTREAMLISTENER
--- a/netwerk/protocol/viewsource/nsViewSourceHandler.h
+++ b/netwerk/protocol/viewsource/nsViewSourceHandler.h
@@ -2,17 +2,18 @@
 /* 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 nsViewSourceHandler_h___
 #define nsViewSourceHandler_h___
 
 #include "nsIProtocolHandler.h"
+#include "mozilla/Attributes.h"
 
-class nsViewSourceHandler : public nsIProtocolHandler
+class nsViewSourceHandler MOZ_FINAL : public nsIProtocolHandler
 {
 public:
     NS_DECL_ISUPPORTS
     NS_DECL_NSIPROTOCOLHANDLER
 };
 
 #endif /* !defined( nsViewSourceHandler_h___ ) */
--- a/netwerk/protocol/websocket/WebSocketChannel.cpp
+++ b/netwerk/protocol/websocket/WebSocketChannel.cpp
@@ -28,16 +28,17 @@
 #include "nsXPIDLString.h"
 #include "nsCRT.h"
 #include "nsThreadUtils.h"
 #include "nsNetError.h"
 #include "nsStringStream.h"
 #include "nsAlgorithm.h"
 #include "nsProxyRelease.h"
 #include "nsNetUtil.h"
+#include "mozilla/Attributes.h"
 
 #include "plbase64.h"
 #include "prmem.h"
 #include "prnetdb.h"
 #include "prbit.h"
 #include "zlib.h"
 
 extern PRThread *gSocketThread;
@@ -75,17 +76,17 @@ NS_IMPL_THREADSAFE_ISUPPORTS11(WebSocket
  */
 
 // some helper classes
 
 //-----------------------------------------------------------------------------
 // CallOnMessageAvailable
 //-----------------------------------------------------------------------------
 
-class CallOnMessageAvailable : public nsIRunnable
+class CallOnMessageAvailable MOZ_FINAL : public nsIRunnable
 {
 public:
   NS_DECL_ISUPPORTS
 
   CallOnMessageAvailable(WebSocketChannel *aChannel,
                          nsCString        &aData,
                          PRInt32           aLen)
     : mChannel(aChannel),
@@ -109,17 +110,17 @@ private:
   PRInt32                           mLen;
 };
 NS_IMPL_THREADSAFE_ISUPPORTS1(CallOnMessageAvailable, nsIRunnable)
 
 //-----------------------------------------------------------------------------
 // CallOnStop
 //-----------------------------------------------------------------------------
 
-class CallOnStop : public nsIRunnable
+class CallOnStop MOZ_FINAL : public nsIRunnable
 {
 public:
   NS_DECL_ISUPPORTS
 
   CallOnStop(WebSocketChannel *aChannel,
              nsresult          aData)
     : mChannel(aChannel),
       mData(aData) {}
@@ -138,17 +139,17 @@ private:
   nsresult                          mData;
 };
 NS_IMPL_THREADSAFE_ISUPPORTS1(CallOnStop, nsIRunnable)
 
 //-----------------------------------------------------------------------------
 // CallOnServerClose
 //-----------------------------------------------------------------------------
 
-class CallOnServerClose : public nsIRunnable
+class CallOnServerClose MOZ_FINAL : public nsIRunnable
 {
 public:
   NS_DECL_ISUPPORTS
 
   CallOnServerClose(WebSocketChannel *aChannel,
                     PRUint16          aCode,
                     nsCString        &aReason)
     : mChannel(aChannel),
@@ -169,17 +170,17 @@ private:
   nsCString                         mReason;
 };
 NS_IMPL_THREADSAFE_ISUPPORTS1(CallOnServerClose, nsIRunnable)
 
 //-----------------------------------------------------------------------------
 // CallAcknowledge
 //-----------------------------------------------------------------------------
 
-class CallAcknowledge : public nsIRunnable
+class CallAcknowledge MOZ_FINAL : public nsIRunnable
 {
 public:
   NS_DECL_ISUPPORTS
 
   CallAcknowledge(WebSocketChannel *aChannel,
                   PRUint32          aSize)
     : mChannel(aChannel),
       mSize(aSize) {}
@@ -198,17 +199,17 @@ private:
   PRUint32                          mSize;
 };
 NS_IMPL_THREADSAFE_ISUPPORTS1(CallAcknowledge, nsIRunnable)
 
 //-----------------------------------------------------------------------------
 // CallOnTransportAvailable
 //-----------------------------------------------------------------------------
 
-class CallOnTransportAvailable : public nsIRunnable
+class CallOnTransportAvailable MOZ_FINAL : public nsIRunnable
 {
 public:
   NS_DECL_ISUPPORTS
 
   CallOnTransportAvailable(WebSocketChannel *aChannel,
                            nsISocketTransport *aTransport,
                            nsIAsyncInputStream *aSocketIn,
                            nsIAsyncOutputStream *aSocketOut)
@@ -342,17 +343,17 @@ private:
   WsMsgType                   mMsgType;
   PRUint32                    mLength;
 };
 
 //-----------------------------------------------------------------------------
 // OutboundEnqueuer
 //-----------------------------------------------------------------------------
 
-class OutboundEnqueuer : public nsIRunnable
+class OutboundEnqueuer MOZ_FINAL : public nsIRunnable
 {
 public:
   NS_DECL_ISUPPORTS
 
   OutboundEnqueuer(WebSocketChannel *aChannel, OutboundMessage *aMsg)
     : mChannel(aChannel), mMessage(aMsg) {}
 
   NS_IMETHOD Run()
--- a/netwerk/socket/nsUDPSocketProvider.h
+++ b/netwerk/socket/nsUDPSocketProvider.h
@@ -1,18 +1,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 nsUDPSocketProvider_h__
 #define nsUDPSocketProvider_h__
 
 #include "nsISocketProvider.h"
+#include "mozilla/Attributes.h"
 
-class nsUDPSocketProvider : public nsISocketProvider
+class nsUDPSocketProvider MOZ_FINAL : public nsISocketProvider
 {
 public:
     NS_DECL_ISUPPORTS
     NS_DECL_NSISOCKETPROVIDER
 
 private:
     ~nsUDPSocketProvider();
 
--- a/netwerk/streamconv/converters/nsDirIndex.h
+++ b/netwerk/streamconv/converters/nsDirIndex.h
@@ -1,19 +1,20 @@
 /* -*- 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 "nsIDirIndex.h"
 #include "nsString.h"
+#include "mozilla/Attributes.h"
 
 /* CID: {f6913e2e-1dd1-11b2-84be-f455dee342af} */
 
-class nsDirIndex : public nsIDirIndex {
+class nsDirIndex MOZ_FINAL : public nsIDirIndex {
 public:
     nsDirIndex();
     ~nsDirIndex();
 
     NS_DECL_ISUPPORTS
     NS_DECL_NSIDIRINDEX
 
 protected:
--- a/netwerk/streamconv/converters/nsMultiMixedConv.h
+++ b/netwerk/streamconv/converters/nsMultiMixedConv.h
@@ -9,35 +9,36 @@
 #include "nsIChannel.h"
 #include "nsIURI.h"
 #include "nsString.h"
 #include "nsXPIDLString.h"
 #include "nsCOMPtr.h"
 #include "nsIByteRangeRequest.h"
 #include "nsIMultiPartChannel.h"
 #include "nsAutoPtr.h"
+#include "mozilla/Attributes.h"
 
 #define NS_MULTIMIXEDCONVERTER_CID                         \
 { /* 7584CE90-5B25-11d3-A175-0050041CAF44 */         \
     0x7584ce90,                                      \
     0x5b25,                                          \
     0x11d3,                                          \
     {0xa1, 0x75, 0x0, 0x50, 0x4, 0x1c, 0xaf, 0x44}       \
 }
 
 //
 // nsPartChannel is a "dummy" channel which represents an individual part of
 // a multipart/mixed stream...
 //
 // Instances on this channel are passed out to the consumer through the
 // nsIStreamListener interface.
 //
-class nsPartChannel : public nsIChannel,
-                      public nsIByteRangeRequest,
-                      public nsIMultiPartChannel
+class nsPartChannel MOZ_FINAL : public nsIChannel,
+                                public nsIByteRangeRequest,
+                                public nsIMultiPartChannel
 {
 public:
   nsPartChannel(nsIChannel *aMultipartChannel, PRUint32 aPartID,
                 nsIStreamListener* aListener);
 
   void InitializeByteRange(PRInt64 aStart, PRInt64 aEnd);
   void SetIsLastPart() { mIsLastPart = true; }
   nsresult SendOnStartRequest(nsISupports* aContext);
--- a/netwerk/streamconv/test/TestStreamConv.cpp
+++ b/netwerk/streamconv/test/TestStreamConv.cpp
@@ -10,16 +10,17 @@
 #include "nsIStreamConverter.h"
 #include "nsICategoryManager.h"
 #include "mozilla/Module.h"
 #include "nsXULAppAPI.h"
 #include "nsIStringStream.h"
 #include "nsCOMPtr.h"
 #include "nsNetUtil.h"
 #include "nsThreadUtils.h"
+#include "mozilla/Attributes.h"
 
 #include "nspr.h"
 
 #define ASYNC_TEST // undefine this if you want to test sycnronous conversion.
 
 /////////////////////////////////
 // Event pump setup
 /////////////////////////////////
@@ -44,17 +45,17 @@ static int gKeepRunning = 0;
 // CID setup
 static NS_DEFINE_CID(kStreamConverterServiceCID, NS_STREAMCONVERTERSERVICE_CID);
 
 ////////////////////////////////////////////////////////////////////////
 // EndListener - This listener is the final one in the chain. It
 //   receives the fully converted data, although it doesn't do anything with
 //   the data.
 ////////////////////////////////////////////////////////////////////////
-class EndListener : public nsIStreamListener {
+class EndListener MOZ_FINAL : public nsIStreamListener {
 public:
     // nsISupports declaration
     NS_DECL_ISUPPORTS
 
     EndListener() {};
 
     // nsIStreamListener method
     NS_IMETHOD OnDataAvailable(nsIRequest* request, nsISupports *ctxt, nsIInputStream *inStr, 
--- a/netwerk/test/TestCallbacks.cpp
+++ b/netwerk/test/TestCallbacks.cpp
@@ -15,16 +15,17 @@
 #include "nsIServiceManager.h"
 #include "nsIStreamListener.h"
 #include "nsIInputStream.h"
 #include "nsIChannel.h"
 #include "nsIURL.h"
 #include "nsIInterfaceRequestor.h" 
 #include "nsIInterfaceRequestorUtils.h"
 #include "nsIDNSService.h" 
+#include "mozilla/Attributes.h"
 
 #include "nsISimpleEnumerator.h"
 #include "nsNetUtil.h"
 #include "nsStringAPI.h"
 
 static NS_DEFINE_CID(kIOServiceCID,              NS_IOSERVICE_CID);
 
 static bool gError = false;
@@ -37,17 +38,17 @@ static PRInt32 gKeepRunning = 0;
 class nsIEquals : public nsISupports {
 public:
     NS_DECLARE_STATIC_IID_ACCESSOR(NS_IEQUALS_IID)
     NS_IMETHOD Equals(void *aPtr, bool *_retval) = 0;
 };
 
 NS_DEFINE_STATIC_IID_ACCESSOR(nsIEquals, NS_IEQUALS_IID)
 
-class ConsumerContext : public nsIEquals {
+class ConsumerContext MOZ_FINAL : public nsIEquals {
 public:
     NS_DECL_ISUPPORTS
 
     ConsumerContext() { }
 
     NS_IMETHOD Equals(void *aPtr, bool *_retval) {
         *_retval = true;
         if (aPtr != this) *_retval = false;
--- a/netwerk/test/TestCommon.h
+++ b/netwerk/test/TestCommon.h
@@ -2,27 +2,28 @@
  * 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 TestCommon_h__
 #define TestCommon_h__
 
 #include <stdlib.h>
 #include "nsThreadUtils.h"
+#include "mozilla/Attributes.h"
 
 inline int test_common_init(int *argc, char ***argv)
 {
   return 0;
 }
 
 //-----------------------------------------------------------------------------
 
 static bool gKeepPumpingEvents = false;
 
-class nsQuitPumpingEvent : public nsIRunnable {
+class nsQuitPumpingEvent MOZ_FINAL : public nsIRunnable {
 public:
   NS_DECL_ISUPPORTS
   NS_IMETHOD Run() {
     gKeepPumpingEvents = false;
     return NS_OK;
   }
 };
 NS_IMPL_THREADSAFE_ISUPPORTS1(nsQuitPumpingEvent, nsIRunnable)
--- a/netwerk/test/TestIncrementalDownload.cpp
+++ b/netwerk/test/TestIncrementalDownload.cpp
@@ -9,21 +9,22 @@
 #include "nsNetUtil.h"
 #include "nsIIncrementalDownload.h"
 #include "nsIRequestObserver.h"
 #include "nsIProgressEventSink.h"
 #include "nsThreadUtils.h"
 #include "nsAutoPtr.h"
 #include "prprf.h"
 #include "prenv.h"
+#include "mozilla/Attributes.h"
 
 //-----------------------------------------------------------------------------
 
-class FetchObserver : public nsIRequestObserver
-                    , public nsIProgressEventSink
+class FetchObserver MOZ_FINAL : public nsIRequestObserver
+                              , public nsIProgressEventSink
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIREQUESTOBSERVER
   NS_DECL_NSIPROGRESSEVENTSINK
 };
 
 NS_IMPL_ISUPPORTS2(FetchObserver, nsIRequestObserver,
--- a/netwerk/test/TestProtocols.cpp
+++ b/netwerk/test/TestProtocols.cpp
@@ -44,16 +44,17 @@
 #include "nsIDNSService.h" 
 #include "nsIAuthPrompt.h"
 #include "nsIPrefService.h"
 #include "nsIPrefBranch.h"
 #include "nsIPropertyBag2.h"
 #include "nsIWritablePropertyBag2.h"
 #include "nsITimedChannel.h"
 #include "nsChannelProperties.h"
+#include "mozilla/Attributes.h"
 
 #include "nsISimpleEnumerator.h"
 #include "nsStringAPI.h"
 #include "nsNetUtil.h"
 #include "prlog.h"
 #include "prtime.h"
 
 namespace TestProtocols {
@@ -559,17 +560,17 @@ InputTestConsumer::OnStopRequest(nsIRequ
     QuitPumpingEvents();
   return NS_OK;
 }
 
 //-----------------------------------------------------------------------------
 // NotificationCallbacks
 //-----------------------------------------------------------------------------
 
-class NotificationCallbacks : public nsIInterfaceRequestor {
+class NotificationCallbacks MOZ_FINAL : public nsIInterfaceRequestor {
 public:
     NS_DECL_ISUPPORTS
 
     NotificationCallbacks() {
     }
 
     NS_IMETHOD GetInterface(const nsIID& iid, void* *result) {
         nsresult rv = NS_ERROR_FAILURE;
--- a/netwerk/test/TestStreamLoader.cpp
+++ b/netwerk/test/TestStreamLoader.cpp
@@ -1,23 +1,24 @@
 #include <stdio.h>
 #include "TestCommon.h"
 #include "nsNetUtil.h"
 #include "nsThreadUtils.h"
 #include "prlog.h"
+#include "mozilla/Attributes.h"
 
 #if defined(PR_LOGGING)
 //
 // set NSPR_LOG_MODULES=Test:5
 //
 static PRLogModuleInfo *gTestLog = nsnull;
 #endif
 #define LOG(args) PR_LOG(gTestLog, PR_LOG_DEBUG, args)
 
-class MyStreamLoaderObserver : public nsIStreamLoaderObserver
+class MyStreamLoaderObserver MOZ_FINAL : public nsIStreamLoaderObserver
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSISTREAMLOADEROBSERVER
 };
 
 NS_IMPL_ISUPPORTS1(MyStreamLoaderObserver, nsIStreamLoaderObserver)
 
--- a/netwerk/wifi/nsWifiAccessPoint.h
+++ b/netwerk/wifi/nsWifiAccessPoint.h
@@ -2,21 +2,22 @@
  * 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 "nsWifiMonitor.h"
 #include "nsIWifiAccessPoint.h"
 
 #include "nsString.h"
 #include "nsCOMArray.h"
+#include "mozilla/Attributes.h"
 
 #ifndef __nsWifiAccessPoint__
 #define __nsWifiAccessPoint__
 
-class nsWifiAccessPoint : public nsIWifiAccessPoint
+class nsWifiAccessPoint MOZ_FINAL : public nsIWifiAccessPoint
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIWIFIACCESSPOINT
 
   nsWifiAccessPoint();
   ~nsWifiAccessPoint();
 
--- a/netwerk/wifi/nsWifiMonitor.cpp
+++ b/netwerk/wifi/nsWifiMonitor.cpp
@@ -106,17 +106,17 @@ NS_IMETHODIMP nsWifiMonitor::StopWatchin
     mKeepGoing = false;
     mon.Notify();
     mThread = nsnull;
   }
 
   return NS_OK;
 }
 
-class nsPassErrorToWifiListeners : public nsIRunnable
+class nsPassErrorToWifiListeners MOZ_FINAL : public nsIRunnable
 {
  public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIRUNNABLE
 
   nsPassErrorToWifiListeners(nsAutoPtr<nsCOMArray<nsIWifiListener> > aListeners,
                              nsresult aResult)
   : mListeners(aListeners),
@@ -166,17 +166,17 @@ NS_IMETHODIMP nsWifiMonitor::Run()
       return NS_ERROR_OUT_OF_MEMORY;
 
     thread->Dispatch(runnable, NS_DISPATCH_SYNC);
   }
 
   return NS_OK;
 }
 
-class nsCallWifiListeners : public nsIRunnable
+class nsCallWifiListeners MOZ_FINAL : public nsIRunnable
 {
  public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIRUNNABLE
 
   nsCallWifiListeners(nsAutoPtr<nsCOMArray<nsIWifiListener> > aListeners,
                       nsAutoPtr<nsTArray<nsIWifiAccessPoint*> > aAccessPoints)
   : mListeners(aListeners),
--- a/netwerk/wifi/nsWifiMonitor.h
+++ b/netwerk/wifi/nsWifiMonitor.h
@@ -8,16 +8,17 @@
 #include "nsIThread.h"
 #include "nsIRunnable.h"
 #include "nsCOMArray.h"
 #include "nsIWifiMonitor.h"
 #include "mozilla/ReentrantMonitor.h"
 #include "prlog.h"
 #include "nsIObserver.h"
 #include "nsTArray.h"
+#include "mozilla/Attributes.h"
 
 #ifndef __nsWifiMonitor__
 #define __nsWifiMonitor__
 
 #if defined(PR_LOGGING)
 extern PRLogModuleInfo *gWifiMonitorLog;
 #endif
 #define LOG(args)     PR_LOG(gWifiMonitorLog, PR_LOG_DEBUG, args)
@@ -34,17 +35,17 @@ class nsWifiListener
     mHasSentData = false;
   }
   ~nsWifiListener() {}
 
   nsCOMPtr<nsIWifiListener> mListener;
   bool mHasSentData;
 };
 
-class nsWifiMonitor : nsIRunnable, nsIWifiMonitor, nsIObserver
+class nsWifiMonitor MOZ_FINAL : nsIRunnable, nsIWifiMonitor, nsIObserver
 {
  public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIWIFIMONITOR
   NS_DECL_NSIRUNNABLE
   NS_DECL_NSIOBSERVER
 
   nsWifiMonitor();