Bug 1117035 - Mark virtual overridden functions as MOZ_OVERRIDE in XPCOM; r=froydnj
authorEhsan Akhgari <ehsan@mozilla.com>
Fri, 02 Jan 2015 01:09:28 -0500
changeset 247856 c3fc371864af3616973861ee140bc23f111a3743
parent 247855 36c28e5f5d0a7fab695e5962ea87aaf18689ddd9
child 247857 58f7805a959f3573d63284e4ab8546631c46cbf5
push id4489
push userraliiev@mozilla.com
push dateMon, 23 Feb 2015 15:17:55 +0000
treeherdermozilla-beta@fd7c3dc24146 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1117035
milestone37.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 1117035 - Mark virtual overridden functions as MOZ_OVERRIDE in XPCOM; r=froydnj
xpcom/base/nsCycleCollector.cpp
xpcom/base/nsDumpUtils.h
xpcom/base/nsIStatusReporter.idl
xpcom/base/nsMemoryImpl.h
xpcom/base/nsMemoryInfoDumper.cpp
xpcom/base/nsMemoryReporterManager.cpp
xpcom/build/XPCOMInit.cpp
xpcom/ds/nsStringEnumerator.cpp
xpcom/ds/nsSupportsArray.cpp
xpcom/ds/nsSupportsArray.h
xpcom/glue/nsCycleCollectionParticipant.h
xpcom/glue/nsEnumeratorUtils.cpp
xpcom/glue/nsISupportsImpl.h
xpcom/glue/nsWeakReference.cpp
xpcom/glue/tests/gtest/TestArray.cpp
xpcom/io/nsAppFileLocationProvider.cpp
xpcom/io/nsStreamUtils.cpp
xpcom/reflect/xptcall/xptcprivate.h
xpcom/reflect/xptinfo/xptiprivate.h
xpcom/tests/TestHarness.h
xpcom/threads/nsTimerImpl.h
--- a/xpcom/base/nsCycleCollector.cpp
+++ b/xpcom/base/nsCycleCollector.cpp
@@ -1734,69 +1734,69 @@ public:
 
   NS_DECL_ISUPPORTS
 
   void SetAllTraces()
   {
     mWantAllTraces = true;
   }
 
-  NS_IMETHOD AllTraces(nsICycleCollectorListener** aListener)
+  NS_IMETHOD AllTraces(nsICycleCollectorListener** aListener) MOZ_OVERRIDE
   {
     SetAllTraces();
     NS_ADDREF(*aListener = this);
     return NS_OK;
   }
 
-  NS_IMETHOD GetWantAllTraces(bool* aAllTraces)
+  NS_IMETHOD GetWantAllTraces(bool* aAllTraces) MOZ_OVERRIDE
   {
     *aAllTraces = mWantAllTraces;
     return NS_OK;
   }
 
-  NS_IMETHOD GetDisableLog(bool* aDisableLog)
+  NS_IMETHOD GetDisableLog(bool* aDisableLog) MOZ_OVERRIDE
   {
     *aDisableLog = mDisableLog;
     return NS_OK;
   }
 
-  NS_IMETHOD SetDisableLog(bool aDisableLog)
+  NS_IMETHOD SetDisableLog(bool aDisableLog) MOZ_OVERRIDE
   {
     mDisableLog = aDisableLog;
     return NS_OK;
   }
 
-  NS_IMETHOD GetWantAfterProcessing(bool* aWantAfterProcessing)
+  NS_IMETHOD GetWantAfterProcessing(bool* aWantAfterProcessing) MOZ_OVERRIDE
   {
     *aWantAfterProcessing = mWantAfterProcessing;
     return NS_OK;
   }
 
-  NS_IMETHOD SetWantAfterProcessing(bool aWantAfterProcessing)
+  NS_IMETHOD SetWantAfterProcessing(bool aWantAfterProcessing) MOZ_OVERRIDE
   {
     mWantAfterProcessing = aWantAfterProcessing;
     return NS_OK;
   }
 
-  NS_IMETHOD GetLogSink(nsICycleCollectorLogSink** aLogSink)
+  NS_IMETHOD GetLogSink(nsICycleCollectorLogSink** aLogSink) MOZ_OVERRIDE
   {
     NS_ADDREF(*aLogSink = mLogSink);
     return NS_OK;
   }
 
-  NS_IMETHOD SetLogSink(nsICycleCollectorLogSink* aLogSink)
+  NS_IMETHOD SetLogSink(nsICycleCollectorLogSink* aLogSink) MOZ_OVERRIDE
   {
     if (!aLogSink) {
       return NS_ERROR_INVALID_ARG;
     }
     mLogSink = aLogSink;
     return NS_OK;
   }
 
-  NS_IMETHOD Begin()
+  NS_IMETHOD Begin() MOZ_OVERRIDE
   {
     nsresult rv;
 
     mCurrentAddress.AssignLiteral("0x");
     ClearDescribers();
     if (mDisableLog) {
       return NS_OK;
     }
@@ -1811,17 +1811,17 @@ public:
     }
     rv = mLogSink->CloseGCLog();
     NS_ENSURE_SUCCESS(rv, rv);
 
     fprintf(mCCLog, "# WantAllTraces=%s\n", mWantAllTraces ? "true" : "false");
     return NS_OK;
   }
   NS_IMETHOD NoteRefCountedObject(uint64_t aAddress, uint32_t aRefCount,
-                                  const char* aObjectDescription)
+                                  const char* aObjectDescription) MOZ_OVERRIDE
   {
     if (!mDisableLog) {
       fprintf(mCCLog, "%p [rc=%u] %s\n", (void*)aAddress, aRefCount,
               aObjectDescription);
     }
     if (mWantAfterProcessing) {
       CCGraphDescriber* d =  new CCGraphDescriber();
       mDescribers.insertBack(d);
@@ -1831,17 +1831,17 @@ public:
       d->mAddress = mCurrentAddress;
       d->mCnt = aRefCount;
       d->mName.Append(aObjectDescription);
     }
     return NS_OK;
   }
   NS_IMETHOD NoteGCedObject(uint64_t aAddress, bool aMarked,
                             const char* aObjectDescription,
-                            uint64_t aCompartmentAddress)
+                            uint64_t aCompartmentAddress) MOZ_OVERRIDE
   {
     if (!mDisableLog) {
       fprintf(mCCLog, "%p [gc%s] %s\n", (void*)aAddress,
               aMarked ? ".marked" : "", aObjectDescription);
     }
     if (mWantAfterProcessing) {
       CCGraphDescriber* d =  new CCGraphDescriber();
       mDescribers.insertBack(d);
@@ -1855,95 +1855,95 @@ public:
         d->mCompartmentOrToAddress.AssignLiteral("0x");
         d->mCompartmentOrToAddress.AppendInt(aCompartmentAddress, 16);
       } else {
         d->mCompartmentOrToAddress.SetIsVoid(true);
       }
     }
     return NS_OK;
   }
-  NS_IMETHOD NoteEdge(uint64_t aToAddress, const char* aEdgeName)
+  NS_IMETHOD NoteEdge(uint64_t aToAddress, const char* aEdgeName) MOZ_OVERRIDE
   {
     if (!mDisableLog) {
       fprintf(mCCLog, "> %p %s\n", (void*)aToAddress, aEdgeName);
     }
     if (mWantAfterProcessing) {
       CCGraphDescriber* d =  new CCGraphDescriber();
       mDescribers.insertBack(d);
       d->mType = CCGraphDescriber::eEdge;
       d->mAddress = mCurrentAddress;
       d->mCompartmentOrToAddress.AssignLiteral("0x");
       d->mCompartmentOrToAddress.AppendInt(aToAddress, 16);
       d->mName.Append(aEdgeName);
     }
     return NS_OK;
   }
   NS_IMETHOD NoteWeakMapEntry(uint64_t aMap, uint64_t aKey,
-                              uint64_t aKeyDelegate, uint64_t aValue)
+                              uint64_t aKeyDelegate, uint64_t aValue) MOZ_OVERRIDE
   {
     if (!mDisableLog) {
       fprintf(mCCLog, "WeakMapEntry map=%p key=%p keyDelegate=%p value=%p\n",
               (void*)aMap, (void*)aKey, (void*)aKeyDelegate, (void*)aValue);
     }
     // We don't support after-processing for weak map entries.
     return NS_OK;
   }
-  NS_IMETHOD NoteIncrementalRoot(uint64_t aAddress)
+  NS_IMETHOD NoteIncrementalRoot(uint64_t aAddress) MOZ_OVERRIDE
   {
     if (!mDisableLog) {
       fprintf(mCCLog, "IncrementalRoot %p\n", (void*)aAddress);
     }
     // We don't support after-processing for incremental roots.
     return NS_OK;
   }
-  NS_IMETHOD BeginResults()
+  NS_IMETHOD BeginResults() MOZ_OVERRIDE
   {
     if (!mDisableLog) {
       fputs("==========\n", mCCLog);
     }
     return NS_OK;
   }
