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 (dom parts); r=bzbarsky
authorEhsan Akhgari <ehsan@mozilla.com>
Thu, 14 Jun 2012 22:31:55 -0400
changeset 96936 01f3e0c756b0de4b0bedb4a037efab8156f2cd71
parent 96935 6c4309dce383644a06475be389dba9d2dba2eebd
child 96937 de7dcf3d03e360428c75f2e6c61348930e31f76b
push id22949
push useremorley@mozilla.com
push dateTue, 19 Jun 2012 08:15:37 +0000
treeherdermozilla-central@19bfe36cace8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbzbarsky
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 (dom parts); r=bzbarsky
dom/base/DOMRequest.h
dom/base/nsDOMClassInfo.cpp
dom/base/nsDOMScriptObjectFactory.h
dom/base/nsDOMWindowUtils.h
dom/base/nsFocusManager.h
dom/base/nsGlobalWindow.cpp
dom/base/nsGlobalWindowCommands.cpp
dom/base/nsJSEnvironment.cpp
dom/base/nsJSEnvironment.h
dom/base/nsJSTimeoutHandler.cpp
dom/base/nsPerformance.h
dom/base/nsQueryContentEventResult.h
dom/base/nsScreen.h
dom/base/nsStructuredCloneContainer.h
dom/base/nsWindowMemoryReporter.h
dom/devicestorage/nsDeviceStorage.cpp
dom/devicestorage/nsDeviceStorage.h
dom/file/FileService.h
dom/file/FileStreamWrappers.cpp
dom/file/LockedFile.h
dom/ipc/ContentChild.cpp
dom/ipc/TabChild.h
dom/media/MediaManager.h
dom/sms/src/SmsCursor.h
dom/sms/src/SmsFilter.h
dom/sms/src/SmsMessage.h
dom/sms/src/SmsRequestManager.h
dom/sms/src/android/SmsDatabaseService.h
dom/sms/src/android/SmsService.h
dom/sms/src/fallback/SmsService.h
dom/sms/src/ipc/SmsIPCService.h
dom/src/geolocation/nsGeoPosition.h
dom/src/geolocation/nsGeolocation.cpp
dom/src/geolocation/nsGeolocation.h
dom/src/storage/nsDOMStorage.h
dom/src/storage/nsDOMStoragePersistentDB.cpp
dom/system/nsDeviceSensors.cpp
dom/workers/FileReaderSyncPrivate.h
dom/workers/RuntimeService.h
dom/workers/WorkerPrivate.cpp
dom/workers/XMLHttpRequest.cpp
--- a/dom/base/DOMRequest.h
+++ b/dom/base/DOMRequest.h
@@ -6,16 +6,17 @@
 
 #ifndef mozilla_dom_domrequest_h__
 #define mozilla_dom_domrequest_h__
 
 #include "nsIDOMDOMRequest.h"
 #include "nsIDOMDOMError.h"
 #include "nsDOMEventTargetHelper.h"
 #include "nsContentUtils.h"
+#include "mozilla/Attributes.h"
 
 #include "nsCOMPtr.h"
 
 namespace mozilla {
 namespace dom {
 
 class DOMRequest : public nsDOMEventTargetHelper,
                    public nsIDOMDOMRequest
@@ -52,17 +53,17 @@ public:
 
 protected:
   void FireEvent(const nsAString& aType, bool aBubble, bool aCancelable);
 
   virtual void RootResultVal();
   virtual void UnrootResultVal();
 };
 
-class DOMRequestService : public nsIDOMRequestService
+class DOMRequestService MOZ_FINAL : public nsIDOMRequestService
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIDOMREQUESTSERVICE
 
   // Returns an owning reference! No one should call this but the factory.
   static DOMRequestService* FactoryCreate()
   {
--- a/dom/base/nsDOMClassInfo.cpp
+++ b/dom/base/nsDOMClassInfo.cpp
@@ -67,16 +67,17 @@
 #include "nsIDOMEventListener.h"
 #include "nsIDOMPopStateEvent.h"
 #include "nsIDOMHashChangeEvent.h"
 #include "nsContentUtils.h"
 #include "nsDOMWindowUtils.h"
 #include "nsIDOMGlobalPropertyInitializer.h"
 #include "mozilla/Preferences.h"
 #include "nsLocation.h"
+#include "mozilla/Attributes.h"
 
 // Window scriptable helper includes
 #include "nsIDocShell.h"
 #include "nsIDocShellTreeItem.h"
 #include "nsIDocShellTreeNode.h"
 #include "nsIScriptExternalNameSet.h"
 #include "nsJSUtils.h"
 #include "nsIInterfaceRequestor.h"
@@ -9763,17 +9764,17 @@ nsHTMLPluginObjElementSH::GetPluginInsta
 
   // We don't care if this actually starts the plugin or not, we just want to
   // try to start it now if possible.
   objlc->SyncStartPluginInstance();
 
   return objlc->GetPluginInstance(_result);
 }
 
-class nsPluginProtoChainInstallRunner : public nsIRunnable
+class nsPluginProtoChainInstallRunner MOZ_FINAL : public nsIRunnable
 {
 public:
   NS_DECL_ISUPPORTS
 
   nsPluginProtoChainInstallRunner(nsIXPConnectWrappedNative* wrapper,
                                   nsIScriptContext* scriptContext)
     : mWrapper(wrapper),
       mContext(scriptContext)
--- a/dom/base/nsDOMScriptObjectFactory.h
+++ b/dom/base/nsDOMScriptObjectFactory.h
@@ -18,19 +18,20 @@
  *                               use in OS2
  */
 
 #include "nsIDOMScriptObjectFactory.h"
 #include "nsIObserver.h"
 #include "nsIExceptionService.h"
 #include "nsIScriptRuntime.h"
 #include "nsIScriptGlobalObject.h" // for misplaced NS_STID_ macros.
+#include "mozilla/Attributes.h"
 
-class nsDOMScriptObjectFactory : public nsIDOMScriptObjectFactory,
-                                 public nsIObserver
+class nsDOMScriptObjectFactory MOZ_FINAL : public nsIDOMScriptObjectFactory,
+                                           public nsIObserver
 {
 public:
   nsDOMScriptObjectFactory();
 
   NS_DECL_ISUPPORTS
 
   // nsIObserver
   NS_DECL_NSIOBSERVER
@@ -43,14 +44,14 @@ public:
                                   nsDOMClassInfoExternalConstructorFnc aConstructorFptr,
                                   const nsIID *aProtoChainInterface,
                                   const nsIID **aInterfaces,
                                   PRUint32 aScriptableFlags,
                                   bool aHasClassInterface,
                                   const nsCID *aConstructorCID);
 };
 
-class nsDOMExceptionProvider : public nsIExceptionProvider
+class nsDOMExceptionProvider MOZ_FINAL : public nsIExceptionProvider
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIEXCEPTIONPROVIDER
 };
--- a/dom/base/nsDOMWindowUtils.h
+++ b/dom/base/nsDOMWindowUtils.h
@@ -3,22 +3,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/. */
 
 #include "nsAutoPtr.h"
 #include "nsWeakReference.h"
 
 #include "nsIDOMWindowUtils.h"
 #include "nsEvent.h"
+#include "mozilla/Attributes.h"
 
 class nsGlobalWindow;
 class nsIPresShell;
 