-  NS_IMETHOD DescribeRoot(uint64_t aAddress, uint32_t aKnownEdges)
+  NS_IMETHOD DescribeRoot(uint64_t aAddress, uint32_t aKnownEdges) MOZ_OVERRIDE
   {
     if (!mDisableLog) {
       fprintf(mCCLog, "%p [known=%u]\n", (void*)aAddress, aKnownEdges);
     }
     if (mWantAfterProcessing) {
       CCGraphDescriber* d =  new CCGraphDescriber();
       mDescribers.insertBack(d);
       d->mType = CCGraphDescriber::eRoot;
       d->mAddress.AppendInt(aAddress, 16);
       d->mCnt = aKnownEdges;
     }
     return NS_OK;
   }
-  NS_IMETHOD DescribeGarbage(uint64_t aAddress)
+  NS_IMETHOD DescribeGarbage(uint64_t aAddress) MOZ_OVERRIDE
   {
     if (!mDisableLog) {
       fprintf(mCCLog, "%p [garbage]\n", (void*)aAddress);
     }
     if (mWantAfterProcessing) {
       CCGraphDescriber* d =  new CCGraphDescriber();
       mDescribers.insertBack(d);
       d->mType = CCGraphDescriber::eGarbage;
       d->mAddress.AppendInt(aAddress, 16);
     }
     return NS_OK;
   }
-  NS_IMETHOD End()
+  NS_IMETHOD End() MOZ_OVERRIDE
   {
     if (!mDisableLog) {
       mCCLog = nullptr;
       nsresult rv = mLogSink->CloseCCLog();
       NS_ENSURE_SUCCESS(rv, rv);
     }
     return NS_OK;
   }
   NS_IMETHOD ProcessNext(nsICycleCollectorHandler* aHandler,
-                         bool* aCanContinue)
+                         bool* aCanContinue) MOZ_OVERRIDE
   {
     if (NS_WARN_IF(!aHandler) || NS_WARN_IF(!mWantAfterProcessing)) {
       return NS_ERROR_UNEXPECTED;
     }
     CCGraphDescriber* d = mDescribers.popFirst();
     if (d) {
       switch (d->mType) {
         case CCGraphDescriber::eRefCountedObject:
--- a/xpcom/base/nsDumpUtils.h
+++ b/xpcom/base/nsDumpUtils.h
@@ -57,18 +57,18 @@ public:
    * Open the fd to watch.  If we encounter an error, return -1.
    */
   virtual int OpenFd() = 0;
 
   /**
    * Called when you can read() from the fd without blocking.  Note that this
    * function is also called when you're at eof (read() returns 0 in this case).
    */
-  virtual void OnFileCanReadWithoutBlocking(int aFd) = 0;
-  virtual void OnFileCanWriteWithoutBlocking(int aFd) {};
+  virtual void OnFileCanReadWithoutBlocking(int aFd) MOZ_OVERRIDE = 0;
+  virtual void OnFileCanWriteWithoutBlocking(int aFd) MOZ_OVERRIDE {};
 
   NS_DECL_THREADSAFE_ISUPPORTS
 
   /**
    * Initialize this object.  This should be called right after the object is
    * constructed.  (This would go in the constructor, except we interact with
    * XPCOM, which we can't do from a constructor because our refcount is 0 at
    * that point.)
@@ -79,17 +79,17 @@ public:
 
   virtual void StartWatching();
 
   // Since implementations can call StartWatching() multiple times, they can of
   // course call StopWatching() multiple times.
   virtual void StopWatching();
 
   NS_IMETHOD Observe(nsISupports* aSubject, const char* aTopic,
-                     const char16_t* aData)
+                     const char16_t* aData) MOZ_OVERRIDE
   {
     MOZ_ASSERT(NS_IsMainThread());
     MOZ_ASSERT(!strcmp(aTopic, "xpcom-shutdown"));
 
     XRE_GetIOMessageLoop()->PostTask(
       FROM_HERE,
       NewRunnableMethod(this, &FdWatcher::StopWatching));
 
--- a/xpcom/base/nsIStatusReporter.idl
+++ b/xpcom/base/nsIStatusReporter.idl
@@ -64,21 +64,21 @@ interface nsIStatusReporterManager : nsI
 /*
  * Note that this defaults 'process' to "", which is usually what's desired.
  */
 #define NS_STATUS_REPORTER_IMPLEMENT(_classname, _name, _desc_Function)       \
     class StatusReporter_##_classname MOZ_FINAL : public nsIStatusReporter {  \
       ~StatusReporter_##_classname() {}                                       \
     public:                                                                   \
       NS_DECL_ISUPPORTS                                                       \
-      NS_IMETHOD GetName(nsACString &name)                                    \
+      NS_IMETHOD GetName(nsACString &name) MOZ_OVERRIDE                       \
         { name.AssignLiteral(_name); return NS_OK; }                          \
-      NS_IMETHOD GetProcess(nsACString &process)                              \
+      NS_IMETHOD GetProcess(nsACString &process) MOZ_OVERRIDE                 \
         { process.Truncate(); return NS_OK; }                                 \
-      NS_IMETHOD GetDescription(nsACString &desc)                             \
+      NS_IMETHOD GetDescription(nsACString &desc) MOZ_OVERRIDE                \
         { _desc_Function(desc); return NS_OK; }                               \
     };                                                                        \
     NS_IMPL_ISUPPORTS(StatusReporter_##_classname, nsIStatusReporter)
 
 #define NS_STATUS_REPORTER_NAME(_classname)  StatusReporter_##_classname
 
 nsresult NS_RegisterStatusReporter(nsIStatusReporter *reporter);
 nsresult NS_UnregisterStatusReporter(nsIStatusReporter *reporter);
--- a/xpcom/base/nsMemoryImpl.h
+++ b/xpcom/base/nsMemoryImpl.h
@@ -15,22 +15,22 @@
 // nsMemoryImpl is a static object. We can do this because it doesn't have
 // a constructor/destructor or any instance members. Please don't add
 // instance member variables, only static member variables.
 
 class nsMemoryImpl : public nsIMemory
 {
 public:
   // We don't use the generic macros because we are a special static object
-  NS_IMETHOD QueryInterface(REFNSIID aIID, void** aResult);
-  NS_IMETHOD_(MozExternalRefCountType) AddRef(void)
+  NS_IMETHOD QueryInterface(REFNSIID aIID, void** aResult) MOZ_OVERRIDE;
+  NS_IMETHOD_(MozExternalRefCountType) AddRef(void) MOZ_OVERRIDE
   {
     return 1;
   }
-  NS_IMETHOD_(MozExternalRefCountType) Release(void)
+  NS_IMETHOD_(MozExternalRefCountType) Release(void) MOZ_OVERRIDE
   {
     return 1;
   }
 
   NS_DECL_NSIMEMORY
 
   static nsresult Create(nsISupports* aOuter,
                          const nsIID& aIID, void** aResult);
--- a/xpcom/base/nsMemoryInfoDumper.cpp
+++ b/xpcom/base/nsMemoryInfoDumper.cpp
@@ -324,22 +324,22 @@ class nsDumpGCAndCCLogsCallbackHolder MO
 public:
   NS_DECL_ISUPPORTS
 
   explicit nsDumpGCAndCCLogsCallbackHolder(nsIDumpGCAndCCLogsCallback* aCallback)
     : mCallback(aCallback)
   {
   }
 
-  NS_IMETHODIMP OnFinish()
+  NS_IMETHODIMP OnFinish() MOZ_OVERRIDE
   {
     return NS_ERROR_UNEXPECTED;
   }
 
-  NS_IMETHODIMP OnDump(nsIFile* aGCLog, nsIFile* aCCLog, bool aIsParent)
+  NS_IMETHODIMP OnDump(nsIFile* aGCLog, nsIFile* aCCLog, bool aIsParent) MOZ_OVERRIDE
   {
     return mCallback->OnDump(aGCLog, aCCLog, aIsParent);
   }
 
 private:
   ~nsDumpGCAndCCLogsCallbackHolder()
   {
     unused << mCallback->OnFinish();
@@ -470,17 +470,17 @@ public:
     , mFinishDumpingData(aFinishDumpingData)
   {
   }
 
   // This is the callback for nsIHandleReportCallback.
   NS_IMETHOD Callback(const nsACString& aProcess, const nsACString& aPath,
                       int32_t aKind, int32_t aUnits, int64_t aAmount,
                       const nsACString& aDescription,
-                      nsISupports* aData)
+                      nsISupports* aData) MOZ_OVERRIDE
   {
     nsAutoCString process;
     if (aProcess.IsEmpty()) {
       // If the process is empty, the report originated with the process doing
       // the dumping.  In that case, generate the process identifier, which is
       // of the form "$PROCESS_NAME (pid $PID)", or just "(pid $PID)" if we
       // don't have a process name.  If we're the main process, we let
       // $PROCESS_NAME be "Main Process".
@@ -510,17 +510,17 @@ public:
                               PromiseFlatCString(aDescription).get());
     }
     mWriter->EndObject();
 
     return NS_OK;
   }
 
   // This is the callback for nsIFinishReportingCallback.
-  NS_IMETHOD Callback(nsISupports* aData)
+  NS_IMETHOD Callback(nsISupports* aData) MOZ_OVERRIDE
   {
     mWriter->EndArray();  // end of "reports" array
     mWriter->End();
 
     // The call to Finish() deallocates the memory allocated by the first Write
     // call. Because that memory was live while the memory reporters ran and
     // was measured by them -- by "heap-allocated" if nothing else -- we want
     // DMD to see it as well. So we deliberately don't call Finish() until
@@ -553,17 +553,17 @@ public:
 
   TempDirFinishCallback(nsIFile* aReportsTmpFile,
                         const nsCString& aReportsFinalFilename)
     : mReportsTmpFile(aReportsTmpFile)
     , mReportsFilename(aReportsFinalFilename)
   {
   }
 
-  NS_IMETHOD Callback(nsISupports* aData)
+  NS_IMETHOD Callback(nsISupports* aData) MOZ_OVERRIDE
   {
     // Rename the memory reports file, now that we're done writing all the
     // files. Its final name is "memory-report<-identifier>-<pid>.json.gz".
 
     nsCOMPtr<nsIFile> reportsFinalFile;
     nsresult rv = NS_GetSpecialDirectory(NS_OS_TEMP_DIR,
                                          getter_AddRefs(reportsFinalFile));
     if (NS_WARN_IF(NS_FAILED(rv))) {
--- a/xpcom/base/nsMemoryReporterManager.cpp
+++ b/xpcom/base/nsMemoryReporterManager.cpp
@@ -597,17 +597,17 @@ NS_IMPL_ISUPPORTS(PrivateReporter, nsIMe
 class VsizeReporter MOZ_FINAL : public nsIMemoryReporter
 {
   ~VsizeReporter() {}
 
 public:
   NS_DECL_ISUPPORTS
 
   NS_METHOD CollectReports(nsIHandleReportCallback* aHandleReport,
-                           nsISupports* aData, bool aAnonymize)
+                           nsISupports* aData, bool aAnonymize) MOZ_OVERRIDE
   {
     int64_t amount;
     nsresult rv = VsizeDistinguishedAmount(&amount);
     NS_ENSURE_SUCCESS(rv, rv);
 
     return MOZ_COLLECT_REPORT(
       "vsize", KIND_OTHER, UNITS_BYTES, amount,
 "Memory mapped by the process, including code and data segments, the heap, "
@@ -624,17 +624,17 @@ NS_IMPL_ISUPPORTS(VsizeReporter, nsIMemo
 class ResidentReporter MOZ_FINAL : public nsIMemoryReporter
 {
   ~ResidentReporter() {}
 
 public:
   NS_DECL_ISUPPORTS
 
   NS_METHOD CollectReports(nsIHandleReportCallback* aHandleReport,
-                           nsISupports* aData, bool aAnonymize)
+                           nsISupports* aData, bool aAnonymize) MOZ_OVERRIDE
   {
     int64_t amount;
     nsresult rv = ResidentDistinguishedAmount(&amount);
     NS_ENSURE_SUCCESS(rv, rv);
 
     return MOZ_COLLECT_REPORT(
       "resident", KIND_OTHER, UNITS_BYTES, amount,
 "Memory mapped by the process that is present in physical memory, also known "
@@ -658,17 +658,17 @@ NS_IMPL_ISUPPORTS(ResidentReporter, nsIM
 class PageFaultsSoftReporter MOZ_FINAL : public nsIMemoryReporter
 {
   ~PageFaultsSoftReporter() {}
 
 public:
   NS_DECL_ISUPPORTS
 
   NS_METHOD CollectReports(nsIHandleReportCallback* aHandleReport,
-                           nsISupports* aData, bool aAnonymize)
+                           nsISupports* aData, bool aAnonymize) MOZ_OVERRIDE
   {
     struct rusage usage;
     int err = getrusage(RUSAGE_SELF, &usage);
     if (err != 0) {
       return NS_ERROR_FAILURE;
     }
     int64_t amount = usage.ru_minflt;
 
@@ -702,17 +702,17 @@ PageFaultsHardDistinguishedAmount(int64_
 class PageFaultsHardReporter MOZ_FINAL : public nsIMemoryReporter
 {
   ~PageFaultsHardReporter() {}
 
 public:
   NS_DECL_ISUPPORTS
 
   NS_METHOD CollectReports(nsIHandleReportCallback* aHandleReport,
-                           nsISupports* aData, bool aAnonymize)
+                           nsISupports* aData, bool aAnonymize) MOZ_OVERRIDE
   {
     int64_t amount = 0;
     nsresult rv = PageFaultsHardDistinguishedAmount(&amount);
     NS_ENSURE_SUCCESS(rv, rv);
 
     return MOZ_COLLECT_REPORT(
       "page-faults-hard", KIND_OTHER, UNITS_COUNT_CUMULATIVE, amount,
 "The number of hard page faults (also known as 'major page faults') that have "
@@ -751,17 +751,17 @@ HeapOverheadRatio(jemalloc_stats_t* aSta
 class JemallocHeapReporter MOZ_FINAL : public nsIMemoryReporter
 {
   ~JemallocHeapReporter() {}
 
 public:
   NS_DECL_ISUPPORTS
 
   NS_METHOD CollectReports(nsIHandleReportCallback* aHandleReport,
-                           nsISupports* aData, bool aAnonymize)
+                           nsISupports* aData, bool aAnonymize) MOZ_OVERRIDE
   {
     jemalloc_stats_t stats;
     jemalloc_stats(&stats);
 
     nsresult rv;
 
     rv = MOZ_COLLECT_REPORT(
       "heap-allocated", KIND_OTHER, UNITS_BYTES, stats.allocated,
@@ -857,17 +857,17 @@ class AtomTablesReporter MOZ_FINAL : pub
   MOZ_DEFINE_MALLOC_SIZE_OF(MallocSizeOf)
 
   ~AtomTablesReporter() {}
 
 public:
   NS_DECL_ISUPPORTS
 
   NS_METHOD CollectReports(nsIHandleReportCallback* aHandleReport,
-                           nsISupports* aData, bool aAnonymize)
+                           nsISupports* aData, bool aAnonymize) MOZ_OVERRIDE
   {
     size_t Main, Static;
     NS_SizeOfAtomTablesIncludingThis(MallocSizeOf, &Main, &Static);
 
     nsresult rv;
     rv = MOZ_COLLECT_REPORT(
       "explicit/atom-tables/main", KIND_HEAP, UNITS_BYTES, Main,
       "Memory used by the main atoms table.");
@@ -894,17 +894,17 @@ class DeadlockDetectorReporter MOZ_FINAL
   MOZ_DEFINE_MALLOC_SIZE_OF(MallocSizeOf)
 
   ~DeadlockDetectorReporter() {}
 
 public:
   NS_DECL_ISUPPORTS
 
   NS_METHOD CollectReports(nsIHandleReportCallback* aHandleReport,
-                           nsISupports* aData, bool aAnonymize)
+                           nsISupports* aData, bool aAnonymize) MOZ_OVERRIDE
   {
     return MOZ_COLLECT_REPORT(
       "explicit/deadlock-detector", KIND_HEAP, UNITS_BYTES,
       BlockingResourceBase::SizeOfDeadlockDetector(MallocSizeOf),
       "Memory used by the deadlock detector.");
   }
 };
 NS_IMPL_ISUPPORTS(DeadlockDetectorReporter, nsIMemoryReporter)
@@ -1573,17 +1573,17 @@ class ExplicitCallback MOZ_FINAL : publi
   ~ExplicitCallback() {}
 
 public:
   NS_DECL_ISUPPORTS
 
   NS_IMETHOD Callback(const nsACString& aProcess, const nsACString& aPath,
                       int32_t aKind, int32_t aUnits, int64_t aAmount,
                       const nsACString& aDescription,
-                      nsISupports* aWrappedExplicit)
+                      nsISupports* aWrappedExplicit) MOZ_OVERRIDE
   {
     // Using the "heap-allocated" reporter here instead of
     // nsMemoryReporterManager.heapAllocated goes against the usual
     // pattern.  But it's for a good reason:  in tests, we can easily
     // create artificial (i.e. deterministic) reporters -- which allows us
     // to precisely test nsMemoryReporterManager.explicit -- but we can't
     // do that for distinguished amounts.
     if (aPath.EqualsLiteral("heap-allocated") ||
--- a/xpcom/build/XPCOMInit.cpp
+++ b/xpcom/build/XPCOMInit.cpp
@@ -376,17 +376,17 @@ public:
   static void Free(const void*, void* aPtr)
   {
     return CountingFree(aPtr);
   }
 
 private:
   NS_IMETHODIMP
   CollectReports(nsIHandleReportCallback* aHandleReport, nsISupports* aData,
-                 bool aAnonymize)
+                 bool aAnonymize) MOZ_OVERRIDE
   {
     return MOZ_COLLECT_REPORT(
       "explicit/icu", KIND_HEAP, UNITS_BYTES, MemoryAllocated(),
       "Memory used by ICU, a Unicode and globalization support library.");
   }
 
   ~ICUReporter() {}
 };
@@ -401,17 +401,17 @@ class OggReporter MOZ_FINAL
   , public CountingAllocatorBase<OggReporter>
 {
 public:
   NS_DECL_ISUPPORTS
 
 private:
   NS_IMETHODIMP
   CollectReports(nsIHandleReportCallback* aHandleReport, nsISupports* aData,
-                 bool aAnonymize)
+                 bool aAnonymize) MOZ_OVERRIDE
   {
     return MOZ_COLLECT_REPORT(
       "explicit/media/libogg", KIND_HEAP, UNITS_BYTES, MemoryAllocated(),
       "Memory allocated through libogg for Ogg, Theora, and related media files.");
   }
 
   ~OggReporter() {}
 };
@@ -427,17 +427,17 @@ class VPXReporter MOZ_FINAL
   , public CountingAllocatorBase<VPXReporter>
 {
 public:
   NS_DECL_ISUPPORTS
 
 private:
   NS_IMETHODIMP
   CollectReports(nsIHandleReportCallback* aHandleReport, nsISupports* aData,
-                 bool aAnonymize)
+                 bool aAnonymize) MOZ_OVERRIDE
   {
     return MOZ_COLLECT_REPORT(
       "explicit/media/libvpx", KIND_HEAP, UNITS_BYTES, MemoryAllocated(),
       "Memory allocated through libvpx for WebM media files.");
   }
 
   ~VPXReporter() {}
 };
@@ -454,17 +454,17 @@ class NesteggReporter MOZ_FINAL
   , public CountingAllocatorBase<NesteggReporter>
 {
 public:
   NS_DECL_ISUPPORTS
 
 private:
   NS_IMETHODIMP
   CollectReports(nsIHandleReportCallback* aHandleReport, nsISupports* aData,
-                 bool aAnonymize)
+                 bool aAnonymize) MOZ_OVERRIDE
   {
     return MOZ_COLLECT_REPORT(
       "explicit/media/libnestegg", KIND_HEAP, UNITS_BYTES, MemoryAllocated(),
       "Memory allocated through libnestegg for WebM media files.");
   }
 
   ~NesteggReporter() {}
 };
--- a/xpcom/ds/nsStringEnumerator.cpp
+++ b/xpcom/ds/nsStringEnumerator.cpp
@@ -50,17 +50,17 @@ public:
     , mIsUnicode(false)
   {}
 
   NS_DECL_ISUPPORTS
   NS_DECL_NSIUTF8STRINGENUMERATOR
 
   // have to declare nsIStringEnumerator manually, because of
   // overlapping method names
-  NS_IMETHOD GetNext(nsAString& aResult);
+  NS_IMETHOD GetNext(nsAString& aResult) MOZ_OVERRIDE;
   NS_DECL_NSISIMPLEENUMERATOR
 
 private:
   ~nsStringEnumerator()
   {
     if (mOwnsArray) {
       // const-casting is safe here, because the NS_New*
       // constructors make sure mOwnsArray is consistent with
--- a/xpcom/ds/nsSupportsArray.cpp
+++ b/xpcom/ds/nsSupportsArray.cpp
@@ -447,25 +447,25 @@ nsSupportsArray::RemoveElementsAt(uint32
       ::memmove(mArray + aIndex, mArray + aIndex + aCount,
                 slide * sizeof(nsISupports*));
     }
     return true;
   }
   return false;
 }
 
-NS_IMETHODIMP_(bool)
-nsSupportsArray::RemoveElement(const nsISupports* aElement, uint32_t aStartIndex)
+NS_IMETHODIMP
+nsSupportsArray::RemoveElement(nsISupports* aElement)
 {
-  int32_t theIndex = IndexOfStartingAt(aElement, aStartIndex);
+  int32_t theIndex = IndexOfStartingAt(aElement, 0);
   if (theIndex >= 0) {
-    return RemoveElementAt(theIndex);
+    return RemoveElementAt(theIndex) ? NS_OK : NS_ERROR_FAILURE;
   }
 
-  return false;
+  return NS_ERROR_FAILURE;
 }
 
 NS_IMETHODIMP_(bool)
 nsSupportsArray::RemoveLastElement(const nsISupports* aElement)
 {
   int32_t theIndex = LastIndexOf(aElement);
   if (theIndex >= 0) {
     return RemoveElementAt(theIndex);
--- a/xpcom/ds/nsSupportsArray.h
+++ b/xpcom/ds/nsSupportsArray.h
@@ -21,119 +21,113 @@ public:
   nsSupportsArray(void);
   static nsresult Create(nsISupports* aOuter, REFNSIID aIID, void** aResult);
 
   NS_DECL_THREADSAFE_ISUPPORTS
 
   NS_DECL_NSISERIALIZABLE
 
   // nsICollection methods:
-  NS_IMETHOD Count(uint32_t* aResult)
+  NS_IMETHOD Count(uint32_t* aResult) MOZ_OVERRIDE
   {
     *aResult = mCount;
     return NS_OK;
   }
-  NS_IMETHOD GetElementAt(uint32_t aIndex, nsISupports** aResult);
-  NS_IMETHOD QueryElementAt(uint32_t aIndex, const nsIID& aIID, void** aResult)
+  NS_IMETHOD GetElementAt(uint32_t aIndex, nsISupports** aResult) MOZ_OVERRIDE;
+  NS_IMETHOD QueryElementAt(uint32_t aIndex, const nsIID& aIID, void** aResult) MOZ_OVERRIDE
   {
     if (aIndex < mCount) {
       nsISupports* element = mArray[aIndex];
       if (element) {
         return element->QueryInterface(aIID, aResult);
       }
     }
     return NS_ERROR_FAILURE;
   }
-  NS_IMETHOD SetElementAt(uint32_t aIndex, nsISupports* aValue)
+  NS_IMETHOD SetElementAt(uint32_t aIndex, nsISupports* aValue) MOZ_OVERRIDE
   {
     return ReplaceElementAt(aValue, aIndex) ? NS_OK : NS_ERROR_FAILURE;
   }
-  NS_IMETHOD AppendElement(nsISupports* aElement)
+  NS_IMETHOD AppendElement(nsISupports* aElement) MOZ_OVERRIDE
   {
     // XXX Invalid cast of bool to nsresult (bug 778110)
     return (nsresult)InsertElementAt(aElement, mCount)/* ? NS_OK : NS_ERROR_FAILURE*/;
   }
   // XXX this is badly named - should be RemoveFirstElement
-  NS_IMETHOD RemoveElement(nsISupports* aElement)
-  {
-    // XXX Invalid cast of bool to nsresult (bug 778110)
-    return (nsresult)RemoveElement(aElement, 0)/* ? NS_OK : NS_ERROR_FAILURE*/;
-  }
-  NS_IMETHOD_(bool) MoveElement(int32_t aFrom, int32_t aTo);
-  NS_IMETHOD Enumerate(nsIEnumerator** aResult);
-  NS_IMETHOD Clear(void);
+  NS_IMETHOD RemoveElement(nsISupports* aElement) MOZ_OVERRIDE;
+  NS_IMETHOD_(bool) MoveElement(int32_t aFrom, int32_t aTo) MOZ_OVERRIDE;
+  NS_IMETHOD Enumerate(nsIEnumerator** aResult) MOZ_OVERRIDE;
+  NS_IMETHOD Clear(void) MOZ_OVERRIDE;
 
   // nsISupportsArray methods:
-  NS_IMETHOD_(bool) Equals(const nsISupportsArray* aOther);
+  NS_IMETHOD_(bool) Equals(const nsISupportsArray* aOther) MOZ_OVERRIDE;
 
-  NS_IMETHOD_(int32_t) IndexOf(const nsISupports* aPossibleElement);
+  NS_IMETHOD_(int32_t) IndexOf(const nsISupports* aPossibleElement) MOZ_OVERRIDE;
   NS_IMETHOD_(int32_t) IndexOfStartingAt(const nsISupports* aPossibleElement,
-                                         uint32_t aStartIndex = 0);
-  NS_IMETHOD_(int32_t) LastIndexOf(const nsISupports* aPossibleElement);
+                                         uint32_t aStartIndex = 0) MOZ_OVERRIDE;
+  NS_IMETHOD_(int32_t) LastIndexOf(const nsISupports* aPossibleElement) MOZ_OVERRIDE;
 
-  NS_IMETHOD GetIndexOf(nsISupports* aPossibleElement, int32_t* aResult)
+  NS_IMETHOD GetIndexOf(nsISupports* aPossibleElement, int32_t* aResult) MOZ_OVERRIDE
   {
     *aResult = IndexOf(aPossibleElement);
     return NS_OK;
   }
 
   NS_IMETHOD GetIndexOfStartingAt(nsISupports* aPossibleElement,
-                                  uint32_t aStartIndex, int32_t* aResult)
+                                  uint32_t aStartIndex, int32_t* aResult) MOZ_OVERRIDE
   {
     *aResult = IndexOfStartingAt(aPossibleElement, aStartIndex);
     return NS_OK;
   }
 
-  NS_IMETHOD GetLastIndexOf(nsISupports* aPossibleElement, int32_t* aResult)
+  NS_IMETHOD GetLastIndexOf(nsISupports* aPossibleElement, int32_t* aResult) MOZ_OVERRIDE
   {
     *aResult = LastIndexOf(aPossibleElement);
     return NS_OK;
   }
 
-  NS_IMETHOD_(bool) InsertElementAt(nsISupports* aElement, uint32_t aIndex);
+  NS_IMETHOD_(bool) InsertElementAt(nsISupports* aElement, uint32_t aIndex) MOZ_OVERRIDE;
 
-  NS_IMETHOD_(bool) ReplaceElementAt(nsISupports* aElement, uint32_t aIndex);
+  NS_IMETHOD_(bool) ReplaceElementAt(nsISupports* aElement, uint32_t aIndex) MOZ_OVERRIDE;
 
-  NS_IMETHOD_(bool) RemoveElementAt(uint32_t aIndex)
+  NS_IMETHOD_(bool) RemoveElementAt(uint32_t aIndex) MOZ_OVERRIDE
   {
     return RemoveElementsAt(aIndex, 1);
   }
-  NS_IMETHOD_(bool) RemoveElement(const nsISupports* aElement,
-                                  uint32_t aStartIndex = 0);
-  NS_IMETHOD_(bool) RemoveLastElement(const nsISupports* aElement);
+  NS_IMETHOD_(bool) RemoveLastElement(const nsISupports* aElement) MOZ_OVERRIDE;
 
-  NS_IMETHOD DeleteLastElement(nsISupports* aElement)
+  NS_IMETHOD DeleteLastElement(nsISupports* aElement) MOZ_OVERRIDE
   {
     return (RemoveLastElement(aElement) ? NS_OK : NS_ERROR_FAILURE);
   }
 
-  NS_IMETHOD DeleteElementAt(uint32_t aIndex)
+  NS_IMETHOD DeleteElementAt(uint32_t aIndex) MOZ_OVERRIDE
   {
     return (RemoveElementAt(aIndex) ? NS_OK : NS_ERROR_FAILURE);
   }
 
-  NS_IMETHOD_(bool) AppendElements(nsISupportsArray* aElements)
+  NS_IMETHOD_(bool) AppendElements(nsISupportsArray* aElements) MOZ_OVERRIDE
   {
     return InsertElementsAt(aElements, mCount);
   }
 
-  NS_IMETHOD Compact(void);
+  NS_IMETHOD Compact(void) MOZ_OVERRIDE;
 
-  NS_IMETHOD Clone(nsISupportsArray** aResult);
+  NS_IMETHOD Clone(nsISupportsArray** aResult) MOZ_OVERRIDE;
 
   NS_IMETHOD_(bool) InsertElementsAt(nsISupportsArray* aOther,
-                                     uint32_t aIndex);
+                                     uint32_t aIndex) MOZ_OVERRIDE;
 
-  NS_IMETHOD_(bool) RemoveElementsAt(uint32_t aIndex, uint32_t aCount);
+  NS_IMETHOD_(bool) RemoveElementsAt(uint32_t aIndex, uint32_t aCount) MOZ_OVERRIDE;
 
-  NS_IMETHOD_(bool) SizeTo(int32_t aSize);
+  NS_IMETHOD_(bool) SizeTo(int32_t aSize) MOZ_OVERRIDE;
 protected:
   void DeleteArray(void);
 
-  NS_IMETHOD_(void) GrowArrayBy(int32_t aGrowBy);
+  void GrowArrayBy(int32_t aGrowBy);
 
   nsISupports** mArray;
   uint32_t mArraySize;
   uint32_t mCount;
   nsISupports*  mAutoArray[kAutoArraySize];
 #if DEBUG_SUPPORTSARRAY
   uint32_t mMaxCount;
   uint32_t mMaxSize;
--- a/xpcom/glue/nsCycleCollectionParticipant.h
+++ b/xpcom/glue/nsCycleCollectionParticipant.h
@@ -478,26 +478,36 @@ DowncastCCParticipant(void* aPtr)
 
 ///////////////////////////////////////////////////////////////////////////////
 // Helpers for implementing a concrete nsCycleCollectionParticipant
 ///////////////////////////////////////////////////////////////////////////////
 
 // If a class defines a participant, then QIing an instance of that class to
 // nsXPCOMCycleCollectionParticipant should produce that participant.
 #ifdef DEBUG
-#define NS_CHECK_FOR_RIGHT_PARTICIPANT_IMPL(_class)                            \
-    virtual void CheckForRightParticipant()                                    \
+#define NS_CHECK_FOR_RIGHT_PARTICIPANT_BASE                                    \
+    virtual void CheckForRightParticipant()
+#define NS_CHECK_FOR_RIGHT_PARTICIPANT_DERIVED                                 \
+    virtual void CheckForRightParticipant() MOZ_OVERRIDE
+#define NS_CHECK_FOR_RIGHT_PARTICIPANT_BODY(_class)                            \
     {                                                                          \
       nsXPCOMCycleCollectionParticipant *p;                                    \
       CallQueryInterface(this, &p);                                            \
       MOZ_ASSERT(p == &NS_CYCLE_COLLECTION_INNERNAME,                          \
                  #_class " should QI to its own CC participant");              \
     }
+#define NS_CHECK_FOR_RIGHT_PARTICIPANT_IMPL(_class)                            \
+    NS_CHECK_FOR_RIGHT_PARTICIPANT_BASE                                        \
+    NS_CHECK_FOR_RIGHT_PARTICIPANT_BODY(_class)
+#define NS_CHECK_FOR_RIGHT_PARTICIPANT_IMPL_INHERITED(_class)                  \
+    NS_CHECK_FOR_RIGHT_PARTICIPANT_DERIVED                                     \
+    NS_CHECK_FOR_RIGHT_PARTICIPANT_BODY(_class)
 #else
 #define NS_CHECK_FOR_RIGHT_PARTICIPANT_IMPL(_class)
+#define NS_CHECK_FOR_RIGHT_PARTICIPANT_IMPL_INHERITED(_class)
 #endif
 
 #define NS_DECL_CYCLE_COLLECTION_CLASS_BODY_NO_UNLINK(_class, _base)           \
 public:                                                                        \
   NS_IMETHOD Traverse(void *p, nsCycleCollectionTraversalCallback &cb);        \
   NS_IMETHOD_(void) DeleteCycleCollectable(void *p)                            \
   {                                                                            \
     DowncastCCParticipant<_class>(p)->DeleteCycleCollectable();                \
@@ -616,17 +626,17 @@ class NS_CYCLE_COLLECTION_INNERCLASS    
 {                                                                                      \
   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED_BODY(_class, _base_class)                   \
   NS_IMETHOD_(void) Trace(void *p, const TraceCallbacks &cb, void *closure);           \
   NS_IMETHOD_(bool) CanSkipReal(void *p, bool aRemovingAllowed);                       \
   NS_IMETHOD_(bool) CanSkipInCCReal(void *p);                                          \
   NS_IMETHOD_(bool) CanSkipThisReal(void *p);                                          \
   NS_IMPL_GET_XPCOM_CYCLE_COLLECTION_PARTICIPANT(_class)                               \
 }; \
-NS_CHECK_FOR_RIGHT_PARTICIPANT_IMPL(_class)  \
+NS_CHECK_FOR_RIGHT_PARTICIPANT_IMPL_INHERITED(_class)  \
 static NS_CYCLE_COLLECTION_INNERCLASS NS_CYCLE_COLLECTION_INNERNAME;
 
 #define NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(_class)  \
   NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(_class, _class)
 
 #define NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED_BODY_NO_UNLINK(_class,        \
                                                                 _base_class)   \
 public:                                                                        \
@@ -644,41 +654,41 @@ public:                                 
 #define NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(_class, _base_class)          \
 class NS_CYCLE_COLLECTION_INNERCLASS                                           \
  : public NS_CYCLE_COLLECTION_CLASSNAME(_base_class)                           \
 {                                                                              \
 public:                                                                        \
   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED_BODY(_class, _base_class)           \
   NS_IMPL_GET_XPCOM_CYCLE_COLLECTION_PARTICIPANT(_class)                       \
 };                                                                             \
-NS_CHECK_FOR_RIGHT_PARTICIPANT_IMPL(_class)                                    \
+NS_CHECK_FOR_RIGHT_PARTICIPANT_IMPL_INHERITED(_class)                          \
 static NS_CYCLE_COLLECTION_INNERCLASS NS_CYCLE_COLLECTION_INNERNAME;
 
 #define NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED_NO_UNLINK(_class,             \
                                                            _base_class)        \
 class NS_CYCLE_COLLECTION_INNERCLASS                                           \
  : public NS_CYCLE_COLLECTION_CLASSNAME(_base_class)                           \
 {                                                                              \
 public:                                                                        \
   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED_BODY_NO_UNLINK(_class, _base_class) \
   NS_IMPL_GET_XPCOM_CYCLE_COLLECTION_PARTICIPANT(_class)                       \
 };                                                                             \
-NS_CHECK_FOR_RIGHT_PARTICIPANT_IMPL(_class)                                    \
+NS_CHECK_FOR_RIGHT_PARTICIPANT_IMPL_INHERITED(_class)                          \
 static NS_CYCLE_COLLECTION_INNERCLASS NS_CYCLE_COLLECTION_INNERNAME;
 
 #define NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(_class,                 \
                                                                _base_class)            \
 class NS_CYCLE_COLLECTION_INNERCLASS                                                   \
  : public NS_CYCLE_COLLECTION_CLASSNAME(_base_class)                                   \
 {                                                                                      \
   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED_BODY(_class, _base_class)                   \
   NS_IMETHOD_(void) Trace(void *p, const TraceCallbacks &cb, void *closure);           \
   NS_IMPL_GET_XPCOM_CYCLE_COLLECTION_PARTICIPANT(_class)                               \
 };                                                                                     \
-NS_CHECK_FOR_RIGHT_PARTICIPANT_IMPL(_class)                                            \
+NS_CHECK_FOR_RIGHT_PARTICIPANT_IMPL_INHERITED(_class)                                  \
 static NS_CYCLE_COLLECTION_INNERCLASS NS_CYCLE_COLLECTION_INNERNAME;
 
 // Cycle collector participant declarations.
 
 #define NS_DECL_CYCLE_COLLECTION_NATIVE_CLASS_BODY(_class)                     \
   public:                                                                      \
     NS_IMETHOD_(void) Root(void *n);                                           \
     NS_IMETHOD_(void) Unlink(void *n);                                         \
--- a/xpcom/glue/nsEnumeratorUtils.cpp
+++ b/xpcom/glue/nsEnumeratorUtils.cpp
@@ -24,17 +24,17 @@ public:
   // nsISupports interface
   NS_DECL_ISUPPORTS_INHERITED  // not really inherited, but no mRefCnt
 
   // nsISimpleEnumerator
   NS_DECL_NSISIMPLEENUMERATOR
   NS_DECL_NSIUTF8STRINGENUMERATOR
   // can't use NS_DECL_NSISTRINGENUMERATOR because they share the
   // HasMore() signature
-  NS_IMETHOD GetNext(nsAString& aResult);
+  NS_IMETHOD GetNext(nsAString& aResult) MOZ_OVERRIDE;
 
   static EmptyEnumeratorImpl* GetInstance()
   {
     static const EmptyEnumeratorImpl kInstance;
     return const_cast<EmptyEnumeratorImpl*>(&kInstance);
   }
 };
 
@@ -97,18 +97,18 @@ NS_NewEmptyEnumerator(nsISimpleEnumerato
 ////////////////////////////////////////////////////////////////////////////////
 
 class nsSingletonEnumerator MOZ_FINAL : public nsISimpleEnumerator
 {
 public:
   NS_DECL_ISUPPORTS
 
   // nsISimpleEnumerator methods
-  NS_IMETHOD HasMoreElements(bool* aResult);
-  NS_IMETHOD GetNext(nsISupports** aResult);
+  NS_IMETHOD HasMoreElements(bool* aResult) MOZ_OVERRIDE;
+  NS_IMETHOD GetNext(nsISupports** aResult) MOZ_OVERRIDE;
 
   explicit nsSingletonEnumerator(nsISupports* aValue);
 
 private:
   ~nsSingletonEnumerator();
 
 protected:
   nsCOMPtr<nsISupports> mValue;
@@ -175,18 +175,18 @@ NS_NewSingletonEnumerator(nsISimpleEnume
 ////////////////////////////////////////////////////////////////////////////////
 
 class nsUnionEnumerator MOZ_FINAL : public nsISimpleEnumerator
 {
 public:
   NS_DECL_ISUPPORTS
 
   // nsISimpleEnumerator methods
-  NS_IMETHOD HasMoreElements(bool* aResult);
-  NS_IMETHOD GetNext(nsISupports** aResult);
+  NS_IMETHOD HasMoreElements(bool* aResult) MOZ_OVERRIDE;
+  NS_IMETHOD GetNext(nsISupports** aResult) MOZ_OVERRIDE;
 
   nsUnionEnumerator(nsISimpleEnumerator* aFirstEnumerator,
                     nsISimpleEnumerator* aSecondEnumerator);
 
 private:
   ~nsUnionEnumerator();
 
 protected:
--- a/xpcom/glue/nsISupportsImpl.h
+++ b/xpcom/glue/nsISupportsImpl.h
@@ -503,28 +503,29 @@ public:
  */
 #define NS_INIT_ISUPPORTS() ((void)0)
 
 /**
  * Use this macro to declare and implement the AddRef & Release methods for a
  * given non-XPCOM <i>_class</i>.
  *
  * @param _class The name of the class implementing the method
+ * @param optional MOZ_OVERRIDE Mark the AddRef & Release methods as overrides.
  */
-#define NS_INLINE_DECL_REFCOUNTING(_class)                                    \
+#define NS_INLINE_DECL_REFCOUNTING(_class, ...)                               \
 public:                                                                       \
-  NS_METHOD_(MozExternalRefCountType) AddRef(void) {                          \
+  NS_METHOD_(MozExternalRefCountType) AddRef(void) __VA_ARGS__ {              \
     MOZ_ASSERT_TYPE_OK_FOR_REFCOUNTING(_class)                                \
     MOZ_ASSERT(int32_t(mRefCnt) >= 0, "illegal refcnt");                      \
     NS_ASSERT_OWNINGTHREAD(_class);                                           \
     ++mRefCnt;                                                                \
     NS_LOG_ADDREF(this, mRefCnt, #_class, sizeof(*this));                     \
     return mRefCnt;                                                           \
   }                                                                           \
-  NS_METHOD_(MozExternalRefCountType) Release(void) {                         \
+  NS_METHOD_(MozExternalRefCountType) Release(void) __VA_ARGS__ {             \
     MOZ_ASSERT(int32_t(mRefCnt) > 0, "dup release");                          \
     NS_ASSERT_OWNINGTHREAD(_class);                                           \
     --mRefCnt;                                                                \
     NS_LOG_RELEASE(this, mRefCnt, #_class);                                   \
     if (mRefCnt == 0) {                                                       \
       NS_ASSERT_OWNINGTHREAD(_class);                                         \
       mRefCnt = 1; /* stabilize */                                            \
       delete this;                                                            \
@@ -540,26 +541,26 @@ public:
 /**
  * Use this macro to declare and implement the AddRef & Release methods for a
  * given non-XPCOM <i>_class</i> in a threadsafe manner.
  *
  * DOES NOT DO REFCOUNT STABILIZATION!
  *
  * @param _class The name of the class implementing the method
  */
-#define NS_INLINE_DECL_THREADSAFE_REFCOUNTING(_class)                         \
+#define NS_INLINE_DECL_THREADSAFE_REFCOUNTING(_class, ...)                    \
 public:                                                                       \
-  NS_METHOD_(MozExternalRefCountType) AddRef(void) {                          \
+  NS_METHOD_(MozExternalRefCountType) AddRef(void) __VA_ARGS__ {              \
     MOZ_ASSERT_TYPE_OK_FOR_REFCOUNTING(_class)                                \
     MOZ_ASSERT(int32_t(mRefCnt) >= 0, "illegal refcnt");                      \
     nsrefcnt count = ++mRefCnt;                                               \
     NS_LOG_ADDREF(this, count, #_class, sizeof(*this));                       \
     return (nsrefcnt) count;                                                  \
   }                                                                           \
-  NS_METHOD_(MozExternalRefCountType) Release(void) {                         \
+  NS_METHOD_(MozExternalRefCountType) Release(void) __VA_ARGS__ {             \
     MOZ_ASSERT(int32_t(mRefCnt) > 0, "dup release");                          \
     nsrefcnt count = --mRefCnt;                                               \
     NS_LOG_RELEASE(this, count, #_class);                                     \
     if (count == 0) {                                                         \
       delete (this);                                                          \
       return 0;                                                               \
     }                                                                         \
     return count;                                                             \
--- a/xpcom/glue/nsWeakReference.cpp
+++ b/xpcom/glue/nsWeakReference.cpp
@@ -14,17 +14,17 @@
 class nsWeakReference MOZ_FINAL : public nsIWeakReference
 {
 public:
   // nsISupports...
   NS_DECL_ISUPPORTS
 
   // nsIWeakReference...
   NS_DECL_NSIWEAKREFERENCE
-  virtual size_t SizeOfOnlyThis(mozilla::MallocSizeOf aMallocSizeOf) const;
+  virtual size_t SizeOfOnlyThis(mozilla::MallocSizeOf aMallocSizeOf) const MOZ_OVERRIDE;
 
 private:
   friend class nsSupportsWeakReference;
 
   explicit nsWeakReference(nsSupportsWeakReference* aReferent)
     : mReferent(aReferent)
     // ...I can only be constructed by an |nsSupportsWeakReference|
   {
--- a/xpcom/glue/tests/gtest/TestArray.cpp
+++ b/xpcom/glue/tests/gtest/TestArray.cpp
@@ -30,18 +30,18 @@ class Foo MOZ_FINAL : public IFoo {
 public:
 
   explicit Foo(int32_t aID);
 
   // nsISupports implementation
   NS_DECL_ISUPPORTS
 
   // IFoo implementation
-  NS_IMETHOD_(nsrefcnt) RefCnt() { return mRefCnt; }
-  NS_IMETHOD_(int32_t) ID() { return mID; }
+  NS_IMETHOD_(nsrefcnt) RefCnt() MOZ_OVERRIDE { return mRefCnt; }
+  NS_IMETHOD_(int32_t) ID() MOZ_OVERRIDE { return mID; }
 
   static int32_t gCount;
 
   int32_t mID;
 
 private:
   ~Foo();
 };
--- a/xpcom/io/nsAppFileLocationProvider.cpp
+++ b/xpcom/io/nsAppFileLocationProvider.cpp
@@ -415,33 +415,33 @@ public:
    */
   nsAppDirectoryEnumerator(nsIDirectoryServiceProvider* aProvider,
                            const char* aKeyList[]) :
     mProvider(aProvider),
     mCurrentKey(aKeyList)
   {
   }
 
-  NS_IMETHOD HasMoreElements(bool* aResult)
+  NS_IMETHOD HasMoreElements(bool* aResult) MOZ_OVERRIDE
   {
     while (!mNext && *mCurrentKey) {
       bool dontCare;
       nsCOMPtr<nsIFile> testFile;
       (void)mProvider->GetFile(*mCurrentKey++, &dontCare, getter_AddRefs(testFile));
       // Don't return a file which does not exist.
       bool exists;
       if (testFile && NS_SUCCEEDED(testFile->Exists(&exists)) && exists) {
         mNext = testFile;
       }
     }
     *aResult = mNext != nullptr;
     return NS_OK;
   }
 
-  NS_IMETHOD GetNext(nsISupports** aResult)
+  NS_IMETHOD GetNext(nsISupports** aResult) MOZ_OVERRIDE
   {
     if (NS_WARN_IF(!aResult)) {
       return NS_ERROR_INVALID_ARG;
     }
     *aResult = nullptr;
 
     bool hasMore;
     HasMoreElements(&hasMore);
--- a/xpcom/io/nsStreamUtils.cpp
+++ b/xpcom/io/nsStreamUtils.cpp
@@ -62,31 +62,31 @@ private:
           nsISupports* sup = event;
           NS_ADDREF(sup);
         }
       }
     }
   }
 
 public:
-  NS_IMETHOD OnInputStreamReady(nsIAsyncInputStream* aStream)
+  NS_IMETHOD OnInputStreamReady(nsIAsyncInputStream* aStream) MOZ_OVERRIDE
   {
     mStream = aStream;
 
     nsresult rv =
       mTarget->Dispatch(this, NS_DISPATCH_NORMAL);
     if (NS_FAILED(rv)) {
       NS_WARNING("Dispatch failed");
       return NS_ERROR_FAILURE;
     }
 
     return NS_OK;
   }
 
-  NS_IMETHOD Run()
+  NS_IMETHOD Run() MOZ_OVERRIDE
   {
     if (mCallback) {
       if (mStream) {
         mCallback->OnInputStreamReady(mStream);
       }
       mCallback = nullptr;
     }
     return NS_OK;
@@ -143,31 +143,31 @@ private:
           nsISupports* sup = event;
           NS_ADDREF(sup);
         }
       }
     }
   }
 
 public:
-  NS_IMETHOD OnOutputStreamReady(nsIAsyncOutputStream* aStream)
+  NS_IMETHOD OnOutputStreamReady(nsIAsyncOutputStream* aStream) MOZ_OVERRIDE
   {
     mStream = aStream;
 
     nsresult rv =
       mTarget->Dispatch(this, NS_DISPATCH_NORMAL);
     if (NS_FAILED(rv)) {
       NS_WARNING("PostEvent failed");
       return NS_ERROR_FAILURE;
     }
 
     return NS_OK;
   }
 
-  NS_IMETHOD Run()
+  NS_IMETHOD Run() MOZ_OVERRIDE
   {
     if (mCallback) {
       if (mStream) {
         mCallback->OnOutputStreamReady(mStream);
       }
       mCallback = nullptr;
     }
     return NS_OK;
@@ -391,30 +391,30 @@ public:
       aReason = NS_BASE_STREAM_CLOSED;
     }
 
     mCanceled = true;
     mCancelStatus = aReason;
     return NS_OK;
   }
 
-  NS_IMETHOD OnInputStreamReady(nsIAsyncInputStream* aSource)
+  NS_IMETHOD OnInputStreamReady(nsIAsyncInputStream* aSource) MOZ_OVERRIDE
   {
     PostContinuationEvent();
     return NS_OK;
   }
 
-  NS_IMETHOD OnOutputStreamReady(nsIAsyncOutputStream* aSink)
+  NS_IMETHOD OnOutputStreamReady(nsIAsyncOutputStream* aSink) MOZ_OVERRIDE
   {
     PostContinuationEvent();
     return NS_OK;
   }
 
   // continuation event handler
-  NS_IMETHOD Run()
+  NS_IMETHOD Run() MOZ_OVERRIDE
   {
     Process();
 
     // clear "in process" flag and post any pending continuation event
     MutexAutoLock lock(mLock);
     mEventInProcess = false;
     if (mEventIsPending) {
       mEventIsPending = false;
--- a/xpcom/reflect/xptcall/xptcprivate.h
+++ b/xpcom/reflect/xptcall/xptcprivate.h
@@ -27,22 +27,22 @@ class nsIXPTCStubBase : public nsISuppor
 public:
 #include "xptcstubsdef.inc"
 };
 
 #undef STUB_ENTRY
 #undef SENTINEL_ENTRY
 
 #if !defined(__ia64) || (!defined(__hpux) && !defined(__linux__) && !defined(__FreeBSD__))
-#define STUB_ENTRY(n) NS_IMETHOD Stub##n();
+#define STUB_ENTRY(n) NS_IMETHOD Stub##n() MOZ_OVERRIDE;
 #else
-#define STUB_ENTRY(n) NS_IMETHOD Stub##n(uint64_t,uint64_t,uint64_t,uint64_t,uint64_t,uint64_t,uint64_t,uint64_t);
+#define STUB_ENTRY(n) NS_IMETHOD Stub##n(uint64_t,uint64_t,uint64_t,uint64_t,uint64_t,uint64_t,uint64_t,uint64_t) MOZ_OVERRIDE;
 #endif
 
-#define SENTINEL_ENTRY(n) NS_IMETHOD Sentinel##n();
+#define SENTINEL_ENTRY(n) NS_IMETHOD Sentinel##n() MOZ_OVERRIDE;
 
 class nsXPTCStubBase MOZ_FINAL : public nsIXPTCStubBase
 {
 public:
     NS_DECL_ISUPPORTS_INHERITED
 
 #include "xptcstubsdef.inc"
 
--- a/xpcom/reflect/xptinfo/xptiprivate.h
+++ b/xpcom/reflect/xptinfo/xptiprivate.h
@@ -310,44 +310,44 @@ private:
 };
 
 class xptiInterfaceInfo MOZ_FINAL : public nsIInterfaceInfo
 {
 public:
     NS_DECL_THREADSAFE_ISUPPORTS
 
     // Use delegation to implement (most!) of nsIInterfaceInfo.
-    NS_IMETHOD GetName(char * *aName) { return !mEntry ? NS_ERROR_UNEXPECTED : mEntry->GetName(aName); }
-    NS_IMETHOD GetInterfaceIID(nsIID * *aIID) { return !mEntry ? NS_ERROR_UNEXPECTED : mEntry->GetIID(aIID); }
-    NS_IMETHOD IsScriptable(bool *_retval) { return !mEntry ? NS_ERROR_UNEXPECTED : mEntry->IsScriptable(_retval); }
-    NS_IMETHOD IsBuiltinClass(bool *_retval) { return !mEntry ? NS_ERROR_UNEXPECTED : mEntry->IsBuiltinClass(_retval); }
+    NS_IMETHOD GetName(char * *aName) MOZ_OVERRIDE { return !mEntry ? NS_ERROR_UNEXPECTED : mEntry->GetName(aName); }
+    NS_IMETHOD GetInterfaceIID(nsIID * *aIID) MOZ_OVERRIDE { return !mEntry ? NS_ERROR_UNEXPECTED : mEntry->GetIID(aIID); }
+    NS_IMETHOD IsScriptable(bool *_retval) MOZ_OVERRIDE { return !mEntry ? NS_ERROR_UNEXPECTED : mEntry->IsScriptable(_retval); }
+    NS_IMETHOD IsBuiltinClass(bool *_retval) MOZ_OVERRIDE { return !mEntry ? NS_ERROR_UNEXPECTED : mEntry->IsBuiltinClass(_retval); }
     // Except this one.
-    NS_IMETHOD GetParent(nsIInterfaceInfo * *aParent) 
+    NS_IMETHOD GetParent(nsIInterfaceInfo * *aParent) MOZ_OVERRIDE
     {
         if(!EnsureResolved() || !EnsureParent())
             return NS_ERROR_UNEXPECTED;
         NS_IF_ADDREF(*aParent = mParent);
         return NS_OK;
     }
-    NS_IMETHOD GetMethodCount(uint16_t *aMethodCount) { return !mEntry ? NS_ERROR_UNEXPECTED : mEntry->GetMethodCount(aMethodCount); }
-    NS_IMETHOD GetConstantCount(uint16_t *aConstantCount) { return !mEntry ? NS_ERROR_UNEXPECTED : mEntry->GetConstantCount(aConstantCount); }
-    NS_IMETHOD GetMethodInfo(uint16_t index, const nsXPTMethodInfo * *info) { return !mEntry ? NS_ERROR_UNEXPECTED : mEntry->GetMethodInfo(index, info); }
-    NS_IMETHOD GetMethodInfoForName(const char *methodName, uint16_t *index, const nsXPTMethodInfo * *info) { return !mEntry ? NS_ERROR_UNEXPECTED : mEntry->GetMethodInfoForName(methodName, index, info); }
-    NS_IMETHOD GetConstant(uint16_t index, JS::MutableHandleValue constant, char** name) { return !mEntry ? NS_ERROR_UNEXPECTED : mEntry->GetConstant(index, constant, name); }
-    NS_IMETHOD GetInfoForParam(uint16_t methodIndex, const nsXPTParamInfo * param, nsIInterfaceInfo **_retval) { return !mEntry ? NS_ERROR_UNEXPECTED : mEntry->GetInfoForParam(methodIndex, param, _retval); }
-    NS_IMETHOD GetIIDForParam(uint16_t methodIndex, const nsXPTParamInfo * param, nsIID * *_retval) { return !mEntry ? NS_ERROR_UNEXPECTED : mEntry->GetIIDForParam(methodIndex, param, _retval); }
-    NS_IMETHOD GetTypeForParam(uint16_t methodIndex, const nsXPTParamInfo * param, uint16_t dimension, nsXPTType *_retval) { return !mEntry ? NS_ERROR_UNEXPECTED : mEntry->GetTypeForParam(methodIndex, param, dimension, _retval); }
-    NS_IMETHOD GetSizeIsArgNumberForParam(uint16_t methodIndex, const nsXPTParamInfo * param, uint16_t dimension, uint8_t *_retval) { return !mEntry ? NS_ERROR_UNEXPECTED : mEntry->GetSizeIsArgNumberForParam(methodIndex, param, dimension, _retval); }
-    NS_IMETHOD GetInterfaceIsArgNumberForParam(uint16_t methodIndex, const nsXPTParamInfo * param, uint8_t *_retval) { return !mEntry ? NS_ERROR_UNEXPECTED : mEntry->GetInterfaceIsArgNumberForParam(methodIndex, param, _retval); }
-    NS_IMETHOD IsIID(const nsIID * IID, bool *_retval) { return !mEntry ? NS_ERROR_UNEXPECTED : mEntry->IsIID(IID, _retval); }
-    NS_IMETHOD GetNameShared(const char **name) { return !mEntry ? NS_ERROR_UNEXPECTED : mEntry->GetNameShared(name); }
-    NS_IMETHOD GetIIDShared(const nsIID * *iid) { return !mEntry ? NS_ERROR_UNEXPECTED : mEntry->GetIIDShared(iid); }
-    NS_IMETHOD IsFunction(bool *_retval) { return !mEntry ? NS_ERROR_UNEXPECTED : mEntry->IsFunction(_retval); }
-    NS_IMETHOD HasAncestor(const nsIID * iid, bool *_retval) { return !mEntry ? NS_ERROR_UNEXPECTED : mEntry->HasAncestor(iid, _retval); }
-    NS_IMETHOD GetIIDForParamNoAlloc(uint16_t methodIndex, const nsXPTParamInfo * param, nsIID *iid) { return !mEntry ? NS_ERROR_UNEXPECTED : mEntry->GetIIDForParamNoAlloc(methodIndex, param, iid); }
+    NS_IMETHOD GetMethodCount(uint16_t *aMethodCount) MOZ_OVERRIDE { return !mEntry ? NS_ERROR_UNEXPECTED : mEntry->GetMethodCount(aMethodCount); }
+    NS_IMETHOD GetConstantCount(uint16_t *aConstantCount) MOZ_OVERRIDE { return !mEntry ? NS_ERROR_UNEXPECTED : mEntry->GetConstantCount(aConstantCount); }
+    NS_IMETHOD GetMethodInfo(uint16_t index, const nsXPTMethodInfo * *info) MOZ_OVERRIDE { return !mEntry ? NS_ERROR_UNEXPECTED : mEntry->GetMethodInfo(index, info); }
+    NS_IMETHOD GetMethodInfoForName(const char *methodName, uint16_t *index, const nsXPTMethodInfo * *info) MOZ_OVERRIDE { return !mEntry ? NS_ERROR_UNEXPECTED : mEntry->GetMethodInfoForName(methodName, index, info); }
+    NS_IMETHOD GetConstant(uint16_t index, JS::MutableHandleValue constant, char** name) MOZ_OVERRIDE { return !mEntry ? NS_ERROR_UNEXPECTED : mEntry->GetConstant(index, constant, name); }
+    NS_IMETHOD GetInfoForParam(uint16_t methodIndex, const nsXPTParamInfo * param, nsIInterfaceInfo **_retval) MOZ_OVERRIDE { return !mEntry ? NS_ERROR_UNEXPECTED : mEntry->GetInfoForParam(methodIndex, param, _retval); }
+    NS_IMETHOD GetIIDForParam(uint16_t methodIndex, const nsXPTParamInfo * param, nsIID * *_retval) MOZ_OVERRIDE { return !mEntry ? NS_ERROR_UNEXPECTED : mEntry->GetIIDForParam(methodIndex, param, _retval); }
+    NS_IMETHOD GetTypeForParam(uint16_t methodIndex, const nsXPTParamInfo * param, uint16_t dimension, nsXPTType *_retval) MOZ_OVERRIDE { return !mEntry ? NS_ERROR_UNEXPECTED : mEntry->GetTypeForParam(methodIndex, param, dimension, _retval); }
+    NS_IMETHOD GetSizeIsArgNumberForParam(uint16_t methodIndex, const nsXPTParamInfo * param, uint16_t dimension, uint8_t *_retval) MOZ_OVERRIDE { return !mEntry ? NS_ERROR_UNEXPECTED : mEntry->GetSizeIsArgNumberForParam(methodIndex, param, dimension, _retval); }
+    NS_IMETHOD GetInterfaceIsArgNumberForParam(uint16_t methodIndex, const nsXPTParamInfo * param, uint8_t *_retval) MOZ_OVERRIDE { return !mEntry ? NS_ERROR_UNEXPECTED : mEntry->GetInterfaceIsArgNumberForParam(methodIndex, param, _retval); }
+    NS_IMETHOD IsIID(const nsIID * IID, bool *_retval) MOZ_OVERRIDE { return !mEntry ? NS_ERROR_UNEXPECTED : mEntry->IsIID(IID, _retval); }
+    NS_IMETHOD GetNameShared(const char **name) MOZ_OVERRIDE { return !mEntry ? NS_ERROR_UNEXPECTED : mEntry->GetNameShared(name); }
+    NS_IMETHOD GetIIDShared(const nsIID * *iid) MOZ_OVERRIDE { return !mEntry ? NS_ERROR_UNEXPECTED : mEntry->GetIIDShared(iid); }
+    NS_IMETHOD IsFunction(bool *_retval) MOZ_OVERRIDE { return !mEntry ? NS_ERROR_UNEXPECTED : mEntry->IsFunction(_retval); }
+    NS_IMETHOD HasAncestor(const nsIID * iid, bool *_retval) MOZ_OVERRIDE { return !mEntry ? NS_ERROR_UNEXPECTED : mEntry->HasAncestor(iid, _retval); }
+    NS_IMETHOD GetIIDForParamNoAlloc(uint16_t methodIndex, const nsXPTParamInfo * param, nsIID *iid) MOZ_OVERRIDE { return !mEntry ? NS_ERROR_UNEXPECTED : mEntry->GetIIDForParamNoAlloc(methodIndex, param, iid); }
 
 public:
     explicit xptiInterfaceInfo(xptiInterfaceEntry* entry);
 
     void Invalidate() 
         {NS_IF_RELEASE(mParent); mEntry = nullptr;}
 
 private:
--- a/xpcom/tests/TestHarness.h
+++ b/xpcom/tests/TestHarness.h
@@ -215,17 +215,17 @@ class ScopedXPCOM : public nsIDirectoryS
       nsCOMPtr<nsIFile> copy = mGREBinD;
       return copy.forget();
     }
 
     ////////////////////////////////////////////////////////////////////////////
     //// nsIDirectoryServiceProvider
 
     NS_IMETHODIMP GetFile(const char *aProperty, bool *_persistent,
-                          nsIFile **_result)
+                          nsIFile **_result) MOZ_OVERRIDE
     {
       // If we were supplied a directory service provider, ask it first.
       if (mDirSvcProvider &&
           NS_SUCCEEDED(mDirSvcProvider->GetFile(aProperty, _persistent,
                                                 _result))) {
         return NS_OK;
       }
 
@@ -260,17 +260,17 @@ class ScopedXPCOM : public nsIDirectoryS
       }
 
       return NS_ERROR_FAILURE;
     }
 
     ////////////////////////////////////////////////////////////////////////////
     //// nsIDirectoryServiceProvider2
 
-    NS_IMETHODIMP GetFiles(const char *aProperty, nsISimpleEnumerator **_enum)
+    NS_IMETHODIMP GetFiles(const char *aProperty, nsISimpleEnumerator **_enum) MOZ_OVERRIDE
     {
       // If we were supplied a directory service provider, ask it first.
       nsCOMPtr<nsIDirectoryServiceProvider2> provider =
         do_QueryInterface(mDirSvcProvider);
       if (provider && NS_SUCCEEDED(provider->GetFiles(aProperty, _enum))) {
         return NS_OK;
       }
 
--- a/xpcom/threads/nsTimerImpl.h
+++ b/xpcom/threads/nsTimerImpl.h
@@ -73,17 +73,17 @@ public:
 
 #ifdef MOZ_TASK_TRACER
   void DispatchTracedTask()
   {
     mTracedTask = mozilla::tasktracer::CreateFakeTracedTask(*(int**)(this));
   }
 #endif
 
-  virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
+  virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const MOZ_OVERRIDE;
 
 private:
   ~nsTimerImpl();
   nsresult InitCommon(uint32_t aType, uint32_t aDelay);
 
   void ReleaseCallback()
   {
     // if we're the last owner of the callback object, make