-class nsDOMWindowUtils : public nsIDOMWindowUtils,
-                         public nsSupportsWeakReference
+class nsDOMWindowUtils MOZ_FINAL : public nsIDOMWindowUtils,
+                                   public nsSupportsWeakReference
 {
 public:
   nsDOMWindowUtils(nsGlobalWindow *aWindow);
   ~nsDOMWindowUtils();
   NS_DECL_ISUPPORTS
   NS_DECL_NSIDOMWINDOWUTILS
 
 protected:
--- a/dom/base/nsFocusManager.h
+++ b/dom/base/nsFocusManager.h
@@ -6,16 +6,17 @@
 #ifndef nsFocusManager_h___
 #define nsFocusManager_h___
 
 #include "nsIFocusManager.h"
 #include "nsWeakReference.h"
 #include "nsIObserver.h"
 #include "nsIContent.h"
 #include "nsIWidget.h"
+#include "mozilla/Attributes.h"
 
 #define FOCUSMETHOD_MASK 0xF000
 #define FOCUSMETHODANDRING_MASK 0xF0F000
 
 #define FOCUSMANAGER_CONTRACTID "@mozilla.org/focus-manager;1"
 
 class nsIDocShellTreeItem;
 class nsPIDOMWindow;
@@ -28,19 +29,19 @@ namespace dom {
 
 struct nsDelayedBlurOrFocusEvent;
 
 /**
  * The focus manager keeps track of where the focus is, that is, the node
  * which receives key events.
  */
 
-class nsFocusManager : public nsIFocusManager,
-                       public nsIObserver,
-                       public nsSupportsWeakReference
+class nsFocusManager MOZ_FINAL : public nsIFocusManager,
+                                 public nsIObserver,
+                                 public nsSupportsWeakReference
 {
   typedef mozilla::widget::InputContextAction InputContextAction;
 
 public:
 
   NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsFocusManager, nsIFocusManager)
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
   NS_DECL_NSIOBSERVER
--- a/dom/base/nsGlobalWindow.cpp
+++ b/dom/base/nsGlobalWindow.cpp
@@ -58,16 +58,17 @@
 #include "nsContentCID.h"
 #include "nsLayoutStatics.h"
 #include "nsCycleCollector.h"
 #include "nsCCUncollectableMarker.h"
 #include "nsAutoJSValHolder.h"
 #include "nsDOMMediaQueryList.h"
 #include "mozilla/dom/workers/Workers.h"
 #include "nsJSPrincipals.h"
+#include "mozilla/Attributes.h"
 
 // Interfaces Needed
 #include "nsIFrame.h"
 #include "nsCanvasFrame.h"
 #include "nsIWidget.h"
 #include "nsIBaseWindow.h"
 #include "nsDeviceSensors.h"
 #include "nsIContent.h"
@@ -409,17 +410,17 @@ static const char sJSStackContractID[] =
 static const char kCryptoContractID[] = NS_CRYPTO_CONTRACTID;
 static const char kPkcs11ContractID[] = NS_PKCS11_CONTRACTID;
 #endif
 static const char sPopStatePrefStr[] = "browser.history.allowPopState";
 
 /**
  * An object implementing the window.URL property.
  */
-class nsDOMMozURLProperty : public nsIDOMMozURLProperty
+class nsDOMMozURLProperty MOZ_FINAL : public nsIDOMMozURLProperty
 {
 public:
   nsDOMMozURLProperty(nsGlobalWindow* aWindow)
     : mWindow(aWindow)
   {
   }
 
   NS_DECL_ISUPPORTS
@@ -489,17 +490,17 @@ nsDOMMozURLProperty::RevokeObjectURL(con
 
   return NS_OK;
 }
 
 /**
  * An indirect observer object that means we don't have to implement nsIObserver
  * on nsGlobalWindow, where any script could see it.
  */
-class nsGlobalWindowObserver : public nsIObserver {
+class nsGlobalWindowObserver MOZ_FINAL : public nsIObserver {
 public:
   nsGlobalWindowObserver(nsGlobalWindow* aWindow) : mWindow(aWindow) {}
   NS_DECL_ISUPPORTS
   NS_IMETHOD Observe(nsISupports* aSubject, const char* aTopic, const PRUnichar* aData)
   {
     if (!mWindow)
       return NS_OK;
     return mWindow->Observe(aSubject, aTopic, aData);
@@ -1532,17 +1533,17 @@ PopupControlState
 nsGlobalWindow::GetPopupControlState() const
 {
   return gPopupControlState;
 }
 
 #define WINDOWSTATEHOLDER_IID \
 {0x0b917c3e, 0xbd50, 0x4683, {0xaf, 0xc9, 0xc7, 0x81, 0x07, 0xae, 0x33, 0x26}}
 
-class WindowStateHolder : public nsISupports
+class WindowStateHolder MOZ_FINAL : public nsISupports
 {
 public:
   NS_DECLARE_STATIC_IID_ACCESSOR(WINDOWSTATEHOLDER_IID)
   NS_DECL_ISUPPORTS
 
   WindowStateHolder(nsGlobalWindow *aWindow,
                     nsIXPConnectJSObjectHolder *aHolder,
                     nsIXPConnectJSObjectHolder *aOuterProto,
--- a/dom/base/nsGlobalWindowCommands.cpp
+++ b/dom/base/nsGlobalWindowCommands.cpp
@@ -22,16 +22,17 @@
 #include "nsIDocShellTreeItem.h"
 #include "nsISelectionController.h"
 #include "nsIWebNavigation.h"
 #include "nsIContentViewerEdit.h"
 #include "nsIContentViewer.h"
 #include "nsFocusManager.h"
 #include "nsCopySupport.h"
 #include "nsGUIEvent.h"
+#include "mozilla/Attributes.h"
 
 #include "nsIClipboardDragDropHooks.h"
 #include "nsIClipboardDragDropHookList.h"
 
 using namespace mozilla;
 
 const char * const sSelectAllString = "cmd_selectAll";
 const char * const sSelectNoneString = "cmd_selectNone";
@@ -85,16 +86,17 @@ const char * const sSelectBottomString =
 #if 0
 #pragma mark -
 #endif
 
 // a base class for selection-related commands, for code sharing
 class nsSelectionCommandsBase : public nsIControllerCommand
 {
 public:
+  virtual ~nsSelectionCommandsBase() {}
 
   NS_DECL_ISUPPORTS
   NS_IMETHOD IsCommandEnabled(const char * aCommandName, nsISupports *aCommandContext, bool *_retval NS_OUTPARAM);
   NS_IMETHOD GetCommandStateParams(const char * aCommandName, nsICommandParams *aParams, nsISupports *aCommandContext);
   NS_IMETHOD DoCommandParams(const char * aCommandName, nsICommandParams *aParams, nsISupports *aCommandContext);
 
 protected:
 
@@ -316,17 +318,17 @@ nsSelectCommand::DoCommand(const char *a
 
   return rv;
 }
 
 #if 0
 #pragma mark -
 #endif
 
-class nsClipboardCommand : public nsIControllerCommand
+class nsClipboardCommand MOZ_FINAL : public nsIControllerCommand
 {
 public:
 
   NS_DECL_ISUPPORTS
   NS_DECL_NSICONTROLLERCOMMAND
 };
 
 NS_IMPL_ISUPPORTS1(nsClipboardCommand, nsIControllerCommand)
@@ -383,16 +385,17 @@ nsClipboardCommand::DoCommandParams(cons
 
 #if 0
 #pragma mark -
 #endif
 
 class nsSelectionCommand : public nsIControllerCommand
 {
 public:
+  virtual ~nsSelectionCommand() {}
 
   NS_DECL_ISUPPORTS
   NS_DECL_NSICONTROLLERCOMMAND
 
 protected:
 
   virtual nsresult    IsClipboardCommandEnabled(const char * aCommandName, nsIContentViewerEdit* aEdit, bool *outCmdEnabled) = 0;
   virtual nsresult    DoClipboardCommand(const char *aCommandName, nsIContentViewerEdit* aEdit, nsICommandParams* aParams) = 0;
@@ -481,22 +484,22 @@ nsSelectionCommand::GetContentViewerEdit
   return NS_OK;
 }
 
 #if 0
 #pragma mark -
 #endif
 
 #define NS_DECL_CLIPBOARD_COMMAND(_cmd)                                                     \
-class _cmd : public nsSelectionCommand                                                  \
+class _cmd : public nsSelectionCommand                                                      \
 {                                                                                           \
 protected:                                                                                  \
                                                                                             \
   virtual nsresult    IsClipboardCommandEnabled(const char* aCommandName,                   \
-                                  nsIContentViewerEdit* aEdit, bool *outCmdEnabled);      \
+                                  nsIContentViewerEdit* aEdit, bool *outCmdEnabled);        \
   virtual nsresult    DoClipboardCommand(const char* aCommandName,                          \
                                   nsIContentViewerEdit* aEdit, nsICommandParams* aParams);  \
   /* no member variables, please, we're stateless! */                                       \
 };
 
 NS_DECL_CLIPBOARD_COMMAND(nsClipboardCopyLinkCommand)
 NS_DECL_CLIPBOARD_COMMAND(nsClipboardImageCommands)
 NS_DECL_CLIPBOARD_COMMAND(nsClipboardSelectAllNoneCommands)
@@ -586,39 +589,35 @@ nsClipboardGetContentsCommand::DoClipboa
   nsAutoString contents;
   nsresult rv = aEdit->GetContents(mimeType.get(), selectionOnly, contents);
   if (NS_FAILED(rv))
     return rv;
     
   return aParams->SetStringValue("result", contents);
 }
 
-
-#if 0
-#pragma mark -
-#endif
-
+#if 0   // Remove unless needed again, bug 204777
 class nsWebNavigationBaseCommand : public nsIControllerCommand
 {
 public:
+  virtual ~nsWebNavigationBaseCommand() {}
 
   NS_DECL_ISUPPORTS
   NS_DECL_NSICONTROLLERCOMMAND
 
 protected:
 
   virtual nsresult    IsWebNavCommandEnabled(const char * aCommandName, nsIWebNavigation* aWebNavigation, bool *outCmdEnabled) = 0;
   virtual nsresult    DoWebNavCommand(const char *aCommandName, nsIWebNavigation* aWebNavigation) = 0;
   
   static nsresult     GetWebNavigationFromContext(nsISupports *aContext, nsIWebNavigation **aWebNavigation);
   
   // no member variables, please, we're stateless!
 };
 
-#if 0   // Remove unless needed again, bug 204777
 class nsGoForwardCommand : public nsWebNavigationBaseCommand
 {
 protected:
 
   virtual nsresult    IsWebNavCommandEnabled(const char * aCommandName, nsIWebNavigation* aWebNavigation, bool *outCmdEnabled);
   virtual nsresult    DoWebNavCommand(const char *aCommandName, nsIWebNavigation* aWebNavigation);
   // no member variables, please, we're stateless!
 };
@@ -626,17 +625,16 @@ protected:
 class nsGoBackCommand : public nsWebNavigationBaseCommand
 {
 protected:
 
   virtual nsresult    IsWebNavCommandEnabled(const char * aCommandName, nsIWebNavigation* aWebNavigation, bool *outCmdEnabled);
   virtual nsresult    DoWebNavCommand(const char *aCommandName, nsIWebNavigation* aWebNavigation);
   // no member variables, please, we're stateless!
 };
-#endif
 
 /*---------------------------------------------------------------------------
 
   nsWebNavigationCommands
      no params
 ----------------------------------------------------------------------------*/
 
 NS_IMPL_ISUPPORTS1(nsWebNavigationBaseCommand, nsIControllerCommand)
@@ -686,21 +684,16 @@ nsWebNavigationBaseCommand::DoCommandPar
 nsresult
 nsWebNavigationBaseCommand::GetWebNavigationFromContext(nsISupports *aContext, nsIWebNavigation **aWebNavigation)
 {
   nsCOMPtr<nsIInterfaceRequestor> windowReq = do_QueryInterface(aContext);
   CallGetInterface(windowReq.get(), aWebNavigation);
   return (*aWebNavigation) ? NS_OK : NS_ERROR_FAILURE;
 }
 
-#if 0
-#pragma mark -
-#endif
-
-#if 0   // Remove unless needed again, bug 204777
 nsresult
 nsGoForwardCommand::IsWebNavCommandEnabled(const char * aCommandName, nsIWebNavigation* aWebNavigation, bool *outCmdEnabled)
 {
   return aWebNavigation->GetCanGoForward(outCmdEnabled);
 }
 
 nsresult
 nsGoForwardCommand::DoWebNavCommand(const char *aCommandName, nsIWebNavigation* aWebNavigation)
@@ -725,17 +718,17 @@ nsGoBackCommand::DoWebNavCommand(const c
 
   nsClipboardDragDropHookCommand
       params        value type   possible values
       "addhook"     isupports    nsIClipboardDragDropHooks as nsISupports
       "removehook"  isupports    nsIClipboardDragDropHooks as nsISupports
 
 ----------------------------------------------------------------------------*/
 
-class nsClipboardDragDropHookCommand : public nsIControllerCommand
+class nsClipboardDragDropHookCommand MOZ_FINAL : public nsIControllerCommand
 {
 public:
 
   NS_DECL_ISUPPORTS
   NS_DECL_NSICONTROLLERCOMMAND
 
 protected:                                                                                   
   // no member variables, please, we're stateless!
--- a/dom/base/nsJSEnvironment.cpp
+++ b/dom/base/nsJSEnvironment.cpp
@@ -73,16 +73,17 @@
 #endif
 #include "prlog.h"
 #include "prthread.h"
 
 #include "mozilla/FunctionTimer.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/Telemetry.h"
 #include "mozilla/dom/BindingUtils.h"
+#include "mozilla/Attributes.h"
 
 #include "sampler.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
 const size_t gStackSize = 8192;
 
@@ -185,17 +186,17 @@ static PRTime sMaxChromeScriptRunTime;
 static nsIScriptSecurityManager *sSecurityManager;
 
 // nsMemoryPressureObserver observes the memory-pressure notifications
 // and forces a garbage collection and cycle collection when it happens, if
 // the appropriate pref is set.
 
 static bool sGCOnMemoryPressure;
 
-class nsMemoryPressureObserver : public nsIObserver
+class nsMemoryPressureObserver MOZ_FINAL : public nsIObserver
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIOBSERVER
 };
 
 NS_IMPL_ISUPPORTS1(nsMemoryPressureObserver, nsIObserver)
 
@@ -3920,17 +3921,17 @@ nsresult NS_CreateJSRuntime(nsIScriptRun
 }
 
 // A fast-array class for JS.  This class supports both nsIJSScriptArray and
 // nsIArray.  If it is JS itself providing and consuming this class, all work
 // can be done via nsIJSScriptArray, and avoid the conversion of elements
 // to/from nsISupports.
 // When consumed by non-JS (eg, another script language), conversion is done
 // on-the-fly.
-class nsJSArgArray : public nsIJSArgArray {
+class nsJSArgArray MOZ_FINAL : public nsIJSArgArray {
 public:
   nsJSArgArray(JSContext *aContext, PRUint32 argc, jsval *argv, nsresult *prv);
   ~nsJSArgArray();
   // nsISupports
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
   NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(nsJSArgArray,
                                                          nsIJSArgArray)
 
--- a/dom/base/nsJSEnvironment.h
+++ b/dom/base/nsJSEnvironment.h
@@ -12,16 +12,17 @@
 #include "jsapi.h"
 #include "jsfriendapi.h"
 #include "nsIObserver.h"
 #include "nsIXPCScriptNotify.h"
 #include "prtime.h"
 #include "nsCycleCollectionParticipant.h"
 #include "nsIXPConnect.h"
 #include "nsIArray.h"
+#include "mozilla/Attributes.h"
 
 class nsIXPConnectJSObjectHolder;
 class nsRootedJSValueArray;
 class nsScriptNameSpaceManager;
 namespace mozilla {
 template <class> class Maybe;
 }
 
@@ -281,17 +282,17 @@ private:
 
   static int JSOptionChangedCallback(const char *pref, void *data);
 
   static JSBool DOMOperationCallback(JSContext *cx);
 };
 
 class nsIJSRuntimeService;
 
-class nsJSRuntime : public nsIScriptRuntime
+class nsJSRuntime MOZ_FINAL : public nsIScriptRuntime
 {
 public:
   // let people who can see us use our runtime for convenience.
   static JSRuntime *sRuntime;
 
 public:
   // nsISupports
   NS_DECL_ISUPPORTS
--- a/dom/base/nsJSTimeoutHandler.cpp
+++ b/dom/base/nsJSTimeoutHandler.cpp
@@ -14,22 +14,23 @@
 #include "nsDOMJSUtils.h"
 #include "nsContentUtils.h"
 #include "nsJSEnvironment.h"
 #include "nsServiceManagerUtils.h"
 #include "nsDOMError.h"
 #include "nsGlobalWindow.h"
 #include "nsIContentSecurityPolicy.h"
 #include "nsAlgorithm.h"
+#include "mozilla/Attributes.h"
 
 static const char kSetIntervalStr[] = "setInterval";
 static const char kSetTimeoutStr[] = "setTimeout";
 
 // Our JS nsIScriptTimeoutHandler implementation.
-class nsJSScriptTimeoutHandler: public nsIScriptTimeoutHandler
+class nsJSScriptTimeoutHandler MOZ_FINAL : public nsIScriptTimeoutHandler
 {
 public:
   // nsISupports
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
   NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(nsJSScriptTimeoutHandler)
 
   nsJSScriptTimeoutHandler();
   ~nsJSScriptTimeoutHandler();
--- a/dom/base/nsPerformance.h
+++ b/dom/base/nsPerformance.h
@@ -6,49 +6,50 @@
 #define nsPerformance_h___
 
 #include "nsIDOMPerformance.h"
 #include "nsIDOMPerformanceTiming.h"
 #include "nsIDOMPerformanceNavigation.h"
 #include "nscore.h"
 #include "nsCOMPtr.h"
 #include "nsAutoPtr.h"
+#include "mozilla/Attributes.h"
 
 class nsIDocument;
 class nsIURI;
 class nsDOMNavigationTiming;
 class nsITimedChannel;
 
 // Script "performance.timing" object
-class nsPerformanceTiming : public nsIDOMPerformanceTiming
+class nsPerformanceTiming MOZ_FINAL : public nsIDOMPerformanceTiming
 {
 public:
   nsPerformanceTiming(nsDOMNavigationTiming* aDOMTiming, nsITimedChannel* aChannel);
   NS_DECL_ISUPPORTS
   NS_DECL_NSIDOMPERFORMANCETIMING
 private:
   ~nsPerformanceTiming();
   nsRefPtr<nsDOMNavigationTiming> mDOMTiming;
   nsCOMPtr<nsITimedChannel> mChannel;
 };
 
 // Script "performance.navigation" object
-class nsPerformanceNavigation : public nsIDOMPerformanceNavigation
+class nsPerformanceNavigation MOZ_FINAL : public nsIDOMPerformanceNavigation
 {
 public:
   nsPerformanceNavigation(nsDOMNavigationTiming* data);
   NS_DECL_ISUPPORTS
   NS_DECL_NSIDOMPERFORMANCENAVIGATION
 private:
   ~nsPerformanceNavigation();
   nsRefPtr<nsDOMNavigationTiming> mData;
 };
 
 // Script "performance" object
-class nsPerformance : public nsIDOMPerformance
+class nsPerformance MOZ_FINAL : public nsIDOMPerformance
 {
 public:
   nsPerformance(nsDOMNavigationTiming* aDOMTiming, nsITimedChannel* aChannel);
 
   NS_DECL_ISUPPORTS
   NS_DECL_NSIDOMPERFORMANCE
 
 private:
--- a/dom/base/nsQueryContentEventResult.h
+++ b/dom/base/nsQueryContentEventResult.h
@@ -1,21 +1,22 @@
 /* -*- 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/. */
 
 #include "nsIQueryContentEventResult.h"
 #include "nsString.h"
 #include "nsRect.h"
+#include "mozilla/Attributes.h"
 
 class nsQueryContentEvent;
 class nsIWidget;
 
-class nsQueryContentEventResult : public nsIQueryContentEventResult
+class nsQueryContentEventResult MOZ_FINAL : public nsIQueryContentEventResult
 {
 public:
   nsQueryContentEventResult();
   ~nsQueryContentEventResult();
   NS_DECL_ISUPPORTS
   NS_DECL_NSIQUERYCONTENTEVENTRESULT
 
   void SetEventResult(nsIWidget* aWidget, const nsQueryContentEvent &aEvent);
--- a/dom/base/nsScreen.h
+++ b/dom/base/nsScreen.h
@@ -7,16 +7,17 @@
 
 #include "mozilla/dom/ScreenOrientation.h"
 #include "mozilla/Hal.h"
 #include "nsIDOMScreen.h"
 #include "nsISupports.h"
 #include "nsIScriptContext.h"
 #include "nsCOMPtr.h"
 #include "nsDOMEventTargetHelper.h"
+#include "mozilla/Attributes.h"
 
 class nsIDocShell;
 class nsDeviceContext;
 struct nsRect;
 
 // Script "screen" object
 class nsScreen : public nsDOMEventTargetHelper
                , public nsIDOMScreen
@@ -39,17 +40,17 @@ public:
 protected:
   nsDeviceContext* GetDeviceContext();
   nsresult GetRect(nsRect& aRect);
   nsresult GetAvailRect(nsRect& aRect);
 
   mozilla::dom::ScreenOrientation mOrientation;
 
 private:
-  class FullScreenEventListener : public nsIDOMEventListener
+  class FullScreenEventListener MOZ_FINAL : public nsIDOMEventListener
   {
   public:
     FullScreenEventListener() {};
 
     NS_DECL_ISUPPORTS
     NS_DECL_NSIDOMEVENTLISTENER
   };
 
--- a/dom/base/nsStructuredCloneContainer.h
+++ b/dom/base/nsStructuredCloneContainer.h
@@ -5,29 +5,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 nsStructuredCloneContainer_h__
 #define nsStructuredCloneContainer_h__
 
 #include "nsIStructuredCloneContainer.h"
 #include "jsapi.h"
+#include "mozilla/Attributes.h"
 
 #define NS_STRUCTUREDCLONECONTAINER_CLASSNAME "nsStructuredCloneContainer"
 #define NS_STRUCTUREDCLONECONTAINER_CONTRACTID \
   "@mozilla.org/docshell/structured-clone-container;1"
 #define NS_STRUCTUREDCLONECONTAINER_CID \
 { /* 38bd0634-0fd4-46f0-b85f-13ced889eeec */       \
   0x38bd0634,                                      \
   0x0fd4,                                          \
   0x46f0,                                          \
   {0xb8, 0x5f, 0x13, 0xce, 0xd8, 0x89, 0xee, 0xec} \
 }
 
-class nsStructuredCloneContainer : public nsIStructuredCloneContainer
+class nsStructuredCloneContainer MOZ_FINAL : public nsIStructuredCloneContainer
 {
   public:
     nsStructuredCloneContainer();
     ~nsStructuredCloneContainer();
 
     NS_DECL_ISUPPORTS
     NS_DECL_NSISTRUCTUREDCLONECONTAINER
 
--- a/dom/base/nsWindowMemoryReporter.h
+++ b/dom/base/nsWindowMemoryReporter.h
@@ -8,16 +8,17 @@
 
 #include "nsIMemoryReporter.h"
 #include "nsIObserver.h"
 #include "nsDataHashtable.h"
 #include "nsWeakReference.h"
 #include "nsAutoPtr.h"
 #include "mozilla/TimeStamp.h"
 #include "nsArenaMemoryStats.h"
+#include "mozilla/Attributes.h"
 
 // This should be used for any nsINode sub-class that has fields of its own
 // that it needs to measure;  any sub-class that doesn't use it will inherit
 // SizeOfExcludingThis from its super-class.  SizeOfIncludingThis() need not be
 // defined, it is inherited from nsINode.
 #define NS_DECL_SIZEOF_EXCLUDING_THIS \
   virtual size_t SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const;
 
@@ -99,51 +100,51 @@ public:
  *   the top level chrome window).  Exposing this ensures that each tab gets
  *   its own sub-tree, even if multiple tabs are showing the same URI.
  *
  * - <top-uri> is the URI of the top window.  Excepting special windows (such
  *   as browser.xul or hiddenWindow.html) it's what the address bar shows for
  *   the tab.
  *
  */
-class nsWindowMemoryReporter: public nsIMemoryMultiReporter,
-                              public nsIObserver,
-                              public nsSupportsWeakReference
+class nsWindowMemoryReporter MOZ_FINAL : public nsIMemoryMultiReporter,
+                                         public nsIObserver,
+                                         public nsSupportsWeakReference
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIMEMORYMULTIREPORTER
   NS_DECL_NSIOBSERVER
 
   static void Init();
 
 private:
   /**
    * GhostURLsReporter generates the "ghost-windows" multi-report, which
    * includes a list of all ghost windows' URLs.  If you're only interested in
    * this list, running this report is faster than running
    * nsWindowMemoryReporter.
    */
-  class GhostURLsReporter: public nsIMemoryMultiReporter
+  class GhostURLsReporter MOZ_FINAL : public nsIMemoryMultiReporter
   {
   public:
     GhostURLsReporter(nsWindowMemoryReporter* aWindowReporter);
 
     NS_DECL_ISUPPORTS
     NS_DECL_NSIMEMORYMULTIREPORTER
 
   private:
     nsRefPtr<nsWindowMemoryReporter> mWindowReporter;
   };
 
   /**
    * nsGhostWindowReporter generates the "ghost-windows" single-report, which
    * counts the number of ghost windows present.
    */
-  class NumGhostsReporter: public nsIMemoryReporter
+  class NumGhostsReporter MOZ_FINAL : public nsIMemoryReporter
   {
   public:
     NumGhostsReporter(nsWindowMemoryReporter* aWindowReporter);
 
     NS_DECL_ISUPPORTS
     NS_DECL_NSIMEMORYREPORTER
 
   private:
--- a/dom/devicestorage/nsDeviceStorage.cpp
+++ b/dom/devicestorage/nsDeviceStorage.cpp
@@ -323,17 +323,17 @@ protected:
   bool mEditable;
   PRUint64 mSince;
 
   // to access mFiles
   friend class InitCursorEvent;
   friend class ContinueCursorEvent;
 };
 
-class DeviceStorageCursorRequest : public nsIContentPermissionRequest
+class DeviceStorageCursorRequest MOZ_FINAL : public nsIContentPermissionRequest
 {
 public:
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
   NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(DeviceStorageCursorRequest, nsIContentPermissionRequest)
 
   NS_FORWARD_NSICONTENTPERMISSIONREQUEST(mCursor->);
 
   DeviceStorageCursorRequest(nsDOMDeviceStorageCursor* aCursor)
@@ -882,17 +882,17 @@ public:
     return NS_OK;
   }
 
 private:
   nsRefPtr<DeviceStorageFile> mFile;
   nsRefPtr<DOMRequest> mRequest;
 };
 
-class DeviceStorageRequest : public nsIContentPermissionRequest, public nsIRunnable
+class DeviceStorageRequest MOZ_FINAL : public nsIContentPermissionRequest, public nsIRunnable
 {
 public:
 
     enum {
         DEVICE_STORAGE_REQUEST_READ,
         DEVICE_STORAGE_REQUEST_WRITE,
         DEVICE_STORAGE_REQUEST_DELETE
     };
--- a/dom/devicestorage/nsDeviceStorage.h
+++ b/dom/devicestorage/nsDeviceStorage.h
@@ -14,18 +14,19 @@ class nsPIDOMWindow;
 #include "nsIURI.h"
 
 #include "nsAutoPtr.h"
 #include "nsCycleCollectionParticipant.h"
 #include "nsDOMClassInfoID.h"
 #include "nsString.h"
 #include "nsWeakPtr.h"
 #include "nsInterfaceHashtable.h"
+#include "mozilla/Attributes.h"
 
-class nsDOMDeviceStorage : public nsIDOMDeviceStorage
+class nsDOMDeviceStorage MOZ_FINAL : public nsIDOMDeviceStorage
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIDOMDEVICESTORAGE
 
   nsDOMDeviceStorage();
 
   nsresult Init(nsPIDOMWindow* aWindow, const nsAString &aType, const PRInt32 aIndex);
--- a/dom/file/FileService.h
+++ b/dom/file/FileService.h
@@ -7,23 +7,24 @@
 #ifndef mozilla_dom_file_fileservice_h__
 #define mozilla_dom_file_fileservice_h__
 
 #include "FileCommon.h"
 
 #include "nsIObserver.h"
 
 #include "nsClassHashtable.h"
+#include "mozilla/Attributes.h"
 
 #include "mozilla/dom/file/FileHelper.h"
 #include "mozilla/dom/file/LockedFile.h"
 
 BEGIN_FILE_NAMESPACE
 
-class FileService : public nsIObserver
+class FileService MOZ_FINAL : public nsIObserver
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIOBSERVER
 
   // Returns a non-owning reference!
   static FileService*
   GetOrCreate();
@@ -58,17 +59,17 @@ public:
   nsIEventTarget*
   StreamTransportTarget()
   {
     NS_ASSERTION(mStreamTransportTarget, "This should never be null!");
     return mStreamTransportTarget;
   }
 
 private:
-  class LockedFileQueue : public FileHelperListener
+  class LockedFileQueue MOZ_FINAL : public FileHelperListener
   {
     friend class FileService;
 
   public:
     NS_IMETHOD_(nsrefcnt)
     AddRef();
 
     NS_IMETHOD_(nsrefcnt)
--- a/dom/file/FileStreamWrappers.cpp
+++ b/dom/file/FileStreamWrappers.cpp
@@ -4,24 +4,25 @@
  * 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 "FileStreamWrappers.h"
 
 #include "nsIFileStorage.h"
 #include "nsISeekableStream.h"
 #include "nsIStandardFileStream.h"
+#include "mozilla/Attributes.h"
 
 #include "FileHelper.h"
 
 USING_FILE_NAMESPACE
 
 namespace {
 
-class ProgressRunnable : public nsIRunnable
+class ProgressRunnable MOZ_FINAL : public nsIRunnable
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIRUNNABLE
 
   ProgressRunnable(FileHelper* aFileHelper,
                    PRUint64 aProgress,
                    PRUint64 aProgressMax)
@@ -32,31 +33,31 @@ public:
   }
 
 private:
   nsRefPtr<FileHelper> mFileHelper;
   PRUint64 mProgress;
   PRUint64 mProgressMax;
 };
 
-class CloseRunnable : public nsIRunnable
+class CloseRunnable MOZ_FINAL : public nsIRunnable
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIRUNNABLE
 
   CloseRunnable(FileHelper* aFileHelper)
   : mFileHelper(aFileHelper)
   { }
 
 private:
   nsRefPtr<FileHelper> mFileHelper;
 };
 
-class DestroyRunnable : public nsIRunnable
+class DestroyRunnable MOZ_FINAL : public nsIRunnable
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIRUNNABLE
 
   DestroyRunnable(FileHelper* aFileHelper)
   : mFileHelper(aFileHelper)
   { }
--- a/dom/file/LockedFile.h
+++ b/dom/file/LockedFile.h
@@ -125,17 +125,17 @@ private:
 
   nsTArray<nsCOMPtr<nsISupports> > mParallelStreams;
   nsCOMPtr<nsISupports> mStream;
 
   bool mAborted;
   bool mCreating;
 };
 
-class FinishHelper : public nsIRunnable
+class FinishHelper MOZ_FINAL : public nsIRunnable
 {
   friend class LockedFile;
 
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIRUNNABLE
 
 private:
--- a/dom/ipc/ContentChild.cpp
+++ b/dom/ipc/ContentChild.cpp
@@ -23,16 +23,17 @@
 #include "mozilla/dom/PCrashReporterChild.h"
 #include "mozilla/dom/StorageChild.h"
 #include "mozilla/hal_sandbox/PHalChild.h"
 #include "mozilla/ipc/TestShellChild.h"
 #include "mozilla/ipc/XPCShellEnvironment.h"
 #include "mozilla/jsipc/PContextWrapperChild.h"
 #include "mozilla/net/NeckoChild.h"
 #include "mozilla/Preferences.h"
+#include "mozilla/Attributes.h"
 
 #if defined(MOZ_SYDNEYAUDIO)
 #include "nsAudioStream.h"
 #endif
 #include "nsIMemoryReporter.h"
 #include "nsIObserverService.h"
 #include "nsTObserverArray.h"
 #include "nsIObserver.h"
@@ -136,17 +137,17 @@ public:
         return true;
     }
 
 private:
     nsCOMPtr<nsIObserver> mObserver;
     nsString mData;
 };
 
-class ConsoleListener : public nsIConsoleListener
+class ConsoleListener MOZ_FINAL : public nsIConsoleListener
 {
 public:
     ConsoleListener(ContentChild* aChild)
     : mChild(aChild) {}
 
     NS_DECL_ISUPPORTS
     NS_DECL_NSICONSOLELISTENER
 
@@ -277,25 +278,25 @@ ContentChild::InitXPCOM()
 PMemoryReportRequestChild*
 ContentChild::AllocPMemoryReportRequest()
 {
     return new MemoryReportRequestChild();
 }
 
 // This is just a wrapper for InfallibleTArray<MemoryReport> that implements
 // nsISupports, so it can be passed to nsIMemoryMultiReporter::CollectReports.
-class MemoryReportsWrapper : public nsISupports {
+class MemoryReportsWrapper MOZ_FINAL : public nsISupports {
 public:
     NS_DECL_ISUPPORTS
     MemoryReportsWrapper(InfallibleTArray<MemoryReport> *r) : mReports(r) { }
     InfallibleTArray<MemoryReport> *mReports;
 };
 NS_IMPL_ISUPPORTS0(MemoryReportsWrapper)
 
-class MemoryReportCallback : public nsIMemoryMultiReporterCallback
+class MemoryReportCallback MOZ_FINAL : public nsIMemoryMultiReporterCallback
 {
 public:
     NS_DECL_ISUPPORTS
 
     MemoryReportCallback(const nsACString &aProcess)
     : mProcess(aProcess)
     {
     }
--- a/dom/ipc/TabChild.h
+++ b/dom/ipc/TabChild.h
@@ -37,16 +37,17 @@
 #include "nsIDialogCreator.h"
 #include "nsIDialogParamBlock.h"
 #include "nsIPresShell.h"
 #include "nsIPrincipal.h"
 #include "nsIScriptObjectPrincipal.h"
 #include "nsIScriptContext.h"
 #include "nsWeakReference.h"
 #include "nsITabChild.h"
+#include "mozilla/Attributes.h"
 
 struct gfxMatrix;
 
 namespace mozilla {
 namespace layout {
 class RenderFrameChild;
 }
 
@@ -110,17 +111,17 @@ public:
   virtual nsIScriptObjectPrincipal* GetObjectPrincipal() { return this; }
   virtual JSContext* GetJSContextForEventHandlers();
   virtual nsIPrincipal* GetPrincipal();
 
   nsCOMPtr<nsIContentFrameMessageManager> mMessageManager;
   TabChild* mTabChild;
 };
 
-class ContentListener : public nsIDOMEventListener
+class ContentListener MOZ_FINAL : public nsIDOMEventListener
 {
 public:
   ContentListener(TabChild* aTabChild) : mTabChild(aTabChild) {}
   NS_DECL_ISUPPORTS
   NS_DECL_NSIDOMEVENTLISTENER
 protected:
   TabChild* mTabChild;
 };
--- a/dom/media/MediaManager.h
+++ b/dom/media/MediaManager.h
@@ -6,16 +6,17 @@
 #include "mozilla/Services.h"
 
 #include "nsHashKeys.h"
 #include "nsClassHashtable.h"
 #include "nsObserverService.h"
 
 #include "nsPIDOMWindow.h"
 #include "nsIDOMNavigatorUserMedia.h"
+#include "mozilla/Attributes.h"
 
 namespace mozilla {
 
 /**
  * This class is an implementation of MediaStreamListener. This is used
  * to Start() and Stop() the underlying MediaEngineSource when MediaStreams
  * are assigned and deassigned in content.
  */
@@ -68,17 +69,17 @@ private:
   nsCOMPtr<nsDOMMediaStream> mStream;
   TrackID mId;
   bool mValid;
 };
 
 typedef nsTArray<nsRefPtr<GetUserMediaCallbackMediaStreamListener> > StreamListeners;
 typedef nsClassHashtable<nsUint64HashKey, StreamListeners> WindowTable;
 
-class MediaManager : public nsIObserver {
+class MediaManager MOZ_FINAL : public nsIObserver {
 public:
   static MediaManager* Get() {
     if (!sSingleton) {
       sSingleton = new MediaManager();
 
       nsCOMPtr<nsIObserverService> obs = services::GetObserverService();
       obs->AddObserver(sSingleton, "xpcom-shutdown", false);
     }
--- a/dom/sms/src/SmsCursor.h
+++ b/dom/sms/src/SmsCursor.h
@@ -4,25 +4,26 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef mozilla_dom_sms_SmsCursor_h
 #define mozilla_dom_sms_SmsCursor_h
 
 #include "nsIDOMSmsCursor.h"
 #include "nsCycleCollectionParticipant.h"
 #include "nsCOMPtr.h"
+#include "mozilla/Attributes.h"
 
 class nsIDOMMozSmsMessage;
 class nsIDOMMozSmsRequest;
 
 namespace mozilla {
 namespace dom {
 namespace sms {
 
-class SmsCursor : public nsIDOMMozSmsCursor
+class SmsCursor MOZ_FINAL : public nsIDOMMozSmsCursor
 {
 public:
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
   NS_DECL_NSIDOMMOZSMSCURSOR
 
   NS_DECL_CYCLE_COLLECTION_CLASS(SmsCursor)
 
   SmsCursor();
--- a/dom/sms/src/SmsFilter.h
+++ b/dom/sms/src/SmsFilter.h
@@ -4,22 +4,23 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef mozilla_dom_sms_SmsFilter_h
 #define mozilla_dom_sms_SmsFilter_h
 
 #include "mozilla/dom/sms/PSms.h"
 #include "nsIDOMSmsFilter.h"
 #include "Types.h"
+#include "mozilla/Attributes.h"
 
 namespace mozilla {
 namespace dom {
 namespace sms {
 
-class SmsFilter : public nsIDOMMozSmsFilter
+class SmsFilter MOZ_FINAL : public nsIDOMMozSmsFilter
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIDOMMOZSMSFILTER
 
   SmsFilter();
   SmsFilter(const SmsFilterData& aData);
 
--- a/dom/sms/src/SmsMessage.h
+++ b/dom/sms/src/SmsMessage.h
@@ -6,22 +6,23 @@
 #ifndef mozilla_dom_sms_SmsMessage_h
 #define mozilla_dom_sms_SmsMessage_h
 
 #include "mozilla/dom/sms/PSms.h"
 #include "nsIDOMSmsMessage.h"
 #include "nsString.h"
 #include "jspubtd.h"
 #include "Types.h"
+#include "mozilla/Attributes.h"
 
 namespace mozilla {
 namespace dom {
 namespace sms {
 
-class SmsMessage : public nsIDOMMozSmsMessage
+class SmsMessage MOZ_FINAL : public nsIDOMMozSmsMessage
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIDOMMOZSMSMESSAGE
 
   SmsMessage(PRInt32 aId, DeliveryState aDelivery, const nsString& aSender,
              const nsString& aReceiver, const nsString& aBody,
              PRUint64 aTimestamp, bool aRead);
--- a/dom/sms/src/SmsRequestManager.h
+++ b/dom/sms/src/SmsRequestManager.h
@@ -5,22 +5,23 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef mozilla_dom_sms_SmsRequestManager_h
 #define mozilla_dom_sms_SmsRequestManager_h
 
 #include "nsCOMArray.h"
 #include "SmsRequest.h"
 #include "nsISmsRequestManager.h"
+#include "mozilla/Attributes.h"
 
 namespace mozilla {
 namespace dom {
 namespace sms {
 
-class SmsRequestManager : nsISmsRequestManager
+class SmsRequestManager MOZ_FINAL : nsISmsRequestManager
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSISMSREQUESTMANAGER
 
 private:
   nsresult DispatchTrustedEventToRequest(const nsAString& aEventName,
                                          nsIDOMMozSmsRequest* aRequest);
--- a/dom/sms/src/android/SmsDatabaseService.h
+++ b/dom/sms/src/android/SmsDatabaseService.h
@@ -2,22 +2,23 @@
 /* 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_dom_sms_SmsDatabaseService_h
 #define mozilla_dom_sms_SmsDatabaseService_h
 
 #include "nsISmsDatabaseService.h"
+#include "mozilla/Attributes.h"
 
 namespace mozilla {
 namespace dom {
 namespace sms {
 
-class SmsDatabaseService : public nsISmsDatabaseService
+class SmsDatabaseService MOZ_FINAL : public nsISmsDatabaseService
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSISMSDATABASESERVICE
 };
 
 } // namespace sms
 } // namespace dom
--- a/dom/sms/src/android/SmsService.h
+++ b/dom/sms/src/android/SmsService.h
@@ -7,17 +7,17 @@
 #define mozilla_dom_sms_SmsService_h
 
 #include "nsISmsService.h"
 
 namespace mozilla {
 namespace dom {
 namespace sms {
 
-class SmsService : public nsISmsService
+class SmsService MOZ_FINAL : public nsISmsService
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSISMSSERVICE
 };
 
 } // namespace sms
 } // namespace dom
--- a/dom/sms/src/fallback/SmsService.h
+++ b/dom/sms/src/fallback/SmsService.h
@@ -2,22 +2,23 @@
 /* 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_dom_sms_SmsService_h
 #define mozilla_dom_sms_SmsService_h
 
 #include "nsISmsService.h"
+#include "mozilla/Attributes.h"
 
 namespace mozilla {
 namespace dom {
 namespace sms {
 
-class SmsService : public nsISmsService
+class SmsService MOZ_FINAL : public nsISmsService
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSISMSSERVICE
 };
 
 } // namespace sms
 } // namespace dom
--- a/dom/sms/src/ipc/SmsIPCService.h
+++ b/dom/sms/src/ipc/SmsIPCService.h
@@ -3,25 +3,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 mozilla_dom_sms_SmsIPCService_h
 #define mozilla_dom_sms_SmsIPCService_h
 
 #include "nsISmsService.h"
 #include "nsISmsDatabaseService.h"
+#include "mozilla/Attributes.h"
 
 namespace mozilla {
 namespace dom {
 namespace sms {
 
 class PSmsChild;
 
-class SmsIPCService : public nsISmsService
-                    , public nsISmsDatabaseService
+class SmsIPCService MOZ_FINAL : public nsISmsService
+                              , public nsISmsDatabaseService
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSISMSSERVICE
   NS_DECL_NSISMSDATABASESERVICE
 
 private:
   static PSmsChild* GetSmsChild();
--- a/dom/src/geolocation/nsGeoPosition.h
+++ b/dom/src/geolocation/nsGeoPosition.h
@@ -7,16 +7,17 @@
 #define nsGeoPosition_h
 
 #include "nsAutoPtr.h"
 #include "nsIClassInfo.h"
 #include "nsDOMClassInfoID.h"
 #include "nsIDOMGeoPositionCoords.h"
 #include "nsIDOMGeoPosition.h"
 #include "nsString.h"
+#include "mozilla/Attributes.h"
 
 ////////////////////////////////////////////////////
 // nsGeoPositionCoords
 ////////////////////////////////////////////////////
 
 /**
  * Simple object that holds a single point in space.
  */
@@ -35,17 +36,17 @@ private:
   const double mLat, mLong, mAlt, mHError, mVError, mHeading, mSpeed;
 };
 
 
 ////////////////////////////////////////////////////
 // nsGeoPosition
 ////////////////////////////////////////////////////
 
-class nsGeoPosition : public nsIDOMGeoPosition
+class nsGeoPosition MOZ_FINAL : public nsIDOMGeoPosition
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIDOMGEOPOSITION
   
   nsGeoPosition(double aLat, double aLong,
                 double aAlt, double aHError,
                 double aVError, double aHeading,
--- a/dom/src/geolocation/nsGeolocation.cpp
+++ b/dom/src/geolocation/nsGeolocation.cpp
@@ -34,16 +34,17 @@
 #include "nsIURI.h"
 #include "nsIPermissionManager.h"
 #include "nsIObserverService.h"
 #include "nsIJSContextStack.h"
 #include "nsThreadUtils.h"
 #include "mozilla/Services.h"
 #include "mozilla/unused.h"
 #include "mozilla/Preferences.h"
+#include "mozilla/Attributes.h"
 
 #include <math.h>
 
 #ifdef MOZ_MAEMO_LIBLOCATION
 #include "MaemoLocationProvider.h"
 #endif
 
 #ifdef MOZ_ENABLE_QTMOBILITY
@@ -139,17 +140,17 @@ private:
 
   nsRefPtr<nsGeolocation>        mLocator;
 };
 
 ////////////////////////////////////////////////////
 // nsDOMGeoPositionError
 ////////////////////////////////////////////////////
 
-class nsDOMGeoPositionError : public nsIDOMGeoPositionError
+class nsDOMGeoPositionError MOZ_FINAL : public nsIDOMGeoPositionError
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIDOMGEOPOSITIONERROR
 
   nsDOMGeoPositionError(PRInt16 aCode);
   void NotifyCallback(nsIDOMGeoPositionErrorCallback* callback);
 
--- a/dom/src/geolocation/nsGeolocation.h
+++ b/dom/src/geolocation/nsGeolocation.h
@@ -28,16 +28,17 @@
 #include "nsIDOMNavigatorGeolocation.h"
 
 #include "nsPIDOMWindow.h"
 
 #include "nsIGeolocationProvider.h"
 #include "nsIContentPermissionPrompt.h"
 #include "DictionaryHelpers.h"
 #include "PCOMContentPermissionRequestChild.h"
+#include "mozilla/Attributes.h"
 
 class nsGeolocationService;
 class nsGeolocation;
 
 class nsGeolocationRequest
  : public nsIContentPermissionRequest
  , public nsITimerCallback
  , public PCOMContentPermissionRequestChild
@@ -83,17 +84,17 @@ class nsGeolocationRequest
   nsAutoPtr<mozilla::dom::GeoPositionOptions> mOptions;
 
   nsRefPtr<nsGeolocation> mLocator;
 };
 
 /**
  * Singleton that manages the geolocation provider
  */
-class nsGeolocationService : public nsIGeolocationUpdate, public nsIObserver
+class nsGeolocationService MOZ_FINAL : public nsIGeolocationUpdate, public nsIObserver
 {
 public:
 
   static nsGeolocationService* GetGeolocationService();
   static nsGeolocationService* GetInstance();  // Non-Addref'ing
   static nsGeolocationService* gService;
 
   NS_DECL_ISUPPORTS
@@ -148,17 +149,17 @@ private:
   // Current state of requests for higher accuracy
   bool mHigherAccuracy;
 };
 
 
 /**
  * Can return a geolocation info
  */ 
-class nsGeolocation : public nsIDOMGeoGeolocation
+class nsGeolocation MOZ_FINAL : public nsIDOMGeoGeolocation
 {
 public:
 
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
   NS_DECL_NSIDOMGEOGEOLOCATION
 
   NS_DECL_CYCLE_COLLECTION_CLASS(nsGeolocation)
 
--- a/dom/src/storage/nsDOMStorage.h
+++ b/dom/src/storage/nsDOMStorage.h
@@ -21,16 +21,17 @@
 #include "nsDOMEvent.h"
 #include "nsIDOMStorageEvent.h"
 #include "nsIDOMStorageManager.h"
 #include "nsCycleCollectionParticipant.h"
 #include "nsIObserver.h"
 #include "nsITimer.h"
 #include "nsWeakReference.h"
 #include "nsIInterfaceRequestor.h"
+#include "mozilla/Attributes.h"
 
 #include "nsDOMStorageDBWrapper.h"
 
 #define IS_PERMISSION_ALLOWED(perm) \
       ((perm) != nsIPermissionManager::UNKNOWN_ACTION && \
       (perm) != nsIPermissionManager::DENY_ACTION)
 
 class nsDOMStorage;
@@ -63,19 +64,19 @@ class nsSessionStorageEntry : public nsS
 public:
   nsSessionStorageEntry(KeyTypePointer aStr);
   nsSessionStorageEntry(const nsSessionStorageEntry& aToCopy);
   ~nsSessionStorageEntry();
 
   nsRefPtr<nsDOMStorageItem> mItem;
 };
 
-class nsDOMStorageManager : public nsIDOMStorageManager
-                          , public nsIObserver
-                          , public nsSupportsWeakReference
+class nsDOMStorageManager MOZ_FINAL : public nsIDOMStorageManager
+                                    , public nsIObserver
+                                    , public nsSupportsWeakReference
 {
 public:
   // nsISupports
   NS_DECL_ISUPPORTS
 
   // nsIDOMStorageManager
   NS_DECL_NSIDOMSTORAGEMANAGER
 
@@ -202,18 +203,18 @@ protected:
   nsCString mScopeDBKey;
   nsCString mQuotaETLDplus1DomainDBKey;
   nsCString mQuotaDomainDBKey;
 
   bool mCanUseChromePersist;
   bool mInPrivateBrowsing;
 };
 
-class DOMStorageImpl : public DOMStorageBase
-                     , public nsSupportsWeakReference
+class DOMStorageImpl MOZ_FINAL : public DOMStorageBase
+                               , public nsSupportsWeakReference
 {
 public:
   NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(DOMStorageImpl, nsIPrivacyTransitionObserver)
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
   NS_DECL_NSIPRIVACYTRANSITIONOBSERVER
 
   DOMStorageImpl(nsDOMStorage*);
   DOMStorageImpl(nsDOMStorage*, DOMStorageImpl&);
@@ -387,19 +388,19 @@ public:
   // this storage also in mLocalStorages hash table.
   nsDOMStorageType mStorageType;
 
   friend class nsIDOMStorage2;
   nsCOMPtr<nsIPrincipal> mPrincipal;
   nsDOMStorage2* mEventBroadcaster;
 };
 
-class nsDOMStorage2 : public nsIDOMStorage,
-                      public nsPIDOMStorage,
-                      public nsIInterfaceRequestor
+class nsDOMStorage2 MOZ_FINAL : public nsIDOMStorage,
+                                public nsPIDOMStorage,
+                                public nsIInterfaceRequestor
 {
 public:
   // nsISupports
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
   NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsDOMStorage2, nsIDOMStorage)
 
   nsDOMStorage2(nsDOMStorage2& aThat);
   nsDOMStorage2();
--- a/dom/src/storage/nsDOMStoragePersistentDB.cpp
+++ b/dom/src/storage/nsDOMStoragePersistentDB.cpp
@@ -15,24 +15,25 @@
 #include "mozStorageCID.h"
 #include "mozStorageHelper.h"
 #include "mozIStorageService.h"
 #include "mozIStorageBindingParamsArray.h"
 #include "mozIStorageBindingParams.h"
 #include "mozIStorageValueArray.h"
 #include "mozIStorageFunction.h"
 #include "nsNetUtil.h"
+#include "mozilla/Attributes.h"
 
 using namespace mozilla;
 
 // Temporary tables for a storage scope will be flushed if found older
 // then this time in seconds since the load
 #define TEMP_TABLE_MAX_AGE (10) // seconds
 
-class nsReverseStringSQLFunction : public mozIStorageFunction
+class nsReverseStringSQLFunction MOZ_FINAL : public mozIStorageFunction
 {
   NS_DECL_ISUPPORTS
   NS_DECL_MOZISTORAGEFUNCTION
 };
 
 NS_IMPL_ISUPPORTS1(nsReverseStringSQLFunction, mozIStorageFunction)
 
 NS_IMETHODIMP
@@ -55,17 +56,17 @@ nsReverseStringSQLFunction::OnFunctionCa
   rv = outVar->SetAsAUTF8String(result);
   NS_ENSURE_SUCCESS(rv, rv);
 
   *aResult = outVar.get();
   outVar.forget();
   return NS_OK;
 }
 
-class nsIsOfflineSQLFunction : public mozIStorageFunction
+class nsIsOfflineSQLFunction MOZ_FINAL : public mozIStorageFunction
 {
   NS_DECL_ISUPPORTS
   NS_DECL_MOZISTORAGEFUNCTION
 };
 
 NS_IMPL_ISUPPORTS1(nsIsOfflineSQLFunction, mozIStorageFunction)
 
 nsDOMStoragePersistentDB::nsDOMStoragePersistentDB()
--- a/dom/system/nsDeviceSensors.cpp
+++ b/dom/system/nsDeviceSensors.cpp
@@ -12,29 +12,30 @@
 #include "nsIDOMWindow.h"
 #include "nsPIDOMWindow.h"
 #include "nsIDOMDocument.h"
 #include "nsIDOMEventTarget.h"
 #include "nsIServiceManager.h"
 #include "nsIServiceManager.h"
 
 #include "mozilla/Preferences.h"
+#include "mozilla/Attributes.h"
 
 using namespace mozilla;
 using namespace hal;
 
 #undef near
 
 // also see sDefaultSensorHint in mobile/android/base/GeckoAppShell.java
 #define DEFAULT_SENSOR_POLL 100
 
 static const nsTArray<nsIDOMWindow*>::index_type NoIndex =
   nsTArray<nsIDOMWindow*>::NoIndex;
 
-class nsDeviceSensorData : public nsIDeviceSensorData
+class nsDeviceSensorData MOZ_FINAL : public nsIDeviceSensorData
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIDEVICESENSORDATA
 
   nsDeviceSensorData(unsigned long type, double x, double y, double z);
 
 private:
--- a/dom/workers/FileReaderSyncPrivate.h
+++ b/dom/workers/FileReaderSyncPrivate.h
@@ -6,24 +6,25 @@
 
 #ifndef nsDOMFileReaderSyncPrivate_h
 #define nsDOMFileReaderSyncPrivate_h
 
 #include "Workers.h"
 
 #include "nsICharsetDetectionObserver.h"
 #include "nsStringGlue.h"
+#include "mozilla/Attributes.h"
 
 class nsIInputStream;
 class nsIDOMBlob;
 
 BEGIN_WORKERS_NAMESPACE
 
-class FileReaderSyncPrivate : public PrivatizableBase,
-                              public nsICharsetDetectionObserver
+class FileReaderSyncPrivate MOZ_FINAL : public PrivatizableBase,
+                                        public nsICharsetDetectionObserver
 {
   nsCString mCharset;
   nsresult ConvertStream(nsIInputStream *aStream, const char *aCharset,
                          nsAString &aResult);
   nsresult GuessCharset(nsIInputStream *aStream, nsACString &aCharset);
 
 public:
   NS_DECL_ISUPPORTS
--- a/dom/workers/RuntimeService.h
+++ b/dom/workers/RuntimeService.h
@@ -15,26 +15,27 @@
 #include "mozilla/Mutex.h"
 #include "mozilla/TimeStamp.h"
 #include "nsAutoPtr.h"
 #include "nsClassHashtable.h"
 #include "nsCOMPtr.h"
 #include "nsHashKeys.h"
 #include "nsStringGlue.h"
 #include "nsTArray.h"
+#include "mozilla/Attributes.h"
 
 class nsIThread;
 class nsITimer;
 class nsPIDOMWindow;
 
 BEGIN_WORKERS_NAMESPACE
 
 class WorkerPrivate;
 
-class RuntimeService : public nsIObserver
+class RuntimeService MOZ_FINAL : public nsIObserver
 {
   struct WorkerDomainInfo
   {
     nsCString mDomain;
     nsTArray<WorkerPrivate*> mActiveWorkers;
     nsTArray<WorkerPrivate*> mQueuedWorkers;
     PRUint32 mChildWorkerCount;
 
--- a/dom/workers/WorkerPrivate.cpp
+++ b/dom/workers/WorkerPrivate.cpp
@@ -34,16 +34,17 @@
 #include "nsDOMClassInfo.h"
 #include "nsDOMJSUtils.h"
 #include "nsGUIEvent.h"
 #include "nsJSEnvironment.h"
 #include "nsJSUtils.h"
 #include "nsNetUtil.h"
 #include "nsThreadUtils.h"
 #include "xpcpublic.h"
+#include "mozilla/Attributes.h"
 
 #ifdef ANDROID
 #include <android/log.h>
 #endif
 
 #include "Events.h"
 #include "Exceptions.h"
 #include "File.h"
@@ -136,17 +137,17 @@ struct WorkerJSRuntimeStats : public JS:
     MOZ_ASSERT(!cstats->extra);
     
     // ReportJSRuntimeExplicitTreeStats expects that cstats->extra is a char pointer
     const char *name = js::IsAtomsCompartment(c) ? "Web Worker Atoms" : "Web Worker";
     cstats->extra = const_cast<char *>(name);
   }
 };
   
-class WorkerMemoryReporter : public nsIMemoryMultiReporter
+class WorkerMemoryReporter MOZ_FINAL : public nsIMemoryMultiReporter
 {
   WorkerPrivate* mWorkerPrivate;
   nsCString mAddressString;
   nsCString mPathPrefix;
 
 public:
   NS_DECL_ISUPPORTS
 
@@ -972,17 +973,17 @@ public:
 
   bool
   WorkerRun(JSContext* aCx, WorkerPrivate* aWorkerPrivate)
   {
     return aWorkerPrivate->NotifyInternal(aCx, mStatus);
   }
 };
 
-class CloseRunnable : public WorkerControlRunnable
+class CloseRunnable MOZ_FINAL : public WorkerControlRunnable
 {
 public:
   CloseRunnable(WorkerPrivate* aWorkerPrivate)
   : WorkerControlRunnable(aWorkerPrivate, ParentThread, UnchangedBusyCount)
   { }
 
   bool
   WorkerRun(JSContext* aCx, WorkerPrivate* aWorkerPrivate)
@@ -1273,17 +1274,17 @@ public:
 };
 
 void
 DummyCallback(nsITimer* aTimer, void* aClosure)
 {
   // Nothing!
 }
 
-class WorkerRunnableEventTarget : public nsIEventTarget
+class WorkerRunnableEventTarget MOZ_FINAL : public nsIEventTarget
 {
 protected:
   nsRefPtr<WorkerRunnable> mWorkerRunnable;
 
 public:
   WorkerRunnableEventTarget(WorkerRunnable* aWorkerRunnable)
   : mWorkerRunnable(aWorkerRunnable)
   { }
--- a/dom/workers/XMLHttpRequest.cpp
+++ b/dom/workers/XMLHttpRequest.cpp
@@ -23,16 +23,17 @@
 #include "EventTarget.h"
 #include "Exceptions.h"
 #include "File.h"
 #include "RuntimeService.h"
 #include "WorkerPrivate.h"
 #include "XMLHttpRequestUpload.h"
 
 #include "DOMBindingInlines.h"
+#include "mozilla/Attributes.h"
 
 USING_WORKERS_NAMESPACE
 
 using mozilla::dom::workers::exceptions::ThrowDOMExceptionForNSResult;
 using mozilla::ErrorResult;
 
 // XXX Need to figure this out...
 #define UNCATCHABLE_EXCEPTION NS_ERROR_OUT_OF_MEMORY
@@ -77,17 +78,17 @@ using mozilla::ErrorResult;
  *  runnable which is guaranteed to run.
  *
  *  NB: Some of this could probably be simplified now that we have the
  *  inner/outer channel ids.
  */
 
 BEGIN_WORKERS_NAMESPACE
 
-class Proxy : public nsIDOMEventListener
+class Proxy MOZ_FINAL : public nsIDOMEventListener
 {
 public:
   // Read on multiple threads.
   WorkerPrivate* mWorkerPrivate;
   XMLHttpRequest* mXMLHttpRequestPrivate;
 
   // Only touched on the main thread.
   nsRefPtr<nsXMLHttpRequest> mXHR;
@@ -371,18 +372,18 @@ public:
 
     mProxy->Teardown();
     mProxy = nsnull;
 
     return NS_OK;
   }
 };
 
-class LoadStartDetectionRunnable : public nsIRunnable,
-                                   public nsIDOMEventListener
+class LoadStartDetectionRunnable MOZ_FINAL : public nsIRunnable,
+                                             public nsIDOMEventListener
 {
   WorkerPrivate* mWorkerPrivate;
   nsRefPtr<Proxy> mProxy;
   nsRefPtr<nsXMLHttpRequest> mXHR;
   XMLHttpRequest* mXMLHttpRequestPrivate;
   nsString mEventType;
   bool mReceivedLoadStart;
   PRUint32 mChannelId;