Merge m-i to m-c, a=merge
authorPhil Ringnalda <philringnalda@gmail.com>
Sat, 03 Jan 2015 20:02:33 -0800
changeset 247771 55f3224d751316ff5b7980b20f6f2b3f1cb74e94
parent 247706 9703c61caf74093fa2f629e0b9067c806b78cc77 (current diff)
parent 247770 811c950c8df604231b2e112c0f7657b25452216f (diff)
child 247776 4e2aba21498758f3203af4b3eaf7bd893aaa6bd9
child 247799 379e016a9f056699add1d74a9fd9c5751b34e123
child 247803 1e7a11a1f2301d779e2a506d406348ea8ae7b6e4
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)
reviewersmerge
milestone37.0a1
first release with
nightly linux32
55f3224d7513 / 37.0a1 / 20150104030205 / files
nightly linux64
55f3224d7513 / 37.0a1 / 20150104030205 / files
nightly mac
55f3224d7513 / 37.0a1 / 20150104030205 / files
nightly win32
55f3224d7513 / 37.0a1 / 20150104030205 / files
nightly win64
55f3224d7513 / 37.0a1 / 20150104030205 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Merge m-i to m-c, a=merge
--- a/accessible/base/nsAccessibilityService.h
+++ b/accessible/base/nsAccessibilityService.h
@@ -58,27 +58,27 @@ protected:
 
 public:
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_NSIACCESSIBLERETRIEVAL
   NS_DECL_NSIOBSERVER
 
   // nsIAccessibilityService
   virtual Accessible* GetRootDocumentAccessible(nsIPresShell* aPresShell,
-                                                bool aCanCreate);
+                                                bool aCanCreate) MOZ_OVERRIDE;
   already_AddRefed<Accessible>
     CreatePluginAccessible(nsPluginFrame* aFrame, nsIContent* aContent,
                            Accessible* aContext);
 
   /**
    * Adds/remove ATK root accessible for gtk+ native window to/from children
    * of the application accessible.
    */
-  virtual Accessible* AddNativeRootAccessible(void* aAtkAccessible);
-  virtual void RemoveNativeRootAccessible(Accessible* aRootAccessible);
+  virtual Accessible* AddNativeRootAccessible(void* aAtkAccessible) MOZ_OVERRIDE;
+  virtual void RemoveNativeRootAccessible(Accessible* aRootAccessible) MOZ_OVERRIDE;
 
   virtual bool HasAccessible(nsIDOMNode* aDOMNode) MOZ_OVERRIDE;
 
   // nsAccesibilityService
   /**
    * Notification used to update the accessible tree when deck panel is
    * switched.
    */
@@ -139,17 +139,17 @@ public:
    */
   virtual void PresShellActivated(nsIPresShell* aPresShell);
 
   /**
    * Recreate an accessible for the given content node in the presshell.
    */
   void RecreateAccessible(nsIPresShell* aPresShell, nsIContent* aContent);
 
-  virtual void FireAccessibleEvent(uint32_t aEvent, Accessible* aTarget);
+  virtual void FireAccessibleEvent(uint32_t aEvent, Accessible* aTarget) MOZ_OVERRIDE;
 
   // nsAccessibiltiyService
 
   /**
    * Return true if accessibility service has been shutdown.
    */
   static bool IsShutdown() { return gIsShutdown; }
 
--- a/accessible/generic/ARIAGridAccessible.h
+++ b/accessible/generic/ARIAGridAccessible.h
@@ -20,37 +20,37 @@ class ARIAGridAccessible : public Access
                            public TableAccessible
 {
 public:
   ARIAGridAccessible(nsIContent* aContent, DocAccessible* aDoc);
 
   NS_DECL_ISUPPORTS_INHERITED
 
   // Accessible
-  virtual TableAccessible* AsTable() { return this; }
+  virtual TableAccessible* AsTable() MOZ_OVERRIDE { return this; }
 
   // TableAccessible
-  virtual uint32_t ColCount();
-  virtual uint32_t RowCount();
-  virtual Accessible* CellAt(uint32_t aRowIndex, uint32_t aColumnIndex);
-  virtual bool IsColSelected(uint32_t aColIdx);
-  virtual bool IsRowSelected(uint32_t aRowIdx);
-  virtual bool IsCellSelected(uint32_t aRowIdx, uint32_t aColIdx);
-  virtual uint32_t SelectedCellCount();
-  virtual uint32_t SelectedColCount();
-  virtual uint32_t SelectedRowCount();
-  virtual void SelectedCells(nsTArray<Accessible*>* aCells);
-  virtual void SelectedCellIndices(nsTArray<uint32_t>* aCells);
-  virtual void SelectedColIndices(nsTArray<uint32_t>* aCols);
-  virtual void SelectedRowIndices(nsTArray<uint32_t>* aRows);
-  virtual void SelectCol(uint32_t aColIdx);
-  virtual void SelectRow(uint32_t aRowIdx);
-  virtual void UnselectCol(uint32_t aColIdx);
-  virtual void UnselectRow(uint32_t aRowIdx);
-  virtual Accessible* AsAccessible() { return this; }
+  virtual uint32_t ColCount() MOZ_OVERRIDE;
+  virtual uint32_t RowCount() MOZ_OVERRIDE;
+  virtual Accessible* CellAt(uint32_t aRowIndex, uint32_t aColumnIndex) MOZ_OVERRIDE;
+  virtual bool IsColSelected(uint32_t aColIdx) MOZ_OVERRIDE;
+  virtual bool IsRowSelected(uint32_t aRowIdx) MOZ_OVERRIDE;
+  virtual bool IsCellSelected(uint32_t aRowIdx, uint32_t aColIdx) MOZ_OVERRIDE;
+  virtual uint32_t SelectedCellCount() MOZ_OVERRIDE;
+  virtual uint32_t SelectedColCount() MOZ_OVERRIDE;
+  virtual uint32_t SelectedRowCount() MOZ_OVERRIDE;
+  virtual void SelectedCells(nsTArray<Accessible*>* aCells) MOZ_OVERRIDE;
+  virtual void SelectedCellIndices(nsTArray<uint32_t>* aCells) MOZ_OVERRIDE;
+  virtual void SelectedColIndices(nsTArray<uint32_t>* aCols) MOZ_OVERRIDE;
+  virtual void SelectedRowIndices(nsTArray<uint32_t>* aRows) MOZ_OVERRIDE;
+  virtual void SelectCol(uint32_t aColIdx) MOZ_OVERRIDE;
+  virtual void SelectRow(uint32_t aRowIdx) MOZ_OVERRIDE;
+  virtual void UnselectCol(uint32_t aColIdx) MOZ_OVERRIDE;
+  virtual void UnselectRow(uint32_t aRowIdx) MOZ_OVERRIDE;
+  virtual Accessible* AsAccessible() MOZ_OVERRIDE { return this; }
 
 protected:
   virtual ~ARIAGridAccessible() {}
 
   /**
    * Return row accessible at the given row index.
    */
   Accessible* GetRowAt(int32_t aRow);
@@ -80,18 +80,18 @@ class ARIAGridCellAccessible : public Hy
                                public TableCellAccessible
 {
 public:
   ARIAGridCellAccessible(nsIContent* aContent, DocAccessible* aDoc);
 
   NS_DECL_ISUPPORTS_INHERITED
 
   // Accessible
-  virtual TableCellAccessible* AsTableCell() { return this; }
-  virtual void ApplyARIAState(uint64_t* aState) const;
+  virtual TableCellAccessible* AsTableCell() MOZ_OVERRIDE { return this; }
+  virtual void ApplyARIAState(uint64_t* aState) const MOZ_OVERRIDE;
   virtual already_AddRefed<nsIPersistentProperties> NativeAttributes() MOZ_OVERRIDE;
 
 protected:
   virtual ~ARIAGridCellAccessible() {}
 
   /**
    * Return a containing row.
    */
--- a/accessible/generic/ApplicationAccessible.h
+++ b/accessible/generic/ApplicationAccessible.h
@@ -30,37 +30,37 @@ class ApplicationAccessible : public Acc
 {
 public:
 
   ApplicationAccessible();
 
   NS_DECL_ISUPPORTS_INHERITED
 
   // Accessible
-  virtual void Shutdown();
+  virtual void Shutdown() MOZ_OVERRIDE;
   virtual nsIntRect Bounds() const MOZ_OVERRIDE;
   virtual already_AddRefed<nsIPersistentProperties> NativeAttributes() MOZ_OVERRIDE;
-  virtual GroupPos GroupPosition();
-  virtual ENameValueFlag Name(nsString& aName);
-  virtual void ApplyARIAState(uint64_t* aState) const;
-  virtual void Description(nsString& aDescription);
-  virtual void Value(nsString& aValue);
+  virtual GroupPos GroupPosition() MOZ_OVERRIDE;
+  virtual ENameValueFlag Name(nsString& aName) MOZ_OVERRIDE;
+  virtual void ApplyARIAState(uint64_t* aState) const MOZ_OVERRIDE;
+  virtual void Description(nsString& aDescription) MOZ_OVERRIDE;
+  virtual void Value(nsString& aValue) MOZ_OVERRIDE;
   virtual mozilla::a11y::role NativeRole() MOZ_OVERRIDE;
   virtual uint64_t State() MOZ_OVERRIDE;
   virtual uint64_t NativeState() MOZ_OVERRIDE;
   virtual Relation RelationByType(RelationType aType) MOZ_OVERRIDE;
 
   virtual Accessible* ChildAtPoint(int32_t aX, int32_t aY,
-                                   EWhichChildAtPoint aWhichChild);
-  virtual Accessible* FocusedChild();
+                                   EWhichChildAtPoint aWhichChild) MOZ_OVERRIDE;
+  virtual Accessible* FocusedChild() MOZ_OVERRIDE;
 
-  virtual void InvalidateChildren();
+  virtual void InvalidateChildren() MOZ_OVERRIDE;
 
   // ActionAccessible
-  virtual KeyBinding AccessKey() const;
+  virtual KeyBinding AccessKey() const MOZ_OVERRIDE;
 
   // ApplicationAccessible
   void AppName(nsAString& aName) const
   {
     nsAutoCString cname;
     mAppInfo->GetName(cname);
     AppendUTF8toUTF16(cname, aName);
   }
@@ -83,19 +83,19 @@ public:
     mAppInfo->GetPlatformVersion(cversion);
     AppendUTF8toUTF16(cversion, aVersion);
   }
 
 protected:
   virtual ~ApplicationAccessible() {}
 
   // Accessible
-  virtual void CacheChildren();
+  virtual void CacheChildren() MOZ_OVERRIDE;
   virtual Accessible* GetSiblingAtOffset(int32_t aOffset,
-                                         nsresult *aError = nullptr) const;
+                                         nsresult *aError = nullptr) const MOZ_OVERRIDE;
 
 private:
   nsCOMPtr<nsIXULAppInfo> mAppInfo;
 };
 
 inline ApplicationAccessible*
 Accessible::AsApplication()
 {
--- a/accessible/generic/BaseAccessibles.h
+++ b/accessible/generic/BaseAccessibles.h
@@ -29,25 +29,25 @@ public:
 
   LeafAccessible(nsIContent* aContent, DocAccessible* aDoc);
 
   // nsISupports
   NS_DECL_ISUPPORTS_INHERITED
 
   // Accessible
   virtual Accessible* ChildAtPoint(int32_t aX, int32_t aY,
-                                   EWhichChildAtPoint aWhichChild);
+                                   EWhichChildAtPoint aWhichChild) MOZ_OVERRIDE;
   virtual bool InsertChildAt(uint32_t aIndex, Accessible* aChild) MOZ_OVERRIDE MOZ_FINAL;
   virtual bool RemoveChild(Accessible* aChild) MOZ_OVERRIDE MOZ_FINAL;
 
 protected:
   virtual ~LeafAccessible() {}
 
   // Accessible
-  virtual void CacheChildren();
+  virtual void CacheChildren() MOZ_OVERRIDE;
 };
 
 /**
  * Used for text or image accessible nodes contained by link accessibles or
  * accessibles for nodes with registered click event handler. It knows how to
  * report the state of the host link (traveled or not) and can activate (click)
  * the host accessible programmatically.
  */
@@ -65,27 +65,27 @@ public:
   virtual void Value(nsString& aValue) MOZ_OVERRIDE;
   virtual uint64_t NativeLinkState() const MOZ_OVERRIDE;
   virtual void TakeFocus() MOZ_OVERRIDE;
 
   // ActionAccessible
   virtual uint8_t ActionCount() MOZ_OVERRIDE;
   virtual void ActionNameAt(uint8_t aIndex, nsAString& aName) MOZ_OVERRIDE;
   virtual bool DoAction(uint8_t index) MOZ_OVERRIDE;
-  virtual KeyBinding AccessKey() const;
+  virtual KeyBinding AccessKey() const MOZ_OVERRIDE;
 
   // HyperLinkAccessible
-  virtual already_AddRefed<nsIURI> AnchorURIAt(uint32_t aAnchorIndex);
+  virtual already_AddRefed<nsIURI> AnchorURIAt(uint32_t aAnchorIndex) MOZ_OVERRIDE;
 
 protected:
   virtual ~LinkableAccessible() {}
 
   // Accessible
-  virtual void BindToParent(Accessible* aParent, uint32_t aIndexInParent);
-  virtual void UnbindFromParent();
+  virtual void BindToParent(Accessible* aParent, uint32_t aIndexInParent) MOZ_OVERRIDE;
+  virtual void UnbindFromParent() MOZ_OVERRIDE;
 
   /**
    * Parent accessible that provides an action for this linkable accessible.
    */
   Accessible* mActionAcc;
   bool mIsLink;
   bool mIsOnclick;
 };
--- a/accessible/generic/DocAccessible.h
+++ b/accessible/generic/DocAccessible.h
@@ -51,49 +51,49 @@ class DocAccessible : public HyperTextAc
   NS_DECL_NSIACCESSIBLEPIVOTOBSERVER
 
 public:
 
   DocAccessible(nsIDocument* aDocument, nsIContent* aRootContent,
                 nsIPresShell* aPresShell);
 
   // nsIScrollPositionListener
-  virtual void ScrollPositionWillChange(nscoord aX, nscoord aY) {}
-  virtual void ScrollPositionDidChange(nscoord aX, nscoord aY);
+  virtual void ScrollPositionWillChange(nscoord aX, nscoord aY) MOZ_OVERRIDE {}
+  virtual void ScrollPositionDidChange(nscoord aX, nscoord aY) MOZ_OVERRIDE;
 
   // nsIDocumentObserver
   NS_DECL_NSIDOCUMENTOBSERVER
 
   // Accessible
   virtual void Init();
-  virtual void Shutdown();
-  virtual nsIFrame* GetFrame() const;
-  virtual nsINode* GetNode() const { return mDocumentNode; }
+  virtual void Shutdown() MOZ_OVERRIDE;
+  virtual nsIFrame* GetFrame() const MOZ_OVERRIDE;
+  virtual nsINode* GetNode() const MOZ_OVERRIDE { return mDocumentNode; }
   nsIDocument* DocumentNode() const { return mDocumentNode; }
 
-  virtual mozilla::a11y::ENameValueFlag Name(nsString& aName);
-  virtual void Description(nsString& aDescription);
-  virtual Accessible* FocusedChild();
+  virtual mozilla::a11y::ENameValueFlag Name(nsString& aName) MOZ_OVERRIDE;
+  virtual void Description(nsString& aDescription) MOZ_OVERRIDE;
+  virtual Accessible* FocusedChild() MOZ_OVERRIDE;
   virtual mozilla::a11y::role NativeRole() MOZ_OVERRIDE;
   virtual uint64_t NativeState() MOZ_OVERRIDE;
   virtual uint64_t NativeInteractiveState() const MOZ_OVERRIDE;
-  virtual bool NativelyUnavailable() const;
-  virtual void ApplyARIAState(uint64_t* aState) const;
-  virtual already_AddRefed<nsIPersistentProperties> Attributes();
+  virtual bool NativelyUnavailable() const MOZ_OVERRIDE;
+  virtual void ApplyARIAState(uint64_t* aState) const MOZ_OVERRIDE;
+  virtual already_AddRefed<nsIPersistentProperties> Attributes() MOZ_OVERRIDE;
 
   virtual void TakeFocus() MOZ_OVERRIDE;
 
 #ifdef A11Y_LOG
-  virtual nsresult HandleAccEvent(AccEvent* aEvent);
+  virtual nsresult HandleAccEvent(AccEvent* aEvent) MOZ_OVERRIDE;
 #endif
 
   virtual nsRect RelativeBounds(nsIFrame** aRelativeFrame) const MOZ_OVERRIDE;
 
   // HyperTextAccessible
-  virtual already_AddRefed<nsIEditor> GetEditor() const;
+  virtual already_AddRefed<nsIEditor> GetEditor() const MOZ_OVERRIDE;
 
   // DocAccessible
 
   /**
    * Return document URL.
    */
   void URL(nsAString& aURL) const;
 
@@ -339,17 +339,17 @@ public:
   void RecreateAccessible(nsIContent* aContent);
 
 protected:
   virtual ~DocAccessible();
 
   void LastRelease();
 
   // Accessible
-  virtual void CacheChildren();
+  virtual void CacheChildren() MOZ_OVERRIDE;
 
   // DocAccessible
   virtual nsresult AddEventListeners();
   virtual nsresult RemoveEventListeners();
 
   /**
    * Marks this document as loaded or loading.
    */
--- a/accessible/generic/FormControlAccessible.h
+++ b/accessible/generic/FormControlAccessible.h
@@ -23,54 +23,54 @@ public:
   {
     // Ignore 'ValueChange' DOM event in lieu of @value attribute change
     // notifications.
     mStateFlags |= eHasNumericValue | eIgnoreDOMUIEvent;
     mType = eProgressType;
   }
 
   // Accessible
-  virtual void Value(nsString& aValue);
+  virtual void Value(nsString& aValue) MOZ_OVERRIDE;
   virtual mozilla::a11y::role NativeRole() MOZ_OVERRIDE;
   virtual uint64_t NativeState() MOZ_OVERRIDE;
 
   // Value
   virtual double MaxValue() const MOZ_OVERRIDE;
   virtual double MinValue() const MOZ_OVERRIDE;
   virtual double CurValue() const MOZ_OVERRIDE;
   virtual double Step() const MOZ_OVERRIDE;
   virtual bool SetCurValue(double aValue) MOZ_OVERRIDE;
 
   // Widgets
-  virtual bool IsWidget() const;
+  virtual bool IsWidget() const MOZ_OVERRIDE;
 
 protected:
   virtual ~ProgressMeterAccessible() {}
 };
 
 /**
   * Generic class used for radio buttons.
   */
 class RadioButtonAccessible : public LeafAccessible
 {
 
 public:
   RadioButtonAccessible(nsIContent* aContent, DocAccessible* aDoc);
 
   // Accessible
-  virtual mozilla::a11y::role NativeRole();
+  virtual mozilla::a11y::role NativeRole() MOZ_OVERRIDE;
 
   // ActionAccessible
   virtual uint8_t ActionCount() MOZ_OVERRIDE;
   virtual void ActionNameAt(uint8_t aIndex, nsAString& aName) MOZ_OVERRIDE;
   virtual bool DoAction(uint8_t aIndex) MOZ_OVERRIDE;
 
   enum { eAction_Click = 0 };
 
   // Widgets
-  virtual bool IsWidget() const;
+  virtual bool IsWidget() const MOZ_OVERRIDE;
 };
 
 } // namespace a11y
 } // namespace mozilla
 
 #endif
 
--- a/accessible/generic/HyperTextAccessible.h
+++ b/accessible/generic/HyperTextAccessible.h
@@ -49,23 +49,23 @@ const char16_t kForcedNewLineChar = '\n'
 class HyperTextAccessible : public AccessibleWrap
 {
 public:
   HyperTextAccessible(nsIContent* aContent, DocAccessible* aDoc);
 
   NS_DECL_ISUPPORTS_INHERITED
 
   // Accessible
-  virtual int32_t GetLevelInternal();
+  virtual int32_t GetLevelInternal() MOZ_OVERRIDE;
   virtual already_AddRefed<nsIPersistentProperties> NativeAttributes() MOZ_OVERRIDE;
   virtual mozilla::a11y::role NativeRole() MOZ_OVERRIDE;
   virtual uint64_t NativeState() MOZ_OVERRIDE;
 
-  virtual void InvalidateChildren();
-  virtual bool RemoveChild(Accessible* aAccessible);
+  virtual void InvalidateChildren() MOZ_OVERRIDE;
+  virtual bool RemoveChild(Accessible* aAccessible) MOZ_OVERRIDE;
 
   // HyperTextAccessible (static helper method)
 
   // Convert content offset to rendered text offset
   nsresult ContentToRenderedOffset(nsIFrame *aFrame, int32_t aContentOffset,
                                    uint32_t *aRenderedOffset) const;
 
   // Convert rendered text offset to content offset
--- a/accessible/generic/OuterDocAccessible.h
+++ b/accessible/generic/OuterDocAccessible.h
@@ -23,28 +23,28 @@ namespace a11y {
 class OuterDocAccessible MOZ_FINAL : public AccessibleWrap
 {
 public:
   OuterDocAccessible(nsIContent* aContent, DocAccessible* aDoc);
 
   NS_DECL_ISUPPORTS_INHERITED
 
   // Accessible
-  virtual void Shutdown();
+  virtual void Shutdown() MOZ_OVERRIDE;
   virtual mozilla::a11y::role NativeRole() MOZ_OVERRIDE;
   virtual Accessible* ChildAtPoint(int32_t aX, int32_t aY,
-                                   EWhichChildAtPoint aWhichChild);
+                                   EWhichChildAtPoint aWhichChild) MOZ_OVERRIDE;
 
-  virtual void InvalidateChildren();
+  virtual void InvalidateChildren() MOZ_OVERRIDE;
   virtual bool InsertChildAt(uint32_t aIdx, Accessible* aChild) MOZ_OVERRIDE;
-  virtual bool RemoveChild(Accessible* aAccessible);
+  virtual bool RemoveChild(Accessible* aAccessible) MOZ_OVERRIDE;
 
 protected:
-  virtual ~OuterDocAccessible();
+  virtual ~OuterDocAccessible() MOZ_OVERRIDE;
 
   // Accessible
-  virtual void CacheChildren();
+  virtual void CacheChildren() MOZ_OVERRIDE;
 };
 
 } // namespace a11y
 } // namespace mozilla
 
 #endif  
--- a/accessible/generic/RootAccessible.h
+++ b/accessible/generic/RootAccessible.h
@@ -21,40 +21,40 @@ class RootAccessible : public DocAccessi
 {
   NS_DECL_ISUPPORTS_INHERITED
 
 public:
   RootAccessible(nsIDocument* aDocument, nsIContent* aRootContent,
                  nsIPresShell* aPresShell);
 
   // nsIDOMEventListener
-  NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent);
+  NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent) MOZ_OVERRIDE;
 
   // Accessible
-  virtual void Shutdown();
-  virtual mozilla::a11y::ENameValueFlag Name(nsString& aName);
+  virtual void Shutdown() MOZ_OVERRIDE;
+  virtual mozilla::a11y::ENameValueFlag Name(nsString& aName) MOZ_OVERRIDE;
   virtual Relation RelationByType(RelationType aType) MOZ_OVERRIDE;
-  virtual mozilla::a11y::role NativeRole();
+  virtual mozilla::a11y::role NativeRole() MOZ_OVERRIDE;
   virtual uint64_t NativeState() MOZ_OVERRIDE;
 
   // RootAccessible
 
   /**
    * Notify that the sub document presshell was activated.
    */
   virtual void DocumentActivated(DocAccessible* aDocument);
 
 protected:
   virtual ~RootAccessible();
 
   /**
    * Add/remove DOM event listeners.
    */
-  virtual nsresult AddEventListeners();
-  virtual nsresult RemoveEventListeners();
+  virtual nsresult AddEventListeners() MOZ_OVERRIDE;
+  virtual nsresult RemoveEventListeners() MOZ_OVERRIDE;
 
   /**
    * Process the DOM event.
    */
   void ProcessDOMEvent(nsIDOMEvent* aEvent);
 
   /**
    * Process "popupshown" event. Used by HandleEvent().
--- a/accessible/generic/TextLeafAccessible.h
+++ b/accessible/generic/TextLeafAccessible.h
@@ -18,26 +18,26 @@ class TextLeafAccessible : public Linkab
 {
 public:
   TextLeafAccessible(nsIContent* aContent, DocAccessible* aDoc);
   virtual ~TextLeafAccessible();
 
   // Accessible
   virtual mozilla::a11y::role NativeRole() MOZ_OVERRIDE;
   virtual void AppendTextTo(nsAString& aText, uint32_t aStartOffset = 0,
-                            uint32_t aLength = UINT32_MAX);
-  virtual ENameValueFlag Name(nsString& aName);
+                            uint32_t aLength = UINT32_MAX) MOZ_OVERRIDE;
+  virtual ENameValueFlag Name(nsString& aName) MOZ_OVERRIDE;
 
   // TextLeafAccessible
   void SetText(const nsAString& aText) { mText = aText; }
   const nsString& Text() const { return mText; }
 
 protected:
   // Accessible
-  virtual void CacheChildren();
+  virtual void CacheChildren() MOZ_OVERRIDE;
 
 protected:
   nsString mText;
 };
 
 
 ////////////////////////////////////////////////////////////////////////////////
 // Accessible downcast method
--- a/accessible/html/HTMLFormControlAccessible.h
+++ b/accessible/html/HTMLFormControlAccessible.h
@@ -31,25 +31,25 @@ public:
   {
     // Ignore "CheckboxStateChange" DOM event in lieu of document observer
     // state change notification.
     mStateFlags |= eIgnoreDOMUIEvent;
   }
 
   // Accessible
   virtual mozilla::a11y::role NativeRole() MOZ_OVERRIDE;
-  virtual uint64_t NativeState();
+  virtual uint64_t NativeState() MOZ_OVERRIDE;
 
   // ActionAccessible
   virtual uint8_t ActionCount() MOZ_OVERRIDE;
   virtual void ActionNameAt(uint8_t aIndex, nsAString& aName) MOZ_OVERRIDE;
   virtual bool DoAction(uint8_t aIndex) MOZ_OVERRIDE;
 
   // Widgets
-  virtual bool IsWidget() const;
+  virtual bool IsWidget() const MOZ_OVERRIDE;
 };
 
 
 /**
  * Accessible for HTML input@type="radio" element.
  */
 class HTMLRadioButtonAccessible : public RadioButtonAccessible
 {
@@ -61,17 +61,17 @@ public:
     // Ignore "RadioStateChange" DOM event in lieu of document observer
     // state change notification.
     mStateFlags |= eIgnoreDOMUIEvent;
   }
 
   // Accessible
   virtual uint64_t NativeState() MOZ_OVERRIDE;
   virtual void GetPositionAndSizeInternal(int32_t *aPosInSet,
-                                          int32_t *aSetSize);
+                                          int32_t *aSetSize) MOZ_OVERRIDE;
 };
 
 
 /**
  * Accessible for HTML input@type="button", @type="submit", @type="image"
  * and HTML button elements.
  */
 class HTMLButtonAccessible : public HyperTextAccessibleWrap
@@ -88,17 +88,17 @@ public:
   virtual uint64_t NativeState() MOZ_OVERRIDE;
 
   // ActionAccessible
   virtual uint8_t ActionCount() MOZ_OVERRIDE;
   virtual void ActionNameAt(uint8_t aIndex, nsAString& aName) MOZ_OVERRIDE;
   virtual bool DoAction(uint8_t aIndex) MOZ_OVERRIDE;
 
   // Widgets
-  virtual bool IsWidget() const;
+  virtual bool IsWidget() const MOZ_OVERRIDE;
 
 protected:
   // Accessible
   virtual ENameValueFlag NativeName(nsString& aName) MOZ_OVERRIDE;
 };
 
 
 /**
@@ -111,33 +111,33 @@ class HTMLTextFieldAccessible MOZ_FINAL 
 public:
   enum { eAction_Click = 0 };
 
   HTMLTextFieldAccessible(nsIContent* aContent, DocAccessible* aDoc);
 
   NS_DECL_ISUPPORTS_INHERITED
 
   // HyperTextAccessible
-  virtual already_AddRefed<nsIEditor> GetEditor() const;
+  virtual already_AddRefed<nsIEditor> GetEditor() const MOZ_OVERRIDE;
 
   // Accessible
-  virtual void Value(nsString& aValue);
-  virtual void ApplyARIAState(uint64_t* aState) const;
+  virtual void Value(nsString& aValue) MOZ_OVERRIDE;
+  virtual void ApplyARIAState(uint64_t* aState) const MOZ_OVERRIDE;
   virtual mozilla::a11y::role NativeRole() MOZ_OVERRIDE;
   virtual uint64_t NativeState() MOZ_OVERRIDE;
   virtual already_AddRefed<nsIPersistentProperties> NativeAttributes() MOZ_OVERRIDE;
 
   // ActionAccessible
   virtual uint8_t ActionCount() MOZ_OVERRIDE;
   virtual void ActionNameAt(uint8_t aIndex, nsAString& aName) MOZ_OVERRIDE;
   virtual bool DoAction(uint8_t aIndex) MOZ_OVERRIDE;
 
   // Widgets
-  virtual bool IsWidget() const;
-  virtual Accessible* ContainerWidget() const;
+  virtual bool IsWidget() const MOZ_OVERRIDE;
+  virtual Accessible* ContainerWidget() const MOZ_OVERRIDE;
 
 protected:
   virtual ~HTMLTextFieldAccessible() {}
 
   // Accessible
   virtual ENameValueFlag NativeName(nsString& aName) MOZ_OVERRIDE;
 
   /**
@@ -152,17 +152,17 @@ protected:
  */
 class HTMLFileInputAccessible : public HyperTextAccessibleWrap
 {
 public:
   HTMLFileInputAccessible(nsIContent* aContent, DocAccessible* aDoc);
 
   // Accessible
   virtual mozilla::a11y::role NativeRole() MOZ_OVERRIDE;
-  virtual nsresult HandleAccEvent(AccEvent* aAccEvent);
+  virtual nsresult HandleAccEvent(AccEvent* aAccEvent) MOZ_OVERRIDE;
 };
 
 
 /**
  * Used for HTML input@type="number".
  */
 class HTMLSpinnerAccessible : public AccessibleWrap
 {
@@ -193,28 +193,28 @@ class HTMLRangeAccessible : public LeafA
 public:
   HTMLRangeAccessible(nsIContent* aContent, DocAccessible* aDoc) :
     LeafAccessible(aContent, aDoc)
   {
     mStateFlags |= eHasNumericValue;
   }
 
   // Accessible
-  virtual void Value(nsString& aValue);
+  virtual void Value(nsString& aValue) MOZ_OVERRIDE;
   virtual mozilla::a11y::role NativeRole() MOZ_OVERRIDE;
 
   // Value
   virtual double MaxValue() const MOZ_OVERRIDE;
   virtual double MinValue() const MOZ_OVERRIDE;
   virtual double CurValue() const MOZ_OVERRIDE;
   virtual double Step() const MOZ_OVERRIDE;
   virtual bool SetCurValue(double aValue) MOZ_OVERRIDE;
 
   // Widgets
-  virtual bool IsWidget() const;
+  virtual bool IsWidget() const MOZ_OVERRIDE;
 };
 
 
 /**
  * Accessible for HTML fieldset element.
  */
 class HTMLGroupboxAccessible : public HyperTextAccessibleWrap
 {
--- a/accessible/html/HTMLImageMapAccessible.h
+++ b/accessible/html/HTMLImageMapAccessible.h
@@ -23,60 +23,60 @@ public:
 
   // nsISupports and cycle collector
   NS_DECL_ISUPPORTS_INHERITED
 
   // Accessible
   virtual a11y::role NativeRole() MOZ_OVERRIDE;
 
   // HyperLinkAccessible
-  virtual uint32_t AnchorCount();
-  virtual Accessible* AnchorAt(uint32_t aAnchorIndex);
-  virtual already_AddRefed<nsIURI> AnchorURIAt(uint32_t aAnchorIndex);
+  virtual uint32_t AnchorCount() MOZ_OVERRIDE;
+  virtual Accessible* AnchorAt(uint32_t aAnchorIndex) MOZ_OVERRIDE;
+  virtual already_AddRefed<nsIURI> AnchorURIAt(uint32_t aAnchorIndex) MOZ_OVERRIDE;
 
   /**
    * Update area children of the image map.
    */
   void UpdateChildAreas(bool aDoFireEvents = true);
 
   /**
    * Return accessible of child node.
    */
   Accessible* GetChildAccessibleFor(const nsINode* aNode) const;
 
 protected:
   virtual ~HTMLImageMapAccessible() { }
 
   // Accessible
-  virtual void CacheChildren();
+  virtual void CacheChildren() MOZ_OVERRIDE;
 };
 
 /**
  * Accessible for image map areas - must be child of image.
  */
 class HTMLAreaAccessible MOZ_FINAL : public HTMLLinkAccessible
 {
 public:
 
   HTMLAreaAccessible(nsIContent* aContent, DocAccessible* aDoc);
 
   // Accessible
-  virtual void Description(nsString& aDescription);
+  virtual void Description(nsString& aDescription) MOZ_OVERRIDE;
   virtual Accessible* ChildAtPoint(int32_t aX, int32_t aY,
-                                   EWhichChildAtPoint aWhichChild);
+                                   EWhichChildAtPoint aWhichChild) MOZ_OVERRIDE;
   virtual nsRect RelativeBounds(nsIFrame** aBoundingFrame) const MOZ_OVERRIDE;
 
   // HyperLinkAccessible
-  virtual uint32_t StartOffset();
-  virtual uint32_t EndOffset();
+  virtual uint32_t StartOffset() MOZ_OVERRIDE;
+  virtual uint32_t EndOffset() MOZ_OVERRIDE;
 
 protected:
   // Accessible
   virtual ENameValueFlag NativeName(nsString& aName) MOZ_OVERRIDE;
-  virtual void CacheChildren();
+  virtual void CacheChildren() MOZ_OVERRIDE;
 };
 
 
 ////////////////////////////////////////////////////////////////////////////////
 // Accessible downcasting method
 
 inline HTMLImageMapAccessible*
 Accessible::AsImageMap()
--- a/accessible/html/HTMLLinkAccessible.h
+++ b/accessible/html/HTMLLinkAccessible.h
@@ -14,30 +14,30 @@ namespace a11y {
 class HTMLLinkAccessible : public HyperTextAccessibleWrap
 {
 public:
   HTMLLinkAccessible(nsIContent* aContent, DocAccessible* aDoc);
 
   NS_DECL_ISUPPORTS_INHERITED
 
   // Accessible
-  virtual void Value(nsString& aValue);
+  virtual void Value(nsString& aValue) MOZ_OVERRIDE;
   virtual a11y::role NativeRole() MOZ_OVERRIDE;
   virtual uint64_t NativeState() MOZ_OVERRIDE;
   virtual uint64_t NativeLinkState() const MOZ_OVERRIDE;
   virtual uint64_t NativeInteractiveState() const MOZ_OVERRIDE;
 
   // ActionAccessible
   virtual uint8_t ActionCount() MOZ_OVERRIDE;
   virtual void ActionNameAt(uint8_t aIndex, nsAString& aName) MOZ_OVERRIDE;
   virtual bool DoAction(uint8_t aIndex) MOZ_OVERRIDE;
 
   // HyperLinkAccessible
-  virtual bool IsLink();
-  virtual already_AddRefed<nsIURI> AnchorURIAt(uint32_t aAnchorIndex);
+  virtual bool IsLink() MOZ_OVERRIDE;
+  virtual already_AddRefed<nsIURI> AnchorURIAt(uint32_t aAnchorIndex) MOZ_OVERRIDE;
 
 protected:
   virtual ~HTMLLinkAccessible() {}
 
   enum { eAction_Jump = 0 };
 
   /**
    * Returns true if the link has href attribute.
--- a/accessible/html/HTMLListAccessible.h
+++ b/accessible/html/HTMLListAccessible.h
@@ -43,52 +43,52 @@ class HTMLLIAccessible : public HyperTex
 {
 public:
   HTMLLIAccessible(nsIContent* aContent, DocAccessible* aDoc);
 
   // nsISupports
   NS_DECL_ISUPPORTS_INHERITED
 
   // Accessible
-  virtual void Shutdown();
+  virtual void Shutdown() MOZ_OVERRIDE;
   virtual nsIntRect Bounds() const MOZ_OVERRIDE;
   virtual a11y::role NativeRole() MOZ_OVERRIDE;
   virtual uint64_t NativeState() MOZ_OVERRIDE;
 
   // HTMLLIAccessible
   HTMLListBulletAccessible* Bullet() const { return mBullet; }
   void UpdateBullet(bool aHasBullet);
 
 protected:
   virtual ~HTMLLIAccessible() { }
 
   // Accessible
-  virtual void CacheChildren();
+  virtual void CacheChildren() MOZ_OVERRIDE;
 
 private:
   nsRefPtr<HTMLListBulletAccessible> mBullet;
 };
 
 
 /**
  * Used for bullet of HTML list item element (for example, HTML li).
  */
 class HTMLListBulletAccessible : public LeafAccessible
 {
 public:
   HTMLListBulletAccessible(nsIContent* aContent, DocAccessible* aDoc);
   virtual ~HTMLListBulletAccessible() { }
 
   // Accessible
-  virtual nsIFrame* GetFrame() const;
-  virtual ENameValueFlag Name(nsString& aName);
+  virtual nsIFrame* GetFrame() const MOZ_OVERRIDE;
+  virtual ENameValueFlag Name(nsString& aName) MOZ_OVERRIDE;
   virtual a11y::role NativeRole() MOZ_OVERRIDE;
   virtual uint64_t NativeState() MOZ_OVERRIDE;
   virtual void AppendTextTo(nsAString& aText, uint32_t aStartOffset = 0,
-                            uint32_t aLength = UINT32_MAX);
+                            uint32_t aLength = UINT32_MAX) MOZ_OVERRIDE;
 
   // HTMLListBulletAccessible
 
   /**
    * Return true if the bullet is inside of list item element boundaries.
    */
   bool IsInside() const;
 };
--- a/accessible/html/HTMLSelectAccessible.h
+++ b/accessible/html/HTMLSelectAccessible.h
@@ -38,30 +38,30 @@ public:
   HTMLSelectListAccessible(nsIContent* aContent, DocAccessible* aDoc);
   virtual ~HTMLSelectListAccessible() {}
 
   // Accessible
   virtual a11y::role NativeRole() MOZ_OVERRIDE;
   virtual uint64_t NativeState() MOZ_OVERRIDE;
 
   // SelectAccessible
-  virtual bool SelectAll();
-  virtual bool UnselectAll();
+  virtual bool SelectAll() MOZ_OVERRIDE;
+  virtual bool UnselectAll() MOZ_OVERRIDE;
 
   // Widgets
-  virtual bool IsWidget() const;
-  virtual bool IsActiveWidget() const;
-  virtual bool AreItemsOperable() const;
-  virtual Accessible* CurrentItem();
-  virtual void SetCurrentItem(Accessible* aItem);
+  virtual bool IsWidget() const MOZ_OVERRIDE;
+  virtual bool IsActiveWidget() const MOZ_OVERRIDE;
+  virtual bool AreItemsOperable() const MOZ_OVERRIDE;
+  virtual Accessible* CurrentItem() MOZ_OVERRIDE;
+  virtual void SetCurrentItem(Accessible* aItem) MOZ_OVERRIDE;
 
 protected:
 
   // Accessible
-  virtual void CacheChildren();
+  virtual void CacheChildren() MOZ_OVERRIDE;
 };
 
 /*
  * Options inside the select, contained within the list
  */
 class HTMLSelectOptionAccessible : public HyperTextAccessibleWrap
 {
 public:
@@ -70,27 +70,27 @@ public:
   HTMLSelectOptionAccessible(nsIContent* aContent, DocAccessible* aDoc);
   virtual ~HTMLSelectOptionAccessible() {}
 
   // Accessible
   virtual a11y::role NativeRole() MOZ_OVERRIDE;
   virtual uint64_t NativeState() MOZ_OVERRIDE;
   virtual uint64_t NativeInteractiveState() const MOZ_OVERRIDE;
 
-  virtual int32_t GetLevelInternal();
+  virtual int32_t GetLevelInternal() MOZ_OVERRIDE;
   virtual nsRect RelativeBounds(nsIFrame** aBoundingFrame) const MOZ_OVERRIDE;
   virtual void SetSelected(bool aSelect) MOZ_OVERRIDE;
 
   // ActionAccessible
   virtual uint8_t ActionCount() MOZ_OVERRIDE;
   virtual void ActionNameAt(uint8_t aIndex, nsAString& aName) MOZ_OVERRIDE;
   virtual bool DoAction(uint8_t aIndex) MOZ_OVERRIDE;
 
   // Widgets
-  virtual Accessible* ContainerWidget() const;
+  virtual Accessible* ContainerWidget() const MOZ_OVERRIDE;
 
 protected:
   // Accessible
   virtual ENameValueFlag NativeName(nsString& aName) MOZ_OVERRIDE;
 
 private:
 
   /**
@@ -163,38 +163,38 @@ class HTMLComboboxAccessible MOZ_FINAL :
 {
 public:
   enum { eAction_Click = 0 };
 
   HTMLComboboxAccessible(nsIContent* aContent, DocAccessible* aDoc);
   virtual ~HTMLComboboxAccessible() {}
 
   // Accessible
-  virtual void Shutdown();
-  virtual void Description(nsString& aDescription);
-  virtual void Value(nsString& aValue);
+  virtual void Shutdown() MOZ_OVERRIDE;
+  virtual void Description(nsString& aDescription) MOZ_OVERRIDE;
+  virtual void Value(nsString& aValue) MOZ_OVERRIDE;
   virtual a11y::role NativeRole() MOZ_OVERRIDE;
   virtual uint64_t NativeState() MOZ_OVERRIDE;
-  virtual void InvalidateChildren();
+  virtual void InvalidateChildren() MOZ_OVERRIDE;
 
   // ActionAccessible
   virtual uint8_t ActionCount() MOZ_OVERRIDE;
   virtual void ActionNameAt(uint8_t aIndex, nsAString& aName) MOZ_OVERRIDE;
   virtual bool DoAction(uint8_t aIndex) MOZ_OVERRIDE;
 
   // Widgets
-  virtual bool IsWidget() const;
-  virtual bool IsActiveWidget() const;
-  virtual bool AreItemsOperable() const;
-  virtual Accessible* CurrentItem();
-  virtual void SetCurrentItem(Accessible* aItem);
+  virtual bool IsWidget() const MOZ_OVERRIDE;
+  virtual bool IsActiveWidget() const MOZ_OVERRIDE;
+  virtual bool AreItemsOperable() const MOZ_OVERRIDE;
+  virtual Accessible* CurrentItem() MOZ_OVERRIDE;
+  virtual void SetCurrentItem(Accessible* aItem) MOZ_OVERRIDE;
 
 protected:
   // Accessible
-  virtual void CacheChildren();
+  virtual void CacheChildren() MOZ_OVERRIDE;
 
   /**
    * Return selected option.
    */
   Accessible* SelectedOption() const;
 
 private:
   nsRefPtr<HTMLComboboxListAccessible> mListAccessible;
@@ -209,22 +209,22 @@ class HTMLComboboxListAccessible : publi
 {
 public:
 
   HTMLComboboxListAccessible(Accessible* aParent, nsIContent* aContent,
                              DocAccessible* aDoc);
   virtual ~HTMLComboboxListAccessible() {}
 
   // Accessible
-  virtual nsIFrame* GetFrame() const;
+  virtual nsIFrame* GetFrame() const MOZ_OVERRIDE;
   virtual a11y::role NativeRole() MOZ_OVERRIDE;
   virtual uint64_t NativeState() MOZ_OVERRIDE;
   virtual nsRect RelativeBounds(nsIFrame** aBoundingFrame) const MOZ_OVERRIDE;
 
   // Widgets
-  virtual bool IsActiveWidget() const;
-  virtual bool AreItemsOperable() const;
+  virtual bool IsActiveWidget() const MOZ_OVERRIDE;
+  virtual bool AreItemsOperable() const MOZ_OVERRIDE;
 };
 
 } // namespace a11y
 } // namespace mozilla
 
 #endif
--- a/accessible/html/HTMLTableAccessible.h
+++ b/accessible/html/HTMLTableAccessible.h
@@ -24,17 +24,17 @@ class HTMLTableCellAccessible : public H
 {
 public:
   HTMLTableCellAccessible(nsIContent* aContent, DocAccessible* aDoc);
 
   // nsISupports
   NS_DECL_ISUPPORTS_INHERITED
 
   // Accessible
-  virtual TableCellAccessible* AsTableCell() { return this; }
+  virtual TableCellAccessible* AsTableCell() MOZ_OVERRIDE { return this; }
   virtual a11y::role NativeRole() MOZ_OVERRIDE;
   virtual uint64_t NativeState() MOZ_OVERRIDE;
   virtual uint64_t NativeInteractiveState() const MOZ_OVERRIDE;
   virtual already_AddRefed<nsIPersistentProperties> NativeAttributes() MOZ_OVERRIDE;
 
   // TableCellAccessible
   virtual TableAccessible* Table() const MOZ_OVERRIDE;
   virtual uint32_t ColIdx() const MOZ_OVERRIDE;
@@ -114,59 +114,59 @@ public:
   {
     mType = eHTMLTableType;
     mGenericTypes |= eTable;
   }
 
   NS_DECL_ISUPPORTS_INHERITED
 
   // TableAccessible
-  virtual Accessible* Caption() const;
-  virtual void Summary(nsString& aSummary);
-  virtual uint32_t ColCount();
-  virtual uint32_t RowCount();
-  virtual Accessible* CellAt(uint32_t aRowIndex, uint32_t aColumnIndex);
-  virtual int32_t CellIndexAt(uint32_t aRowIdx, uint32_t aColIdx);
-  virtual int32_t ColIndexAt(uint32_t aCellIdx);
-  virtual int32_t RowIndexAt(uint32_t aCellIdx);
+  virtual Accessible* Caption() const MOZ_OVERRIDE;
+  virtual void Summary(nsString& aSummary) MOZ_OVERRIDE;
+  virtual uint32_t ColCount() MOZ_OVERRIDE;
+  virtual uint32_t RowCount() MOZ_OVERRIDE;
+  virtual Accessible* CellAt(uint32_t aRowIndex, uint32_t aColumnIndex) MOZ_OVERRIDE;
+  virtual int32_t CellIndexAt(uint32_t aRowIdx, uint32_t aColIdx) MOZ_OVERRIDE;
+  virtual int32_t ColIndexAt(uint32_t aCellIdx) MOZ_OVERRIDE;
+  virtual int32_t RowIndexAt(uint32_t aCellIdx) MOZ_OVERRIDE;
   virtual void RowAndColIndicesAt(uint32_t aCellIdx, int32_t* aRowIdx,
-                                  int32_t* aColIdx);
-  virtual uint32_t ColExtentAt(uint32_t aRowIdx, uint32_t aColIdx);
-  virtual uint32_t RowExtentAt(uint32_t aRowIdx, uint32_t aColIdx);
-  virtual bool IsColSelected(uint32_t aColIdx);
-  virtual bool IsRowSelected(uint32_t aRowIdx);
-  virtual bool IsCellSelected(uint32_t aRowIdx, uint32_t aColIdx);
-  virtual uint32_t SelectedCellCount();
-  virtual uint32_t SelectedColCount();
-  virtual uint32_t SelectedRowCount();
-  virtual void SelectedCells(nsTArray<Accessible*>* aCells);
-  virtual void SelectedCellIndices(nsTArray<uint32_t>* aCells);
-  virtual void SelectedColIndices(nsTArray<uint32_t>* aCols);
-  virtual void SelectedRowIndices(nsTArray<uint32_t>* aRows);
-  virtual void SelectCol(uint32_t aColIdx);
-  virtual void SelectRow(uint32_t aRowIdx);
-  virtual void UnselectCol(uint32_t aColIdx);
-  virtual void UnselectRow(uint32_t aRowIdx);
-  virtual bool IsProbablyLayoutTable();
-  virtual Accessible* AsAccessible() { return this; }
+                                  int32_t* aColIdx) MOZ_OVERRIDE;
+  virtual uint32_t ColExtentAt(uint32_t aRowIdx, uint32_t aColIdx) MOZ_OVERRIDE;
+  virtual uint32_t RowExtentAt(uint32_t aRowIdx, uint32_t aColIdx) MOZ_OVERRIDE;
+  virtual bool IsColSelected(uint32_t aColIdx) MOZ_OVERRIDE;
+  virtual bool IsRowSelected(uint32_t aRowIdx) MOZ_OVERRIDE;
+  virtual bool IsCellSelected(uint32_t aRowIdx, uint32_t aColIdx) MOZ_OVERRIDE;
+  virtual uint32_t SelectedCellCount() MOZ_OVERRIDE;
+  virtual uint32_t SelectedColCount() MOZ_OVERRIDE;
+  virtual uint32_t SelectedRowCount() MOZ_OVERRIDE;
+  virtual void SelectedCells(nsTArray<Accessible*>* aCells) MOZ_OVERRIDE;
+  virtual void SelectedCellIndices(nsTArray<uint32_t>* aCells) MOZ_OVERRIDE;
+  virtual void SelectedColIndices(nsTArray<uint32_t>* aCols) MOZ_OVERRIDE;
+  virtual void SelectedRowIndices(nsTArray<uint32_t>* aRows) MOZ_OVERRIDE;
+  virtual void SelectCol(uint32_t aColIdx) MOZ_OVERRIDE;
+  virtual void SelectRow(uint32_t aRowIdx) MOZ_OVERRIDE;
+  virtual void UnselectCol(uint32_t aColIdx) MOZ_OVERRIDE;
+  virtual void UnselectRow(uint32_t aRowIdx) MOZ_OVERRIDE;
+  virtual bool IsProbablyLayoutTable() MOZ_OVERRIDE;
+  virtual Accessible* AsAccessible() MOZ_OVERRIDE { return this; }
 
   // Accessible
-  virtual TableAccessible* AsTable() { return this; }
-  virtual void Description(nsString& aDescription);
+  virtual TableAccessible* AsTable() MOZ_OVERRIDE { return this; }
+  virtual void Description(nsString& aDescription) MOZ_OVERRIDE;
   virtual a11y::role NativeRole() MOZ_OVERRIDE;
   virtual uint64_t NativeState() MOZ_OVERRIDE;
   virtual already_AddRefed<nsIPersistentProperties> NativeAttributes() MOZ_OVERRIDE;
   virtual Relation RelationByType(RelationType aRelationType) MOZ_OVERRIDE;
 
 protected:
   virtual ~HTMLTableAccessible() {}
 
   // Accessible
   virtual ENameValueFlag NativeName(nsString& aName) MOZ_OVERRIDE;
-  virtual void CacheChildren();
+  virtual void CacheChildren() MOZ_OVERRIDE;
 
   // HTMLTableAccessible
 
   /**
    * Add row or column to selection.
    *
    * @param aIndex   [in] index of row or column to be selected
    * @param aTarget  [in] indicates what should be selected, either row or column
--- a/accessible/mac/AccessibleWrap.h
+++ b/accessible/mac/AccessibleWrap.h
@@ -40,23 +40,23 @@ public: // construction, destruction
 
   /**
    * The objective-c |Class| type that this accessible's native object
    * should be instantied with.   used on runtime to determine the
    * right type for this accessible's associated native object.
    */
   virtual Class GetNativeType ();
 
-  virtual void Shutdown ();
-  virtual void InvalidateChildren();
+  virtual void Shutdown () MOZ_OVERRIDE;
+  virtual void InvalidateChildren() MOZ_OVERRIDE;
 
   virtual bool InsertChildAt(uint32_t aIdx, Accessible* aChild) MOZ_OVERRIDE;
-  virtual bool RemoveChild(Accessible* aAccessible);
+  virtual bool RemoveChild(Accessible* aAccessible) MOZ_OVERRIDE;
 
-  virtual nsresult HandleAccEvent(AccEvent* aEvent);
+  virtual nsresult HandleAccEvent(AccEvent* aEvent) MOZ_OVERRIDE;
 
   /**
    * Ignored means that the accessible might still have children, but is not
    * displayed to the user. it also has no native accessible object represented
    * for it.
    */
   bool IsIgnored();
   
--- a/accessible/xul/XULAlertAccessible.h
+++ b/accessible/xul/XULAlertAccessible.h
@@ -18,23 +18,23 @@ namespace a11y {
 class XULAlertAccessible : public AccessibleWrap
 {
 public:
   XULAlertAccessible(nsIContent* aContent, DocAccessible* aDoc);
 
   NS_DECL_ISUPPORTS_INHERITED
 
   // Accessible
-  virtual mozilla::a11y::ENameValueFlag Name(nsString& aName);
+  virtual mozilla::a11y::ENameValueFlag Name(nsString& aName) MOZ_OVERRIDE;
   virtual a11y::role NativeRole() MOZ_OVERRIDE;
   virtual uint64_t NativeState() MOZ_OVERRIDE;
 
   // Widgets
-  virtual bool IsWidget() const;
-  virtual Accessible* ContainerWidget() const;
+  virtual bool IsWidget() const MOZ_OVERRIDE;
+  virtual Accessible* ContainerWidget() const MOZ_OVERRIDE;
 
 protected:
   ~XULAlertAccessible();
 };
 
 } // namespace a11y
 } // namespace mozilla
 
--- a/accessible/xul/XULColorPickerAccessible.h
+++ b/accessible/xul/XULColorPickerAccessible.h
@@ -16,42 +16,42 @@ namespace a11y {
  */
 class XULColorPickerTileAccessible : public AccessibleWrap
 {
 public:
   XULColorPickerTileAccessible(nsIContent* aContent,
                                DocAccessible* aDoc);
 
   // Accessible
-  virtual void Value(nsString& aValue);
+  virtual void Value(nsString& aValue) MOZ_OVERRIDE;
   virtual a11y::role NativeRole() MOZ_OVERRIDE;
   virtual uint64_t NativeState() MOZ_OVERRIDE;
   virtual uint64_t NativeInteractiveState() const MOZ_OVERRIDE;
 
   // Widgets
-  virtual Accessible* ContainerWidget() const;
+  virtual Accessible* ContainerWidget() const MOZ_OVERRIDE;
 };
 
 
 /**
  * Used for colorpicker button (xul:colorpicker@type="button").
  */
 class XULColorPickerAccessible : public XULColorPickerTileAccessible
 {
 public:
   XULColorPickerAccessible(nsIContent* aContent, DocAccessible* aDoc);
 
   // Accessible
   virtual a11y::role NativeRole() MOZ_OVERRIDE;
   virtual uint64_t NativeState() MOZ_OVERRIDE;
 
   // Widgets
-  virtual bool IsWidget() const;
-  virtual bool IsActiveWidget() const;
-  virtual bool AreItemsOperable() const;
+  virtual bool IsWidget() const MOZ_OVERRIDE;
+  virtual bool IsActiveWidget() const MOZ_OVERRIDE;
+  virtual bool AreItemsOperable() const MOZ_OVERRIDE;
 
   virtual bool IsAcceptableChild(Accessible* aPossibleChild) const MOZ_OVERRIDE;
 };
 
 } // namespace a11y
 } // namespace mozilla
 
 #endif  
--- a/accessible/xul/XULComboboxAccessible.h
+++ b/accessible/xul/XULComboboxAccessible.h
@@ -17,28 +17,28 @@ namespace a11y {
 class XULComboboxAccessible : public AccessibleWrap
 {
 public:
   enum { eAction_Click = 0 };
 
   XULComboboxAccessible(nsIContent* aContent, DocAccessible* aDoc);
 
   // Accessible
-  virtual void Description(nsString& aDescription);
-  virtual void Value(nsString& aValue);
+  virtual void Description(nsString& aDescription) MOZ_OVERRIDE;
+  virtual void Value(nsString& aValue) MOZ_OVERRIDE;
   virtual a11y::role NativeRole() MOZ_OVERRIDE;
-  virtual uint64_t NativeState();
-  virtual bool CanHaveAnonChildren();
+  virtual uint64_t NativeState() MOZ_OVERRIDE;
+  virtual bool CanHaveAnonChildren() MOZ_OVERRIDE;
 
   // ActionAccessible
   virtual uint8_t ActionCount() MOZ_OVERRIDE;
   virtual void ActionNameAt(uint8_t aIndex, nsAString& aName) MOZ_OVERRIDE;
   virtual bool DoAction(uint8_t aIndex) MOZ_OVERRIDE;
 
   // Widgets
-  virtual bool IsActiveWidget() const;
-  virtual bool AreItemsOperable() const;
+  virtual bool IsActiveWidget() const MOZ_OVERRIDE;
+  virtual bool AreItemsOperable() const MOZ_OVERRIDE;
 };
 
 } // namespace a11y
 } // namespace mozilla
 
 #endif
--- a/accessible/xul/XULElementAccessibles.h
+++ b/accessible/xul/XULElementAccessibles.h
@@ -18,17 +18,17 @@ class XULLabelTextLeafAccessible;
  * Used for XUL description and label elements.
  */
 class XULLabelAccessible : public HyperTextAccessibleWrap
 {
 public:
   XULLabelAccessible(nsIContent* aContent, DocAccessible* aDoc);
 
   // Accessible
-  virtual void Shutdown();
+  virtual void Shutdown() MOZ_OVERRIDE;
   virtual a11y::role NativeRole() MOZ_OVERRIDE;
   virtual uint64_t NativeState() MOZ_OVERRIDE;
   virtual Relation RelationByType(RelationType aType) MOZ_OVERRIDE;
 
   void UpdateLabelValue(const nsString& aValue);
 
 protected:
   // Accessible
@@ -81,30 +81,30 @@ public:
 
 class XULLinkAccessible : public XULLabelAccessible
 {
 
 public:
   XULLinkAccessible(nsIContent* aContent, DocAccessible* aDoc);
 
   // Accessible
-  virtual void Value(nsString& aValue);
+  virtual void Value(nsString& aValue) MOZ_OVERRIDE;
   virtual a11y::role NativeRole() MOZ_OVERRIDE;
   virtual uint64_t NativeLinkState() const MOZ_OVERRIDE;
 
   // ActionAccessible
   virtual uint8_t ActionCount() MOZ_OVERRIDE;
   virtual void ActionNameAt(uint8_t aIndex, nsAString& aName) MOZ_OVERRIDE;
   virtual bool DoAction(uint8_t aIndex) MOZ_OVERRIDE;
 
   // HyperLinkAccessible
-  virtual bool IsLink();
-  virtual uint32_t StartOffset();
-  virtual uint32_t EndOffset();
-  virtual already_AddRefed<nsIURI> AnchorURIAt(uint32_t aAnchorIndex);
+  virtual bool IsLink() MOZ_OVERRIDE;
+  virtual uint32_t StartOffset() MOZ_OVERRIDE;
+  virtual uint32_t EndOffset() MOZ_OVERRIDE;
+  virtual already_AddRefed<nsIURI> AnchorURIAt(uint32_t aAnchorIndex) MOZ_OVERRIDE;
 
 protected:
   virtual ~XULLinkAccessible();
 
   // Accessible
   virtual ENameValueFlag NativeName(nsString& aName) MOZ_OVERRIDE;
 
   enum { eAction_Jump = 0 };
--- a/accessible/xul/XULFormControlAccessible.h
+++ b/accessible/xul/XULFormControlAccessible.h
@@ -40,20 +40,20 @@ public:
   virtual uint64_t NativeState() MOZ_OVERRIDE;
 
   // ActionAccessible
   virtual uint8_t ActionCount() MOZ_OVERRIDE;
   virtual void ActionNameAt(uint8_t aIndex, nsAString& aName) MOZ_OVERRIDE;
   virtual bool DoAction(uint8_t aIndex) MOZ_OVERRIDE;
 
   // Widgets
-  virtual bool IsWidget() const;
-  virtual bool IsActiveWidget() const;
-  virtual bool AreItemsOperable() const;
-  virtual Accessible* ContainerWidget() const;
+  virtual bool IsWidget() const MOZ_OVERRIDE;
+  virtual bool IsActiveWidget() const MOZ_OVERRIDE;
+  virtual bool AreItemsOperable() const MOZ_OVERRIDE;
+  virtual Accessible* ContainerWidget() const MOZ_OVERRIDE;
 
   virtual bool IsAcceptableChild(Accessible* aPossibleChild) const MOZ_OVERRIDE;
 
 protected:
   virtual ~XULButtonAccessible();
 
   // XULButtonAccessible
   bool ContainsMenu() const;
@@ -127,35 +127,35 @@ class XULRadioButtonAccessible : public 
 public:
   XULRadioButtonAccessible(nsIContent* aContent, DocAccessible* aDoc);
 
   // Accessible
   virtual uint64_t NativeState() MOZ_OVERRIDE;
   virtual uint64_t NativeInteractiveState() const MOZ_OVERRIDE;
 
   // Widgets
-  virtual Accessible* ContainerWidget() const;
+  virtual Accessible* ContainerWidget() const MOZ_OVERRIDE;
 };
 
 /**
  * Used for XUL radiogroup element.
  */
 class XULRadioGroupAccessible : public XULSelectControlAccessible
 {
 public:
   XULRadioGroupAccessible(nsIContent* aContent, DocAccessible* aDoc);
 
   // Accessible
   virtual mozilla::a11y::role NativeRole() MOZ_OVERRIDE;
   virtual uint64_t NativeInteractiveState() const MOZ_OVERRIDE;
 
   // Widgets
-  virtual bool IsWidget() const;
-  virtual bool IsActiveWidget() const;
-  virtual bool AreItemsOperable() const;
+  virtual bool IsWidget() const MOZ_OVERRIDE;
+  virtual bool IsActiveWidget() const MOZ_OVERRIDE;
+  virtual bool AreItemsOperable() const MOZ_OVERRIDE;
 };
 
 /**
  * Used for XUL statusbar element.
  */
 class XULStatusBarAccessible : public AccessibleWrap
 {
 public:
--- a/accessible/xul/XULListboxAccessible.h
+++ b/accessible/xul/XULListboxAccessible.h
@@ -59,45 +59,45 @@ public:
  */
 class XULListboxAccessible : public XULSelectControlAccessible,
                              public TableAccessible
 {
 public:
   XULListboxAccessible(nsIContent* aContent, DocAccessible* aDoc);
 
   // TableAccessible
-  virtual uint32_t ColCount();
-  virtual uint32_t RowCount();
-  virtual Accessible* CellAt(uint32_t aRowIndex, uint32_t aColumnIndex);
-  virtual bool IsColSelected(uint32_t aColIdx);
-  virtual bool IsRowSelected(uint32_t aRowIdx);
-  virtual bool IsCellSelected(uint32_t aRowIdx, uint32_t aColIdx);
-  virtual uint32_t SelectedCellCount();
-  virtual uint32_t SelectedColCount();
-  virtual uint32_t SelectedRowCount();
-  virtual void SelectedCells(nsTArray<Accessible*>* aCells);
-  virtual void SelectedCellIndices(nsTArray<uint32_t>* aCells);
-  virtual void SelectedColIndices(nsTArray<uint32_t>* aCols);
-  virtual void SelectedRowIndices(nsTArray<uint32_t>* aRows);
-  virtual void SelectRow(uint32_t aRowIdx);
-  virtual void UnselectRow(uint32_t aRowIdx);
-  virtual Accessible* AsAccessible() { return this; }
+  virtual uint32_t ColCount() MOZ_OVERRIDE;
+  virtual uint32_t RowCount() MOZ_OVERRIDE;
+  virtual Accessible* CellAt(uint32_t aRowIndex, uint32_t aColumnIndex) MOZ_OVERRIDE;
+  virtual bool IsColSelected(uint32_t aColIdx) MOZ_OVERRIDE;
+  virtual bool IsRowSelected(uint32_t aRowIdx) MOZ_OVERRIDE;
+  virtual bool IsCellSelected(uint32_t aRowIdx, uint32_t aColIdx) MOZ_OVERRIDE;
+  virtual uint32_t SelectedCellCount() MOZ_OVERRIDE;
+  virtual uint32_t SelectedColCount() MOZ_OVERRIDE;
+  virtual uint32_t SelectedRowCount() MOZ_OVERRIDE;
+  virtual void SelectedCells(nsTArray<Accessible*>* aCells) MOZ_OVERRIDE;
+  virtual void SelectedCellIndices(nsTArray<uint32_t>* aCells) MOZ_OVERRIDE;
+  virtual void SelectedColIndices(nsTArray<uint32_t>* aCols) MOZ_OVERRIDE;
+  virtual void SelectedRowIndices(nsTArray<uint32_t>* aRows) MOZ_OVERRIDE;
+  virtual void SelectRow(uint32_t aRowIdx) MOZ_OVERRIDE;
+  virtual void UnselectRow(uint32_t aRowIdx) MOZ_OVERRIDE;
+  virtual Accessible* AsAccessible() MOZ_OVERRIDE { return this; }
 
   // Accessible
-  virtual void Value(nsString& aValue);
-  virtual TableAccessible* AsTable() { return this; }
+  virtual void Value(nsString& aValue) MOZ_OVERRIDE;
+  virtual TableAccessible* AsTable() MOZ_OVERRIDE { return this; }
   virtual a11y::role NativeRole() MOZ_OVERRIDE;
   virtual uint64_t NativeState() MOZ_OVERRIDE;
 
   // Widgets
-  virtual bool IsWidget() const;
-  virtual bool IsActiveWidget() const;
-  virtual bool AreItemsOperable() const;
+  virtual bool IsWidget() const MOZ_OVERRIDE;
+  virtual bool IsActiveWidget() const MOZ_OVERRIDE;
+  virtual bool AreItemsOperable() const MOZ_OVERRIDE;
 
-  virtual Accessible* ContainerWidget() const;
+  virtual Accessible* ContainerWidget() const MOZ_OVERRIDE;
 
 protected:
   virtual ~XULListboxAccessible() {}
 
   bool IsMulticolumn() { return ColCount() > 1; }
 };
 
 /**
@@ -108,27 +108,27 @@ class XULListitemAccessible : public XUL
 public:
   enum { eAction_Click = 0 };
 
   NS_DECL_ISUPPORTS_INHERITED
 
   XULListitemAccessible(nsIContent* aContent, DocAccessible* aDoc);
 
   // Accessible
-  virtual void Description(nsString& aDesc);
+  virtual void Description(nsString& aDesc) MOZ_OVERRIDE;
   virtual a11y::role NativeRole() MOZ_OVERRIDE;
   virtual uint64_t NativeState() MOZ_OVERRIDE;
   virtual uint64_t NativeInteractiveState() const MOZ_OVERRIDE;
-  virtual bool CanHaveAnonChildren();
+  virtual bool CanHaveAnonChildren() MOZ_OVERRIDE;
 
   // Actions
   virtual void ActionNameAt(uint8_t index, nsAString& aName) MOZ_OVERRIDE;
 
   // Widgets
-  virtual Accessible* ContainerWidget() const;
+  virtual Accessible* ContainerWidget() const MOZ_OVERRIDE;
 
 protected:
   virtual ~XULListitemAccessible();
 
   // Accessible
   virtual ENameValueFlag NativeName(nsString& aName) MOZ_OVERRIDE;
 
   // XULListitemAccessible
@@ -150,17 +150,17 @@ class XULListCellAccessible : public Hyp
 {
 public:
   XULListCellAccessible(nsIContent* aContent, DocAccessible* aDoc);
 
   // nsISupports
   NS_DECL_ISUPPORTS_INHERITED
 
   // Accessible
-  virtual TableCellAccessible* AsTableCell() { return this; }
+  virtual TableCellAccessible* AsTableCell() MOZ_OVERRIDE { return this; }
   virtual already_AddRefed<nsIPersistentProperties> NativeAttributes() MOZ_OVERRIDE;
   virtual a11y::role NativeRole() MOZ_OVERRIDE;
 
   // TableCellAccessible
   virtual TableAccessible* Table() const MOZ_OVERRIDE;
   virtual uint32_t ColIdx() const MOZ_OVERRIDE;
   virtual uint32_t RowIdx() const MOZ_OVERRIDE;
   virtual void ColHeaderCells(nsTArray<Accessible*>* aHeaderCells) MOZ_OVERRIDE;
--- a/accessible/xul/XULMenuAccessible.h
+++ b/accessible/xul/XULMenuAccessible.h
@@ -19,35 +19,35 @@ namespace a11y {
 class XULMenuitemAccessible : public AccessibleWrap
 {
 public:
   enum { eAction_Click = 0 };
 
   XULMenuitemAccessible(nsIContent* aContent, DocAccessible* aDoc);
 
   // Accessible
-  virtual void Description(nsString& aDescription);
+  virtual void Description(nsString& aDescription) MOZ_OVERRIDE;
   virtual a11y::role NativeRole() MOZ_OVERRIDE;
   virtual uint64_t NativeState() MOZ_OVERRIDE;
   virtual uint64_t NativeInteractiveState() const MOZ_OVERRIDE;
-  virtual int32_t GetLevelInternal();
+  virtual int32_t GetLevelInternal() MOZ_OVERRIDE;
 
-  virtual bool CanHaveAnonChildren();
+  virtual bool CanHaveAnonChildren() MOZ_OVERRIDE;
 
   // ActionAccessible
   virtual uint8_t ActionCount() MOZ_OVERRIDE;
   virtual void ActionNameAt(uint8_t aIndex, nsAString& aName) MOZ_OVERRIDE;
   virtual bool DoAction(uint8_t aIndex) MOZ_OVERRIDE;
-  virtual KeyBinding AccessKey() const;
-  virtual KeyBinding KeyboardShortcut() const;
+  virtual KeyBinding AccessKey() const MOZ_OVERRIDE;
+  virtual KeyBinding KeyboardShortcut() const MOZ_OVERRIDE;
 
   // Widgets
-  virtual bool IsActiveWidget() const;
-  virtual bool AreItemsOperable() const;
-  virtual Accessible* ContainerWidget() const;
+  virtual bool IsActiveWidget() const MOZ_OVERRIDE;
+  virtual bool AreItemsOperable() const MOZ_OVERRIDE;
+  virtual Accessible* ContainerWidget() const MOZ_OVERRIDE;
 
 protected:
   // Accessible
   virtual ENameValueFlag NativeName(nsString& aName) MOZ_OVERRIDE;
 };
 
 /**
  * Used for XUL menuseparator element.
@@ -80,21 +80,21 @@ class XULMenupopupAccessible : public XU
 public:
   XULMenupopupAccessible(nsIContent* aContent, DocAccessible* aDoc);
 
   // Accessible
   virtual a11y::role NativeRole() MOZ_OVERRIDE;
   virtual uint64_t NativeState() MOZ_OVERRIDE;
 
   // Widgets
-  virtual bool IsWidget() const;
-  virtual bool IsActiveWidget() const;
-  virtual bool AreItemsOperable() const;
+  virtual bool IsWidget() const MOZ_OVERRIDE;
+  virtual bool IsActiveWidget() const MOZ_OVERRIDE;
+  virtual bool AreItemsOperable() const MOZ_OVERRIDE;
 
-  virtual Accessible* ContainerWidget() const;
+  virtual Accessible* ContainerWidget() const MOZ_OVERRIDE;
 
 protected:
   // Accessible
   virtual ENameValueFlag NativeName(nsString& aName) MOZ_OVERRIDE;
 };
 
 /**
  * Used for XUL menubar element.
@@ -103,20 +103,20 @@ class XULMenubarAccessible : public Acce
 {
 public:
   XULMenubarAccessible(nsIContent* aContent, DocAccessible* aDoc);
 
   // Accessible
   virtual a11y::role NativeRole() MOZ_OVERRIDE;
 
   // Widget
-  virtual bool IsActiveWidget() const;
-  virtual bool AreItemsOperable() const;
-  virtual Accessible* CurrentItem();
-  virtual void SetCurrentItem(Accessible* aItem);
+  virtual bool IsActiveWidget() const MOZ_OVERRIDE;
+  virtual bool AreItemsOperable() const MOZ_OVERRIDE;
+  virtual Accessible* CurrentItem() MOZ_OVERRIDE;
+  virtual void SetCurrentItem(Accessible* aItem) MOZ_OVERRIDE;
 
 protected:
   // Accessible
   virtual ENameValueFlag NativeName(nsString& aName) MOZ_OVERRIDE;
 };
 
 } // namespace a11y
 } // namespace mozilla
--- a/accessible/xul/XULSelectControlAccessible.h
+++ b/accessible/xul/XULSelectControlAccessible.h
@@ -18,31 +18,31 @@ namespace a11y {
  */
 class XULSelectControlAccessible : public AccessibleWrap
 {
 public:
   XULSelectControlAccessible(nsIContent* aContent, DocAccessible* aDoc);
   virtual ~XULSelectControlAccessible() {}
 
   // Accessible
-  virtual void Shutdown();
+  virtual void Shutdown() MOZ_OVERRIDE;
 
   // SelectAccessible
   virtual void SelectedItems(nsTArray<Accessible*>* aItems) MOZ_OVERRIDE;
-  virtual uint32_t SelectedItemCount();
-  virtual Accessible* GetSelectedItem(uint32_t aIndex);
-  virtual bool IsItemSelected(uint32_t aIndex);
-  virtual bool AddItemToSelection(uint32_t aIndex);
-  virtual bool RemoveItemFromSelection(uint32_t aIndex);
-  virtual bool SelectAll();
-  virtual bool UnselectAll();
+  virtual uint32_t SelectedItemCount() MOZ_OVERRIDE;
+  virtual Accessible* GetSelectedItem(uint32_t aIndex) MOZ_OVERRIDE;
+  virtual bool IsItemSelected(uint32_t aIndex) MOZ_OVERRIDE;
+  virtual bool AddItemToSelection(uint32_t aIndex) MOZ_OVERRIDE;
+  virtual bool RemoveItemFromSelection(uint32_t aIndex) MOZ_OVERRIDE;
+  virtual bool SelectAll() MOZ_OVERRIDE;
+  virtual bool UnselectAll() MOZ_OVERRIDE;
 
   // Widgets
-  virtual Accessible* CurrentItem();
-  virtual void SetCurrentItem(Accessible* aItem);
+  virtual Accessible* CurrentItem() MOZ_OVERRIDE;
+  virtual void SetCurrentItem(Accessible* aItem) MOZ_OVERRIDE;
 
 protected:
   // nsIDOMXULMultiSelectControlElement inherits from this, so we'll always have
   // one of these if the widget is valid and not defunct
   nsCOMPtr<nsIDOMXULSelectControlElement> mSelectControl;
 };
 
 } // namespace a11y
--- a/accessible/xul/XULSliderAccessible.h
+++ b/accessible/xul/XULSliderAccessible.h
@@ -17,21 +17,21 @@ namespace a11y {
  * Used for XUL slider and scale elements.
  */
 class XULSliderAccessible : public AccessibleWrap
 {
 public:
   XULSliderAccessible(nsIContent* aContent, DocAccessible* aDoc);
 
   // Accessible
-  virtual void Value(nsString& aValue);
+  virtual void Value(nsString& aValue) MOZ_OVERRIDE;
   virtual a11y::role NativeRole() MOZ_OVERRIDE;
   virtual uint64_t NativeInteractiveState() const MOZ_OVERRIDE;
-  virtual bool NativelyUnavailable() const;
-  virtual bool CanHaveAnonChildren();
+  virtual bool NativelyUnavailable() const MOZ_OVERRIDE;
+  virtual bool CanHaveAnonChildren() MOZ_OVERRIDE;
 
   // Value
   virtual double MaxValue() const MOZ_OVERRIDE;
   virtual double MinValue() const MOZ_OVERRIDE;
   virtual double CurValue() const MOZ_OVERRIDE;
   virtual double Step() const MOZ_OVERRIDE;
   virtual bool SetCurValue(double aValue) MOZ_OVERRIDE;
 
--- a/accessible/xul/XULTabAccessible.h
+++ b/accessible/xul/XULTabAccessible.h
@@ -40,17 +40,17 @@ public:
  * A container of tab objects, xul:tabs element.
  */
 class XULTabsAccessible : public XULSelectControlAccessible
 {
 public:
   XULTabsAccessible(nsIContent* aContent, DocAccessible* aDoc);
 
   // Accessible
-  virtual void Value(nsString& aValue);
+  virtual void Value(nsString& aValue) MOZ_OVERRIDE;
   virtual a11y::role NativeRole() MOZ_OVERRIDE;
 
   // ActionAccessible
   virtual uint8_t ActionCount() MOZ_OVERRIDE;
 
 protected:
   // Accessible
   virtual ENameValueFlag NativeName(nsString& aName) MOZ_OVERRIDE;
--- a/accessible/xul/XULTreeAccessible.h
+++ b/accessible/xul/XULTreeAccessible.h
@@ -34,45 +34,45 @@ public:
   XULTreeAccessible(nsIContent* aContent, DocAccessible* aDoc,
                     nsTreeBodyFrame* aTreeframe);
 
   // nsISupports and cycle collection
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(XULTreeAccessible, Accessible)
 
   // Accessible
-  virtual void Shutdown();
-  virtual void Value(nsString& aValue);
+  virtual void Shutdown() MOZ_OVERRIDE;
+  virtual void Value(nsString& aValue) MOZ_OVERRIDE;
   virtual a11y::role NativeRole() MOZ_OVERRIDE;
   virtual uint64_t NativeState() MOZ_OVERRIDE;
   virtual Accessible* ChildAtPoint(int32_t aX, int32_t aY,
-                                   EWhichChildAtPoint aWhichChild);
+                                   EWhichChildAtPoint aWhichChild) MOZ_OVERRIDE;
 
   virtual Accessible* GetChildAt(uint32_t aIndex) const MOZ_OVERRIDE;
   virtual uint32_t ChildCount() const MOZ_OVERRIDE;
   virtual Relation RelationByType(RelationType aType) MOZ_OVERRIDE;
 
   // SelectAccessible
   virtual void SelectedItems(nsTArray<Accessible*>* aItems) MOZ_OVERRIDE;
-  virtual uint32_t SelectedItemCount();
-  virtual Accessible* GetSelectedItem(uint32_t aIndex);
-  virtual bool IsItemSelected(uint32_t aIndex);
-  virtual bool AddItemToSelection(uint32_t aIndex);
-  virtual bool RemoveItemFromSelection(uint32_t aIndex);
-  virtual bool SelectAll();
-  virtual bool UnselectAll();
+  virtual uint32_t SelectedItemCount() MOZ_OVERRIDE;
+  virtual Accessible* GetSelectedItem(uint32_t aIndex) MOZ_OVERRIDE;
+  virtual bool IsItemSelected(uint32_t aIndex) MOZ_OVERRIDE;
+  virtual bool AddItemToSelection(uint32_t aIndex) MOZ_OVERRIDE;
+  virtual bool RemoveItemFromSelection(uint32_t aIndex) MOZ_OVERRIDE;
+  virtual bool SelectAll() MOZ_OVERRIDE;
+  virtual bool UnselectAll() MOZ_OVERRIDE;
 
   // Widgets
-  virtual bool IsWidget() const;
-  virtual bool IsActiveWidget() const;
-  virtual bool AreItemsOperable() const;
-  virtual Accessible* CurrentItem();
-  virtual void SetCurrentItem(Accessible* aItem);
+  virtual bool IsWidget() const MOZ_OVERRIDE;
+  virtual bool IsActiveWidget() const MOZ_OVERRIDE;
+  virtual bool AreItemsOperable() const MOZ_OVERRIDE;
+  virtual Accessible* CurrentItem() MOZ_OVERRIDE;
+  virtual void SetCurrentItem(Accessible* aItem) MOZ_OVERRIDE;
 
-  virtual Accessible* ContainerWidget() const;
+  virtual Accessible* ContainerWidget() const MOZ_OVERRIDE;
 
   // XULTreeAccessible
 
   /**
    * Return tree item accessible at the givem row. If accessible doesn't exist
    * in the cache then create and cache it.
    *
    * @param aRow         [in] the given row index
@@ -157,17 +157,17 @@ public:
   virtual void TakeFocus() MOZ_OVERRIDE;
 
   // ActionAccessible
   virtual uint8_t ActionCount() MOZ_OVERRIDE;
   virtual void ActionNameAt(uint8_t aIndex, nsAString& aName) MOZ_OVERRIDE;
   virtual bool DoAction(uint8_t aIndex) MOZ_OVERRIDE;
 
   // Widgets
-  virtual Accessible* ContainerWidget() const;
+  virtual Accessible* ContainerWidget() const MOZ_OVERRIDE;
 
   // XULTreeItemAccessibleBase
   NS_DECLARE_STATIC_IID_ACCESSOR(XULTREEITEMBASEACCESSIBLE_IMPL_CID)
 
   /**
    * Return row index associated with the accessible.
    */
   int32_t GetRowIndex() const { return mRow; }
@@ -185,19 +185,19 @@ public:
   virtual void RowInvalidated(int32_t aStartColIdx, int32_t aEndColIdx) = 0;
 
 protected:
   virtual ~XULTreeItemAccessibleBase();
 
   enum { eAction_Click = 0, eAction_Expand = 1 };
 
   // Accessible
-  virtual void DispatchClickEvent(nsIContent *aContent, uint32_t aActionIndex);
+  virtual void DispatchClickEvent(nsIContent *aContent, uint32_t aActionIndex) MOZ_OVERRIDE;
   virtual Accessible* GetSiblingAtOffset(int32_t aOffset,
-                                         nsresult *aError = nullptr) const;
+                                         nsresult *aError = nullptr) const MOZ_OVERRIDE;
 
   // XULTreeItemAccessibleBase
 
   /**
    * Return true if the tree item accessible is expandable (contains subrows).
    */
   bool IsExpandable();
 
@@ -226,28 +226,28 @@ public:
                         nsITreeView* aTreeView, int32_t aRow);
 
   // nsISupports and cycle collection
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(XULTreeItemAccessible,
                                            XULTreeItemAccessibleBase)
 
   // Accessible
-  virtual void Shutdown();
-  virtual ENameValueFlag Name(nsString& aName);
+  virtual void Shutdown() MOZ_OVERRIDE;
+  virtual ENameValueFlag Name(nsString& aName) MOZ_OVERRIDE;
   virtual a11y::role NativeRole() MOZ_OVERRIDE;
 
   // XULTreeItemAccessibleBase
-  virtual void RowInvalidated(int32_t aStartColIdx, int32_t aEndColIdx);
+  virtual void RowInvalidated(int32_t aStartColIdx, int32_t aEndColIdx) MOZ_OVERRIDE;
 
 protected:
   virtual ~XULTreeItemAccessible();
 
   // Accessible
-  virtual void CacheChildren();
+  virtual void CacheChildren() MOZ_OVERRIDE;
 
   // XULTreeItemAccessible
   nsCOMPtr<nsITreeColumn> mColumn;
   nsString mCachedName;
 };
 
 
 /**
--- a/accessible/xul/XULTreeGridAccessible.h
+++ b/accessible/xul/XULTreeGridAccessible.h
@@ -25,36 +25,36 @@ class XULTreeGridAccessible : public XUL
 {
 public:
   XULTreeGridAccessible(nsIContent* aContent, DocAccessible* aDoc,
                         nsTreeBodyFrame* aTreeFrame) :
     XULTreeAccessible(aContent, aDoc, aTreeFrame)
     { mGenericTypes |= eTable; }
 
   // TableAccessible
-  virtual uint32_t ColCount();
-  virtual uint32_t RowCount();
-  virtual Accessible* CellAt(uint32_t aRowIndex, uint32_t aColumnIndex);
-  virtual void ColDescription(uint32_t aColIdx, nsString& aDescription);
-  virtual bool IsColSelected(uint32_t aColIdx);
-  virtual bool IsRowSelected(uint32_t aRowIdx);
-  virtual bool IsCellSelected(uint32_t aRowIdx, uint32_t aColIdx);
-  virtual uint32_t SelectedCellCount();
-  virtual uint32_t SelectedColCount();
-  virtual uint32_t SelectedRowCount();
-  virtual void SelectedCells(nsTArray<Accessible*>* aCells);
-  virtual void SelectedCellIndices(nsTArray<uint32_t>* aCells);
-  virtual void SelectedColIndices(nsTArray<uint32_t>* aCols);
-  virtual void SelectedRowIndices(nsTArray<uint32_t>* aRows);
-  virtual void SelectRow(uint32_t aRowIdx);
-  virtual void UnselectRow(uint32_t aRowIdx);
-  virtual Accessible* AsAccessible() { return this; }
+  virtual uint32_t ColCount() MOZ_OVERRIDE;
+  virtual uint32_t RowCount() MOZ_OVERRIDE;
+  virtual Accessible* CellAt(uint32_t aRowIndex, uint32_t aColumnIndex) MOZ_OVERRIDE;
+  virtual void ColDescription(uint32_t aColIdx, nsString& aDescription) MOZ_OVERRIDE;
+  virtual bool IsColSelected(uint32_t aColIdx) MOZ_OVERRIDE;
+  virtual bool IsRowSelected(uint32_t aRowIdx) MOZ_OVERRIDE;
+  virtual bool IsCellSelected(uint32_t aRowIdx, uint32_t aColIdx) MOZ_OVERRIDE;
+  virtual uint32_t SelectedCellCount() MOZ_OVERRIDE;
+  virtual uint32_t SelectedColCount() MOZ_OVERRIDE;
+  virtual uint32_t SelectedRowCount() MOZ_OVERRIDE;
+  virtual void SelectedCells(nsTArray<Accessible*>* aCells) MOZ_OVERRIDE;
+  virtual void SelectedCellIndices(nsTArray<uint32_t>* aCells) MOZ_OVERRIDE;
+  virtual void SelectedColIndices(nsTArray<uint32_t>* aCols) MOZ_OVERRIDE;
+  virtual void SelectedRowIndices(nsTArray<uint32_t>* aRows) MOZ_OVERRIDE;
+  virtual void SelectRow(uint32_t aRowIdx) MOZ_OVERRIDE;
+  virtual void UnselectRow(uint32_t aRowIdx) MOZ_OVERRIDE;
+  virtual Accessible* AsAccessible() MOZ_OVERRIDE { return this; }
 
   // Accessible
-  virtual TableAccessible* AsTable() { return this; }
+  virtual TableAccessible* AsTable() MOZ_OVERRIDE { return this; }
   virtual a11y::role NativeRole() MOZ_OVERRIDE;
 
 protected:
   virtual ~XULTreeGridAccessible();
 
   // XULTreeAccessible
   virtual already_AddRefed<Accessible>
     CreateTreeItemAccessible(int32_t aRow) const MOZ_OVERRIDE;
@@ -75,35 +75,35 @@ public:
                            nsITreeView* aTreeView, int32_t aRow);
 
   // nsISupports and cycle collection
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(XULTreeGridRowAccessible,
                                            XULTreeItemAccessibleBase)
 
   // Accessible
-  virtual void Shutdown();
+  virtual void Shutdown() MOZ_OVERRIDE;
   virtual a11y::role NativeRole() MOZ_OVERRIDE;
-  virtual ENameValueFlag Name(nsString& aName);
+  virtual ENameValueFlag Name(nsString& aName) MOZ_OVERRIDE;
   virtual Accessible* ChildAtPoint(int32_t aX, int32_t aY,
-                                   EWhichChildAtPoint aWhichChild);
+                                   EWhichChildAtPoint aWhichChild) MOZ_OVERRIDE;
 
   virtual Accessible* GetChildAt(uint32_t aIndex) const MOZ_OVERRIDE;
   virtual uint32_t ChildCount() const MOZ_OVERRIDE;
 
   // XULTreeItemAccessibleBase
   virtual XULTreeGridCellAccessible* GetCellAccessible(nsITreeColumn* aColumn)
     const MOZ_OVERRIDE MOZ_FINAL;
-  virtual void RowInvalidated(int32_t aStartColIdx, int32_t aEndColIdx);
+  virtual void RowInvalidated(int32_t aStartColIdx, int32_t aEndColIdx) MOZ_OVERRIDE;
 
 protected:
   virtual ~XULTreeGridRowAccessible();
 
   // Accessible
-  virtual void CacheChildren();
+  virtual void CacheChildren() MOZ_OVERRIDE;
 
   // XULTreeItemAccessibleBase
   mutable nsRefPtrHashtable<nsPtrHashKey<const void>, XULTreeGridCellAccessible>
     mAccessibleCache;
 };
 
 
 /**
@@ -122,22 +122,22 @@ public:
                             int32_t aRow, nsITreeColumn* aColumn);
 
   // nsISupports
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(XULTreeGridCellAccessible,
                                            LeafAccessible)
 
   // Accessible
-  virtual TableCellAccessible* AsTableCell() { return this; }
+  virtual TableCellAccessible* AsTableCell() MOZ_OVERRIDE { return this; }
   virtual nsIntRect Bounds() const MOZ_OVERRIDE;
-  virtual ENameValueFlag Name(nsString& aName);
-  virtual Accessible* FocusedChild();
+  virtual ENameValueFlag Name(nsString& aName) MOZ_OVERRIDE;
+  virtual Accessible* FocusedChild() MOZ_OVERRIDE;
   virtual already_AddRefed<nsIPersistentProperties> NativeAttributes() MOZ_OVERRIDE;
-  virtual int32_t IndexInParent() const;
+  virtual int32_t IndexInParent() const MOZ_OVERRIDE;
   virtual Relation RelationByType(RelationType aType) MOZ_OVERRIDE;
   virtual a11y::role NativeRole() MOZ_OVERRIDE;
   virtual uint64_t NativeState() MOZ_OVERRIDE;
   virtual uint64_t NativeInteractiveState() const MOZ_OVERRIDE;
 
   // ActionAccessible
   virtual uint8_t ActionCount() MOZ_OVERRIDE;
   virtual void ActionNameAt(uint8_t aIndex, nsAString& aName) MOZ_OVERRIDE;
@@ -158,18 +158,18 @@ public:
    */
   bool CellInvalidated();
 
 protected:
   virtual ~XULTreeGridCellAccessible();
 
   // Accessible
   virtual Accessible* GetSiblingAtOffset(int32_t aOffset,
-                                         nsresult* aError = nullptr) const;
-  virtual void DispatchClickEvent(nsIContent* aContent, uint32_t aActionIndex);
+                                         nsresult* aError = nullptr) const MOZ_OVERRIDE;
+  virtual void DispatchClickEvent(nsIContent* aContent, uint32_t aActionIndex) MOZ_OVERRIDE;
 
   // XULTreeGridCellAccessible
 
   /**
    * Return true if value of cell can be modified.
    */
   bool IsEditable() const;
 
--- a/b2g/app/b2g.js
+++ b/b2g/app/b2g.js
@@ -1015,16 +1015,19 @@ pref("apz.subframe.enabled", true);
 // Overscroll-related settings
 pref("apz.overscroll.enabled", true);
 pref("apz.overscroll.stretch_factor", "0.15");
 pref("apz.overscroll.spring_stiffness", "0.002");
 pref("apz.overscroll.spring_friction", "0.02");
 pref("apz.overscroll.stop_distance_threshold", "5.0");
 pref("apz.overscroll.stop_velocity_threshold", "0.01");
 
+// For event-regions based hit-testing
+pref("layout.event-regions.enabled", true);
+
 // This preference allows FirefoxOS apps (and content, I think) to force
 // the use of software (instead of hardware accelerated) 2D canvases by
 // creating a context like this:
 //
 //   canvas.getContext('2d', { willReadFrequently: true })
 //
 // Using a software canvas can save memory when JS calls getImageData()
 // on the canvas frequently. See bug 884226.
--- a/browser/base/content/test/general/test_offlineNotification.html
+++ b/browser/base/content/test/general/test_offlineNotification.html
@@ -4,17 +4,17 @@
 https://bugzilla.mozilla.org/show_bug.cgi?id=462856
 -->
 <head>
   <title>Test offline app notification</title>
   <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
   <script type="text/javascript" src="offlineByDefault.js"></script>
   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
 </head>
-<body onload="loaded()">
+<body>
 <p id="display">
 <!-- Load the test frame twice from the same domain,
      to make sure we get notifications for both -->
 <iframe name="testFrame" src="offlineChild.html"></iframe>
 <iframe name="testFrame2" src="offlineChild2.html"></iframe>
 <!-- Load from another domain to make sure we get a second allow/deny
      notification -->
 <iframe name="testFrame3" src="http://example.com/tests/browser/base/content/test/general/offlineChild.html"></iframe>
@@ -118,12 +118,14 @@ function loaded() {
   is(panel.childElementCount, 2, "2 notifications being displayed");
   panel.firstElementChild.button.click();
 
   // should have dismissed one of the notifications.
   is(panel.childElementCount, 1, "1 notification now being displayed");
   panel.firstElementChild.button.click();
 }
 
+SimpleTest.waitForFocus(loaded);
+
 </script>
 </pre>
 </body>
 </html>
--- a/browser/components/preferences/aboutPermissions.js
+++ b/browser/components/preferences/aboutPermissions.js
@@ -1,12 +1,14 @@
 /* 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/. */
 
+"use strict";
+
 let Ci = Components.interfaces;
 let Cc = Components.classes;
 let Cu = Components.utils;
 
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 Cu.import("resource://gre/modules/Services.jsm");
 Cu.import("resource://gre/modules/DownloadUtils.jsm");
 Cu.import("resource://gre/modules/NetUtil.jsm");
@@ -564,28 +566,27 @@ let AboutPermissions = {
         let uri = NetUtil.newURI(aHostname);
         this.addHost(uri.host);
       } catch (e) {
         // newURI will throw for add-ons logins stored in chrome:// URIs
       }
       itemCnt++;
     }, this);
 
-    let (enumerator = Services.perms.enumerator) {
-      while (enumerator.hasMoreElements()) {
-        if (itemCnt % this.LIST_BUILD_CHUNK == 0) {
-          yield true;
-        }
-        let permission = enumerator.getNext().QueryInterface(Ci.nsIPermission);
-        // Only include sites with exceptions set for supported permission types.
-        if (this._supportedPermissions.indexOf(permission.type) != -1) {
-          this.addHost(permission.host);
-        }
-        itemCnt++;
+    let enumerator = Services.perms.enumerator;
+    while (enumerator.hasMoreElements()) {
+      if (itemCnt % this.LIST_BUILD_CHUNK == 0) {
+        yield true;
       }
+      let permission = enumerator.getNext().QueryInterface(Ci.nsIPermission);
+      // Only include sites with exceptions set for supported permission types.
+      if (this._supportedPermissions.indexOf(permission.type) != -1) {
+        this.addHost(permission.host);
+      }
+      itemCnt++;
     }
 
     yield false;
   },
 
   /**
    * Creates a new Site and adds it to _sites if it's not already there.
    *
@@ -667,17 +668,18 @@ let AboutPermissions = {
   /**
    * Deletes sites for a host and all of its sub-domains. Removes these sites
    * from _sites and removes their corresponding elements from the DOM.
    *
    * @param aHost
    *        The host string corresponding to the site to delete.
    */
   deleteFromSitesList: function(aHost) {
-    for each (let site in this._sites) {
+    for (let host in this._sites) {
+      let site = this._sites[host];
       if (site.host.hasRootDomain(aHost)) {
         if (site == this._selectedSite) {
           // Replace site-specific interface with "All Sites" interface.
           this.sitesList.selectedItem = document.getElementById("all-sites-item");
         }
 
         this.sitesList.removeChild(site.listitem);
         delete this._sites[site.host];
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -1832,17 +1832,17 @@ nsDocShell::ValidateOrigin(nsIDocShellTr
         innerTargetURI = NS_GetInnermostURI(targetURI);
 
     return innerOriginURI && innerTargetURI &&
         NS_SUCCEEDED(innerOriginURI->SchemeIs("file", &originIsFile)) &&
         NS_SUCCEEDED(innerTargetURI->SchemeIs("file", &targetIsFile)) &&
         originIsFile && targetIsFile;
 }
 
-NS_IMETHODIMP
+nsresult
 nsDocShell::GetEldestPresContext(nsPresContext** aPresContext)
 {
     NS_ENSURE_ARG_POINTER(aPresContext);
     *aPresContext = nullptr;
 
     nsCOMPtr<nsIContentViewer> viewer = mContentViewer;
     while (viewer) {
         nsCOMPtr<nsIContentViewer> prevViewer;
@@ -7681,17 +7681,17 @@ nsDocShell::EndPageLoad(nsIWebProgress *
     return NS_OK;
 }
 
 
 //*****************************************************************************
 // nsDocShell: Content Viewer Management
 //*****************************************************************************   
 
-NS_IMETHODIMP
+nsresult
 nsDocShell::EnsureContentViewer()
 {
     if (mContentViewer)
         return NS_OK;
     if (mIsBeingDestroyed)
         return NS_ERROR_FAILURE;
 
     nsCOMPtr<nsIURI> baseURI;
@@ -8687,17 +8687,17 @@ nsDocShell::RestoreFromHistory()
     // Restart plugins, and paint the content.
     if (shell) {
         shell->Thaw();
     }
 
     return privWin->FireDelayedDOMEvents();
 }
 
-NS_IMETHODIMP
+nsresult
 nsDocShell::CreateContentViewer(const char *aContentType,
                                 nsIRequest * request,
                                 nsIStreamListener ** aContentHandler)
 {
     *aContentHandler = nullptr;
 
     // Can we check the content type of the current content viewer
     // and reuse it without destroying it and re-creating it?
@@ -8914,17 +8914,17 @@ nsDocShell::NewContentViewerObj(const ch
                                                    aContentHandler,
                                                    aViewer);
     NS_ENSURE_SUCCESS(rv, rv);
 
     (*aViewer)->SetContainer(this);
     return NS_OK;
 }
 
-NS_IMETHODIMP
+nsresult
 nsDocShell::SetupNewViewer(nsIContentViewer * aNewViewer)
 {
     //
     // Copy content viewer state from previous or parent content viewer.
     //
     // The following logic is mirrored in nsHTMLDocument::StartDocumentLoad!
     //
     // Do NOT to maintain a reference to the old content viewer outside
@@ -9185,17 +9185,17 @@ public:
     nsCopyFaviconCallback(nsIURI *aNewURI, bool aInPrivateBrowsing)
       : mNewURI(aNewURI)
       , mInPrivateBrowsing(aInPrivateBrowsing)
     {
     }
 
     NS_IMETHODIMP
     OnComplete(nsIURI *aFaviconURI, uint32_t aDataLen,
-               const uint8_t *aData, const nsACString &aMimeType)
+               const uint8_t *aData, const nsACString &aMimeType) MOZ_OVERRIDE
     {
         // Continue only if there is an associated favicon.
         if (!aFaviconURI) {
           return NS_OK;
         }
 
         NS_ASSERTION(aDataLen == 0,
                      "We weren't expecting the callback to deliver data.");
@@ -10597,17 +10597,17 @@ AppendSegmentToString(nsIInputStream *in
     nsAutoCString *buf = static_cast<nsAutoCString *>(closure);
     buf->Append(fromRawSegment, count);
 
     // Indicate that we have consumed all of aFromSegment
     *writeCount = count;
     return NS_OK;
 }
 
-NS_IMETHODIMP
+nsresult
 nsDocShell::AddHeadersToChannel(nsIInputStream *aHeadersData,
                                 nsIChannel *aGenericChannel)
 {
     nsCOMPtr<nsIHttpChannel> httpChannel = do_QueryInterface(aGenericChannel);
     NS_ENSURE_STATE(httpChannel);
 
     uint32_t numRead;
     nsAutoCString headersString;
@@ -11726,17 +11726,17 @@ nsDocShell::AddToSessionHistory(nsIURI *
             NS_ADDREF(*aNewEntry);
         }
     }
 
     return rv;
 }
 
 
-NS_IMETHODIMP
+nsresult
 nsDocShell::LoadHistoryEntry(nsISHEntry * aEntry, uint32_t aLoadType)
 {
     if (!IsNavigationAllowed()) {
         return NS_OK;
     }
     
     nsCOMPtr<nsIURI> uri;
     nsCOMPtr<nsIInputStream> postData;
@@ -11854,17 +11854,18 @@ NS_IMETHODIMP nsDocShell::GetShouldSaveL
         // Don't capture historystate and save it in history
         // if the page asked not to do so.
         mOSHE->GetSaveLayoutStateFlag(aShould);
     }
 
     return NS_OK;
 }
 
-NS_IMETHODIMP nsDocShell::PersistLayoutHistoryState()
+nsresult
+nsDocShell::PersistLayoutHistoryState()
 {
     nsresult  rv = NS_OK;
     
     if (mOSHE) {
         nsCOMPtr<nsIPresShell> shell = GetPresShell();
         if (shell) {
             nsCOMPtr<nsILayoutHistoryState> layoutState;
             rv = shell->CaptureHistoryState(getter_AddRefs(layoutState));
--- a/docshell/base/nsDocShell.h
+++ b/docshell/base/nsDocShell.h
@@ -155,17 +155,17 @@ class nsDocShell MOZ_FINAL : public nsDo
 
 public:
     MOZ_DECLARE_REFCOUNTED_TYPENAME(nsDocShell)
     // Object Management
     nsDocShell();
 
     NS_DECL_AND_IMPL_ZEROING_OPERATOR_NEW
 
-    virtual nsresult Init();
+    virtual nsresult Init() MOZ_OVERRIDE;
 
     NS_DECL_ISUPPORTS_INHERITED
 
     NS_DECL_NSIDOCSHELL
     NS_DECL_NSIDOCSHELLTREEITEM
     NS_DECL_NSIWEBNAVIGATION
     NS_DECL_NSIBASEWINDOW
     NS_DECL_NSISCROLLABLE
@@ -176,63 +176,63 @@ public:
     NS_DECL_NSIREFRESHURI
     NS_DECL_NSICONTENTVIEWERCONTAINER
     NS_DECL_NSIWEBPAGEDESCRIPTOR
     NS_DECL_NSIAUTHPROMPTPROVIDER
     NS_DECL_NSICLIPBOARDCOMMANDS
     NS_DECL_NSIWEBSHELLSERVICES
     NS_FORWARD_SAFE_NSIDOMSTORAGEMANAGER(TopSessionStorageManager())
 
-    NS_IMETHOD Stop() {
+    NS_IMETHOD Stop() MOZ_OVERRIDE {
         // Need this here because otherwise nsIWebNavigation::Stop
         // overrides the docloader's Stop()
         return nsDocLoader::Stop();
     }
 
     // Need to implement (and forward) nsISecurityEventSink, because
     // nsIWebProgressListener has methods with identical names...
     NS_FORWARD_NSISECURITYEVENTSINK(nsDocLoader::)
 
     // nsILinkHandler
     NS_IMETHOD OnLinkClick(nsIContent* aContent,
         nsIURI* aURI,
         const char16_t* aTargetSpec,
         const nsAString& aFileName,
         nsIInputStream* aPostDataStream,
         nsIInputStream* aHeadersDataStream,
-        bool aIsTrusted);
+        bool aIsTrusted) MOZ_OVERRIDE;
     NS_IMETHOD OnLinkClickSync(nsIContent* aContent,
         nsIURI* aURI,
         const char16_t* aTargetSpec,
         const nsAString& aFileName,
         nsIInputStream* aPostDataStream = 0,
         nsIInputStream* aHeadersDataStream = 0,
         nsIDocShell** aDocShell = 0,
-        nsIRequest** aRequest = 0);
+        nsIRequest** aRequest = 0) MOZ_OVERRIDE;
     NS_IMETHOD OnOverLink(nsIContent* aContent,
         nsIURI* aURI,
-        const char16_t* aTargetSpec);
-    NS_IMETHOD OnLeaveLink();
+        const char16_t* aTargetSpec) MOZ_OVERRIDE;
+    NS_IMETHOD OnLeaveLink() MOZ_OVERRIDE;
 
     nsDocShellInfoLoadType ConvertLoadTypeToDocShellLoadInfo(uint32_t aLoadType);
     uint32_t ConvertDocShellLoadInfoToLoadType(nsDocShellInfoLoadType aDocShellLoadType);
 
     // Don't use NS_DECL_NSILOADCONTEXT because some of nsILoadContext's methods
     // are shared with nsIDocShell (appID, etc.) and can't be declared twice.
-    NS_IMETHOD GetAssociatedWindow(nsIDOMWindow**);
-    NS_IMETHOD GetTopWindow(nsIDOMWindow**);
-    NS_IMETHOD GetTopFrameElement(nsIDOMElement**);
-    NS_IMETHOD GetNestedFrameId(uint64_t*);
-    NS_IMETHOD IsAppOfType(uint32_t, bool*);
-    NS_IMETHOD GetIsContent(bool*);
-    NS_IMETHOD GetUsePrivateBrowsing(bool*);
-    NS_IMETHOD SetUsePrivateBrowsing(bool);
-    NS_IMETHOD SetPrivateBrowsing(bool);
-    NS_IMETHOD GetUseRemoteTabs(bool*);
-    NS_IMETHOD SetRemoteTabs(bool);
+    NS_IMETHOD GetAssociatedWindow(nsIDOMWindow**) MOZ_OVERRIDE;
+    NS_IMETHOD GetTopWindow(nsIDOMWindow**) MOZ_OVERRIDE;
+    NS_IMETHOD GetTopFrameElement(nsIDOMElement**) MOZ_OVERRIDE;
+    NS_IMETHOD GetNestedFrameId(uint64_t*) MOZ_OVERRIDE;
+    NS_IMETHOD IsAppOfType(uint32_t, bool*) MOZ_OVERRIDE;
+    NS_IMETHOD GetIsContent(bool*) MOZ_OVERRIDE;
+    NS_IMETHOD GetUsePrivateBrowsing(bool*) MOZ_OVERRIDE;
+    NS_IMETHOD SetUsePrivateBrowsing(bool) MOZ_OVERRIDE;
+    NS_IMETHOD SetPrivateBrowsing(bool) MOZ_OVERRIDE;
+    NS_IMETHOD GetUseRemoteTabs(bool*) MOZ_OVERRIDE;
+    NS_IMETHOD SetRemoteTabs(bool) MOZ_OVERRIDE;
 
     // Restores a cached presentation from history (mLSHE).
     // This method swaps out the content viewer and simulates loads for
     // subframes.  It then simulates the completion of the toplevel load.
     nsresult RestoreFromHistory();
 
     // Perform a URI load from a refresh timer.  This is just like the
     // ForceRefreshURI method on nsIRefreshURI, but makes sure to take
@@ -387,72 +387,72 @@ public:
     void AddProfileTimelineMarker(mozilla::UniquePtr<TimelineMarker> &aMarker);
 
     // Global counter for how many docShells are currently recording profile
     // timeline markers
     static unsigned long gProfileTimelineRecordingsCount;
 protected:
     // Object Management
     virtual ~nsDocShell();
-    virtual void DestroyChildren();
+    virtual void DestroyChildren() MOZ_OVERRIDE;
 
     // Content Viewer Management
-    NS_IMETHOD EnsureContentViewer();
+    nsresult EnsureContentViewer();
     // aPrincipal can be passed in if the caller wants.  If null is
     // passed in, the about:blank principal will end up being used.
     nsresult CreateAboutBlankContentViewer(nsIPrincipal* aPrincipal,
                                            nsIURI* aBaseURI,
                                            bool aTryToSaveOldPresentation = true);
-    NS_IMETHOD CreateContentViewer(const char * aContentType, 
+    nsresult CreateContentViewer(const char * aContentType, 
         nsIRequest * request, nsIStreamListener ** aContentHandler);
-    NS_IMETHOD NewContentViewerObj(const char * aContentType, 
+    nsresult NewContentViewerObj(const char * aContentType, 
         nsIRequest * request, nsILoadGroup * aLoadGroup, 
         nsIStreamListener ** aContentHandler, nsIContentViewer ** aViewer);
-    NS_IMETHOD SetupNewViewer(nsIContentViewer * aNewViewer);
+    nsresult SetupNewViewer(nsIContentViewer * aNewViewer);
 
     void SetupReferrerFromChannel(nsIChannel * aChannel);
     
-    NS_IMETHOD GetEldestPresContext(nsPresContext** aPresContext);
+    nsresult GetEldestPresContext(nsPresContext** aPresContext);
 
     // Get the principal that we'll set on the channel if we're inheriting.  If
     // aConsiderCurrentDocument is true, we try to use the current document if
     // at all possible.  If that fails, we fall back on the parent document.
     // If that fails too, we force creation of a content viewer and use the
     // resulting principal.  If aConsiderCurrentDocument is false, we just look
     // at the parent.
     nsIPrincipal* GetInheritedPrincipal(bool aConsiderCurrentDocument);
 
     // Actually open a channel and perform a URI load.  Note: whatever owner is
     // passed to this function will be set on the channel.  Callers who wish to
     // not have an owner on the channel should just pass null.
     // If aSrcdoc is not void, the load will be considered as a srcdoc load,
     // and the contents of aSrcdoc will be loaded instead of aURI.
-    virtual nsresult DoURILoad(nsIURI * aURI,
-                               nsIURI * aReferrer,
-                               bool aSendReferrer,
-                               uint32_t aReferrerPolicy,
-                               nsISupports * aOwner,
-                               const char * aTypeHint,
-                               const nsAString & aFileName,
-                               nsIInputStream * aPostData,
-                               nsIInputStream * aHeadersData,
-                               bool firstParty,
-                               nsIDocShell ** aDocShell,
-                               nsIRequest ** aRequest,
-                               bool aIsNewWindowTarget,
-                               bool aBypassClassifier,
-                               bool aForceAllowCookies,
-                               const nsAString &aSrcdoc,
-                               nsIURI * baseURI,
-                               nsContentPolicyType aContentPolicyType);
-    NS_IMETHOD AddHeadersToChannel(nsIInputStream * aHeadersData, 
-                                  nsIChannel * aChannel);
-    virtual nsresult DoChannelLoad(nsIChannel * aChannel,
-                                   nsIURILoader * aURILoader,
-                                   bool aBypassClassifier);
+    nsresult DoURILoad(nsIURI * aURI,
+                       nsIURI * aReferrer,
+                       bool aSendReferrer,
+                       uint32_t aReferrerPolicy,
+                       nsISupports * aOwner,
+                       const char * aTypeHint,
+                       const nsAString & aFileName,
+                       nsIInputStream * aPostData,
+                       nsIInputStream * aHeadersData,
+                       bool firstParty,
+                       nsIDocShell ** aDocShell,
+                       nsIRequest ** aRequest,
+                       bool aIsNewWindowTarget,
+                       bool aBypassClassifier,
+                       bool aForceAllowCookies,
+                       const nsAString &aSrcdoc,
+                       nsIURI * baseURI,
+                       nsContentPolicyType aContentPolicyType);
+    nsresult AddHeadersToChannel(nsIInputStream * aHeadersData, 
+                                 nsIChannel * aChannel);
+    nsresult DoChannelLoad(nsIChannel * aChannel,
+                           nsIURILoader * aURILoader,
+                           bool aBypassClassifier);
 
     nsresult ScrollToAnchor(nsACString & curHash, nsACString & newHash,
                             uint32_t aLoadType);
 
     // Returns true if would have called FireOnLocationChange,
     // but did not because aFireOnLocationChange was false on entry.
     // In this case it is the caller's responsibility to ensure
     // FireOnLocationChange is called.
@@ -471,40 +471,40 @@ protected:
     // If OnNewURI calls AddToSessionHistory, it will pass its
     // aCloneSHChildren argument as aCloneChildren.
     bool OnNewURI(nsIURI * aURI, nsIChannel * aChannel, nsISupports* aOwner,
                     uint32_t aLoadType,
                     bool aFireOnLocationChange,
                     bool aAddToGlobalHistory,
                     bool aCloneSHChildren);
 
-    virtual void SetReferrerURI(nsIURI * aURI);
-    virtual void SetReferrerPolicy(uint32_t referrerPolicy);
+    void SetReferrerURI(nsIURI * aURI);
+    void SetReferrerPolicy(uint32_t referrerPolicy);
 
     // Session History
-    virtual bool ShouldAddToSessionHistory(nsIURI * aURI);
+    bool ShouldAddToSessionHistory(nsIURI * aURI);
     // Either aChannel or aOwner must be null.  If aChannel is
     // present, the owner should be gotten from it.
     // If aCloneChildren is true, then our current session history's
     // children will be cloned onto the new entry.  This should be
     // used when we aren't actually changing the document while adding
     // the new session history entry.
-    virtual nsresult AddToSessionHistory(nsIURI * aURI, nsIChannel * aChannel,
-                                         nsISupports* aOwner,
-                                         bool aCloneChildren,
-                                         nsISHEntry ** aNewEntry);
+    nsresult AddToSessionHistory(nsIURI * aURI, nsIChannel * aChannel,
+                                 nsISupports* aOwner,
+                                 bool aCloneChildren,
+                                 nsISHEntry ** aNewEntry);
     nsresult AddChildSHEntryToParent(nsISHEntry* aNewEntry, int32_t aChildOffset,
                                      bool aCloneChildren);
 
     nsresult AddChildSHEntryInternal(nsISHEntry* aCloneRef, nsISHEntry* aNewEntry,
                                      int32_t aChildOffset, uint32_t loadType,
                                      bool aCloneChildren);
 
-    NS_IMETHOD LoadHistoryEntry(nsISHEntry * aEntry, uint32_t aLoadType);
-    NS_IMETHOD PersistLayoutHistoryState();
+    nsresult LoadHistoryEntry(nsISHEntry * aEntry, uint32_t aLoadType);
+    nsresult PersistLayoutHistoryState();
 
     // Clone a session history tree for subframe navigation.
     // The tree rooted at |aSrcEntry| will be cloned into |aDestEntry|, except
     // for the entry with id |aCloneID|, which will be replaced with
     // |aReplaceEntry|.  |aSrcShell| is a (possibly null) docshell which
     // corresponds to |aSrcEntry| via its mLSHE or mOHE pointers, and will
     // have that pointer updated to point to the cloned history entry.
     // If aCloneChildren is true then the children of the entry with id
@@ -562,17 +562,17 @@ protected:
                                        WalkHistoryEntriesFunc aCallback,
                                        void *aData);
 
     // overridden from nsDocLoader, this provides more information than the
     // normal OnStateChange with flags STATE_REDIRECTING
     virtual void OnRedirectStateChange(nsIChannel* aOldChannel,
                                        nsIChannel* aNewChannel,
                                        uint32_t aRedirectFlags,
-                                       uint32_t aStateFlags);
+                                       uint32_t aStateFlags) MOZ_OVERRIDE;
 
     /**
      * Helper function that determines if channel is an HTTP POST.
      *
      * @param aChannel
      *        The channel to test
      *
      * @return True iff channel is an HTTP post.
@@ -796,17 +796,17 @@ protected:
     bool DoAppRedirectIfNeeded(nsIURI * aURI,
                                nsIDocShellLoadInfo * aLoadInfo,
                                bool aFirstParty);
 protected:
     nsresult GetCurScrollPos(int32_t scrollOrientation, int32_t * curPos);
     nsresult SetCurScrollPosEx(int32_t curHorizontalPos, int32_t curVerticalPos);
 
     // Override the parent setter from nsDocLoader
-    virtual nsresult SetDocLoaderParent(nsDocLoader * aLoader);
+    virtual nsresult SetDocLoaderParent(nsDocLoader * aLoader) MOZ_OVERRIDE;
 
     void ClearFrameHistory(nsISHEntry* aEntry);
 
     /**
      * Initializes mTiming if it isn't yet.
      * After calling this, mTiming is non-null.
      */
     void MaybeInitTiming();
--- a/docshell/base/nsIWebShellServices.h
+++ b/docshell/base/nsIWebShellServices.h
@@ -24,12 +24,12 @@ public:
                             int32_t aSource = kCharsetUninitialized) = 0;
   NS_IMETHOD StopDocumentLoad(void) = 0;
 };
 
 NS_DEFINE_STATIC_IID_ACCESSOR(nsIWebShellServices, NS_IWEB_SHELL_SERVICES_IID)
 
 /* Use this macro when declaring classes that implement this interface. */
 #define NS_DECL_NSIWEBSHELLSERVICES \
-  NS_IMETHOD ReloadDocument(const char *aCharset=nullptr, int32_t aSource=kCharsetUninitialized); \
-  NS_IMETHOD StopDocumentLoad(void); \
+  NS_IMETHOD ReloadDocument(const char *aCharset=nullptr, int32_t aSource=kCharsetUninitialized) MOZ_OVERRIDE; \
+  NS_IMETHOD StopDocumentLoad(void) MOZ_OVERRIDE; \
 
 #endif /* nsIWebShellServices_h___ */
--- a/dom/base/DOMException.cpp
+++ b/dom/base/DOMException.cpp
@@ -671,16 +671,44 @@ DOMException::GetName(nsString& retval)
 }
 
 void
 DOMException::GetMessageMoz(nsString& retval)
 {
   CopyUTF8toUTF16(mMessage, retval);
 }
 
+already_AddRefed<DOMException>
+DOMException::Constructor(GlobalObject& /* unused */,
+                          const nsAString& aMessage,
+                          const Optional<nsAString>& aName,
+                          ErrorResult& aError)
+{
+  nsresult exceptionResult = NS_OK;
+  uint16_t exceptionCode = 0;
+  nsCString name(NS_LITERAL_CSTRING("Error"));
+
+  if (aName.WasPassed()) {
+    CopyUTF16toUTF8(aName.Value(), name);
+    for (uint32_t idx = 0; idx < ArrayLength(sDOMErrorMsgMap); idx++) {
+      if (name.EqualsASCII(sDOMErrorMsgMap[idx].mName)) {
+        exceptionResult = sDOMErrorMsgMap[idx].mNSResult;
+        exceptionCode = sDOMErrorMsgMap[idx].mCode;
+      }
+    }
+  }
+
+  nsRefPtr<DOMException> retval =
+    new DOMException(exceptionResult,
+                     NS_ConvertUTF16toUTF8(aMessage),
+                     name,
+                     exceptionCode);
+  return retval.forget();
+}
+
 JSObject*
 DOMException::WrapObject(JSContext* aCx)
 {
   return DOMExceptionBinding::Wrap(aCx, this);
 }
 
 /* static */already_AddRefed<DOMException>
 DOMException::Create(nsresult aRv)
--- a/dom/base/DOMException.h
+++ b/dom/base/DOMException.h
@@ -17,30 +17,33 @@
 #include "js/GCAPI.h"
 #include "nsCOMPtr.h"
 #include "nsCycleCollectionParticipant.h"
 #include "nsID.h"
 #include "nsIDOMDOMException.h"
 #include "nsWrapperCache.h"
 #include "xpcexception.h"
 #include "nsString.h"
+#include "mozilla/dom/BindingDeclarations.h"
 
 class nsIStackFrame;
 class nsString;
 
 nsresult
 NS_GetNameAndMessageForDOMNSResult(nsresult aNSResult, nsACString& aName,
                                    nsACString& aMessage,
                                    uint16_t* aCode = nullptr);
 
 namespace mozilla {
 class ErrorResult;
 
 namespace dom {
 
+class GlobalObject;
+
 #define MOZILLA_EXCEPTION_IID \
 { 0x55eda557, 0xeba0, 0x4fe3, \
   { 0xae, 0x2e, 0xf3, 0x94, 0x49, 0x23, 0x62, 0xd6 } }
 
 class Exception : public nsIXPCException,
                   public nsWrapperCache
 {
 public:
@@ -131,16 +134,22 @@ public:
 
   // nsIException overrides
   NS_IMETHOD ToString(nsACString& aReturn) MOZ_OVERRIDE;
 
   // nsWrapperCache overrides
   virtual JSObject* WrapObject(JSContext* aCx)
     MOZ_OVERRIDE;
 
+  static already_AddRefed<DOMException>
+  Constructor(GlobalObject& /* unused */,
+              const nsAString& aMessage,
+              const Optional<nsAString>& aName,
+              ErrorResult& aError);
+
   uint16_t Code() const {
     return mCode;
   }
 
   // Intentionally shadow the nsXPCException version.
   void GetMessageMoz(nsString& retval);
   void GetName(nsString& retval);
 
--- a/dom/base/nsCrossSiteListenerProxy.cpp
+++ b/dom/base/nsCrossSiteListenerProxy.cpp
@@ -422,16 +422,19 @@ nsCORSListenerProxy::nsCORSListenerProxy
                                          const nsTArray<nsCString>& aPreflightHeaders)
   : mOuterListener(aOuter),
     mRequestingPrincipal(aRequestingPrincipal),
     mOriginHeaderPrincipal(aRequestingPrincipal),
     mWithCredentials(aWithCredentials && !gDisableCORSPrivateData),
     mRequestApproved(false),
     mHasBeenCrossSite(false),
     mIsPreflight(true),
+#ifdef DEBUG
+    mInited(false),
+#endif
     mPreflightMethod(aPreflightMethod),
     mPreflightHeaders(aPreflightHeaders)
 {
   for (uint32_t i = 0; i < mPreflightHeaders.Length(); ++i) {
     ToLowerCase(mPreflightHeaders[i]);
   }
   mPreflightHeaders.Sort();
 }
@@ -448,23 +451,27 @@ nsCORSListenerProxy::Init(nsIChannel* aC
 
   nsresult rv = UpdateChannel(aChannel, aAllowDataURI);
   if (NS_FAILED(rv)) {
     mOuterListener = nullptr;
     mRequestingPrincipal = nullptr;
     mOriginHeaderPrincipal = nullptr;
     mOuterNotificationCallbacks = nullptr;
   }
+#ifdef DEBUG
+  mInited = true;
+#endif
   return rv;
 }
 
 NS_IMETHODIMP
 nsCORSListenerProxy::OnStartRequest(nsIRequest* aRequest,
                                     nsISupports* aContext)
 {
+  MOZ_ASSERT(mInited, "nsCORSListenerProxy has not been initialized properly");
   nsresult rv = CheckRequestApproved(aRequest);
   mRequestApproved = NS_SUCCEEDED(rv);
   if (!mRequestApproved) {
     rv = LogBlockedRequest(aRequest);
     NS_WARN_IF_FALSE(NS_SUCCEEDED(rv), "Failed to log blocked cross-site request");
     if (sPreflightCache) {
       nsCOMPtr<nsIChannel> channel = do_QueryInterface(aRequest);
       if (channel) {
@@ -594,32 +601,34 @@ nsCORSListenerProxy::CheckRequestApprove
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsCORSListenerProxy::OnStopRequest(nsIRequest* aRequest,
                                    nsISupports* aContext,
                                    nsresult aStatusCode)
 {
+  MOZ_ASSERT(mInited, "nsCORSListenerProxy has not been initialized properly");
   nsresult rv = mOuterListener->OnStopRequest(aRequest, aContext, aStatusCode);
   mOuterListener = nullptr;
   mOuterNotificationCallbacks = nullptr;
   mRedirectCallback = nullptr;
   mOldRedirectChannel = nullptr;
   mNewRedirectChannel = nullptr;
   return rv;
 }
 
 NS_IMETHODIMP
 nsCORSListenerProxy::OnDataAvailable(nsIRequest* aRequest,
                                      nsISupports* aContext, 
                                      nsIInputStream* aInputStream,
                                      uint64_t aOffset,
                                      uint32_t aCount)
 {
+  MOZ_ASSERT(mInited, "nsCORSListenerProxy has not been initialized properly");
   if (!mRequestApproved) {
     return NS_ERROR_DOM_BAD_URI;
   }
   return mOuterListener->OnDataAvailable(aRequest, aContext, aInputStream,
                                          aOffset, aCount);
 }
 
 NS_IMETHODIMP
--- a/dom/base/nsCrossSiteListenerProxy.h
+++ b/dom/base/nsCrossSiteListenerProxy.h
@@ -70,16 +70,19 @@ private:
   // The principal to use for our Origin header ("source origin" in spec terms).
   // This can get changed during redirects, unlike mRequestingPrincipal.
   nsCOMPtr<nsIPrincipal> mOriginHeaderPrincipal;
   nsCOMPtr<nsIInterfaceRequestor> mOuterNotificationCallbacks;
   bool mWithCredentials;
   bool mRequestApproved;
   bool mHasBeenCrossSite;
   bool mIsPreflight;
+#ifdef DEBUG
+  bool mInited;
+#endif
   nsCString mPreflightMethod;
   nsTArray<nsCString> mPreflightHeaders;
   nsCOMPtr<nsIAsyncVerifyRedirectCallback> mRedirectCallback;
   nsCOMPtr<nsIChannel> mOldRedirectChannel;
   nsCOMPtr<nsIChannel> mNewRedirectChannel;
 };
 
 #endif
--- a/dom/base/test/test_DOMException.html
+++ b/dom/base/test/test_DOMException.html
@@ -39,12 +39,29 @@ var constants = [
   "INVALID_NODE_TYPE_ERR",
   "DATA_CLONE_ERR"
 ];
 for (var i = 0; i < constants.length; ++i) {
   var constant = constants[i];
   if (constant)
     is(DOMException[constant], i, constant)
 }
+
+var ex = new DOMException();
+ise(ex.name, "Error",
+    "Not passing a name should end up with 'Error' as the name");
+ise(ex.message, "",
+    "Not passing a message should end up with empty string as the message");
+
+ex = new DOMException("foo");
+ise(ex.name, "Error",
+    "Not passing a name should still end up with 'Error' as the name");
+ise(ex.message, "foo", "Should be using passed-in message");
+
+ex = new DOMException("bar", "NotSupportedError");
+ise(ex.name, "NotSupportedError", "Should be using the passed-in name");
+ise(ex.message, "bar", "Should still be using passed-in message");
+ise(ex.code, DOMException.NOT_SUPPORTED_ERR,
+    "Should have the right exception code");
 </script>
 </pre>
 </body>
 </html>
--- a/dom/bindings/BindingUtils.cpp
+++ b/dom/bindings/BindingUtils.cpp
@@ -29,16 +29,18 @@
 #include "xpcprivate.h"
 #include "XrayWrapper.h"
 #include "nsPrintfCString.h"
 #include "prprf.h"
 
 #include "mozilla/dom/ScriptSettings.h"
 #include "mozilla/dom/DOMError.h"
 #include "mozilla/dom/DOMErrorBinding.h"
+#include "mozilla/dom/DOMException.h"
+#include "mozilla/dom/DOMExceptionBinding.h"
 #include "mozilla/dom/ElementBinding.h"
 #include "mozilla/dom/HTMLObjectElement.h"
 #include "mozilla/dom/HTMLObjectElementBinding.h"
 #include "mozilla/dom/HTMLSharedObjectElement.h"
 #include "mozilla/dom/HTMLEmbedElementBinding.h"
 #include "mozilla/dom/HTMLAppletElementBinding.h"
 #include "mozilla/dom/Promise.h"
 #include "WorkerPrivate.h"
@@ -211,33 +213,74 @@ ErrorResult::ReportJSException(JSContext
   JS::Rooted<JS::Value> exception(cx, mJSException);
   if (JS_WrapValue(cx, &exception)) {
     JS_SetPendingException(cx, exception);
   }
   mJSException = exception;
   // If JS_WrapValue failed, not much we can do about it...  No matter
   // what, go ahead and unroot mJSException.
   js::RemoveRawValueRoot(cx, &mJSException);
+
+  // We no longer have a useful exception but we do want to signal that an error
+  // occured.
+  mResult = NS_ERROR_FAILURE;
 }
 
 void
 ErrorResult::ReportJSExceptionFromJSImplementation(JSContext* aCx)
 {
   MOZ_ASSERT(!mMightHaveUnreportedJSException,
              "Why didn't you tell us you planned to handle JS exceptions?");
 
+  dom::DOMException* domException;
+  nsresult rv =
+    UNWRAP_OBJECT(DOMException, &mJSException.toObject(), domException);
+  if (NS_SUCCEEDED(rv)) {
+    // We actually have to create a new DOMException object, because the one we
+    // have has a stack that includes the chrome code that threw it, and in
+    // particular has the wrong file/line/column information.
+    nsString message;
+    domException->GetMessageMoz(message);
+    nsString name;
+    domException->GetName(name);
+    nsRefPtr<dom::DOMException> newException =
+      new dom::DOMException(nsresult(domException->Result()),
+                            NS_ConvertUTF16toUTF8(message),
+                            NS_ConvertUTF16toUTF8(name),
+                            domException->Code());
+    JS::Rooted<JS::Value> reflector(aCx);
+    if (!GetOrCreateDOMReflector(aCx, newException, &reflector)) {
+      // Well, that threw _an_ exception.  Let's forget ours.  We can just
+      // unroot and not change the value, since mJSException is completely
+      // ignored if mResult is not NS_ERROR_DOM_JS_EXCEPTION and we plan to
+      // change mResult to a different value.
+      js::RemoveRawValueRoot(aCx, &mJSException);
+
+      // We no longer have a useful exception but we do want to signal that an
+      // error occured.
+      mResult = NS_ERROR_FAILURE;
+
+      // But do make sure to not ReportJSException here, since we don't have one.
+      return;
+    }
+
+    mJSException = reflector;
+    ReportJSException(aCx);
+    return;
+  }
+
   dom::DOMError* domError;
-  nsresult rv = UNWRAP_OBJECT(DOMError, &mJSException.toObject(), domError);
+  rv = UNWRAP_OBJECT(DOMError, &mJSException.toObject(), domError);
   if (NS_FAILED(rv)) {
-    // Unwrapping really shouldn't fail here, if mExceptionHandling is set to
+    // Unwrapping really shouldn't fail here: if mExceptionHandling is set to
     // eRethrowContentExceptions then the CallSetup destructor only stores an
-    // exception if it unwraps to DOMError. If we reach this then either
-    // mExceptionHandling wasn't set to eRethrowContentExceptions and we
-    // shouldn't be calling ReportJSExceptionFromJSImplementation or something
-    // went really wrong.
+    // exception if it unwraps to DOMError or DOMException. If we reach this
+    // then either mExceptionHandling wasn't set to eRethrowContentExceptions
+    // and we shouldn't be calling ReportJSExceptionFromJSImplementation or
+    // something went really wrong.
     NS_RUNTIMEABORT("We stored a non-DOMError exception!");
   }
 
   nsString message;
   domError->GetMessage(message);
 
   JS_ReportError(aCx, "%hs", message.get());
   js::RemoveRawValueRoot(aCx, &mJSException);
--- a/dom/bindings/CallbackObject.cpp
+++ b/dom/bindings/CallbackObject.cpp
@@ -3,16 +3,18 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "mozilla/dom/CallbackObject.h"
 #include "mozilla/dom/BindingUtils.h"
 #include "mozilla/dom/DOMError.h"
 #include "mozilla/dom/DOMErrorBinding.h"
+#include "mozilla/dom/DOMException.h"
+#include "mozilla/dom/DOMExceptionBinding.h"
 #include "jsfriendapi.h"
 #include "nsIScriptGlobalObject.h"
 #include "nsIXPConnect.h"
 #include "nsIScriptContext.h"
 #include "nsPIDOMWindow.h"
 #include "nsJSUtils.h"
 #include "nsIScriptSecurityManager.h"
 #include "xpcprivate.h"
@@ -185,31 +187,33 @@ CallbackObject::CallSetup::ShouldRethrow
 {
   if (mExceptionHandling == eRethrowExceptions) {
     return true;
   }
 
   MOZ_ASSERT(mExceptionHandling == eRethrowContentExceptions);
 
   // For eRethrowContentExceptions we only want to throw an exception if the
-  // object that was thrown is a DOMError object in the caller compartment
-  // (which we stored in mCompartment).
+  // object that was thrown is a DOMError or DOMException object in the caller
+  // compartment (which we stored in mCompartment).
 
   if (!aException.isObject()) {
     return false;
   }
 
   JS::Rooted<JSObject*> obj(mCx, &aException.toObject());
   obj = js::UncheckedUnwrap(obj, /* stopAtOuter = */ false);
   if (js::GetObjectCompartment(obj) != mCompartment) {
     return false;
   }
 
   DOMError* domError;
-  return NS_SUCCEEDED(UNWRAP_OBJECT(DOMError, obj, domError));
+  DOMException* domException;
+  return NS_SUCCEEDED(UNWRAP_OBJECT(DOMError, obj, domError)) ||
+         NS_SUCCEEDED(UNWRAP_OBJECT(DOMException, obj, domException));
 }
 
 CallbackObject::CallSetup::~CallSetup()
 {
   // To get our nesting right we have to destroy our JSAutoCompartment first.
   // In particular, we want to do this before we try reporting any exceptions,
   // so we end up reporting them while in the compartment of our entry point,
   // not whatever cross-compartment wrappper mCallback might be.
--- a/dom/bindings/CallbackObject.h
+++ b/dom/bindings/CallbackObject.h
@@ -80,18 +80,18 @@ public:
   {
     return mIncumbentGlobal;
   }
 
   enum ExceptionHandling {
     // Report any exception and don't throw it to the caller code.
     eReportExceptions,
     // Throw an exception to the caller code if the thrown exception is a
-    // binding object for a DOMError from the caller's scope, otherwise report
-    // it.
+    // binding object for a DOMError or DOMException from the caller's scope,
+    // otherwise report it.
     eRethrowContentExceptions,
     // Throw any exception to the caller code.
     eRethrowExceptions
   };
 
   size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
   {
     return aMallocSizeOf(this);
--- a/dom/bindings/Codegen.py
+++ b/dom/bindings/Codegen.py
@@ -2263,27 +2263,27 @@ class MethodDefiner(PropertyDefiner):
                     "nativeName": "UnforgeableValueOf",
                     "methodInfo": False,
                     "length": 0,
                     "flags": "JSPROP_ENUMERATE", # readonly/permanent added
                                                  # automatically.
                     "condition": MemberCondition(None, None)
                 })
 
-        if (descriptor.interface.isJSImplemented() and
-            descriptor.interface.hasInterfaceObject()):
+        if descriptor.interface.isJSImplemented():
             if static:
-                self.chrome.append({
-                    "name": '_create',
-                    "nativeName": ("%s::_Create" % descriptor.name),
-                    "methodInfo": False,
-                    "length": 2,
-                    "flags": "0",
-                    "condition": MemberCondition(None, None)
-                })
+                if descriptor.interface.hasInterfaceObject():
+                    self.chrome.append({
+                        "name": '_create',
+                        "nativeName": ("%s::_Create" % descriptor.name),
+                        "methodInfo": False,
+                        "length": 2,
+                        "flags": "0",
+                        "condition": MemberCondition(None, None)
+                    })
             else:
                 for m in clearableCachedAttrs(descriptor):
                     attrName = MakeNativeName(m.identifier.name)
                     self.chrome.append({
                         "name": "_clearCached%sValue" % attrName,
                         "nativeName": MakeJSImplClearCachedValueNativeName(m),
                         "methodInfo": False,
                         "length": "0",
--- a/dom/bindings/test/TestInterfaceJS.js
+++ b/dom/bindings/test/TestInterfaceJS.js
@@ -9,17 +9,20 @@ const Ci = Components.interfaces;
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 Cu.import("resource://gre/modules/Services.jsm");
 
 function TestInterfaceJS(anyArg, objectArg) {}
 
 TestInterfaceJS.prototype = {
   classID: Components.ID("{2ac4e026-cf25-47d5-b067-78d553c3cad8}"),
   contractID: "@mozilla.org/dom/test-interface-js;1",
-  QueryInterface: XPCOMUtils.generateQI([Ci.nsISupports]),
+  QueryInterface: XPCOMUtils.generateQI([Ci.nsISupports,
+                                         Ci.nsIDOMGlobalPropertyInitializer]),
+
+  init: function(win) { this._win = win; },
 
   __init: function (anyArg, objectArg, dictionaryArg) {
     this._anyAttr = undefined;
     this._objectAttr = null;
     this._anyArg = anyArg;
     this._objectArg = objectArg;
     this._dictionaryArg = dictionaryArg;
     this._cachedAttr = 15;
@@ -54,11 +57,20 @@ TestInterfaceJS.prototype = {
   returnBadUnion: function(x) { return 3; },
 
   get cachedAttr() { return this._cachedAttr; },
   setCachedAttr: function(n) { this._cachedAttr = n; },
   clearCachedAttrCache: function () { this.__DOM_IMPL__._clearCachedCachedAttrValue(); },
 
   testSequenceOverload: function(arg) {},
   testSequenceUnion: function(arg) {},
+
+  testThrowDOMError: function() {
+    throw new this._win.DOMError("NotSupportedError", "We are a DOMError");
+  },
+
+  testThrowDOMException: function() {
+    throw new this._win.DOMException("We are a DOMException",
+                                     "NotSupportedError");
+  },
 };
 
 this.NSGetFactory = XPCOMUtils.generateNSGetFactory([TestInterfaceJS])
--- a/dom/bindings/test/TestJSImplGen.webidl
+++ b/dom/bindings/test/TestJSImplGen.webidl
@@ -738,8 +738,15 @@ interface TestNavigator {
 interface TestNavigatorWithConstructor {
 };
 
 interface TestCImplementedInterface : TestJSImplInterface {
 };
 
 interface TestCImplementedInterface2 {
 };
+
+[NoInterfaceObject,
+ JSImplementation="@mozilla.org/test-js-impl-interface;2"]
+interface TestJSImplNoInterfaceObject {
+  [Cached, Pure]
+  readonly attribute byte cachedByte;
+};
--- a/dom/bindings/test/mochitest.ini
+++ b/dom/bindings/test/mochitest.ini
@@ -48,8 +48,10 @@ skip-if = debug == false
 skip-if = debug == false
 [test_sequence_wrapping.html]
 [test_setWithNamedGetterNoNamedSetter.html]
 [test_throwing_method_noDCE.html]
 [test_treat_non_object_as_null.html]
 [test_traceProtos.html]
 [test_sequence_detection.html]
 skip-if = debug == false
+[test_exception_options_from_jsimplemented.html]
+skip-if = debug == false
new file mode 100644
--- /dev/null
+++ b/dom/bindings/test/test_exception_options_from_jsimplemented.html
@@ -0,0 +1,73 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1107592
+-->
+<head>
+  <meta charset="utf-8">
+  <title>Test for Bug 1107592</title>
+  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+  <script type="application/javascript">
+
+  /** Test for Bug 1107592 **/
+
+  SimpleTest.waitForExplicitFinish();
+
+  function doTest() {
+    var t = new TestInterfaceJS();
+    try {
+      t.testThrowDOMError();
+    } catch (e) {
+      ok(e instanceof Error, "Should have an Error here");
+      ok(!(e instanceof DOMException), "Should not have DOMException here");
+      ok(!("code" in e), "Should not have a 'code' property");
+      ise(e.name, "Error", "Should not have an interesting name here");
+      ise(e.message, "We are a DOMError", "Should have the right message");
+      ise(e.stack,
+          "doTest@http://mochi.test:8888/tests/dom/bindings/test/test_exception_options_from_jsimplemented.html:20:7\n",
+          "Exception stack should still only show our code");
+      ise(e.fileName,
+          "http://mochi.test:8888/tests/dom/bindings/test/test_exception_options_from_jsimplemented.html",
+          "Should have the right file name");
+      ise(e.lineNumber, 20, "Should have the right line number");
+      ise(e.columnNumber, 6, "Should have the right column number");
+    }
+
+    try {
+      t.testThrowDOMException();
+    } catch (e) {
+      ok(e instanceof Error, "Should also have an Error here");
+      ok(e instanceof DOMException, "Should have DOMException here");
+      ise(e.name, "NotSupportedError", "Should have the right name here");
+      ise(e.message, "We are a DOMException",
+          "Should also have the right message");
+      ise(e.code, DOMException.NOT_SUPPORTED_ERR,
+          "Should have the right 'code'");
+      ise(e.stack,
+          "doTest@http://mochi.test:8888/tests/dom/bindings/test/test_exception_options_from_jsimplemented.html:38:6\n",
+          "Exception stack should still only show our code");
+      ise(e.filename,
+          "http://mochi.test:8888/tests/dom/bindings/test/test_exception_options_from_jsimplemented.html",
+          "Should still have the right file name");
+      ise(e.lineNumber, 38, "Should still have the right line number");
+      todo_is(e.columnNumber, 6,
+              "No column number support for DOMException yet");
+    }
+    SimpleTest.finish();
+  }
+
+  SpecialPowers.pushPrefEnv({set: [['dom.expose_test_interfaces', true]]},
+                            doTest);
+  </script>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1107592">Mozilla Bug 1107592</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+</pre>
+</body>
+</html>
--- a/dom/media/webaudio/AudioNodeStream.cpp
+++ b/dom/media/webaudio/AudioNodeStream.cpp
@@ -104,17 +104,16 @@ AudioNodeStream::SetStreamTimeParameter(
       static_cast<AudioNodeStream*>(mStream)->
           SetStreamTimeParameterImpl(mIndex, mRelativeToStream, mStreamTime);
     }
     double mStreamTime;
     MediaStream* mRelativeToStream;
     uint32_t mIndex;
   };
 
-  MOZ_ASSERT(this);
   GraphImpl()->AppendMessage(new Message(this, aIndex,
       aContext->DestinationStream(),
       aContext->DOMTimeToStreamTime(aStreamTime)));
 }
 
 void
 AudioNodeStream::SetStreamTimeParameterImpl(uint32_t aIndex, MediaStream* aRelativeToStream,
                                             double aStreamTime)
@@ -134,17 +133,16 @@ AudioNodeStream::SetDoubleParameter(uint
     {
       static_cast<AudioNodeStream*>(mStream)->Engine()->
           SetDoubleParameter(mIndex, mValue);
     }
     double mValue;
     uint32_t mIndex;
   };
 
-  MOZ_ASSERT(this);
   GraphImpl()->AppendMessage(new Message(this, aIndex, aValue));
 }
 
 void
 AudioNodeStream::SetInt32Parameter(uint32_t aIndex, int32_t aValue)
 {
   class Message : public ControlMessage {
   public:
@@ -154,17 +152,16 @@ AudioNodeStream::SetInt32Parameter(uint3
     {
       static_cast<AudioNodeStream*>(mStream)->Engine()->
           SetInt32Parameter(mIndex, mValue);
     }
     int32_t mValue;
     uint32_t mIndex;
   };
 
-  MOZ_ASSERT(this);
   GraphImpl()->AppendMessage(new Message(this, aIndex, aValue));
 }
 
 void
 AudioNodeStream::SetTimelineParameter(uint32_t aIndex,
                                       const AudioParamTimeline& aValue)
 {
   class Message : public ControlMessage {
@@ -198,17 +195,16 @@ AudioNodeStream::SetThreeDPointParameter
     {
       static_cast<AudioNodeStream*>(mStream)->Engine()->
           SetThreeDPointParameter(mIndex, mValue);
     }
     ThreeDPoint mValue;
     uint32_t mIndex;
   };
 
-  MOZ_ASSERT(this);
   GraphImpl()->AppendMessage(new Message(this, aIndex, aValue));
 }
 
 void
 AudioNodeStream::SetBuffer(already_AddRefed<ThreadSharedFloatArrayBufferList>&& aBuffer)
 {
   class Message : public ControlMessage {
   public:
@@ -218,17 +214,16 @@ AudioNodeStream::SetBuffer(already_AddRe
     virtual void Run()
     {
       static_cast<AudioNodeStream*>(mStream)->Engine()->
           SetBuffer(mBuffer.forget());
     }
     nsRefPtr<ThreadSharedFloatArrayBufferList> mBuffer;
   };
 
-  MOZ_ASSERT(this);
   GraphImpl()->AppendMessage(new Message(this, aBuffer));
 }
 
 void
 AudioNodeStream::SetRawArrayData(nsTArray<float>& aData)
 {
   class Message : public ControlMessage {
   public:
@@ -240,17 +235,16 @@ AudioNodeStream::SetRawArrayData(nsTArra
     }
     virtual void Run()
     {
       static_cast<AudioNodeStream*>(mStream)->Engine()->SetRawArrayData(mData);
     }
     nsTArray<float> mData;
   };
 
-  MOZ_ASSERT(this);
   GraphImpl()->AppendMessage(new Message(this, aData));
 }
 
 void
 AudioNodeStream::SetChannelMixingParameters(uint32_t aNumberOfChannels,
                                             ChannelCountMode aChannelCountMode,
                                             ChannelInterpretation aChannelInterpretation)
 {
@@ -271,17 +265,16 @@ AudioNodeStream::SetChannelMixingParamet
         SetChannelMixingParametersImpl(mNumberOfChannels, mChannelCountMode,
                                        mChannelInterpretation);
     }
     uint32_t mNumberOfChannels;
     ChannelCountMode mChannelCountMode;
     ChannelInterpretation mChannelInterpretation;
   };
 
-  MOZ_ASSERT(this);
   GraphImpl()->AppendMessage(new Message(this, aNumberOfChannels,
                                          aChannelCountMode,
                                          aChannelInterpretation));
 }
 
 void
 AudioNodeStream::SetPassThrough(bool aPassThrough)
 {
@@ -291,17 +284,16 @@ AudioNodeStream::SetPassThrough(bool aPa
       : ControlMessage(aStream), mPassThrough(aPassThrough) {}
     virtual void Run()
     {
       static_cast<AudioNodeStream*>(mStream)->mPassThrough = mPassThrough;
     }
     bool mPassThrough;
   };
 
-  MOZ_ASSERT(this);
   GraphImpl()->AppendMessage(new Message(this, aPassThrough));
 }
 
 void
 AudioNodeStream::SetChannelMixingParametersImpl(uint32_t aNumberOfChannels,
                                                 ChannelCountMode aChannelCountMode,
                                                 ChannelInterpretation aChannelInterpretation)
 {
--- a/dom/plugins/test/mochitest/test_crash_nested_loop.html
+++ b/dom/plugins/test/mochitest/test_crash_nested_loop.html
@@ -22,16 +22,17 @@
     // If we hit that bug, the browser process would crash when the plugin
     // crashes in crashInNestedLoop.  If not, we'll pass "spuriously".
     try {
       p.crashInNestedLoop();
       // The plugin didn't crash when expected.  This happens sometimes.  Give
       // it longer to crash.  If it crashes (but not at the apropriate time),
       // soft fail with a todo; if it doesn't crash then something went wrong,
       // so fail.
+      SimpleTest.requestFlakyTimeout("sometimes the plugin takes a little longer to crash");
       setTimeout(
         function() {
           try {
             p.getPaintCount();
             ok(false, "plugin should crash");
           } catch (e) {
             todo(false, "p.crashInNestedLoop() should throw an exception");
           }
--- a/dom/svg/DOMSVGPathSeg.h
+++ b/dom/svg/DOMSVGPathSeg.h
@@ -37,35 +37,35 @@ namespace mozilla {
                          uint32_t aListIndex,                                 \
                          bool aIsAnimValItem)                                 \
     : DOMSVGPathSeg(aList, aListIndex, aIsAnimValItem)                        \
   {                                                                           \
     CHECK_ARG_COUNT_IN_SYNC(segType);                                         \
   }                                                                           \
   /* From DOMSVGPathSeg: */                                                   \
   virtual uint32_t                                                            \
-  Type() const                                                                \
+  Type() const MOZ_OVERRIDE                                                   \
   {                                                                           \
     return segType;                                                           \
   }                                                                           \
   virtual DOMSVGPathSeg*                                                      \
-  Clone()                                                                     \
+  Clone() MOZ_OVERRIDE                                                        \
   {                                                                           \
     /* InternalItem() + 1, because we're skipping the encoded seg type */     \
     float *args = IsInList() ? InternalItem() + 1 : mArgs;                    \
     return new DOMSVGPathSeg##segName(args);                                  \
   }                                                                           \
   virtual float*                                                              \
-  PtrToMemberArgs()                                                           \
+  PtrToMemberArgs() MOZ_OVERRIDE                                              \
   {                                                                           \
     return mArgs;                                                             \
   }                                                                           \
                                                                               \
   virtual JSObject*                                                           \
-  WrapObject(JSContext* aCx) MOZ_OVERRIDE       \
+  WrapObject(JSContext* aCx) MOZ_OVERRIDE                                     \
   {                                                                           \
     return dom::SVGPathSeg##segName##Binding::Wrap(aCx, this);        \
   }
 
 
 /**
  * Class DOMSVGPathSeg
  *
--- a/dom/svg/DOMSVGPoint.h
+++ b/dom/svg/DOMSVGPoint.h
@@ -84,21 +84,21 @@ public:
     mPt.mX = aPt.x;
     mPt.mY = aPt.y;
     NS_ASSERTION(IsFinite(mPt.mX) && IsFinite(mPt.mX),
                  "DOMSVGPoint coords are not finite");
   }
 
 
   // WebIDL
-  virtual float X();
-  virtual void SetX(float aX, ErrorResult& rv);
-  virtual float Y();
-  virtual void SetY(float aY, ErrorResult& rv);
-  virtual already_AddRefed<nsISVGPoint> MatrixTransform(dom::SVGMatrix& matrix);
+  virtual float X() MOZ_OVERRIDE;
+  virtual void SetX(float aX, ErrorResult& rv) MOZ_OVERRIDE;
+  virtual float Y() MOZ_OVERRIDE;
+  virtual void SetY(float aY, ErrorResult& rv) MOZ_OVERRIDE;
+  virtual already_AddRefed<nsISVGPoint> MatrixTransform(dom::SVGMatrix& matrix) MOZ_OVERRIDE;
   nsISupports* GetParentObject() MOZ_OVERRIDE {
     return mList;
   }
 
   virtual DOMSVGPoint* Copy() MOZ_OVERRIDE {
     return new DOMSVGPoint(this);
   }
 
--- a/dom/svg/SVGAnimateElement.h
+++ b/dom/svg/SVGAnimateElement.h
@@ -28,15 +28,15 @@ protected:
 
   virtual JSObject* WrapNode(JSContext *aCx) MOZ_OVERRIDE;
 
 public:
   // nsIDOMNode
   virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE;
 
   // SVGAnimationElement
-  virtual nsSMILAnimationFunction& AnimationFunction();
+  virtual nsSMILAnimationFunction& AnimationFunction() MOZ_OVERRIDE;
 };
 
 } // namespace dom
 } // namespace mozilla
 
 #endif // mozilla_dom_SVGAnimateElement_h
--- a/dom/svg/SVGAnimateMotionElement.h
+++ b/dom/svg/SVGAnimateMotionElement.h
@@ -28,20 +28,20 @@ protected:
 
   virtual JSObject* WrapNode(JSContext *aCx) MOZ_OVERRIDE;
 
 public:
   // nsIDOMNode specializations
   virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE;
 
   // SVGAnimationElement
-  virtual nsSMILAnimationFunction& AnimationFunction();
+  virtual nsSMILAnimationFunction& AnimationFunction() MOZ_OVERRIDE;
   virtual bool GetTargetAttributeName(int32_t *aNamespaceID,
-                                      nsIAtom **aLocalName) const;
-  virtual nsSMILTargetAttrType GetTargetAttributeType() const;
+                                      nsIAtom **aLocalName) const MOZ_OVERRIDE;
+  virtual nsSMILTargetAttrType GetTargetAttributeType() const MOZ_OVERRIDE;
 
   // nsSVGElement
   virtual nsIAtom* GetPathDataAttrName() const MOZ_OVERRIDE {
     return nsGkAtoms::path;
   }
 
   // Utility method to let our <mpath> children tell us when they've changed,
   // so we can make sure our mAnimationFunction is marked as having changed.
--- a/dom/svg/SVGAnimateTransformElement.h
+++ b/dom/svg/SVGAnimateTransformElement.h
@@ -34,15 +34,15 @@ public:
 
   // Element specializations
   bool ParseAttribute(int32_t aNamespaceID,
                         nsIAtom* aAttribute,
                         const nsAString& aValue,
                         nsAttrValue& aResult) MOZ_OVERRIDE;
 
   // SVGAnimationElement
-  virtual nsSMILAnimationFunction& AnimationFunction();
+  virtual nsSMILAnimationFunction& AnimationFunction() MOZ_OVERRIDE;
 };
 
 } // namespace dom
 } // namespace mozilla
 
 #endif // mozilla_dom_SVGAnimateTransformElement_h
--- a/dom/svg/SVGDefsElement.h
+++ b/dom/svg/SVGDefsElement.h
@@ -19,17 +19,17 @@ class SVGDefsElement MOZ_FINAL : public 
 protected:
   friend nsresult (::NS_NewSVGDefsElement(nsIContent **aResult,
                                           already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
   explicit SVGDefsElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
   virtual JSObject* WrapNode(JSContext* aCx) MOZ_OVERRIDE;
 
 public:
   // nsIContent
-  NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const;
+  NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const MOZ_OVERRIDE;
 
-  virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const;
+  virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE;
 };
 
 } // namespace dom
 } // namespace mozilla
 
 #endif // mozilla_dom_SVGDefsElement_h
--- a/dom/svg/SVGFEDiffuseLightingElement.h
+++ b/dom/svg/SVGFEDiffuseLightingElement.h
@@ -29,19 +29,19 @@ protected:
 
 public:
   virtual FilterPrimitiveDescription
     GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
                             const IntRect& aFilterSubregion,
                             const nsTArray<bool>& aInputsAreTainted,
                             nsTArray<mozilla::RefPtr<SourceSurface>>& aInputImages) MOZ_OVERRIDE;
   virtual bool AttributeAffectsRendering(
-          int32_t aNameSpaceID, nsIAtom* aAttribute) const;
+          int32_t aNameSpaceID, nsIAtom* aAttribute) const MOZ_OVERRIDE;
 
-  virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const;
+  virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE;
 
   // WebIDL
   already_AddRefed<SVGAnimatedString> In1();
   already_AddRefed<SVGAnimatedNumber> SurfaceScale();
   already_AddRefed<SVGAnimatedNumber> DiffuseConstant();
   already_AddRefed<SVGAnimatedNumber> KernelUnitLengthX();
   already_AddRefed<SVGAnimatedNumber> KernelUnitLengthY();
 };
--- a/dom/svg/SVGFEOffsetElement.h
+++ b/dom/svg/SVGFEOffsetElement.h
@@ -32,17 +32,17 @@ protected:
 public:
   virtual FilterPrimitiveDescription
     GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
                             const IntRect& aFilterSubregion,
                             const nsTArray<bool>& aInputsAreTainted,
                             nsTArray<mozilla::RefPtr<SourceSurface>>& aInputImages) MOZ_OVERRIDE;
   virtual bool AttributeAffectsRendering(
           int32_t aNameSpaceID, nsIAtom* aAttribute) const MOZ_OVERRIDE;
-  virtual nsSVGString& GetResultImageName() { return mStringAttributes[RESULT]; }
+  virtual nsSVGString& GetResultImageName() MOZ_OVERRIDE { return mStringAttributes[RESULT]; }
   virtual void GetSourceImageNames(nsTArray<nsSVGStringInfo>& aSources) MOZ_OVERRIDE;
 
   virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE;
 
   // WebIDL
   already_AddRefed<SVGAnimatedString> In1();
   already_AddRefed<SVGAnimatedNumber> Dx();
   already_AddRefed<SVGAnimatedNumber> Dy();
--- a/dom/svg/SVGFESpecularLightingElement.h
+++ b/dom/svg/SVGFESpecularLightingElement.h
@@ -25,25 +25,25 @@ class SVGFESpecularLightingElement : pub
 protected:
   explicit SVGFESpecularLightingElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
     : SVGFESpecularLightingElementBase(aNodeInfo)
   {
   }
   virtual JSObject* WrapNode(JSContext* aCx) MOZ_OVERRIDE;
 
 public:
-  virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const;
+  virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE;
 
   virtual FilterPrimitiveDescription
     GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
                             const IntRect& aFilterSubregion,
                             const nsTArray<bool>& aInputsAreTainted,
                             nsTArray<mozilla::RefPtr<SourceSurface>>& aInputImages) MOZ_OVERRIDE;
   virtual bool AttributeAffectsRendering(
-          int32_t aNameSpaceID, nsIAtom* aAttribute) const;
+          int32_t aNameSpaceID, nsIAtom* aAttribute) const MOZ_OVERRIDE;
 
   // WebIDL
   already_AddRefed<SVGAnimatedString> In1();
   already_AddRefed<SVGAnimatedNumber> SurfaceScale();
   already_AddRefed<SVGAnimatedNumber> SpecularConstant();
   already_AddRefed<SVGAnimatedNumber> SpecularExponent();
   already_AddRefed<SVGAnimatedNumber> KernelUnitLengthX();
   already_AddRefed<SVGAnimatedNumber> KernelUnitLengthY();
--- a/dom/svg/SVGFETileElement.h
+++ b/dom/svg/SVGFETileElement.h
@@ -23,17 +23,17 @@ class SVGFETileElement : public SVGFETil
 protected:
   explicit SVGFETileElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
     : SVGFETileElementBase(aNodeInfo)
   {
   }
   virtual JSObject* WrapNode(JSContext *cx) MOZ_OVERRIDE;
 
 public:
-  virtual bool SubregionIsUnionOfRegions() { return false; }
+  virtual bool SubregionIsUnionOfRegions() MOZ_OVERRIDE { return false; }
 
   virtual FilterPrimitiveDescription
     GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
                             const IntRect& aFilterSubregion,
                             const nsTArray<bool>& aInputsAreTainted,
                             nsTArray<mozilla::RefPtr<SourceSurface>>& aInputImages) MOZ_OVERRIDE;
   virtual bool AttributeAffectsRendering(
           int32_t aNameSpaceID, nsIAtom* aAttribute) const MOZ_OVERRIDE;
--- a/dom/svg/SVGGElement.h
+++ b/dom/svg/SVGGElement.h
@@ -19,17 +19,17 @@ class SVGGElement MOZ_FINAL : public SVG
 protected:
   explicit SVGGElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
   virtual JSObject* WrapNode(JSContext *cx) MOZ_OVERRIDE;
   friend nsresult (::NS_NewSVGGElement(nsIContent **aResult,
                                        already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
 
 public:
   // nsIContent
-  NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const;
+  NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const MOZ_OVERRIDE;
 
-  virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const;
+  virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE;
 };
 
 } // namespace dom
 } // namespace mozilla
 
 #endif // mozilla_dom_SVGGElement_h
--- a/dom/svg/SVGIFrameElement.h
+++ b/dom/svg/SVGIFrameElement.h
@@ -89,18 +89,18 @@ public:
   using nsElementFrameLoaderOwner::GetContentDocument;
   using nsElementFrameLoaderOwner::GetContentWindow;
 
   // Parses a sandbox attribute and converts it to the set of flags used internally.
   // Returns 0 if there isn't the attribute.
   uint32_t GetSandboxFlags();
 
 private:
-  virtual LengthAttributesInfo GetLengthInfo();
-  virtual SVGAnimatedPreserveAspectRatio *GetPreserveAspectRatio();
+  virtual LengthAttributesInfo GetLengthInfo() MOZ_OVERRIDE;
+  virtual SVGAnimatedPreserveAspectRatio *GetPreserveAspectRatio() MOZ_OVERRIDE;
   virtual mozilla::dom::Element* ThisFrameElement() MOZ_OVERRIDE
   {
     return this;
   }
 
   enum { ATTR_X, ATTR_Y, ATTR_WIDTH, ATTR_HEIGHT };
   nsSVGLength2 mLengthAttributes[4];
   static LengthInfo sLengthInfo[4];
--- a/dom/svg/SVGIntegerPairSMILType.h
+++ b/dom/svg/SVGIntegerPairSMILType.h
@@ -23,17 +23,17 @@ public:
     static SVGIntegerPairSMILType sSingleton;
     return &sSingleton;
   }
 
 protected:
   // nsISMILType Methods
   // -------------------
   virtual void     Init(nsSMILValue& aValue) const MOZ_OVERRIDE;
-  virtual void     Destroy(nsSMILValue&) const;
+  virtual void     Destroy(nsSMILValue&) const MOZ_OVERRIDE;
   virtual nsresult Assign(nsSMILValue& aDest, const nsSMILValue& aSrc) const MOZ_OVERRIDE;
   virtual bool     IsEqual(const nsSMILValue& aLeft,
                            const nsSMILValue& aRight) const MOZ_OVERRIDE;
   virtual nsresult Add(nsSMILValue& aDest, const nsSMILValue& aValueToAdd,
                        uint32_t aCount) const MOZ_OVERRIDE;
   virtual nsresult ComputeDistance(const nsSMILValue& aFrom,
                                    const nsSMILValue& aTo,
                                    double& aDistance) const MOZ_OVERRIDE;
--- a/dom/svg/SVGLineElement.h
+++ b/dom/svg/SVGLineElement.h
@@ -30,17 +30,17 @@ public:
   NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* name) const MOZ_OVERRIDE;
 
   // nsSVGPathGeometryElement methods:
   virtual bool IsMarkable() MOZ_OVERRIDE { return true; }
   virtual void GetMarkPoints(nsTArray<nsSVGMark> *aMarks) MOZ_OVERRIDE;
   virtual void GetAsSimplePath(SimplePath* aSimplePath) MOZ_OVERRIDE;
   virtual TemporaryRef<Path> BuildPath(PathBuilder* aBuilder) MOZ_OVERRIDE;
 
-  virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const;
+  virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE;
 
   // WebIDL
   already_AddRefed<SVGAnimatedLength> X1();
   already_AddRefed<SVGAnimatedLength> Y1();
   already_AddRefed<SVGAnimatedLength> X2();
   already_AddRefed<SVGAnimatedLength> Y2();
 
 protected:
--- a/dom/svg/SVGNumberPairSMILType.h
+++ b/dom/svg/SVGNumberPairSMILType.h
@@ -18,17 +18,17 @@ class SVGNumberPairSMILType : public nsI
 public:
   // Singleton for nsSMILValue objects to hold onto.
   static SVGNumberPairSMILType sSingleton;
 
 protected:
   // nsISMILType Methods
   // -------------------
   virtual void     Init(nsSMILValue& aValue) const MOZ_OVERRIDE;
-  virtual void     Destroy(nsSMILValue&) const;
+  virtual void     Destroy(nsSMILValue&) const MOZ_OVERRIDE;
   virtual nsresult Assign(nsSMILValue& aDest, const nsSMILValue& aSrc) const MOZ_OVERRIDE;
   virtual bool     IsEqual(const nsSMILValue& aLeft,
                            const nsSMILValue& aRight) const MOZ_OVERRIDE;
   virtual nsresult Add(nsSMILValue& aDest, const nsSMILValue& aValueToAdd,
                        uint32_t aCount) const MOZ_OVERRIDE;
   virtual nsresult ComputeDistance(const nsSMILValue& aFrom,
                                    const nsSMILValue& aTo,
                                    double& aDistance) const MOZ_OVERRIDE;
--- a/dom/svg/SVGOrientSMILType.h
+++ b/dom/svg/SVGOrientSMILType.h
@@ -38,17 +38,17 @@ class SVGOrientSMILType : public nsISMIL
 public:
   // Singleton for nsSMILValue objects to hold onto.
   static SVGOrientSMILType sSingleton;
 
 protected:
   // nsISMILType Methods
   // -------------------
   virtual void     Init(nsSMILValue& aValue) const MOZ_OVERRIDE;
-  virtual void     Destroy(nsSMILValue&) const;
+  virtual void     Destroy(nsSMILValue&) const MOZ_OVERRIDE;
   virtual nsresult Assign(nsSMILValue& aDest, const nsSMILValue& aSrc) const MOZ_OVERRIDE;
   virtual bool     IsEqual(const nsSMILValue& aLeft,
                            const nsSMILValue& aRight) const MOZ_OVERRIDE;
   virtual nsresult Add(nsSMILValue& aDest, const nsSMILValue& aValueToAdd,
                        uint32_t aCount) const MOZ_OVERRIDE;
   virtual nsresult ComputeDistance(const nsSMILValue& aFrom,
                                    const nsSMILValue& aTo,
                                    double& aDistance) const MOZ_OVERRIDE;
--- a/dom/svg/SVGPolygonElement.h
+++ b/dom/svg/SVGPolygonElement.h
@@ -25,15 +25,15 @@ protected:
   friend nsresult (::NS_NewSVGPolygonElement(nsIContent **aResult,
                                              already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
 
 public:
   // nsSVGPathGeometryElement methods:
   virtual void GetMarkPoints(nsTArray<nsSVGMark> *aMarks) MOZ_OVERRIDE;
   virtual mozilla::TemporaryRef<Path> BuildPath(PathBuilder* aBuilder) MOZ_OVERRIDE;
 
-  virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const;
+  virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE;
 };
 
 } // namespace dom
 } // namespace mozilla
 
 #endif // mozilla_dom_SVGPolygonElement_h
--- a/dom/svg/SVGPolylineElement.h
+++ b/dom/svg/SVGPolylineElement.h
@@ -24,15 +24,15 @@ protected:
   friend nsresult (::NS_NewSVGPolylineElement(nsIContent **aResult,
                                               already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
 
   // nsSVGPathGeometryElement methods:
   virtual mozilla::TemporaryRef<Path> BuildPath(PathBuilder* aBuilder) MOZ_OVERRIDE;
 
 public:
   // nsIContent interface
-  virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const;
+  virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE;
 };
 
 } // namespace mozilla
 } // namespace dom
 
 #endif // mozilla_dom_SVGPolylineElement_h
--- a/dom/svg/SVGRect.h
+++ b/dom/svg/SVGRect.h
@@ -61,17 +61,17 @@ public:
     return mHeight;
   }
 
   virtual void SetHeight(float aHeight, ErrorResult& aRv) MOZ_FINAL
   {
     mHeight = aHeight;
   }
 
-  virtual nsIContent* GetParentObject() const
+  virtual nsIContent* GetParentObject() const MOZ_OVERRIDE
   {
     return mParent;
   }
 
 protected:
   ~SVGRect() {}
 
   nsCOMPtr<nsIContent> mParent;
--- a/dom/svg/SVGSetElement.h
+++ b/dom/svg/SVGSetElement.h
@@ -28,15 +28,15 @@ protected:
 
   virtual JSObject* WrapNode(JSContext *aCx) MOZ_OVERRIDE;
 
 public:
   // nsIDOMNode
   virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE;
 
   // SVGAnimationElement
-  virtual nsSMILAnimationFunction& AnimationFunction();
+  virtual nsSMILAnimationFunction& AnimationFunction() MOZ_OVERRIDE;
 };
 
 } // namespace dom
 } // namespace mozilla
 
 #endif // mozilla_dom_SVGSetElement_h
--- a/dom/svg/SVGSwitchElement.h
+++ b/dom/svg/SVGSwitchElement.h
@@ -35,23 +35,23 @@ public:
 
   // interfaces:
 
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(SVGSwitchElement,
                                            SVGSwitchElementBase)
   // nsINode
   virtual nsresult InsertChildAt(nsIContent* aKid, uint32_t aIndex,
-                                 bool aNotify);
-  virtual void RemoveChildAt(uint32_t aIndex, bool aNotify);
+                                 bool aNotify) MOZ_OVERRIDE;
+  virtual void RemoveChildAt(uint32_t aIndex, bool aNotify) MOZ_OVERRIDE;
 
   // nsIContent
-  NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const;
+  NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const MOZ_OVERRIDE;
 
-  virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const;
+  virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE;
 private:
   void UpdateActiveChild()
   { mActiveChild = FindActiveChild(); }
   nsIContent* FindActiveChild() const;
 
   // only this child will be displayed
   nsCOMPtr<nsIContent> mActiveChild;
 };
--- a/dom/svg/SVGSymbolElement.h
+++ b/dom/svg/SVGSymbolElement.h
@@ -30,27 +30,27 @@ protected:
   virtual JSObject* WrapNode(JSContext *cx) MOZ_OVERRIDE;
 
 public:
   // interfaces:
 
   NS_DECL_ISUPPORTS_INHERITED
 
   // nsIContent interface
-  NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* name) const;
+  NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* name) const MOZ_OVERRIDE;
 
-  virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const;
+  virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE;
 
   // WebIDL
   already_AddRefed<SVGAnimatedRect> ViewBox();
   already_AddRefed<DOMSVGAnimatedPreserveAspectRatio> PreserveAspectRatio();
 
 protected:
-  virtual nsSVGViewBox *GetViewBox();
-  virtual SVGAnimatedPreserveAspectRatio *GetPreserveAspectRatio();
+  virtual nsSVGViewBox *GetViewBox() MOZ_OVERRIDE;
+  virtual SVGAnimatedPreserveAspectRatio *GetPreserveAspectRatio() MOZ_OVERRIDE;
 
   nsSVGViewBox mViewBox;
   SVGAnimatedPreserveAspectRatio mPreserveAspectRatio;
 };
 
 } // namespace dom
 } // namespace mozilla
 
--- a/dom/svg/SVGTextElement.h
+++ b/dom/svg/SVGTextElement.h
@@ -22,19 +22,19 @@ protected:
   explicit SVGTextElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
   virtual JSObject* WrapNode(JSContext *cx) MOZ_OVERRIDE;
 
   friend nsresult (::NS_NewSVGTextElement(nsIContent **aResult,
                                           already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
 
 public:
   // nsIContent interface
-  NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const;
+  NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const MOZ_OVERRIDE;
 
-  virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const;
+  virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE;
 
 protected:
   virtual EnumAttributesInfo GetEnumInfo() MOZ_OVERRIDE;
   virtual LengthAttributesInfo GetLengthInfo() MOZ_OVERRIDE;
 
   nsSVGEnum mEnumAttributes[1];
   virtual nsSVGEnum* EnumAttributes() MOZ_OVERRIDE
     { return mEnumAttributes; }
--- a/dom/svg/SVGViewBoxSMILType.h
+++ b/dom/svg/SVGViewBoxSMILType.h
@@ -18,17 +18,17 @@ class SVGViewBoxSMILType : public nsISMI
 public:
   // Singleton for nsSMILValue objects to hold onto.
   static SVGViewBoxSMILType sSingleton;
 
 protected:
   // nsISMILType Methods
   // -------------------
   virtual void     Init(nsSMILValue& aValue) const MOZ_OVERRIDE;
-  virtual void     Destroy(nsSMILValue&) const;
+  virtual void     Destroy(nsSMILValue&) const MOZ_OVERRIDE;
   virtual nsresult Assign(nsSMILValue& aDest, const nsSMILValue& aSrc) const MOZ_OVERRIDE;
   virtual bool     IsEqual(const nsSMILValue& aLeft,
                            const nsSMILValue& aRight) const MOZ_OVERRIDE;
   virtual nsresult Add(nsSMILValue& aDest, const nsSMILValue& aValueToAdd,
                        uint32_t aCount) const MOZ_OVERRIDE;
   virtual nsresult ComputeDistance(const nsSMILValue& aFrom,
                                    const nsSMILValue& aTo,
                                    double& aDistance) const MOZ_OVERRIDE;
--- a/dom/svg/nsSVGPolyElement.h
+++ b/dom/svg/nsSVGPolyElement.h
@@ -24,22 +24,22 @@ protected:
   virtual ~nsSVGPolyElement();
 
 public:
   //interfaces
 
   NS_DECL_ISUPPORTS_INHERITED
 
   // nsIContent interface
-  NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* name) const;
+  NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* name) const MOZ_OVERRIDE;
 
-  virtual SVGAnimatedPointList* GetAnimatedPointList() {
+  virtual SVGAnimatedPointList* GetAnimatedPointList() MOZ_OVERRIDE {
     return &mPoints;
   }
-  virtual nsIAtom* GetPointListAttrName() const {
+  virtual nsIAtom* GetPointListAttrName() const MOZ_OVERRIDE {
     return nsGkAtoms::points;
   }
 
   // nsSVGElement methods:
   virtual bool HasValidDimensions() const MOZ_OVERRIDE;
 
   // nsSVGPathGeometryElement methods:
   virtual bool AttributeDefinesGeometry(const nsIAtom *aName) MOZ_OVERRIDE;
--- a/dom/svg/test/bbox-helper.svg
+++ b/dom/svg/test/bbox-helper.svg
@@ -5,16 +5,19 @@
     <image id="i" x="10" y="10" width="100" height="100"/>
   </g>
   <text id="b" x="20" y="20">b</text>
   <text id="a" x="20" y="30">a</text>
   <text id="y" x="20" y="40">y</text>
   <text id="tspan">
     <tspan x="20" y="20">b</tspan>
   </text>
+  <text id="text" x="20" y="60">text</text>
+  <!-- &#8206; is the same as the HTML &lrm; -->
+  <text id="lrmText" x="20" y="60">&#8206;text</text>
   <g id="v">
     <circle cx="100" cy="50" r="5"/>
     <path d="M 100,100 L 100,200"/>
   </g>
   <g id="h">
     <circle cx="200" cy="50" r="5"/>
     <path d="M 200,100 L 300,100"/>
   </g>
--- a/dom/svg/test/test_bbox.xhtml
+++ b/dom/svg/test/test_bbox.xhtml
@@ -53,16 +53,17 @@ function run()
     is(bbox1.height, bbox2.height, id1 + ".getBBox().height");
   }
 
   checkBBox("fO", 10, 10, 100, 100, 0.0);
   checkBBox("i", 10, 10, 100, 100, 0.0);
   compareBBoxHeight("a", "b");
   compareBBoxHeight("a", "y");
   compareBBox("b", "tspan");
+  compareBBoxHeight("text", "lrmText");
   checkBBox("v", 95, 45, 10, 155, 0.001);
   checkBBox("h", 195, 45, 105, 55, 0.001);
   checkBBox("e", 95, 95, 10, 10, 0.001);
   
   SimpleTest.finish();
 }
 
 window.addEventListener("load", run, false);
--- a/dom/svg/test/test_pathLength.html
+++ b/dom/svg/test/test_pathLength.html
@@ -9,38 +9,44 @@ https://bugzilla.mozilla.org/show_bug.cg
   <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
 </head>
 <body>
 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1024926">Mozilla Bug 1024926</a>
 <p id="display"></p>
 <div id="content" style="display: none">
   <svg width="100%" height="1" id="svg">
-    <path id="path" d="M50,100l0,0l0,-50l100,0l86.3325,122.665z"></path>
+    <path id="path_lines" d="M50,100l0,0l0,-50l100,0l86.3325,122.665z"></path>
+    <path id="path_straight_curve" d="M0,0 C100,0 150,0 200,0" />
   </svg>
 </div>
 <pre id="test">
 <script class="testbody" type="text/javascript">
 
   SimpleTest.waitForExplicitFinish();
 
-  var path = document.getElementById("path");
-
+  // Test a closed path with a series of lines.
+  var path = document.getElementById("path_lines");
   is(path.getTotalLength(), 500, "Unexpected path length");
 
+  // Test a path that's been shortened via the DOM.
   for (var i = 0; i < 2; i++) {
       path.pathSegList.removeItem(path.pathSegList.numberOfItems - 1);
   }
-
   is(path.getTotalLength(), 150, "Unexpected path length");
 
+  // Test a path that's been shortened to be empty, via the DOM.
   while (path.pathSegList.numberOfItems > 0) {
       path.pathSegList.removeItem(0);
   }
+  is(path.getTotalLength(), 0, "Unexpected path length");
 
-  is(path.getTotalLength(), 0, "Unexpected path length");
+  // Test a path with a curve command ("C") that is really a straight line.
+  path = document.getElementById("path_straight_curve");
+  is(path.getTotalLength(), 200, "Unexpected path length, for straight line " +
+                                 "generated by 'C' command");
 
   SimpleTest.finish();
 
 </script>
 </pre>
 </body>
 </html>
--- a/dom/webidl/DOMException.webidl
+++ b/dom/webidl/DOMException.webidl
@@ -69,17 +69,18 @@ interface Exception {
   stringifier;
 };
 
 Exception implements ExceptionMembers;
 
 // XXXkhuey this is an 'exception', not an interface, but we don't have any
 // parser or codegen mechanisms for dealing with exceptions.
 [ExceptionClass,
- Exposed=(Window, Worker)]
+ Exposed=(Window, Worker),
+ Constructor(optional DOMString message = "", optional DOMString name)]
 interface DOMException {
   const unsigned short INDEX_SIZE_ERR = 1;
   const unsigned short DOMSTRING_SIZE_ERR = 2; // historical
   const unsigned short HIERARCHY_REQUEST_ERR = 3;
   const unsigned short WRONG_DOCUMENT_ERR = 4;
   const unsigned short INVALID_CHARACTER_ERR = 5;
   const unsigned short NO_DATA_ALLOWED_ERR = 6; // historical
   const unsigned short NO_MODIFICATION_ALLOWED_ERR = 7;
--- a/dom/webidl/TestInterfaceJS.webidl
+++ b/dom/webidl/TestInterfaceJS.webidl
@@ -43,9 +43,16 @@ interface TestInterfaceJS {
   void setCachedAttr(short n);
   void clearCachedAttrCache();
 
   // Test for sequence overloading and union behavior
   void testSequenceOverload(sequence<DOMString> arg);
   void testSequenceOverload(DOMString arg);
 
   void testSequenceUnion((sequence<DOMString> or DOMString) arg);
+
+  // Tests for exception-throwing behavior
+  [Throws]
+  void testThrowDOMError();
+
+  [Throws]
+  void testThrowDOMException();
 };
--- a/editor/libeditor/CreateElementTxn.h
+++ b/editor/libeditor/CreateElementTxn.h
@@ -39,17 +39,17 @@ public:
                    nsINode& aParent,
                    int32_t aOffsetInParent);
 
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(CreateElementTxn, EditTxn)
 
   NS_DECL_EDITTXN
 
-  NS_IMETHOD RedoTransaction();
+  NS_IMETHOD RedoTransaction() MOZ_OVERRIDE;
 
   already_AddRefed<Element> GetNewNode();
 
 protected:
   virtual ~CreateElementTxn();
 
   /** the document into which the new node will be inserted */
   nsEditor* mEditor;
--- a/editor/libeditor/DeleteNodeTxn.h
+++ b/editor/libeditor/DeleteNodeTxn.h
@@ -31,17 +31,17 @@ public:
 
   DeleteNodeTxn();
 
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(DeleteNodeTxn, EditTxn)
 
   NS_DECL_EDITTXN
 
-  NS_IMETHOD RedoTransaction();
+  NS_IMETHOD RedoTransaction() MOZ_OVERRIDE;
 
 protected:
   virtual ~DeleteNodeTxn();
 
   /** the element to delete */
   nsCOMPtr<nsINode> mNode;
 
   /** parent of node to delete */
--- a/editor/libeditor/DeleteRangeTxn.h
+++ b/editor/libeditor/DeleteRangeTxn.h
@@ -32,23 +32,23 @@ public:
     */
   nsresult Init(nsEditor* aEditor,
                 nsRange* aRange,
                 nsRangeUpdater* aRangeUpdater);
 
   DeleteRangeTxn();
 
   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(DeleteRangeTxn, EditAggregateTxn)
-  NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr);
+  NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr) MOZ_OVERRIDE;
 
   NS_DECL_EDITTXN
 
-  NS_IMETHOD RedoTransaction();
+  NS_IMETHOD RedoTransaction() MOZ_OVERRIDE;
 
-  virtual void LastRelease()
+  virtual void LastRelease() MOZ_OVERRIDE
   {
     mRange = nullptr;
     EditAggregateTxn::LastRelease();
   }
 protected:
 
   nsresult CreateTxnsToDeleteBetween(nsINode* aNode,
                                      int32_t aStartOffset,
--- a/editor/libeditor/DeleteTextTxn.h
+++ b/editor/libeditor/DeleteTextTxn.h
@@ -36,17 +36,17 @@ public:
                 nsGenericDOMDataNode& aCharData,
                 uint32_t aOffset,
                 uint32_t aNumCharsToDelete,
                 nsRangeUpdater* aRangeUpdater);
 
   nsresult Init();
 
   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(DeleteTextTxn, EditTxn)
-  NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr);
+  NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr) MOZ_OVERRIDE;
 
   NS_DECL_EDITTXN
 
   uint32_t GetOffset() { return mOffset; }
 
   uint32_t GetNumCharsToDelete() { return mNumCharsToDelete; }
 
 protected:
--- a/editor/libeditor/EditAggregateTxn.h
+++ b/editor/libeditor/EditAggregateTxn.h
@@ -26,18 +26,18 @@ class EditAggregateTxn : public EditTxn
 public:
   EditAggregateTxn();
 
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(EditAggregateTxn, EditTxn)
 
   NS_DECL_EDITTXN
 
-  NS_IMETHOD RedoTransaction();
-  NS_IMETHOD Merge(nsITransaction *aTransaction, bool *aDidMerge);
+  NS_IMETHOD RedoTransaction() MOZ_OVERRIDE;
+  NS_IMETHOD Merge(nsITransaction *aTransaction, bool *aDidMerge) MOZ_OVERRIDE;
 
   /** append a transaction to this aggregate */
   NS_IMETHOD AppendChild(EditTxn *aTxn);
 
   /** get the name assigned to this txn */
   NS_IMETHOD GetName(nsIAtom **aName);
 
 protected:
--- a/editor/libeditor/EditTxn.h
+++ b/editor/libeditor/EditTxn.h
@@ -19,22 +19,22 @@ class EditTxn : public nsITransaction,
                 public nsPIEditorTransaction
 {
 public:
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
   NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(EditTxn, nsITransaction)
 
   virtual void LastRelease() {}
 
-  NS_IMETHOD RedoTransaction(void);
-  NS_IMETHOD GetIsTransient(bool *aIsTransient);
-  NS_IMETHOD Merge(nsITransaction *aTransaction, bool *aDidMerge);
+  NS_IMETHOD RedoTransaction(void) MOZ_OVERRIDE;
+  NS_IMETHOD GetIsTransient(bool *aIsTransient) MOZ_OVERRIDE;
+  NS_IMETHOD Merge(nsITransaction *aTransaction, bool *aDidMerge) MOZ_OVERRIDE;
 
 protected:
   virtual ~EditTxn();
 };
 
 #define NS_DECL_EDITTXN \
-  NS_IMETHOD DoTransaction(); \
-  NS_IMETHOD UndoTransaction(); \
-  NS_IMETHOD GetTxnDescription(nsAString& aTxnDescription);
+  NS_IMETHOD DoTransaction() MOZ_OVERRIDE; \
+  NS_IMETHOD UndoTransaction() MOZ_OVERRIDE; \
+  NS_IMETHOD GetTxnDescription(nsAString& aTxnDescription) MOZ_OVERRIDE;
 
 #endif
--- a/editor/libeditor/JoinNodeTxn.h
+++ b/editor/libeditor/JoinNodeTxn.h
@@ -32,17 +32,17 @@ public:
     * @param aRightNode the second of two nodes to join
     */
   JoinNodeTxn(nsEditor& aEditor, nsINode& aLeftNode, nsINode& aRightNode);
 
   /* Call this after constructing to ensure the inputs are correct */
   nsresult CheckValidity();
 
   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(JoinNodeTxn, EditTxn)
-  NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr);
+  NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr) MOZ_OVERRIDE;
 
   NS_DECL_EDITTXN
 
 protected:
   nsEditor&  mEditor;
 
   /** The nodes to operate upon.  After the merge, mRightNode remains and
    * mLeftNode is removed from the content tree.
--- a/editor/libeditor/PlaceholderTxn.cpp
+++ b/editor/libeditor/PlaceholderTxn.cpp
@@ -246,16 +246,16 @@ NS_IMETHODIMP PlaceholderTxn::ForwardEnd
 }
 
 NS_IMETHODIMP PlaceholderTxn::Commit()
 {
   mCommitted = true;
   return NS_OK;
 }
 
-NS_IMETHODIMP PlaceholderTxn::RememberEndingSelection()
+nsresult PlaceholderTxn::RememberEndingSelection()
 {
   nsRefPtr<Selection> selection = mEditor->GetSelection();
   NS_ENSURE_TRUE(selection, NS_ERROR_NULL_POINTER);
   mEndSel.SaveSelection(selection);
   return NS_OK;
 }
 
--- a/editor/libeditor/PlaceholderTxn.h
+++ b/editor/libeditor/PlaceholderTxn.h
@@ -39,35 +39,35 @@ public:
   
   PlaceholderTxn();
 
   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(PlaceholderTxn, EditAggregateTxn)
 // ------------ EditAggregateTxn -----------------------
 
   NS_DECL_EDITTXN
 
-  NS_IMETHOD RedoTransaction();
-  NS_IMETHOD Merge(nsITransaction *aTransaction, bool *aDidMerge);
+  NS_IMETHOD RedoTransaction() MOZ_OVERRIDE;
+  NS_IMETHOD Merge(nsITransaction *aTransaction, bool *aDidMerge) MOZ_OVERRIDE;
 
 // ------------ nsIAbsorbingTransaction -----------------------
 
   NS_IMETHOD Init(nsIAtom* aName, nsSelectionState* aSelState,
-                  nsEditor* aEditor);
+                  nsEditor* aEditor) MOZ_OVERRIDE;
   
-  NS_IMETHOD GetTxnName(nsIAtom **aName);
+  NS_IMETHOD GetTxnName(nsIAtom **aName) MOZ_OVERRIDE;
   
-  NS_IMETHOD StartSelectionEquals(nsSelectionState *aSelState, bool *aResult);
+  NS_IMETHOD StartSelectionEquals(nsSelectionState *aSelState, bool *aResult) MOZ_OVERRIDE;
 
-  NS_IMETHOD EndPlaceHolderBatch();
+  NS_IMETHOD EndPlaceHolderBatch() MOZ_OVERRIDE;
 
-  NS_IMETHOD ForwardEndBatchTo(nsIAbsorbingTransaction *aForwardingAddress);
+  NS_IMETHOD ForwardEndBatchTo(nsIAbsorbingTransaction *aForwardingAddress) MOZ_OVERRIDE;
 
-  NS_IMETHOD Commit();
+  NS_IMETHOD Commit() MOZ_OVERRIDE;
 
-  NS_IMETHOD RememberEndingSelection();
+  nsresult RememberEndingSelection();
 
 protected:
   virtual ~PlaceholderTxn();
 
   /** the presentation shell, which we'll need to get the selection */
   bool        mAbsorb;          // do we auto absorb any and all transaction?
   nsWeakPtr   mForwarding;
   mozilla::dom::IMETextTxn *mIMETextTxn;      // first IME txn in this placeholder - used for IME merging
--- a/editor/libeditor/SetDocTitleTxn.h
+++ b/editor/libeditor/SetDocTitleTxn.h
@@ -28,18 +28,18 @@ public:
                   const nsAString *aValue);
   SetDocTitleTxn();
 private:
   nsresult SetDomTitle(const nsAString& aTitle);
 
 public:
   NS_DECL_EDITTXN
 
-  NS_IMETHOD RedoTransaction();
-  NS_IMETHOD GetIsTransient(bool *aIsTransient);
+  NS_IMETHOD RedoTransaction() MOZ_OVERRIDE;
+  NS_IMETHOD GetIsTransient(bool *aIsTransient) MOZ_OVERRIDE;
 
 protected:
 
   /** the editor that created this transaction */
   nsIHTMLEditor*  mEditor;
   
   /** The new title string */
   nsString    mValue;
--- a/editor/libeditor/SplitNodeTxn.h
+++ b/editor/libeditor/SplitNodeTxn.h
@@ -34,17 +34,17 @@ public:
     */
   SplitNodeTxn(nsEditor& aEditor, nsIContent& aNode, int32_t aOffset);
 
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(SplitNodeTxn, EditTxn)
 
   NS_DECL_EDITTXN
 
-  NS_IMETHOD RedoTransaction();
+  NS_IMETHOD RedoTransaction() MOZ_OVERRIDE;
 
   nsIContent* GetNewNode();
 
 protected:
   virtual ~SplitNodeTxn();
 
   nsEditor& mEditor;
 
--- a/editor/libeditor/nsEditorCommands.h
+++ b/editor/libeditor/nsEditorCommands.h
@@ -18,32 +18,32 @@ class nsISupports;
 // MUST be stateless. Any state must be stored via the refCon (an nsIEditor).
 class nsBaseEditorCommand : public nsIControllerCommand
 {
 public:
   nsBaseEditorCommand();
     
   NS_DECL_ISUPPORTS
     
-  NS_IMETHOD  IsCommandEnabled(const char * aCommandName, nsISupports *aCommandRefCon, bool *_retval) = 0;
-  NS_IMETHOD  DoCommand(const char *aCommandName, nsISupports *aCommandRefCon) = 0;
+  NS_IMETHOD  IsCommandEnabled(const char * aCommandName, nsISupports *aCommandRefCon, bool *_retval) MOZ_OVERRIDE = 0;
+  NS_IMETHOD  DoCommand(const char *aCommandName, nsISupports *aCommandRefCon) MOZ_OVERRIDE = 0;
 
 protected:
   virtual ~nsBaseEditorCommand() {}
 };
 
 
 #define NS_DECL_EDITOR_COMMAND(_cmd)                    \
 class _cmd : public nsBaseEditorCommand                 \
 {                                                       \
 public:                                                 \
-  NS_IMETHOD IsCommandEnabled(const char * aCommandName, nsISupports *aCommandRefCon, bool *_retval); \
-  NS_IMETHOD DoCommand(const char *aCommandName, nsISupports *aCommandRefCon); \
-  NS_IMETHOD DoCommandParams(const char *aCommandName,nsICommandParams *aParams, nsISupports *aCommandRefCon); \
-  NS_IMETHOD GetCommandStateParams(const char *aCommandName,nsICommandParams *aParams, nsISupports *aCommandRefCon); \
+  NS_IMETHOD IsCommandEnabled(const char * aCommandName, nsISupports *aCommandRefCon, bool *_retval) MOZ_OVERRIDE; \
+  NS_IMETHOD DoCommand(const char *aCommandName, nsISupports *aCommandRefCon) MOZ_OVERRIDE; \
+  NS_IMETHOD DoCommandParams(const char *aCommandName,nsICommandParams *aParams, nsISupports *aCommandRefCon) MOZ_OVERRIDE; \
+  NS_IMETHOD GetCommandStateParams(const char *aCommandName,nsICommandParams *aParams, nsISupports *aCommandRefCon) MOZ_OVERRIDE; \
 };
 
 
 
 // basic editor commands
 NS_DECL_EDITOR_COMMAND(nsUndoCommand)
 NS_DECL_EDITOR_COMMAND(nsRedoCommand)
 NS_DECL_EDITOR_COMMAND(nsClearUndoCommand)
--- a/editor/libeditor/nsHTMLDataTransfer.cpp
+++ b/editor/libeditor/nsHTMLDataTransfer.cpp
@@ -130,17 +130,18 @@ static nsCOMPtr<nsIDOMNode> GetTablePare
     }
     parent->GetParentNode(getter_AddRefs(tmp));
     parent = tmp;
   }
   return nullptr;
 }
 
 
-NS_IMETHODIMP nsHTMLEditor::LoadHTML(const nsAString & aInputString)
+nsresult
+nsHTMLEditor::LoadHTML(const nsAString & aInputString)
 {
   NS_ENSURE_TRUE(mRules, NS_ERROR_NOT_INITIALIZED);
 
   // force IME commit; set up rules sniffing and batching
   ForceCompositionEnd();
   nsAutoEditBatch beginBatching(this);
   nsAutoRules beginRulesSniffing(this, EditAction::loadHTML, nsIEditor::eNext);
 
@@ -831,18 +832,19 @@ nsHTMLEditor::StripFormattingNodes(nsIDO
   return NS_OK;
 }
 
 NS_IMETHODIMP nsHTMLEditor::PrepareTransferable(nsITransferable **transferable)
 {
   return NS_OK;
 }
 
-NS_IMETHODIMP nsHTMLEditor::PrepareHTMLTransferable(nsITransferable **aTransferable, 
-                                                    bool aHavePrivFlavor)
+nsresult
+nsHTMLEditor::PrepareHTMLTransferable(nsITransferable **aTransferable,
+                                      bool aHavePrivFlavor)
 {
   // Create generic Transferable for getting the data
   nsresult rv = CallCreateInstance("@mozilla.org/widget/transferable;1", aTransferable);
   NS_ENSURE_SUCCESS(rv, rv);
 
   // Get the nsITransferable interface for getting the data from the clipboard
   if (aTransferable)
   {
@@ -1117,23 +1119,24 @@ nsresult nsHTMLEditor::InsertObject(cons
                                  aDestinationNode, aDestOffset,
                                  aDoDeleteSelection,
                                  aIsSafe);
   }
 
   return NS_OK;
 }
 
-NS_IMETHODIMP nsHTMLEditor::InsertFromTransferable(nsITransferable *transferable, 
-                                                   nsIDOMDocument *aSourceDoc,
-                                                   const nsAString & aContextStr,
-                                                   const nsAString & aInfoStr,
-                                                   nsIDOMNode *aDestinationNode,
-                                                   int32_t aDestOffset,
-                                                   bool aDoDeleteSelection)
+nsresult
+nsHTMLEditor::InsertFromTransferable(nsITransferable *transferable,
+                                     nsIDOMDocument *aSourceDoc,
+                                     const nsAString & aContextStr,
+                                     const nsAString & aInfoStr,
+                                     nsIDOMNode *aDestinationNode,
+                                     int32_t aDestOffset,
+                                     bool aDoDeleteSelection)
 {
   nsresult rv = NS_OK;
   nsXPIDLCString bestFlavor;
   nsCOMPtr<nsISupports> genericDataObj;
   uint32_t len = 0;
   if (NS_SUCCEEDED(transferable->GetAnyTransferData(getter_Copies(bestFlavor), getter_AddRefs(genericDataObj), &len)))
   {
     nsAutoTxnsConserveSelection dontSpazMySelection(this);
--- a/editor/libeditor/nsHTMLEditRules.h
+++ b/editor/libeditor/nsHTMLEditRules.h
@@ -64,53 +64,53 @@ class nsHTMLEditRules : public nsTextEdi
 {
 public:
 
   NS_DECL_ISUPPORTS_INHERITED
 
   nsHTMLEditRules();
 
   // nsIEditRules methods
-  NS_IMETHOD Init(nsPlaintextEditor *aEditor);
-  NS_IMETHOD DetachEditor();
+  NS_IMETHOD Init(nsPlaintextEditor *aEditor) MOZ_OVERRIDE;
+  NS_IMETHOD DetachEditor() MOZ_OVERRIDE;
   NS_IMETHOD BeforeEdit(EditAction action,
-                        nsIEditor::EDirection aDirection);
+                        nsIEditor::EDirection aDirection) MOZ_OVERRIDE;
   NS_IMETHOD AfterEdit(EditAction action,
-                       nsIEditor::EDirection aDirection);
+                       nsIEditor::EDirection aDirection) MOZ_OVERRIDE;
   NS_IMETHOD WillDoAction(mozilla::dom::Selection* aSelection, nsRulesInfo* aInfo,
-                          bool* aCancel, bool* aHandled);
+                          bool* aCancel, bool* aHandled) MOZ_OVERRIDE;
   NS_IMETHOD DidDoAction(mozilla::dom::Selection* aSelection,
-                         nsRulesInfo* aInfo, nsresult aResult);
-  NS_IMETHOD DocumentModified();
+                         nsRulesInfo* aInfo, nsresult aResult) MOZ_OVERRIDE;
+  NS_IMETHOD DocumentModified() MOZ_OVERRIDE;
 
   nsresult GetListState(bool *aMixed, bool *aOL, bool *aUL, bool *aDL);
   nsresult GetListItemState(bool *aMixed, bool *aLI, bool *aDT, bool *aDD);
   nsresult GetIndentState(bool *aCanIndent, bool *aCanOutdent);
   nsresult GetAlignment(bool *aMixed, nsIHTMLEditor::EAlignment *aAlign);
   nsresult GetParagraphState(bool *aMixed, nsAString &outFormat);
   nsresult MakeSureElemStartsOrEndsOnCR(nsIDOMNode *aNode);
 
   // nsIEditActionListener methods
   
-  NS_IMETHOD WillCreateNode(const nsAString& aTag, nsIDOMNode *aParent, int32_t aPosition);
-  NS_IMETHOD DidCreateNode(const nsAString& aTag, nsIDOMNode *aNode, nsIDOMNode *aParent, int32_t aPosition, nsresult aResult);
-  NS_IMETHOD WillInsertNode(nsIDOMNode *aNode, nsIDOMNode *aParent, int32_t aPosition);
-  NS_IMETHOD DidInsertNode(nsIDOMNode *aNode, nsIDOMNode *aParent, int32_t aPosition, nsresult aResult);
-  NS_IMETHOD WillDeleteNode(nsIDOMNode *aChild);
-  NS_IMETHOD DidDeleteNode(nsIDOMNode *aChild, nsresult aResult);
-  NS_IMETHOD WillSplitNode(nsIDOMNode *aExistingRightNode, int32_t aOffset);
-  NS_IMETHOD DidSplitNode(nsIDOMNode *aExistingRightNode, int32_t aOffset, nsIDOMNode *aNewLeftNode, nsresult aResult);
-  NS_IMETHOD WillJoinNodes(nsIDOMNode *aLeftNode, nsIDOMNode *aRightNode, nsIDOMNode *aParent);
-  NS_IMETHOD DidJoinNodes(nsIDOMNode  *aLeftNode, nsIDOMNode *aRightNode, nsIDOMNode *aParent, nsresult aResult);
-  NS_IMETHOD WillInsertText(nsIDOMCharacterData *aTextNode, int32_t aOffset, const nsAString &aString);
-  NS_IMETHOD DidInsertText(nsIDOMCharacterData *aTextNode, int32_t aOffset, const nsAString &aString, nsresult aResult);
-  NS_IMETHOD WillDeleteText(nsIDOMCharacterData *aTextNode, int32_t aOffset, int32_t aLength);
-  NS_IMETHOD DidDeleteText(nsIDOMCharacterData *aTextNode, int32_t aOffset, int32_t aLength, nsresult aResult);
-  NS_IMETHOD WillDeleteSelection(nsISelection *aSelection);
-  NS_IMETHOD DidDeleteSelection(nsISelection *aSelection);
+  NS_IMETHOD WillCreateNode(const nsAString& aTag, nsIDOMNode *aParent, int32_t aPosition) MOZ_OVERRIDE;
+  NS_IMETHOD DidCreateNode(const nsAString& aTag, nsIDOMNode *aNode, nsIDOMNode *aParent, int32_t aPosition, nsresult aResult) MOZ_OVERRIDE;
+  NS_IMETHOD WillInsertNode(nsIDOMNode *aNode, nsIDOMNode *aParent, int32_t aPosition) MOZ_OVERRIDE;
+  NS_IMETHOD DidInsertNode(nsIDOMNode *aNode, nsIDOMNode *aParent, int32_t aPosition, nsresult aResult) MOZ_OVERRIDE;
+  NS_IMETHOD WillDeleteNode(nsIDOMNode *aChild) MOZ_OVERRIDE;
+  NS_IMETHOD DidDeleteNode(nsIDOMNode *aChild, nsresult aResult) MOZ_OVERRIDE;
+  NS_IMETHOD WillSplitNode(nsIDOMNode *aExistingRightNode, int32_t aOffset) MOZ_OVERRIDE;
+  NS_IMETHOD DidSplitNode(nsIDOMNode *aExistingRightNode, int32_t aOffset, nsIDOMNode *aNewLeftNode, nsresult aResult) MOZ_OVERRIDE;
+  NS_IMETHOD WillJoinNodes(nsIDOMNode *aLeftNode, nsIDOMNode *aRightNode, nsIDOMNode *aParent) MOZ_OVERRIDE;
+  NS_IMETHOD DidJoinNodes(nsIDOMNode  *aLeftNode, nsIDOMNode *aRightNode, nsIDOMNode *aParent, nsresult aResult) MOZ_OVERRIDE;
+  NS_IMETHOD WillInsertText(nsIDOMCharacterData *aTextNode, int32_t aOffset, const nsAString &aString) MOZ_OVERRIDE;
+  NS_IMETHOD DidInsertText(nsIDOMCharacterData *aTextNode, int32_t aOffset, const nsAString &aString, nsresult aResult) MOZ_OVERRIDE;
+  NS_IMETHOD WillDeleteText(nsIDOMCharacterData *aTextNode, int32_t aOffset, int32_t aLength) MOZ_OVERRIDE;
+  NS_IMETHOD DidDeleteText(nsIDOMCharacterData *aTextNode, int32_t aOffset, int32_t aLength, nsresult aResult) MOZ_OVERRIDE;
+  NS_IMETHOD WillDeleteSelection(nsISelection *aSelection) MOZ_OVERRIDE;
+  NS_IMETHOD DidDeleteSelection(nsISelection *aSelection) MOZ_OVERRIDE;
 
 protected:
   virtual ~nsHTMLEditRules();
 
   enum RulesEndpoint
   {
     kStart,
     kEnd
--- a/editor/libeditor/nsHTMLEditor.cpp
+++ b/editor/libeditor/nsHTMLEditor.cpp
@@ -2658,17 +2658,17 @@ nsHTMLEditor::InsertLinkAroundSelection(
 
       res = SetInlineProperty(nsGkAtoms::a, name, value);
       NS_ENSURE_SUCCESS(res, res);
     }
   }
   return NS_OK;
 }
 
-NS_IMETHODIMP
+nsresult
 nsHTMLEditor::SetHTMLBackgroundColor(const nsAString& aColor)
 {
   NS_PRECONDITION(mDocWeak, "Missing Editor DOM Document");
   
   // Find a selected or enclosing table element to set background on
   nsCOMPtr<nsIDOMElement> element;
   int32_t selectedCount;
   nsAutoString tagName;
@@ -4528,17 +4528,17 @@ nsHTMLEditor::SetIsCSSEnabled(bool aIsCS
     // Turn on NoCSS, as we're disabling CSS.
     flags |= eEditorNoCSSMask;
   }
 
   return SetFlags(flags);
 }
 
 // Set the block background color
-NS_IMETHODIMP
+nsresult
 nsHTMLEditor::SetCSSBackgroundColor(const nsAString& aColor)
 {
   if (!mRules) { return NS_ERROR_NOT_INITIALIZED; }
   ForceCompositionEnd();
 
   // Protect the edit rules object from dying
   nsCOMPtr<nsIEditRules> kungFuDeathGrip(mRules);
 
@@ -4763,17 +4763,17 @@ nsHTMLEditor::AreNodesSameType(nsIConten
     return true;
   }
 
   // If CSS is enabled, we are stricter about span nodes.
   return mHTMLCSSUtils->ElementsSameStyle(aNode1->AsDOMNode(),
                                           aNode2->AsDOMNode());
 }
 
-NS_IMETHODIMP
+nsresult
 nsHTMLEditor::CopyLastEditableChildStyles(nsIDOMNode * aPreviousBlock, nsIDOMNode * aNewBlock,
                                           nsIDOMNode **aOutBrNode)
 {
   nsCOMPtr<nsINode> newBlock = do_QueryInterface(aNewBlock);
   NS_ENSURE_STATE(newBlock || !aNewBlock);
   *aOutBrNode = nullptr;
   nsCOMPtr<nsIDOMNode> child, tmp;
   nsresult res;
--- a/editor/libeditor/nsHTMLEditor.h
+++ b/editor/libeditor/nsHTMLEditor.h
@@ -95,37 +95,37 @@ public:
   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsHTMLEditor, nsPlaintextEditor)
 
 
   nsHTMLEditor();
 
   bool GetReturnInParagraphCreatesNewParagraph();
 
   /* ------------ nsPlaintextEditor overrides -------------- */
-  NS_IMETHOD GetIsDocumentEditable(bool *aIsDocumentEditable);
-  NS_IMETHOD BeginningOfDocument();
-  virtual nsresult HandleKeyPressEvent(nsIDOMKeyEvent* aKeyEvent);
-  virtual already_AddRefed<nsIContent> GetFocusedContent();
-  virtual already_AddRefed<nsIContent> GetFocusedContentForIME();
-  virtual bool IsActiveInDOMWindow();
-  virtual already_AddRefed<mozilla::dom::EventTarget> GetDOMEventTarget();
+  NS_IMETHOD GetIsDocumentEditable(bool *aIsDocumentEditable) MOZ_OVERRIDE;
+  NS_IMETHOD BeginningOfDocument() MOZ_OVERRIDE;
+  virtual nsresult HandleKeyPressEvent(nsIDOMKeyEvent* aKeyEvent) MOZ_OVERRIDE;
+  virtual already_AddRefed<nsIContent> GetFocusedContent() MOZ_OVERRIDE;
+  virtual already_AddRefed<nsIContent> GetFocusedContentForIME() MOZ_OVERRIDE;
+  virtual bool IsActiveInDOMWindow() MOZ_OVERRIDE;
+  virtual already_AddRefed<mozilla::dom::EventTarget> GetDOMEventTarget() MOZ_OVERRIDE;
   virtual mozilla::dom::Element* GetEditorRoot() MOZ_OVERRIDE;
-  virtual already_AddRefed<nsIContent> FindSelectionRoot(nsINode *aNode);
-  virtual bool IsAcceptableInputEvent(nsIDOMEvent* aEvent);
-  virtual already_AddRefed<nsIContent> GetInputEventTargetContent();
+  virtual already_AddRefed<nsIContent> FindSelectionRoot(nsINode *aNode) MOZ_OVERRIDE;
+  virtual bool IsAcceptableInputEvent(nsIDOMEvent* aEvent) MOZ_OVERRIDE;
+  virtual already_AddRefed<nsIContent> GetInputEventTargetContent() MOZ_OVERRIDE;
   virtual bool IsEditable(nsINode* aNode) MOZ_OVERRIDE;
   using nsEditor::IsEditable;
 
   /* ------------ nsStubMutationObserver overrides --------- */
   NS_DECL_NSIMUTATIONOBSERVER_CONTENTAPPENDED
   NS_DECL_NSIMUTATIONOBSERVER_CONTENTINSERTED
   NS_DECL_NSIMUTATIONOBSERVER_CONTENTREMOVED
 
   /* ------------ nsIEditorIMESupport overrides ------------ */
-  NS_IMETHOD GetPreferredIMEState(mozilla::widget::IMEState *aState);
+  NS_IMETHOD GetPreferredIMEState(mozilla::widget::IMEState *aState) MOZ_OVERRIDE;
 
   /* ------------ nsIHTMLEditor methods -------------- */
 
   NS_DECL_NSIHTMLEDITOR
 
   /* ------------ nsIHTMLObjectResizer methods -------------- */
   /* -------- Implemented in nsHTMLObjectResizer.cpp -------- */
   NS_DECL_NSIHTMLOBJECTRESIZER
@@ -134,104 +134,104 @@ public:
   /* -------- Implemented in nsHTMLAbsPosition.cpp --------- */
   NS_DECL_NSIHTMLABSPOSEDITOR
 
   /* ------------ nsIHTMLInlineTableEditor methods -------------- */
   /* ------- Implemented in nsHTMLInlineTableEditor.cpp --------- */
   NS_DECL_NSIHTMLINLINETABLEEDITOR
 
   /* ------------ nsIHTMLEditor methods -------------- */
-  NS_IMETHOD CopyLastEditableChildStyles(nsIDOMNode *aPreviousBlock, nsIDOMNode *aNewBlock,
+  nsresult CopyLastEditableChildStyles(nsIDOMNode *aPreviousBlock, nsIDOMNode *aNewBlock,
                                          nsIDOMNode **aOutBrNode);
 
-  NS_IMETHOD LoadHTML(const nsAString &aInputString);
+  nsresult LoadHTML(const nsAString &aInputString);
 
   nsresult GetCSSBackgroundColorState(bool *aMixed, nsAString &aOutColor,
                                       bool aBlockLevel);
   NS_IMETHOD GetHTMLBackgroundColorState(bool *aMixed, nsAString &outColor);
 
   /* ------------ nsIEditorStyleSheets methods -------------- */
 
-  NS_IMETHOD AddStyleSheet(const nsAString & aURL);
-  NS_IMETHOD ReplaceStyleSheet(const nsAString& aURL);
-  NS_IMETHOD RemoveStyleSheet(const nsAString &aURL);
+  NS_IMETHOD AddStyleSheet(const nsAString & aURL) MOZ_OVERRIDE;
+  NS_IMETHOD ReplaceStyleSheet(const nsAString& aURL) MOZ_OVERRIDE;
+  NS_IMETHOD RemoveStyleSheet(const nsAString &aURL) MOZ_OVERRIDE;
 
-  NS_IMETHOD AddOverrideStyleSheet(const nsAString & aURL);
-  NS_IMETHOD ReplaceOverrideStyleSheet(const nsAString& aURL);
-  NS_IMETHOD RemoveOverrideStyleSheet(const nsAString &aURL);
+  NS_IMETHOD AddOverrideStyleSheet(const nsAString & aURL) MOZ_OVERRIDE;
+  NS_IMETHOD ReplaceOverrideStyleSheet(const nsAString& aURL) MOZ_OVERRIDE;
+  NS_IMETHOD RemoveOverrideStyleSheet(const nsAString &aURL) MOZ_OVERRIDE;
 
-  NS_IMETHOD EnableStyleSheet(const nsAString& aURL, bool aEnable);
+  NS_IMETHOD EnableStyleSheet(const nsAString& aURL, bool aEnable) MOZ_OVERRIDE;
 
   /* ------------ nsIEditorMailSupport methods -------------- */
 
   NS_DECL_NSIEDITORMAILSUPPORT
 
   /* ------------ nsITableEditor methods -------------- */
 
-  NS_IMETHOD InsertTableCell(int32_t aNumber, bool aAfter);
-  NS_IMETHOD InsertTableColumn(int32_t aNumber, bool aAfter);
-  NS_IMETHOD InsertTableRow(int32_t aNumber, bool aAfter);
-  NS_IMETHOD DeleteTable();
-  NS_IMETHOD DeleteTableCell(int32_t aNumber);
-  NS_IMETHOD DeleteTableCellContents();
-  NS_IMETHOD DeleteTableColumn(int32_t aNumber);
-  NS_IMETHOD DeleteTableRow(int32_t aNumber);
-  NS_IMETHOD SelectTableCell();
-  NS_IMETHOD SelectBlockOfCells(nsIDOMElement *aStartCell, nsIDOMElement *aEndCell);
-  NS_IMETHOD SelectTableRow();
-  NS_IMETHOD SelectTableColumn();
-  NS_IMETHOD SelectTable();
-  NS_IMETHOD SelectAllTableCells();
-  NS_IMETHOD SwitchTableCellHeaderType(nsIDOMElement *aSourceCell, nsIDOMElement **aNewCell);
-  NS_IMETHOD JoinTableCells(bool aMergeNonContiguousContents);
-  NS_IMETHOD SplitTableCell();
-  NS_IMETHOD NormalizeTable(nsIDOMElement *aTable);
+  NS_IMETHOD InsertTableCell(int32_t aNumber, bool aAfter) MOZ_OVERRIDE;
+  NS_IMETHOD InsertTableColumn(int32_t aNumber, bool aAfter) MOZ_OVERRIDE;
+  NS_IMETHOD InsertTableRow(int32_t aNumber, bool aAfter) MOZ_OVERRIDE;
+  NS_IMETHOD DeleteTable() MOZ_OVERRIDE;
+  NS_IMETHOD DeleteTableCell(int32_t aNumber) MOZ_OVERRIDE;
+  NS_IMETHOD DeleteTableCellContents() MOZ_OVERRIDE;
+  NS_IMETHOD DeleteTableColumn(int32_t aNumber) MOZ_OVERRIDE;
+  NS_IMETHOD DeleteTableRow(int32_t aNumber) MOZ_OVERRIDE;
+  NS_IMETHOD SelectTableCell() MOZ_OVERRIDE;
+  NS_IMETHOD SelectBlockOfCells(nsIDOMElement *aStartCell, nsIDOMElement *aEndCell) MOZ_OVERRIDE;
+  NS_IMETHOD SelectTableRow() MOZ_OVERRIDE;
+  NS_IMETHOD SelectTableColumn() MOZ_OVERRIDE;
+  NS_IMETHOD SelectTable() MOZ_OVERRIDE;
+  NS_IMETHOD SelectAllTableCells() MOZ_OVERRIDE;
+  NS_IMETHOD SwitchTableCellHeaderType(nsIDOMElement *aSourceCell, nsIDOMElement **aNewCell) MOZ_OVERRIDE;
+  NS_IMETHOD JoinTableCells(bool aMergeNonContiguousContents) MOZ_OVERRIDE;
+  NS_IMETHOD SplitTableCell() MOZ_OVERRIDE;
+  NS_IMETHOD NormalizeTable(nsIDOMElement *aTable) MOZ_OVERRIDE;
   NS_IMETHOD GetCellIndexes(nsIDOMElement *aCell,
-                            int32_t* aRowIndex, int32_t* aColIndex);
+                            int32_t* aRowIndex, int32_t* aColIndex) MOZ_OVERRIDE;
   NS_IMETHOD GetTableSize(nsIDOMElement *aTable,
-                          int32_t* aRowCount, int32_t* aColCount);
-  NS_IMETHOD GetCellAt(nsIDOMElement* aTable, int32_t aRowIndex, int32_t aColIndex, nsIDOMElement **aCell);
+                          int32_t* aRowCount, int32_t* aColCount) MOZ_OVERRIDE;
+  NS_IMETHOD GetCellAt(nsIDOMElement* aTable, int32_t aRowIndex, int32_t aColIndex, nsIDOMElement **aCell) MOZ_OVERRIDE;
   NS_IMETHOD GetCellDataAt(nsIDOMElement* aTable,
                            int32_t aRowIndex, int32_t aColIndex,
                            nsIDOMElement **aCell,
                            int32_t* aStartRowIndex, int32_t* aStartColIndex,
                            int32_t* aRowSpan, int32_t* aColSpan, 
                            int32_t* aActualRowSpan, int32_t* aActualColSpan, 
-                           bool* aIsSelected);
-  NS_IMETHOD GetFirstRow(nsIDOMElement* aTableElement, nsIDOMNode** aRowNode);
-  NS_IMETHOD GetNextRow(nsIDOMNode* aCurrentRowNode, nsIDOMNode** aRowNode);
-  NS_IMETHOD GetLastCellInRow(nsIDOMNode* aRowNode, nsIDOMNode** aCellNode);
+                           bool* aIsSelected) MOZ_OVERRIDE;
+  NS_IMETHOD GetFirstRow(nsIDOMElement* aTableElement, nsIDOMNode** aRowNode) MOZ_OVERRIDE;
+  NS_IMETHOD GetNextRow(nsIDOMNode* aCurrentRowNode, nsIDOMNode** aRowNode) MOZ_OVERRIDE;
+  nsresult GetLastCellInRow(nsIDOMNode* aRowNode, nsIDOMNode** aCellNode);
 
   NS_IMETHOD SetSelectionAfterTableEdit(nsIDOMElement* aTable, int32_t aRow, int32_t aCol, 
-                                        int32_t aDirection, bool aSelected);
+                                        int32_t aDirection, bool aSelected) MOZ_OVERRIDE;
   NS_IMETHOD GetSelectedOrParentTableElement(nsAString& aTagName,
                                              int32_t *aSelectedCount,
-                                             nsIDOMElement** aTableElement);
-  NS_IMETHOD GetSelectedCellsType(nsIDOMElement *aElement, uint32_t *aSelectionType);
+                                             nsIDOMElement** aTableElement) MOZ_OVERRIDE;
+  NS_IMETHOD GetSelectedCellsType(nsIDOMElement *aElement, uint32_t *aSelectionType) MOZ_OVERRIDE;
 
   nsresult GetCellFromRange(nsRange* aRange, nsIDOMElement** aCell);
 
   // Finds the first selected cell in first range of selection
   // This is in the *order of selection*, not order in the table
   // (i.e., each cell added to selection is added in another range 
   //  in the selection's rangelist, independent of location in table)
   // aRange is optional: returns the range around the cell
-  NS_IMETHOD GetFirstSelectedCell(nsIDOMRange **aRange, nsIDOMElement **aCell);
+  NS_IMETHOD GetFirstSelectedCell(nsIDOMRange **aRange, nsIDOMElement **aCell) MOZ_OVERRIDE;
   // Get next cell until no more are found. Always use GetFirstSelected cell first
   // aRange is optional: returns the range around the cell
-  NS_IMETHOD GetNextSelectedCell(nsIDOMRange **aRange, nsIDOMElement **aCell);
+  NS_IMETHOD GetNextSelectedCell(nsIDOMRange **aRange, nsIDOMElement **aCell) MOZ_OVERRIDE;
 
   // Upper-left-most selected cell in table
-  NS_IMETHOD GetFirstSelectedCellInTable(int32_t *aRowIndex, int32_t *aColIndex, nsIDOMElement **aCell);
+  NS_IMETHOD GetFirstSelectedCellInTable(int32_t *aRowIndex, int32_t *aColIndex, nsIDOMElement **aCell) MOZ_OVERRIDE;
     
   /* miscellaneous */
   // This sets background on the appropriate container element (table, cell,)
   //   or calls into nsTextEditor to set the page background
-  NS_IMETHOD SetCSSBackgroundColor(const nsAString& aColor);
-  NS_IMETHOD SetHTMLBackgroundColor(const nsAString& aColor);
+  nsresult SetCSSBackgroundColor(const nsAString& aColor);
+  nsresult SetHTMLBackgroundColor(const nsAString& aColor);
 
   /* ------------ Block methods moved from nsEditor -------------- */
   static already_AddRefed<mozilla::dom::Element> GetBlockNodeParent(nsINode* aNode);
   static already_AddRefed<nsIDOMNode> GetBlockNodeParent(nsIDOMNode *aNode);
 
   void IsNextCharInNodeWhitespace(nsIContent* aContent,
                                   int32_t aOffset,
                                   bool* outIsSpace,
@@ -242,104 +242,104 @@ public:
                                   int32_t aOffset,
                                   bool* outIsSpace,
                                   bool* outIsNBSP,
                                   nsIContent** outNode = nullptr,
                                   int32_t* outOffset = 0);
 
   /* ------------ Overrides of nsEditor interface methods -------------- */
 
-  nsresult EndUpdateViewBatch();
+  nsresult EndUpdateViewBatch() MOZ_OVERRIDE;
 
   /** prepare the editor for use */
   NS_IMETHOD Init(nsIDOMDocument *aDoc, nsIContent *aRoot,
                   nsISelectionController *aSelCon, uint32_t aFlags,
-                  const nsAString& aValue);
-  NS_IMETHOD PreDestroy(bool aDestroyingFrames);
+                  const nsAString& aValue) MOZ_OVERRIDE;
+  NS_IMETHOD PreDestroy(bool aDestroyingFrames) MOZ_OVERRIDE;
 
   /** Internal, static version */
   // aElement must not be null.
   static bool NodeIsBlockStatic(const mozilla::dom::Element* aElement);
   static nsresult NodeIsBlockStatic(nsIDOMNode *aNode, bool *aIsBlock);
 protected:
   virtual ~nsHTMLEditor();
 
   using nsEditor::IsBlockNode;
-  virtual bool IsBlockNode(nsINode *aNode);
+  virtual bool IsBlockNode(nsINode *aNode) MOZ_OVERRIDE;
 
 public:
-  NS_IMETHOD SetFlags(uint32_t aFlags);
+  NS_IMETHOD SetFlags(uint32_t aFlags) MOZ_OVERRIDE;
 
-  NS_IMETHOD Paste(int32_t aSelectionType);
-  NS_IMETHOD CanPaste(int32_t aSelectionType, bool *aCanPaste);
+  NS_IMETHOD Paste(int32_t aSelectionType) MOZ_OVERRIDE;
+  NS_IMETHOD CanPaste(int32_t aSelectionType, bool *aCanPaste) MOZ_OVERRIDE;
 
-  NS_IMETHOD PasteTransferable(nsITransferable *aTransferable);
-  NS_IMETHOD CanPasteTransferable(nsITransferable *aTransferable, bool *aCanPaste);
+  NS_IMETHOD PasteTransferable(nsITransferable *aTransferable) MOZ_OVERRIDE;
+  NS_IMETHOD CanPasteTransferable(nsITransferable *aTransferable, bool *aCanPaste) MOZ_OVERRIDE;
 
-  NS_IMETHOD DebugUnitTests(int32_t *outNumTests, int32_t *outNumTestsFailed);
+  NS_IMETHOD DebugUnitTests(int32_t *outNumTests, int32_t *outNumTestsFailed) MOZ_OVERRIDE;
 
   /** All editor operations which alter the doc should be prefaced
    *  with a call to StartOperation, naming the action and direction */
   NS_IMETHOD StartOperation(EditAction opID,
-                            nsIEditor::EDirection aDirection);
+                            nsIEditor::EDirection aDirection) MOZ_OVERRIDE;
 
   /** All editor operations which alter the doc should be followed
    *  with a call to EndOperation */
-  NS_IMETHOD EndOperation();
+  NS_IMETHOD EndOperation() MOZ_OVERRIDE;
 
   /** returns true if aParentTag can contain a child of type aChildTag */
   virtual bool TagCanContainTag(nsIAtom& aParentTag, nsIAtom& aChildTag)
     MOZ_OVERRIDE;
   
   /** returns true if aNode is a container */
   virtual bool IsContainer(nsINode* aNode) MOZ_OVERRIDE;
   virtual bool IsContainer(nsIDOMNode* aNode) MOZ_OVERRIDE;
 
   /** make the given selection span the entire document */
-  virtual nsresult SelectEntireDocument(mozilla::dom::Selection* aSelection);
+  virtual nsresult SelectEntireDocument(mozilla::dom::Selection* aSelection) MOZ_OVERRIDE;
 
   NS_IMETHOD SetAttributeOrEquivalent(nsIDOMElement * aElement,
                                       const nsAString & aAttribute,
                                       const nsAString & aValue,
-                                      bool aSuppressTransaction);
+                                      bool aSuppressTransaction) MOZ_OVERRIDE;
   NS_IMETHOD RemoveAttributeOrEquivalent(nsIDOMElement * aElement,
                                          const nsAString & aAttribute,
-                                         bool aSuppressTransaction);
+                                         bool aSuppressTransaction) MOZ_OVERRIDE;
 
   /** join together any adjacent editable text nodes in the range */
   nsresult CollapseAdjacentTextNodes(nsRange* aRange);
 
   virtual bool AreNodesSameType(nsIContent* aNode1, nsIContent* aNode2)
     MOZ_OVERRIDE;
 
   NS_IMETHOD DeleteSelectionImpl(EDirection aAction,
-                                 EStripWrappers aStripWrappers);
+                                 EStripWrappers aStripWrappers) MOZ_OVERRIDE;
   nsresult DeleteNode(nsINode* aNode);
-  NS_IMETHODIMP DeleteNode(nsIDOMNode * aNode);
+  NS_IMETHOD DeleteNode(nsIDOMNode * aNode) MOZ_OVERRIDE;
   nsresult DeleteText(nsGenericDOMDataNode& aTextNode, uint32_t aOffset,
                       uint32_t aLength);
   virtual nsresult InsertTextImpl(const nsAString& aStringToInsert,
                                   nsCOMPtr<nsINode>* aInOutNode,
                                   int32_t* aInOutOffset,
                                   nsIDocument* aDoc) MOZ_OVERRIDE;
-  NS_IMETHOD_(bool) IsModifiableNode(nsIDOMNode *aNode);
-  virtual bool IsModifiableNode(nsINode *aNode);
+  NS_IMETHOD_(bool) IsModifiableNode(nsIDOMNode *aNode) MOZ_OVERRIDE;
+  virtual bool IsModifiableNode(nsINode *aNode) MOZ_OVERRIDE;
 
-  NS_IMETHOD GetIsSelectionEditable(bool* aIsSelectionEditable);
+  NS_IMETHOD GetIsSelectionEditable(bool* aIsSelectionEditable) MOZ_OVERRIDE;
 
-  NS_IMETHOD SelectAll();
+  NS_IMETHOD SelectAll() MOZ_OVERRIDE;
 
-  NS_IMETHOD GetRootElement(nsIDOMElement **aRootElement);
+  NS_IMETHOD GetRootElement(nsIDOMElement **aRootElement) MOZ_OVERRIDE;
 
   /* ------------ nsICSSLoaderObserver -------------- */
   NS_IMETHOD StyleSheetLoaded(mozilla::CSSStyleSheet* aSheet,
-                              bool aWasAlternate, nsresult aStatus);
+                              bool aWasAlternate, nsresult aStatus) MOZ_OVERRIDE;
 
   /* ------------ Utility Routines, not part of public API -------------- */
-  NS_IMETHOD TypedText(const nsAString& aString, ETypingAction aAction);
+  NS_IMETHOD TypedText(const nsAString& aString, ETypingAction aAction) MOZ_OVERRIDE;
   nsresult InsertNodeAtPoint( nsIDOMNode *aNode, 
                               nsCOMPtr<nsIDOMNode> *ioParent, 
                               int32_t *ioOffset, 
                               bool aNoEmptyNodes);
 
   // Use this to assure that selection is set after attribute nodes when 
   //  trying to collapse selection at begining of a block node
   //  e.g., when setting at beginning of a table cell
@@ -371,19 +371,19 @@ public:
                            bool aSafeToAskFrames,
                            bool *aSeenBR);
 
   // Returns TRUE if sheet was loaded, false if it wasn't
   bool     EnableExistingStyleSheet(const nsAString& aURL);
 
   // Dealing with the internal style sheet lists:
   NS_IMETHOD GetStyleSheetForURL(const nsAString &aURL,
-                                 mozilla::CSSStyleSheet** _retval);
+                                 mozilla::CSSStyleSheet** _retval) MOZ_OVERRIDE;
   NS_IMETHOD GetURLForStyleSheet(mozilla::CSSStyleSheet* aStyleSheet,
-                                 nsAString& aURL);
+                                 nsAString& aURL) MOZ_OVERRIDE;
 
   // Add a url + known style sheet to the internal lists:
   nsresult AddNewStyleSheetToList(const nsAString &aURL,
                                   mozilla::CSSStyleSheet* aStyleSheet);
 
   nsresult RemoveStyleSheetFromList(const nsAString &aURL);
 
   bool IsCSSEnabled()
@@ -397,23 +397,23 @@ public:
     MOZ_ASSERT(aElement);
     uint32_t attrCount = aElement->GetAttrCount();
     return attrCount > 1 ||
            (1 == attrCount && !aElement->GetAttrNameAt(0)->Equals(nsGkAtoms::mozdirty));
   }
 
 protected:
 
-  NS_IMETHOD  InitRules();
+  NS_IMETHOD  InitRules() MOZ_OVERRIDE;
 
   // Create the event listeners for the editor to install
-  virtual void CreateEventListeners();
+  virtual void CreateEventListeners() MOZ_OVERRIDE;
 
-  virtual nsresult InstallEventListeners();
-  virtual void RemoveEventListeners();
+  virtual nsresult InstallEventListeners() MOZ_OVERRIDE;
+  virtual void RemoveEventListeners() MOZ_OVERRIDE;
 
   bool ShouldReplaceRootElement();
   void ResetRootElementAndEventTarget();
   nsresult GetBodyElement(nsIDOMHTMLElement** aBody);
   // Get the focused node of this editor.
   // @return    If the editor has focus, this returns the focused node.
   //            Otherwise, returns null.
   already_AddRefed<nsINode> GetFocusedNode();
@@ -421,17 +421,17 @@ protected:
   // Return TRUE if aElement is a table-related elemet and caret was set
   bool SetCaretInTableCell(nsIDOMElement* aElement);
 
   // key event helpers
   NS_IMETHOD TabInTable(bool inIsShift, bool *outHandled);
   already_AddRefed<mozilla::dom::Element> CreateBR(nsINode* aNode,
       int32_t aOffset, EDirection aSelect = eNone);
   NS_IMETHOD CreateBR(nsIDOMNode *aNode, int32_t aOffset, 
-                      nsCOMPtr<nsIDOMNode> *outBRNode, nsIEditor::EDirection aSelect = nsIEditor::eNone);
+                      nsCOMPtr<nsIDOMNode> *outBRNode, nsIEditor::EDirection aSelect = nsIEditor::eNone) MOZ_OVERRIDE;
 
 // Table Editing (implemented in nsTableEditor.cpp)
 
   // Table utilities
 
   // Insert a new cell after or before supplied aCell. 
   //  Optional: If aNewCell supplied, returns the newly-created cell (addref'd, of course)
   // This doesn't change or use the current selection
@@ -544,31 +544,31 @@ protected:
 
   nsresult InsertObject(const char* aType, nsISupports* aObject, bool aIsSafe,
                         nsIDOMDocument *aSourceDoc,
                         nsIDOMNode *aDestinationNode,
                         int32_t aDestOffset,
                         bool aDoDeleteSelection);
 
   // factored methods for handling insertion of data from transferables (drag&drop or clipboard)
-  NS_IMETHOD PrepareTransferable(nsITransferable **transferable);
-  NS_IMETHOD PrepareHTMLTransferable(nsITransferable **transferable, bool havePrivFlavor);
-  NS_IMETHOD InsertFromTransferable(nsITransferable *transferable, 
+  NS_IMETHOD PrepareTransferable(nsITransferable **transferable) MOZ_OVERRIDE;
+  nsresult PrepareHTMLTransferable(nsITransferable **transferable, bool havePrivFlavor);
+  nsresult InsertFromTransferable(nsITransferable *transferable, 
                                     nsIDOMDocument *aSourceDoc,
                                     const nsAString & aContextStr,
                                     const nsAString & aInfoStr,
                                     nsIDOMNode *aDestinationNode,
                                     int32_t aDestinationOffset,
                                     bool aDoDeleteSelection);
   nsresult InsertFromDataTransfer(mozilla::dom::DataTransfer *aDataTransfer,
                                   int32_t aIndex,
                                   nsIDOMDocument *aSourceDoc,
                                   nsIDOMNode *aDestinationNode,
                                   int32_t aDestOffset,
-                                  bool aDoDeleteSelection);
+                                  bool aDoDeleteSelection) MOZ_OVERRIDE;
   bool HavePrivateHTMLFlavor( nsIClipboard *clipboard );
   nsresult   ParseCFHTML(nsCString & aCfhtml, char16_t **aStuffToPaste, char16_t **aCfcontext);
   nsresult   DoContentFilterCallback(const nsAString &aFlavor,
                                      nsIDOMDocument *aSourceDoc,
                                      bool aWillDeleteSelection,
                                      nsIDOMNode **aFragmentAsNode,      
                                      nsIDOMNode **aFragStartNode,
                                      int32_t *aFragStartOffset,
--- a/editor/libeditor/nsHTMLEditorEventListener.h
+++ b/editor/libeditor/nsHTMLEditorEventListener.h
@@ -22,17 +22,17 @@ public:
   }
 
   virtual ~nsHTMLEditorEventListener()
   {
   }
 
 #ifdef DEBUG
   // WARNING: You must be use nsHTMLEditor or its sub class for this class.
-  virtual nsresult Connect(nsEditor* aEditor);
+  virtual nsresult Connect(nsEditor* aEditor) MOZ_OVERRIDE;
 #endif
 
 protected:
   virtual nsresult MouseDown(nsIDOMMouseEvent* aMouseEvent) MOZ_OVERRIDE;
   virtual nsresult MouseUp(nsIDOMMouseEvent* aMouseEvent) MOZ_OVERRIDE;
   virtual nsresult MouseClick(nsIDOMMouseEvent* aMouseEvent) MOZ_OVERRIDE;
 
   inline nsHTMLEditor* GetHTMLEditor();
--- a/editor/libeditor/nsPlaintextEditor.h
+++ b/editor/libeditor/nsPlaintextEditor.h
@@ -66,93 +66,93 @@ public:
 
   /* ------------ nsIEditorMailSupport overrides -------------- */
   NS_DECL_NSIEDITORMAILSUPPORT
 
   /* ------------ Overrides of nsEditor interface methods -------------- */
   NS_IMETHOD SetAttributeOrEquivalent(nsIDOMElement * aElement,
                                       const nsAString & aAttribute,
                                       const nsAString & aValue,
-                                      bool aSuppressTransaction);
+                                      bool aSuppressTransaction) MOZ_OVERRIDE;
   NS_IMETHOD RemoveAttributeOrEquivalent(nsIDOMElement * aElement,
                                          const nsAString & aAttribute,
-                                         bool aSuppressTransaction);
+                                         bool aSuppressTransaction) MOZ_OVERRIDE;
 
   /** prepare the editor for use */
   NS_IMETHOD Init(nsIDOMDocument *aDoc, nsIContent *aRoot,
                   nsISelectionController *aSelCon, uint32_t aFlags,
-                  const nsAString& aValue);
+                  const nsAString& aValue) MOZ_OVERRIDE;
   
-  NS_IMETHOD GetDocumentIsEmpty(bool *aDocumentIsEmpty);
-  NS_IMETHOD GetIsDocumentEditable(bool *aIsDocumentEditable);
+  NS_IMETHOD GetDocumentIsEmpty(bool *aDocumentIsEmpty) MOZ_OVERRIDE;
+  NS_IMETHOD GetIsDocumentEditable(bool *aIsDocumentEditable) MOZ_OVERRIDE;
 
   NS_IMETHOD DeleteSelection(EDirection aAction,
-                             EStripWrappers aStripWrappers);
+                             EStripWrappers aStripWrappers) MOZ_OVERRIDE;
 
-  NS_IMETHOD SetDocumentCharacterSet(const nsACString & characterSet);
+  NS_IMETHOD SetDocumentCharacterSet(const nsACString & characterSet) MOZ_OVERRIDE;
 
-  NS_IMETHOD Undo(uint32_t aCount);
-  NS_IMETHOD Redo(uint32_t aCount);
+  NS_IMETHOD Undo(uint32_t aCount) MOZ_OVERRIDE;
+  NS_IMETHOD Redo(uint32_t aCount) MOZ_OVERRIDE;
 
-  NS_IMETHOD Cut();
-  NS_IMETHOD CanCut(bool *aCanCut);
-  NS_IMETHOD Copy();
-  NS_IMETHOD CanCopy(bool *aCanCopy);
-  NS_IMETHOD Paste(int32_t aSelectionType);
-  NS_IMETHOD CanPaste(int32_t aSelectionType, bool *aCanPaste);
-  NS_IMETHOD PasteTransferable(nsITransferable *aTransferable);
-  NS_IMETHOD CanPasteTransferable(nsITransferable *aTransferable, bool *aCanPaste);
+  NS_IMETHOD Cut() MOZ_OVERRIDE;
+  NS_IMETHOD CanCut(bool *aCanCut) MOZ_OVERRIDE;
+  NS_IMETHOD Copy() MOZ_OVERRIDE;
+  NS_IMETHOD CanCopy(bool *aCanCopy) MOZ_OVERRIDE;
+  NS_IMETHOD Paste(int32_t aSelectionType) MOZ_OVERRIDE;
+  NS_IMETHOD CanPaste(int32_t aSelectionType, bool *aCanPaste) MOZ_OVERRIDE;
+  NS_IMETHOD PasteTransferable(nsITransferable *aTransferable) MOZ_OVERRIDE;
+  NS_IMETHOD CanPasteTransferable(nsITransferable *aTransferable, bool *aCanPaste) MOZ_OVERRIDE;
 
   NS_IMETHOD OutputToString(const nsAString& aFormatType,
                             uint32_t aFlags,
-                            nsAString& aOutputString);
+                            nsAString& aOutputString) MOZ_OVERRIDE;
                             
   NS_IMETHOD OutputToStream(nsIOutputStream* aOutputStream,
                             const nsAString& aFormatType,
                             const nsACString& aCharsetOverride,
-                            uint32_t aFlags);
+                            uint32_t aFlags) MOZ_OVERRIDE;
 
 
   /** All editor operations which alter the doc should be prefaced
    *  with a call to StartOperation, naming the action and direction */
   NS_IMETHOD StartOperation(EditAction opID,
-                            nsIEditor::EDirection aDirection);
+                            nsIEditor::EDirection aDirection) MOZ_OVERRIDE;
 
   /** All editor operations which alter the doc should be followed
    *  with a call to EndOperation */
-  NS_IMETHOD EndOperation();
+  NS_IMETHOD EndOperation() MOZ_OVERRIDE;
 
   /** make the given selection span the entire document */
-  virtual nsresult SelectEntireDocument(mozilla::dom::Selection* aSelection);
+  virtual nsresult SelectEntireDocument(mozilla::dom::Selection* aSelection) MOZ_OVERRIDE;
 
-  virtual nsresult HandleKeyPressEvent(nsIDOMKeyEvent* aKeyEvent);
+  virtual nsresult HandleKeyPressEvent(nsIDOMKeyEvent* aKeyEvent) MOZ_OVERRIDE;
 
-  virtual already_AddRefed<mozilla::dom::EventTarget> GetDOMEventTarget();
+  virtual already_AddRefed<mozilla::dom::EventTarget> GetDOMEventTarget() MOZ_OVERRIDE;
 
-  virtual nsresult BeginIMEComposition(mozilla::WidgetCompositionEvent* aEvent);
+  virtual nsresult BeginIMEComposition(mozilla::WidgetCompositionEvent* aEvent) MOZ_OVERRIDE;
   virtual nsresult UpdateIMEComposition(nsIDOMEvent* aTextEvent) MOZ_OVERRIDE;
 
-  virtual already_AddRefed<nsIContent> GetInputEventTargetContent();
+  virtual already_AddRefed<nsIContent> GetInputEventTargetContent() MOZ_OVERRIDE;
 
   /* ------------ Utility Routines, not part of public API -------------- */
   NS_IMETHOD TypedText(const nsAString& aString, ETypingAction aAction);
 
   nsresult InsertTextAt(const nsAString &aStringToInsert,
                         nsIDOMNode *aDestinationNode,
                         int32_t aDestOffset,
                         bool aDoDeleteSelection);
 
   virtual nsresult InsertFromDataTransfer(mozilla::dom::DataTransfer *aDataTransfer,
                                           int32_t aIndex,
                                           nsIDOMDocument *aSourceDoc,
                                           nsIDOMNode *aDestinationNode,
                                           int32_t aDestOffset,
-                                          bool aDoDeleteSelection);
+                                          bool aDoDeleteSelection) MOZ_OVERRIDE;
 
-  virtual nsresult InsertFromDrop(nsIDOMEvent* aDropEvent);
+  virtual nsresult InsertFromDrop(nsIDOMEvent* aDropEvent) MOZ_OVERRIDE;
 
   /**
    * Extends the selection for given deletion operation
    * If done, also update aAction to what's actually left to do after the
    * extension.
    */
   nsresult ExtendSelectionForDelete(mozilla::dom::Selection* aSelection,
                                     nsIEditor::EDirection *aAction);
--- a/editor/libeditor/nsStyleSheetTxns.h
+++ b/editor/libeditor/nsStyleSheetTxns.h
@@ -24,17 +24,17 @@ public:
     * @param aSheet   the stylesheet to add
     */
   NS_IMETHOD Init(nsIEditor* aEditor,
                   mozilla::CSSStyleSheet* aSheet);
 
   AddStyleSheetTxn();
 
   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(AddStyleSheetTxn, EditTxn)
-  NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr);
+  NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr) MOZ_OVERRIDE;
 
   NS_DECL_EDITTXN
 
 protected:
 
   nsIEditor* mEditor;                      // the editor that created this transaction
   nsRefPtr<mozilla::CSSStyleSheet> mSheet; // the style sheet to add
 
@@ -49,17 +49,17 @@ public:
     * @param aSheet   the stylesheet to remove
     */
   NS_IMETHOD Init(nsIEditor* aEditor,
                   mozilla::CSSStyleSheet* aSheet);
 
   RemoveStyleSheetTxn();
 
   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(RemoveStyleSheetTxn, EditTxn)
-  NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr);
+  NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr) MOZ_OVERRIDE;
 
   NS_DECL_EDITTXN
 
 protected:
 
   nsIEditor* mEditor;                      // the editor that created this transaction
   nsRefPtr<mozilla::CSSStyleSheet> mSheet; // the style sheet to remove
 
--- a/editor/libeditor/nsTableEditor.cpp
+++ b/editor/libeditor/nsTableEditor.cpp
@@ -353,17 +353,17 @@ nsHTMLEditor::GetNextRow(nsIDOMNode* aCu
     NS_ENSURE_SUCCESS(res, res);
 
     parentSibling = nextNode;
   }
   // If here, row was not found
   return NS_EDITOR_ELEMENT_NOT_FOUND;
 }
 
-NS_IMETHODIMP 
+nsresult
 nsHTMLEditor::GetLastCellInRow(nsIDOMNode* aRowNode, nsIDOMNode** aCellNode)
 {
   NS_ENSURE_TRUE(aCellNode, NS_ERROR_NULL_POINTER);
 
   *aCellNode = nullptr;
 
   NS_ENSURE_TRUE(aRowNode, NS_ERROR_NULL_POINTER);
 
--- a/editor/libeditor/nsTextEditRules.h
+++ b/editor/libeditor/nsTextEditRules.h
@@ -41,29 +41,29 @@ class nsTextEditRules : public nsIEditRu
 public:
   NS_DECL_NSITIMERCALLBACK
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
   NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsTextEditRules, nsIEditRules)
 
   nsTextEditRules();
 
   // nsIEditRules methods
-  NS_IMETHOD Init(nsPlaintextEditor *aEditor);
-  NS_IMETHOD SetInitialValue(const nsAString& aValue);
-  NS_IMETHOD DetachEditor();
+  NS_IMETHOD Init(nsPlaintextEditor *aEditor) MOZ_OVERRIDE;
+  NS_IMETHOD SetInitialValue(const nsAString& aValue) MOZ_OVERRIDE;
+  NS_IMETHOD DetachEditor() MOZ_OVERRIDE;
   NS_IMETHOD BeforeEdit(EditAction action,
-                        nsIEditor::EDirection aDirection);
+                        nsIEditor::EDirection aDirection) MOZ_OVERRIDE;
   NS_IMETHOD AfterEdit(EditAction action,
-                       nsIEditor::EDirection aDirection);
+                       nsIEditor::EDirection aDirection) MOZ_OVERRIDE;
   NS_IMETHOD WillDoAction(mozilla::dom::Selection* aSelection,
-                          nsRulesInfo* aInfo, bool* aCancel, bool* aHandled);
+                          nsRulesInfo* aInfo, bool* aCancel, bool* aHandled) MOZ_OVERRIDE;
   NS_IMETHOD DidDoAction(mozilla::dom::Selection* aSelection,
-                         nsRulesInfo* aInfo, nsresult aResult);
-  NS_IMETHOD DocumentIsEmpty(bool *aDocumentIsEmpty);
-  NS_IMETHOD DocumentModified();
+                         nsRulesInfo* aInfo, nsresult aResult) MOZ_OVERRIDE;
+  NS_IMETHOD DocumentIsEmpty(bool *aDocumentIsEmpty) MOZ_OVERRIDE;
+  NS_IMETHOD DocumentModified() MOZ_OVERRIDE;
 
 protected:
   virtual ~nsTextEditRules();
 
 public:
   void ResetIMETextPWBuf();
 
   /**
--- a/editor/txtsvc/nsFilteredContentIterator.h
+++ b/editor/txtsvc/nsFilteredContentIterator.h
@@ -25,25 +25,25 @@ public:
 
   // nsISupports interface...
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
   NS_DECL_CYCLE_COLLECTION_CLASS(nsFilteredContentIterator)
 
   explicit nsFilteredContentIterator(nsITextServicesFilter* aFilter);
 
   /* nsIContentIterator */
-  virtual nsresult Init(nsINode* aRoot);
-  virtual nsresult Init(nsIDOMRange* aRange);
-  virtual void First();
-  virtual void Last();
-  virtual void Next();
-  virtual void Prev();
-  virtual nsINode *GetCurrentNode();
-  virtual bool IsDone();
-  virtual nsresult PositionAt(nsINode* aCurNode);
+  virtual nsresult Init(nsINode* aRoot) MOZ_OVERRIDE;
+  virtual nsresult Init(nsIDOMRange* aRange) MOZ_OVERRIDE;
+  virtual void First() MOZ_OVERRIDE;
+  virtual void Last() MOZ_OVERRIDE;
+  virtual void Next() MOZ_OVERRIDE;
+  virtual void Prev() MOZ_OVERRIDE;
+  virtual nsINode *GetCurrentNode() MOZ_OVERRIDE;
+  virtual bool IsDone() MOZ_OVERRIDE;
+  virtual nsresult PositionAt(nsINode* aCurNode) MOZ_OVERRIDE;
 
   /* Helpers */
   bool DidSkip()      { return mDidSkip; }
   void         ClearDidSkip() {  mDidSkip = false; }
 
 protected:
   nsFilteredContentIterator() { }
 
--- a/editor/txtsvc/nsTextServicesDocument.h
+++ b/editor/txtsvc/nsTextServicesDocument.h
@@ -102,67 +102,67 @@ public:
    */
   static void RegisterAtoms();
 
   /* Macro for AddRef(), Release(), and QueryInterface() */
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
   NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsTextServicesDocument, nsITextServicesDocument)
 
   /* nsITextServicesDocument method implementations. */
-  NS_IMETHOD InitWithEditor(nsIEditor *aEditor);
-  NS_IMETHOD GetDocument(nsIDOMDocument **aDoc);
-  NS_IMETHOD SetExtent(nsIDOMRange* aDOMRange);
-  NS_IMETHOD ExpandRangeToWordBoundaries(nsIDOMRange *aRange);
-  NS_IMETHOD SetFilter(nsITextServicesFilter *aFilter);
-  NS_IMETHOD GetCurrentTextBlock(nsString *aStr);
-  NS_IMETHOD FirstBlock();
-  NS_IMETHOD LastSelectedBlock(TSDBlockSelectionStatus *aSelStatus, int32_t *aSelOffset, int32_t *aSelLength);
-  NS_IMETHOD PrevBlock();
-  NS_IMETHOD NextBlock();
-  NS_IMETHOD IsDone(bool *aIsDone);
-  NS_IMETHOD SetSelection(int32_t aOffset, int32_t aLength);
-  NS_IMETHOD ScrollSelectionIntoView();
-  NS_IMETHOD DeleteSelection();
-  NS_IMETHOD InsertText(const nsString *aText);
+  NS_IMETHOD InitWithEditor(nsIEditor *aEditor) MOZ_OVERRIDE;
+  NS_IMETHOD GetDocument(nsIDOMDocument **aDoc) MOZ_OVERRIDE;
+  NS_IMETHOD SetExtent(nsIDOMRange* aDOMRange) MOZ_OVERRIDE;
+  NS_IMETHOD ExpandRangeToWordBoundaries(nsIDOMRange *aRange) MOZ_OVERRIDE;
+  NS_IMETHOD SetFilter(nsITextServicesFilter *aFilter) MOZ_OVERRIDE;
+  NS_IMETHOD GetCurrentTextBlock(nsString *aStr) MOZ_OVERRIDE;
+  NS_IMETHOD FirstBlock() MOZ_OVERRIDE;
+  NS_IMETHOD LastSelectedBlock(TSDBlockSelectionStatus *aSelStatus, int32_t *aSelOffset, int32_t *aSelLength) MOZ_OVERRIDE;
+  NS_IMETHOD PrevBlock() MOZ_OVERRIDE;
+  NS_IMETHOD NextBlock() MOZ_OVERRIDE;
+  NS_IMETHOD IsDone(bool *aIsDone) MOZ_OVERRIDE;
+  NS_IMETHOD SetSelection(int32_t aOffset, int32_t aLength) MOZ_OVERRIDE;
+  NS_IMETHOD ScrollSelectionIntoView() MOZ_OVERRIDE;
+  NS_IMETHOD DeleteSelection() MOZ_OVERRIDE;
+  NS_IMETHOD InsertText(const nsString *aText) MOZ_OVERRIDE;
 
   /* nsIEditActionListener method implementations. */
   NS_IMETHOD WillInsertNode(nsIDOMNode *aNode,
                             nsIDOMNode *aParent,
-                            int32_t      aPosition);
+                            int32_t      aPosition) MOZ_OVERRIDE;
   NS_IMETHOD DidInsertNode(nsIDOMNode *aNode,
                            nsIDOMNode *aParent,
                            int32_t     aPosition,
-                           nsresult    aResult);
+                           nsresult    aResult) MOZ_OVERRIDE;
 
-  NS_IMETHOD WillDeleteNode(nsIDOMNode *aChild);
-  NS_IMETHOD DidDeleteNode(nsIDOMNode *aChild, nsresult aResult);
+  NS_IMETHOD WillDeleteNode(nsIDOMNode *aChild) MOZ_OVERRIDE;
+  NS_IMETHOD DidDeleteNode(nsIDOMNode *aChild, nsresult aResult) MOZ_OVERRIDE;
 
   NS_IMETHOD WillSplitNode(nsIDOMNode * aExistingRightNode,
-                           int32_t      aOffset);
+                           int32_t      aOffset) MOZ_OVERRIDE;
   NS_IMETHOD DidSplitNode(nsIDOMNode *aExistingRightNode,
                           int32_t     aOffset,
                           nsIDOMNode *aNewLeftNode,
-                          nsresult    aResult);
+                          nsresult    aResult) MOZ_OVERRIDE;
 
   NS_IMETHOD WillJoinNodes(nsIDOMNode  *aLeftNode,
                            nsIDOMNode  *aRightNode,
-                           nsIDOMNode  *aParent);
+                           nsIDOMNode  *aParent) MOZ_OVERRIDE;
   NS_IMETHOD DidJoinNodes(nsIDOMNode  *aLeftNode,
                           nsIDOMNode  *aRightNode,
                           nsIDOMNode  *aParent,
-                          nsresult     aResult);
+                          nsresult     aResult) MOZ_OVERRIDE;
   // these listen methods are unused:
-  NS_IMETHOD WillCreateNode(const nsAString& aTag, nsIDOMNode *aParent, int32_t aPosition);
-  NS_IMETHOD DidCreateNode(const nsAString& aTag, nsIDOMNode *aNode, nsIDOMNode *aParent, int32_t aPosition, nsresult aResult);
-  NS_IMETHOD WillInsertText(nsIDOMCharacterData *aTextNode, int32_t aOffset, const nsAString &aString);
-  NS_IMETHOD DidInsertText(nsIDOMCharacterData *aTextNode, int32_t aOffset, const nsAString &aString, nsresult aResult);
-  NS_IMETHOD WillDeleteText(nsIDOMCharacterData *aTextNode, int32_t aOffset, int32_t aLength);
-  NS_IMETHOD DidDeleteText(nsIDOMCharacterData *aTextNode, int32_t aOffset, int32_t aLength, nsresult aResult);
-  NS_IMETHOD WillDeleteSelection(nsISelection *aSelection);
-  NS_IMETHOD DidDeleteSelection(nsISelection *aSelection);
+  NS_IMETHOD WillCreateNode(const nsAString& aTag, nsIDOMNode *aParent, int32_t aPosition) MOZ_OVERRIDE;
+  NS_IMETHOD DidCreateNode(const nsAString& aTag, nsIDOMNode *aNode, nsIDOMNode *aParent, int32_t aPosition, nsresult aResult) MOZ_OVERRIDE;
+  NS_IMETHOD WillInsertText(nsIDOMCharacterData *aTextNode, int32_t aOffset, const nsAString &aString) MOZ_OVERRIDE;
+  NS_IMETHOD DidInsertText(nsIDOMCharacterData *aTextNode, int32_t aOffset, const nsAString &aString, nsresult aResult) MOZ_OVERRIDE;
+  NS_IMETHOD WillDeleteText(nsIDOMCharacterData *aTextNode, int32_t aOffset, int32_t aLength) MOZ_OVERRIDE;
+  NS_IMETHOD DidDeleteText(nsIDOMCharacterData *aTextNode, int32_t aOffset, int32_t aLength, nsresult aResult) MOZ_OVERRIDE;
+  NS_IMETHOD WillDeleteSelection(nsISelection *aSelection) MOZ_OVERRIDE;
+  NS_IMETHOD DidDeleteSelection(nsISelection *aSelection) MOZ_OVERRIDE;
 
   /* Helper functions */
   static nsresult GetRangeEndPoints(nsRange* aRange, nsIDOMNode** aParent1,
                                     int32_t* aOffset1, nsIDOMNode** aParent2,
                                     int32_t* aOffset2);
   static nsresult CreateRange(nsIDOMNode* aStartParent, int32_t aStartOffset,
                               nsIDOMNode* aEndParent, int32_t aEndOffset,
                               nsRange** aRange);
--- a/gfx/2d/Path.cpp
+++ b/gfx/2d/Path.cpp
@@ -454,16 +454,22 @@ FlattenBezier(const BezierControlPoints 
   if (count > 1 && t2 >= 0 && t2 < 1.0) {
     FindInflectionApproximationRange(aControlPoints, &t2min, &t2max, t2, aTolerance);
   }
   BezierControlPoints nextCPs = aControlPoints;
   BezierControlPoints prevCPs;
 
   // Process ranges. [t1min, t1max] and [t2min, t2max] are approximated by line
   // segments.
+  if (count == 1 && t1min <= 0 && t1max >= 1.0) {
+    // The whole range can be approximated by a line segment.
+    aSink->LineTo(aControlPoints.mCP4);
+    return;
+  }
+
   if (t1min > 0) {
     // Flatten the Bezier up until the first inflection point's approximation
     // point.
     SplitBezier(aControlPoints, &prevCPs,
                 &remainingCP, t1min);
     FlattenBezierCurveSegment(prevCPs, aSink, aTolerance);
   }
   if (t1max >= 0 && t1max < 1.0 && (count == 1 || t2min > t1max)) {
--- a/gfx/layers/ImageContainer.h
+++ b/gfx/layers/ImageContainer.h
@@ -805,26 +805,26 @@ public:
    * The surface must not be modified after this call!!!
    */
   void SetData(const Data& aData)
   {
     mSize = aData.mSize;
     mSourceSurface = aData.mSourceSurface;
   }
 
-  virtual TemporaryRef<gfx::SourceSurface> GetAsSourceSurface()
+  virtual TemporaryRef<gfx::SourceSurface> GetAsSourceSurface() MOZ_OVERRIDE
   {
     return mSourceSurface.get();
   }
 
-  virtual ISharedImage* AsSharedImage() { return this; }
-  virtual uint8_t* GetBuffer() { return nullptr; }
+  virtual ISharedImage* AsSharedImage() MOZ_OVERRIDE { return this; }
+  virtual uint8_t* GetBuffer() MOZ_OVERRIDE { return nullptr; }
   virtual TextureClient* GetTextureClient(CompositableClient* aClient) MOZ_OVERRIDE;
 
-  gfx::IntSize GetSize() { return mSize; }
+  virtual gfx::IntSize GetSize() MOZ_OVERRIDE { return mSize; }
 
   CairoImage();
   ~CairoImage();
 
   gfx::IntSize mSize;
 
   nsCountedRef<nsMainThreadSourceSurfaceRef> mSourceSurface;
   nsDataHashtable<nsUint32HashKey, RefPtr<TextureClient> >  mTextureClients;
--- a/gfx/layers/ImageLayers.h
+++ b/gfx/layers/ImageLayers.h
@@ -86,18 +86,18 @@ public:
       mDisallowBigImage = aDisallowBigImage;
       Mutated();
     }
   }
 
 protected:
   ImageLayer(LayerManager* aManager, void* aImplData);
   ~ImageLayer();
-  virtual void PrintInfo(std::stringstream& aStream, const char* aPrefix);
-  virtual void DumpPacket(layerscope::LayersPacket* aPacket, const void* aParent);
+  virtual void PrintInfo(std::stringstream& aStream, const char* aPrefix) MOZ_OVERRIDE;
+  virtual void DumpPacket(layerscope::LayersPacket* aPacket, const void* aParent) MOZ_OVERRIDE;
 
   nsRefPtr<ImageContainer> mContainer;
   GraphicsFilter mFilter;
   gfx::IntSize mScaleToSize;
   ScaleMode mScaleMode;
   bool mDisallowBigImage;
   gfx::Matrix4x4 mEffectiveTransformForBuffer;
 };
--- a/gfx/layers/LayerScope.cpp
+++ b/gfx/layers/LayerScope.cpp
@@ -573,28 +573,28 @@ public:
 
     NS_DECL_THREADSAFE_ISUPPORTS
 
     DebugListener() { }
 
     /* nsIServerSocketListener */
 
     NS_IMETHODIMP OnSocketAccepted(nsIServerSocket *aServ,
-                                   nsISocketTransport *aTransport)
+                                   nsISocketTransport *aTransport) MOZ_OVERRIDE
     {
         if (!WebSocketHelper::GetSocketManager())
             return NS_OK;
 
         printf_stderr("*** LayerScope: Accepted connection\n");
         WebSocketHelper::GetSocketManager()->AddConnection(aTransport);
         return NS_OK;
     }
 
     NS_IMETHODIMP OnStopListening(nsIServerSocket *aServ,
-                                  nsresult aStatus)
+                                  nsresult aStatus) MOZ_OVERRIDE
     {
         return NS_OK;
     }
 };
 
 NS_IMPL_ISUPPORTS(DebugListener, nsIServerSocketListener);
 
 
@@ -620,17 +620,17 @@ public:
 
         DebugGLData *d;
         while ((d = mList.popFirst()) != nullptr)
             delete d;
     }
 
     /* nsIRunnable impl; send the data */
 
-    NS_IMETHODIMP Run() {
+    NS_IMETHODIMP Run() MOZ_OVERRIDE {
         DebugGLData *d;
         nsresult rv = NS_OK;
 
         while ((d = mList.popFirst()) != nullptr) {
             UniquePtr<DebugGLData> cleaner(d);
             if (!d->Write()) {
                 rv = NS_ERROR_FAILURE;
                 break;
--- a/gfx/layers/Layers.h
+++ b/gfx/layers/Layers.h
@@ -98,19 +98,19 @@ class SurfaceDescriptor;
 class Compositor;
 struct TextureFactoryIdentifier;
 struct EffectMask;
 
 namespace layerscope {
 class LayersPacket;
 }
 
-#define MOZ_LAYER_DECL_NAME(n, e)                           \
-  virtual const char* Name() const { return n; }            \
-  virtual LayerType GetType() const { return e; }
+#define MOZ_LAYER_DECL_NAME(n, e)                              \
+  virtual const char* Name() const MOZ_OVERRIDE { return n; }  \
+  virtual LayerType GetType() const MOZ_OVERRIDE { return e; }
 
 /**
  * Base class for userdata objects attached to layers and layer managers.
  */
 class LayerUserData {
 public:
   virtual ~LayerUserData() {}
 };
@@ -1718,21 +1718,21 @@ public:
    */
   void SetAllowResidualTranslation(bool aAllow) { mAllowResidualTranslation = aAllow; }
 
   /**
    * Can be used anytime
    */
   const nsIntRegion& GetValidRegion() const { return mValidRegion; }
 
-  virtual PaintedLayer* AsPaintedLayer() { return this; }
+  virtual PaintedLayer* AsPaintedLayer() MOZ_OVERRIDE { return this; }
 
   MOZ_LAYER_DECL_NAME("PaintedLayer", TYPE_PAINTED)
 
-  virtual void ComputeEffectiveTransforms(const gfx::Matrix4x4& aTransformToSurface)
+  virtual void ComputeEffectiveTransforms(const gfx::Matrix4x4& aTransformToSurface) MOZ_OVERRIDE
   {
     gfx::Matrix4x4 idealTransform = GetLocalTransform() * aTransformToSurface;
     gfx::Matrix residual;
     mEffectiveTransform = SnapTransformTranslation(idealTransform,
         mAllowResidualTranslation ? &residual : nullptr);
     // The residual can only be a translation because SnapTransformTranslation
     // only changes the transform if it's a translation
     NS_ASSERTION(residual.IsTranslation(),
@@ -1768,19 +1768,19 @@ protected:
     , mValidRegion()
     , mCreationHint(aCreationHint)
     , mUsedForReadback(false)
     , mAllowResidualTranslation(false)
   {
     mContentFlags = 0; // Clear NO_TEXT, NO_TEXT_OVER_TRANSPARENT
   }
 
-  virtual void PrintInfo(std::stringstream& aStream, const char* aPrefix);
+  virtual void PrintInfo(std::stringstream& aStream, const char* aPrefix) MOZ_OVERRIDE;
 
-  virtual void DumpPacket(layerscope::LayersPacket* aPacket, const void* aParent);
+  virtual void DumpPacket(layerscope::LayersPacket* aPacket, const void* aParent) MOZ_OVERRIDE;
 
   /**
    * ComputeEffectiveTransforms snaps the ideal transform to get mEffectiveTransform.
    * mResidualTranslation is the translation that should be applied *before*
    * mEffectiveTransform to get the ideal transform.
    */
   gfxPoint mResidualTranslation;
   nsIntRegion mValidRegion;
@@ -1850,41 +1850,41 @@ public:
     }
 
     MOZ_LAYERS_LOG_IF_SHADOWABLE(this, ("Layer::Mutated(%p) InheritedScale", this));
     mInheritedXScale = aXScale;
     mInheritedYScale = aYScale;
     Mutated();
   }
 
-  virtual void FillSpecificAttributes(SpecificLayerAttributes& aAttrs);
+  virtual void FillSpecificAttributes(SpecificLayerAttributes& aAttrs) MOZ_OVERRIDE;
 
   void SortChildrenBy3DZOrder(nsTArray<Layer*>& aArray);
 
   // These getters can be used anytime.
 
-  virtual ContainerLayer* AsContainerLayer() { return this; }
-  virtual const ContainerLayer* AsContainerLayer() const { return this; }
+  virtual ContainerLayer* AsContainerLayer() MOZ_OVERRIDE { return this; }
+  virtual const ContainerLayer* AsContainerLayer() const MOZ_OVERRIDE { return this; }
 
-  virtual Layer* GetFirstChild() const { return mFirstChild; }
-  virtual Layer* GetLastChild() const { return mLastChild; }
+  virtual Layer* GetFirstChild() const MOZ_OVERRIDE { return mFirstChild; }
+  virtual Layer* GetLastChild() const MOZ_OVERRIDE { return mLastChild; }
   float GetPreXScale() const { return mPreXScale; }
   float GetPreYScale() const { return mPreYScale; }
   float GetInheritedXScale() const { return mInheritedXScale; }
   float GetInheritedYScale() const { return mInheritedYScale; }
 
   MOZ_LAYER_DECL_NAME("ContainerLayer", TYPE_CONTAINER)
 
   /**
    * ContainerLayer backends need to override ComputeEffectiveTransforms
    * since the decision about whether to use a temporary surface for the
    * container is backend-specific. ComputeEffectiveTransforms must also set
    * mUseIntermediateSurface.
    */
-  virtual void ComputeEffectiveTransforms(const gfx::Matrix4x4& aTransformToSurface) = 0;
+  virtual void ComputeEffectiveTransforms(const gfx::Matrix4x4& aTransformToSurface) MOZ_OVERRIDE = 0;
 
   /**
    * Call this only after ComputeEffectiveTransforms has been invoked
    * on this layer.
    * Returns true if this will use an intermediate surface. This is largely
    * backend-dependent, but it affects the operation of GetEffectiveOpacity().
    */
   bool UseIntermediateSurface() { return mUseIntermediateSurface; }
@@ -1951,19 +1951,19 @@ protected:
    */
   void DefaultComputeSupportsComponentAlphaChildren(bool* aNeedsSurfaceCopy = nullptr);
 
   /**
    * Loops over the children calling ComputeEffectiveTransforms on them.
    */
   void ComputeEffectiveTransformsForChildren(const gfx::Matrix4x4& aTransformToSurface);
 
-  virtual void PrintInfo(std::stringstream& aStream, const char* aPrefix);
+  virtual void PrintInfo(std::stringstream& aStream, const char* aPrefix) MOZ_OVERRIDE;
 
-  virtual void DumpPacket(layerscope::LayersPacket* aPacket, const void* aParent);
+  virtual void DumpPacket(layerscope::LayersPacket* aPacket, const void* aParent) MOZ_OVERRIDE;
 
   Layer* mFirstChild;
   Layer* mLastChild;
   float mPreXScale;
   float mPreYScale;
   // The resolution scale inherited from the parent layer. This will already
   // be part of mTransform.
   float mInheritedXScale;
@@ -1979,17 +1979,17 @@ protected:
 
 /**
  * A Layer which just renders a solid color in its visible region. It actually
  * can fill any area that contains the visible region, so if you need to
  * restrict the area filled, set a clip region on this layer.
  */
 class ColorLayer : public Layer {
 public:
-  virtual ColorLayer* AsColorLayer() { return this; }
+  virtual ColorLayer* AsColorLayer() MOZ_OVERRIDE { return this; }
 
   /**
    * CONSTRUCTION PHASE ONLY
    * Set the color of the layer.
    */
   virtual void SetColor(const gfxRGBA& aColor)
   {
     if (mColor != aColor) {
@@ -2012,32 +2012,32 @@ public:
     return mBounds;
   }
 
   // This getter can be used anytime.
   virtual const gfxRGBA& GetColor() { return mColor; }
 
   MOZ_LAYER_DECL_NAME("ColorLayer", TYPE_COLOR)
 
-  virtual void ComputeEffectiveTransforms(const gfx::Matrix4x4& aTransformToSurface)
+  virtual void ComputeEffectiveTransforms(const gfx::Matrix4x4& aTransformToSurface) MOZ_OVERRIDE
   {
     gfx::Matrix4x4 idealTransform = GetLocalTransform() * aTransformToSurface;
     mEffectiveTransform = SnapTransformTranslation(idealTransform, nullptr);
     ComputeEffectiveTransformForMaskLayer(aTransformToSurface);
   }
 
 protected:
   ColorLayer(LayerManager* aManager, void* aImplData)
     : Layer(aManager, aImplData),
       mColor(0.0, 0.0, 0.0, 0.0)
   {}
 
-  virtual void PrintInfo(std::stringstream& aStream, const char* aPrefix);
+  virtual void PrintInfo(std::stringstream& aStream, const char* aPrefix) MOZ_OVERRIDE;
 
-  virtual void DumpPacket(layerscope::LayersPacket* aPacket, const void* aParent);
+  virtual void DumpPacket(layerscope::LayersPacket* aPacket, const void* aParent) MOZ_OVERRIDE;
 
   nsIntRect mBounds;
   gfxRGBA mColor;
 };
 
 /**
  * A Layer for HTML Canvas elements.  It's backed by either a
  * gfxASurface or a GLContext (for WebGL layers), and has some control
@@ -2158,17 +2158,17 @@ public:
       mFilter = aFilter;
       Mutated();
     }
   }
   GraphicsFilter GetFilter() const { return mFilter; }
 
   MOZ_LAYER_DECL_NAME("CanvasLayer", TYPE_CANVAS)
 
-  virtual void ComputeEffectiveTransforms(const gfx::Matrix4x4& aTransformToSurface)
+  virtual void ComputeEffectiveTransforms(const gfx::Matrix4x4& aTransformToSurface) MOZ_OVERRIDE
   {
     // Snap our local transform first, and snap the inherited transform as well.
     // This makes our snapping equivalent to what would happen if our content
     // was drawn into a PaintedLayer (gfxContext would snap using the local
     // transform, then we'd snap again when compositing the PaintedLayer).
     mEffectiveTransform =
         SnapTransform(GetLocalTransform(), gfxRect(0, 0, mBounds.width, mBounds.height),
                       nullptr)*
@@ -2182,19 +2182,19 @@ protected:
     , mPreTransCallback(nullptr)
     , mPreTransCallbackData(nullptr)
     , mPostTransCallback(nullptr)
     , mPostTransCallbackData(nullptr)
     , mFilter(GraphicsFilter::FILTER_GOOD)
     , mDirty(false)
   {}
 
-  virtual void PrintInfo(std::stringstream& aStream, const char* aPrefix);
+  virtual void PrintInfo(std::stringstream& aStream, const char* aPrefix) MOZ_OVERRIDE;
 
-  virtual void DumpPacket(layerscope::LayersPacket* aPacket, const void* aParent);
+  virtual void DumpPacket(layerscope::LayersPacket* aPacket, const void* aParent) MOZ_OVERRIDE;
 
   void FireDidTransactionCallback()
   {
     if (mPostTransCallback) {
       mPostTransCallback(mPostTransCallbackData);
     }
   }
 
@@ -2234,20 +2234,20 @@ private:
  */
 class RefLayer : public ContainerLayer {
   friend class LayerManager;
 
 private:
   virtual bool InsertAfter(Layer* aChild, Layer* aAfter) MOZ_OVERRIDE
   { MOZ_CRASH(); return false; }
 
-  virtual bool RemoveChild(Layer* aChild)
+  virtual bool RemoveChild(Layer* aChild) MOZ_OVERRIDE
   { MOZ_CRASH(); return false; }
 
-  virtual bool RepositionChild(Layer* aChild, Layer* aAfter)
+  virtual bool RepositionChild(Layer* aChild, Layer* aAfter) MOZ_OVERRIDE
   { MOZ_CRASH(); return false; }
 
   using Layer::SetFrameMetrics;
 
 public:
   /**
    * CONSTRUCTION PHASE ONLY
    * Set the ID of the layer's referent.
@@ -2290,35 +2290,35 @@ public:
    */
   void DetachReferentLayer(Layer* aLayer)
   {
     mFirstChild = mLastChild = nullptr;
     aLayer->SetParent(nullptr);
   }
 
   // These getters can be used anytime.
-  virtual RefLayer* AsRefLayer() { return this; }
+  virtual RefLayer* AsRefLayer() MOZ_OVERRIDE { return this; }
 
   virtual int64_t GetReferentId() { return mId; }
 
   /**
    * DRAWING PHASE ONLY
    */
-  virtual void FillSpecificAttributes(SpecificLayerAttributes& aAttrs);
+  virtual void FillSpecificAttributes(SpecificLayerAttributes& aAttrs) MOZ_OVERRIDE;
 
   MOZ_LAYER_DECL_NAME("RefLayer", TYPE_REF)
 
 protected:
   RefLayer(LayerManager* aManager, void* aImplData)
     : ContainerLayer(aManager, aImplData) , mId(0)
   {}
 
-  virtual void PrintInfo(std::stringstream& aStream, const char* aPrefix);
+  virtual void PrintInfo(std::stringstream& aStream, const char* aPrefix) MOZ_OVERRIDE;
 
-  virtual void DumpPacket(layerscope::LayersPacket* aPacket, const void* aParent);
+  virtual void DumpPacket(layerscope::LayersPacket* aPacket, const void* aParent) MOZ_OVERRIDE;
 
   Layer* mTempReferent;
   // 0 is a special value that means "no ID".
   uint64_t mId;
 };
 
 void SetAntialiasingFlags(Layer* aLayer, gfx::DrawTarget* aTarget);
 
--- a/gfx/layers/MacIOSurfaceImage.h
+++ b/gfx/layers/MacIOSurfaceImage.h
@@ -16,23 +16,23 @@ namespace mozilla {
 namespace layers {
 
 class MacIOSurfaceImage : public Image,
                           public ISharedImage {
 public:
   void SetSurface(MacIOSurface* aSurface) { mSurface = aSurface; }
   MacIOSurface* GetSurface() { return mSurface; }
 
-  gfx::IntSize GetSize() {
+  gfx::IntSize GetSize() MOZ_OVERRIDE {
     return gfx::IntSize(mSurface->GetDevicePixelWidth(), mSurface->GetDevicePixelHeight());
   }
 
   virtual ISharedImage* AsSharedImage() MOZ_OVERRIDE { return this; }
 
-  virtual TemporaryRef<gfx::SourceSurface> GetAsSourceSurface();
+  virtual TemporaryRef<gfx::SourceSurface> GetAsSourceSurface() MOZ_OVERRIDE;
 
   virtual TextureClient* GetTextureClient(CompositableClient* aClient) MOZ_OVERRIDE;
   virtual uint8_t* GetBuffer() MOZ_OVERRIDE { return nullptr; }
 
   MacIOSurfaceImage() : Image(nullptr, ImageFormat::MAC_IOSURFACE) {}
 
 private:
   RefPtr<MacIOSurface> mSurface;
--- a/gfx/layers/ReadbackLayer.h
+++ b/gfx/layers/ReadbackLayer.h
@@ -82,17 +82,17 @@ public:
  *
  * This API exists to work around the limitations of transparent windowless
  * plugin rendering APIs. It should not be used for anything else.
  */
 class ReadbackLayer : public Layer {
 public:
   MOZ_LAYER_DECL_NAME("ReadbackLayer", TYPE_READBACK)
 
-  virtual void ComputeEffectiveTransforms(const gfx::Matrix4x4& aTransformToSurface)
+  virtual void ComputeEffectiveTransforms(const gfx::Matrix4x4& aTransformToSurface) MOZ_OVERRIDE
   {
     // Snap our local transform first, and snap the inherited transform as well.
     // This makes our snapping equivalent to what would happen if our content
     // was drawn into a PaintedLayer (gfxContext would snap using the local
     // transform, then we'd snap again when compositing the PaintedLayer).
     mEffectiveTransform =
         SnapTransform(GetLocalTransform(), gfxRect(0, 0, mSize.width, mSize.height),
                       nullptr)*
@@ -169,19 +169,19 @@ protected:
     Layer(aManager, aImplData),
     mSequenceCounter(0),
     mSize(0,0),
     mBackgroundLayer(nullptr),
     mBackgroundLayerOffset(0, 0),
     mBackgroundColor(gfxRGBA(0,0,0,0))
   {}
 
-  virtual void PrintInfo(std::stringstream& aStream, const char* aPrefix);
+  virtual void PrintInfo(std::stringstream& aStream, const char* aPrefix) MOZ_OVERRIDE;
 
-  virtual void DumpPacket(layerscope::LayersPacket* aPacket, const void* aParent);
+  virtual void DumpPacket(layerscope::LayersPacket* aPacket, const void* aParent) MOZ_OVERRIDE;
 
   uint64_t mSequenceCounter;
   nsAutoPtr<ReadbackSink> mSink;
   nsIntSize mSize;
 
   // This can refer to any (earlier) sibling PaintedLayer. That PaintedLayer
   // must have mUsedForReadback set on it. If the PaintedLayer is removed
   // for the container, this will be set to null by NotifyPaintedLayerRemoved.
--- a/gfx/layers/basic/BasicCanvasLayer.h
+++ b/gfx/layers/basic/BasicCanvasLayer.h
@@ -22,17 +22,17 @@ class BasicCanvasLayer : public Copyable
                          public BasicImplData
 {
 public:
   explicit BasicCanvasLayer(BasicLayerManager* aLayerManager) :
     CopyableCanvasLayer(aLayerManager,
                         static_cast<BasicImplData*>(MOZ_THIS_IN_INITIALIZER_LIST()))
   { }
   
-  virtual void SetVisibleRegion(const nsIntRegion& aRegion)
+  virtual void SetVisibleRegion(const nsIntRegion& aRegion) MOZ_OVERRIDE
   {
     NS_ASSERTION(BasicManager()->InConstruction(),
                  "Can only set properties in construction phase");
     CanvasLayer::SetVisibleRegion(aRegion);
   }
   
   virtual void Paint(gfx::DrawTarget* aDT,
                      const gfx::Point& aDeviceOffset,
--- a/gfx/layers/basic/BasicColorLayer.cpp
+++ b/gfx/layers/basic/BasicColorLayer.cpp
@@ -35,17 +35,17 @@ public:
 
 protected:
   virtual ~BasicColorLayer()
   {
     MOZ_COUNT_DTOR(BasicColorLayer);
   }
 
 public:
-  virtual void SetVisibleRegion(const nsIntRegion& aRegion)
+  virtual void SetVisibleRegion(const nsIntRegion& aRegion) MOZ_OVERRIDE
   {
     NS_ASSERTION(BasicManager()->InConstruction(),
                  "Can only set properties in construction phase");
     ColorLayer::SetVisibleRegion(aRegion);
   }
 
   virtual void Paint(DrawTarget* aDT,
                      const gfx::Point& aDeviceOffset,
--- a/gfx/layers/basic/BasicCompositor.h
+++ b/gfx/layers/basic/BasicCompositor.h
@@ -97,29 +97,31 @@ public:
                           gfx::Rect *aRenderBoundsOut = nullptr) MOZ_OVERRIDE;
   virtual void EndFrame() MOZ_OVERRIDE;
   virtual void EndFrameForExternalComposition(const gfx::Matrix& aTransform) MOZ_OVERRIDE
   {
     NS_RUNTIMEABORT("We shouldn't ever hit this");
   }
   virtual void AbortFrame() MOZ_OVERRIDE;
 
-  virtual bool SupportsPartialTextureUpdate() { return true; }
+  virtual bool SupportsPartialTextureUpdate() MOZ_OVERRIDE { return true; }
   virtual bool CanUseCanvasLayerForSize(const gfx::IntSize &aSize) MOZ_OVERRIDE { return true; }
   virtual int32_t GetMaxTextureSize() const MOZ_OVERRIDE { return INT32_MAX; }
   virtual void SetDestinationSurfaceSize(const gfx::IntSize& aSize) MOZ_OVERRIDE { }
   
   virtual void SetScreenRenderOffset(const ScreenPoint& aOffset) MOZ_OVERRIDE {
   }
 
-  virtual void MakeCurrent(MakeCurrentFlags aFlags = 0) { }
+  virtual void MakeCurrent(MakeCurrentFlags aFlags = 0) MOZ_OVERRIDE { }
 
   virtual void PrepareViewport(const gfx::IntSize& aSize) MOZ_OVERRIDE { }
 
-  virtual const char* Name() const { return "Basic"; }
+#ifdef MOZ_DUMP_PAINTING
+  virtual const char* Name() const MOZ_OVERRIDE { return "Basic"; }
+#endif // MOZ_DUMP_PAINTING
 
   virtual LayersBackend GetBackendType() const MOZ_OVERRIDE {
     return LayersBackend::LAYERS_BASIC;
   }
 
   virtual nsIWidget* GetWidget() const MOZ_OVERRIDE { return mWidget; }
 
   gfx::DrawTarget *GetDrawTarget() { return mDrawTarget; }
--- a/gfx/layers/basic/BasicContainerLayer.h
+++ b/gfx/layers/basic/BasicContainerLayer.h
@@ -25,50 +25,50 @@ public:
   {
     MOZ_COUNT_CTOR(BasicContainerLayer);
     mSupportsComponentAlphaChildren = true;
   }
 protected:
   virtual ~BasicContainerLayer();
 
 public:
-  virtual void SetVisibleRegion(const nsIntRegion& aRegion)
+  virtual void SetVisibleRegion(const nsIntRegion& aRegion) MOZ_OVERRIDE
   {
     NS_ASSERTION(BasicManager()->InConstruction(),
                  "Can only set properties in construction phase");
     ContainerLayer::SetVisibleRegion(aRegion);
   }
-  virtual bool InsertAfter(Layer* aChild, Layer* aAfter)
+  virtual bool InsertAfter(Layer* aChild, Layer* aAfter) MOZ_OVERRIDE
   {
     if (!BasicManager()->InConstruction()) {
       NS_ERROR("Can only set properties in construction phase");
       return false;
     }
     return ContainerLayer::InsertAfter(aChild, aAfter);
   }
 
-  virtual bool RemoveChild(Layer* aChild)
+  virtual bool RemoveChild(Layer* aChild) MOZ_OVERRIDE
   { 
     if (!BasicManager()->InConstruction()) {
       NS_ERROR("Can only set properties in construction phase");
       return false;
     }
     return ContainerLayer::RemoveChild(aChild);
   }
 
-  virtual bool RepositionChild(Layer* aChild, Layer* aAfter)
+  virtual bool RepositionChild(Layer* aChild, Layer* aAfter) MOZ_OVERRIDE
   {
     if (!BasicManager()->InConstruction()) {
       NS_ERROR("Can only set properties in construction phase");
       return false;
     }
     return ContainerLayer::RepositionChild(aChild, aAfter);
   }
 
-  virtual void ComputeEffectiveTransforms(const gfx::Matrix4x4& aTransformToSurface);
+  virtual void ComputeEffectiveTransforms(const gfx::Matrix4x4& aTransformToSurface) MOZ_OVERRIDE;
 
   /**
    * Returns true when:
    * a) no (non-hidden) childrens' visible areas overlap in
    * (aInRect intersected with this layer's visible region).
    * b) the (non-hidden) childrens' visible areas cover
    * (aInRect intersected with this layer's visible region).
    * c) this layer and all (non-hidden) children have transforms that are translations
--- a/gfx/layers/basic/BasicImageLayer.cpp
+++ b/gfx/layers/basic/BasicImageLayer.cpp
@@ -34,17 +34,17 @@ public:
   }
 protected:
   virtual ~BasicImageLayer()
   {
     MOZ_COUNT_DTOR(BasicImageLayer);
   }
 
 public:
-  virtual void SetVisibleRegion(const nsIntRegion& aRegion)
+  virtual void SetVisibleRegion(const nsIntRegion& aRegion) MOZ_OVERRIDE
   {
     NS_ASSERTION(BasicManager()->InConstruction(),
                  "Can only set properties in construction phase");
     ImageLayer::SetVisibleRegion(aRegion);
   }
 
   virtual void Paint(DrawTarget* aDT,
                      const gfx::Point& aDeviceOffset,
--- a/gfx/layers/basic/BasicImages.cpp
+++ b/gfx/layers/basic/BasicImages.cpp
@@ -43,20 +43,20 @@ public:
   {
     if (mDecodedBuffer) {
       // Right now this only happens if the Image was never drawn, otherwise
       // this will have been tossed away at surface destruction.
       mRecycleBin->RecycleBuffer(mDecodedBuffer.forget(), mSize.height * mStride);
     }
   }
 
-  virtual void SetData(const Data& aData);
-  virtual void SetDelayedConversion(bool aDelayed) { mDelayedConversion = aDelayed; }
+  virtual void SetData(const Data& aData) MOZ_OVERRIDE;
+  virtual void SetDelayedConversion(bool aDelayed) MOZ_OVERRIDE { mDelayedConversion = aDelayed; }
 
-  TemporaryRef<gfx::SourceSurface> GetAsSourceSurface();
+  TemporaryRef<gfx::SourceSurface> GetAsSourceSurface() MOZ_OVERRIDE;
 
   virtual size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const MOZ_OVERRIDE
   {
     return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf);
   }
 
   virtual size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const MOZ_OVERRIDE
   {
--- a/gfx/layers/basic/BasicLayers.h
+++ b/gfx/layers/basic/BasicLayers.h
@@ -91,67 +91,67 @@ public:
    */
   void SetDefaultTarget(gfxContext* aContext);
   virtual void SetDefaultTargetConfiguration(BufferMode aDoubleBuffering, ScreenRotation aRotation);
   gfxContext* GetDefaultTarget() { return mDefaultTarget; }
 
   nsIWidget* GetRetainerWidget() { return mWidget; }
   void ClearRetainerWidget() { mWidget = nullptr; }
 
-  virtual bool IsWidgetLayerManager() { return mWidget != nullptr; }
-  virtual bool IsInactiveLayerManager() { return mType == BLM_INACTIVE; }
+  virtual bool IsWidgetLayerManager() MOZ_OVERRIDE { return mWidget != nullptr; }
+  virtual bool IsInactiveLayerManager() MOZ_OVERRIDE { return mType == BLM_INACTIVE; }
 
-  virtual void BeginTransaction();
-  virtual void BeginTransactionWithTarget(gfxContext* aTarget);
-  virtual bool EndEmptyTransaction(EndTransactionFlags aFlags = END_DEFAULT);
+  virtual void BeginTransaction() MOZ_OVERRIDE;
+  virtual void BeginTransactionWithTarget(gfxContext* aTarget) MOZ_OVERRIDE;
+  virtual bool EndEmptyTransaction(EndTransactionFlags aFlags = END_DEFAULT) MOZ_OVERRIDE;
   virtual void EndTransaction(DrawPaintedLayerCallback aCallback,
                               void* aCallbackData,
-                              EndTransactionFlags aFlags = END_DEFAULT);
-  virtual bool ShouldAvoidComponentAlphaLayers() { return IsWidgetLayerManager(); }
+                              EndTransactionFlags aFlags = END_DEFAULT) MOZ_OVERRIDE;
+  virtual bool ShouldAvoidComponentAlphaLayers() MOZ_OVERRIDE { return IsWidgetLayerManager(); }
 
   void AbortTransaction();
 
-  virtual void SetRoot(Layer* aLayer);
+  virtual void SetRoot(Layer* aLayer) MOZ_OVERRIDE;
 
-  virtual already_AddRefed<PaintedLayer> CreatePaintedLayer();
-  virtual already_AddRefed<ContainerLayer> CreateContainerLayer();
-  virtual already_AddRefed<ImageLayer> CreateImageLayer();
-  virtual already_AddRefed<CanvasLayer> CreateCanvasLayer();
-  virtual already_AddRefed<ColorLayer> CreateColorLayer();
-  virtual already_AddRefed<ReadbackLayer> CreateReadbackLayer();
+  virtual already_AddRefed<PaintedLayer> CreatePaintedLayer() MOZ_OVERRIDE;
+  virtual already_AddRefed<ContainerLayer> CreateContainerLayer() MOZ_OVERRIDE;
+  virtual already_AddRefed<ImageLayer> CreateImageLayer() MOZ_OVERRIDE;
+  virtual already_AddRefed<CanvasLayer> CreateCanvasLayer() MOZ_OVERRIDE;
+  virtual already_AddRefed<ColorLayer> CreateColorLayer() MOZ_OVERRIDE;
+  virtual already_AddRefed<ReadbackLayer> CreateReadbackLayer() MOZ_OVERRIDE;
   virtual ImageFactory *GetImageFactory();
 
-  virtual LayersBackend GetBackendType() { return LayersBackend::LAYERS_BASIC; }
-  virtual void GetBackendName(nsAString& name) { name.AssignLiteral("Basic"); }
+  virtual LayersBackend GetBackendType() MOZ_OVERRIDE { return LayersBackend::LAYERS_BASIC; }
+  virtual void GetBackendName(nsAString& name) MOZ_OVERRIDE { name.AssignLiteral("Basic"); }
 
   bool InConstruction() { return mPhase == PHASE_CONSTRUCTION; }
 #ifdef DEBUG
   bool InDrawing() { return mPhase == PHASE_DRAWING; }
   bool InForward() { return mPhase == PHASE_FORWARD; }
 #endif
   bool InTransaction() { return mPhase != PHASE_NONE; }
 
   gfxContext* GetTarget() { return mTarget; }
   void SetTarget(gfxContext* aTarget) { mUsingDefaultTarget = false; mTarget = aTarget; }
   bool IsRetained() { return mWidget != nullptr; }
 
-  virtual const char* Name() const { return "Basic"; }
+  virtual const char* Name() const MOZ_OVERRIDE { return "Basic"; }
 
   // Clear the cached contents of this layer tree.
   virtual void ClearCachedResources(Layer* aSubtree = nullptr) MOZ_OVERRIDE;
 
   void SetTransactionIncomplete() { mTransactionIncomplete = true; }
   bool IsTransactionIncomplete() { return mTransactionIncomplete; }
 
   already_AddRefed<gfxContext> PushGroupForLayer(gfxContext* aContext, Layer* aLayer,
                                                  const nsIntRegion& aRegion,
                                                  bool* aNeedsClipToVisibleRegion);
 
-  virtual bool IsCompositingCheap() { return false; }
-  virtual int32_t GetMaxTextureSize() const { return INT32_MAX; }
+  virtual bool IsCompositingCheap() MOZ_OVERRIDE { return false; }
+  virtual int32_t GetMaxTextureSize() const MOZ_OVERRIDE { return INT32_MAX; }
   bool CompositorMightResample() { return mCompositorMightResample; }
 
   virtual bool SupportsMixBlendModes(EnumSet<gfx::CompositionOp>& aMixBlendModes) MOZ_OVERRIDE { return true; }
 
 protected:
   enum TransactionPhase {
     PHASE_NONE, PHASE_CONSTRUCTION, PHASE_DRAWING, PHASE_FORWARD
   };
--- a/gfx/layers/basic/BasicPaintedLayer.h
+++ b/gfx/layers/basic/BasicPaintedLayer.h
@@ -40,49 +40,49 @@ public:
 
 protected:
   virtual ~BasicPaintedLayer()
   {
     MOZ_COUNT_DTOR(BasicPaintedLayer);
   }
 
 public:
-  virtual void SetVisibleRegion(const nsIntRegion& aRegion)
+  virtual void SetVisibleRegion(const nsIntRegion& aRegion) MOZ_OVERRIDE
   {
     NS_ASSERTION(BasicManager()->InConstruction(),
                  "Can only set properties in construction phase");
     PaintedLayer::SetVisibleRegion(aRegion);
   }
-  virtual void InvalidateRegion(const nsIntRegion& aRegion)
+  virtual void InvalidateRegion(const nsIntRegion& aRegion) MOZ_OVERRIDE
   {
     NS_ASSERTION(BasicManager()->InConstruction(),
                  "Can only set properties in construction phase");
     mInvalidRegion.Or(mInvalidRegion, aRegion);
     mInvalidRegion.SimplifyOutward(20);
     mValidRegion.Sub(mValidRegion, mInvalidRegion);
   }
 
   virtual void PaintThebes(gfxContext* aContext,
                            Layer* aMaskLayer,
                            LayerManager::DrawPaintedLayerCallback aCallback,
-                           void* aCallbackData);
+                           void* aCallbackData) MOZ_OVERRIDE;
 
   virtual void Validate(LayerManager::DrawPaintedLayerCallback aCallback,
                         void* aCallbackData,
                         ReadbackProcessor* aReadback) MOZ_OVERRIDE;
 
-  virtual void ClearCachedResources()
+  virtual void ClearCachedResources() MOZ_OVERRIDE
   {
     if (mContentClient) {
       mContentClient->Clear();
     }
     mValidRegion.SetEmpty();
   }
 
-  virtual void ComputeEffectiveTransforms(const gfx::Matrix4x4& aTransformToSurface)
+  virtual void ComputeEffectiveTransforms(const gfx::Matrix4x4& aTransformToSurface) MOZ_OVERRIDE
   {
     if (!BasicManager()->IsRetained()) {
       // Don't do any snapping of our transform, since we're just going to
       // draw straight through without intermediate buffers.
       mEffectiveTransform = GetLocalTransform() * aTransformToSurface;
       if (gfxPoint(0,0) != mResidualTranslation) {
         mResidualTranslation = gfxPoint(0,0);
         mValidRegion.SetEmpty();
--- a/gfx/layers/basic/MacIOSurfaceTextureHostBasic.h
+++ b/gfx/layers/basic/MacIOSurfaceTextureHostBasic.h
@@ -72,17 +72,17 @@ public:
   virtual TemporaryRef<gfx::DataSourceSurface> GetAsSurface() MOZ_OVERRIDE
   {
     return nullptr; // XXX - implement this (for MOZ_DUMP_PAINTING)
   }
 
   virtual gfx::IntSize GetSize() const MOZ_OVERRIDE;
 
 #ifdef MOZ_LAYERS_HAVE_LOG
-  virtual const char* Name() { return "MacIOSurfaceTextureHostBasic"; }
+  virtual const char* Name() MOZ_OVERRIDE { return "MacIOSurfaceTextureHostBasic"; }
 #endif
 
 protected:
   RefPtr<BasicCompositor> mCompositor;
   RefPtr<MacIOSurfaceTextureSourceBasic> mTextureSource;
   RefPtr<MacIOSurface> mSurface;
 };
 
--- a/gfx/layers/client/CanvasClient.h
+++ b/gfx/layers/client/CanvasClient.h
@@ -71,17 +71,17 @@ class CanvasClient2D : public CanvasClie
 {
 public:
   CanvasClient2D(CompositableForwarder* aLayerForwarder,
                  TextureFlags aFlags)
     : CanvasClient(aLayerForwarder, aFlags)
   {
   }
 
-  TextureInfo GetTextureInfo() const
+  TextureInfo GetTextureInfo() const MOZ_OVERRIDE
   {
     return TextureInfo(CompositableType::IMAGE, mTextureFlags);
   }
 
   virtual void Clear() MOZ_OVERRIDE
   {
     mBuffer = nullptr;
   }
--- a/gfx/layers/client/ClientContainerLayer.h
+++ b/gfx/layers/client/ClientContainerLayer.h
@@ -41,17 +41,17 @@ protected:
     while (mFirstChild) {
       ContainerLayer::RemoveChild(mFirstChild);
     }
 
     MOZ_COUNT_DTOR(ClientContainerLayer);
   }
 
 public:
-  virtual void RenderLayer()
+  virtual void RenderLayer() MOZ_OVERRIDE
   {
     if (GetMaskLayer()) {
       ToClientLayer(GetMaskLayer())->RenderLayer();
     }
     
     DefaultComputeSupportsComponentAlphaChildren();
 
     nsAutoTArray<Layer*, 12> children;
@@ -70,17 +70,17 @@ public:
 
       if (!ClientManager()->GetRepeatTransaction() &&
           !child->GetInvalidRegion().IsEmpty()) {
         child->Mutated();
       }
     }
   }
 
-  virtual void SetVisibleRegion(const nsIntRegion& aRegion)
+  virtual void SetVisibleRegion(const nsIntRegion& aRegion) MOZ_OVERRIDE
   {
     NS_ASSERTION(ClientManager()->InConstruction(),
                  "Can only set properties in construction phase");
     ContainerLayer::SetVisibleRegion(aRegion);
   }
   virtual bool InsertAfter(Layer* aChild, Layer* aAfter) MOZ_OVERRIDE
   {
     if(!ClientManager()->InConstruction()) {
@@ -123,20 +123,20 @@ public:
       return false;
     }
     ClientManager()->AsShadowForwarder()->RepositionChild(ClientManager()->Hold(this),
                                                           ClientManager()->Hold(aChild),
                                                           aAfter ? ClientManager()->Hold(aAfter) : nullptr);
     return true;
   }
 
-  virtual Layer* AsLayer() { return this; }
-  virtual ShadowableLayer* AsShadowableLayer() { return this; }
+  virtual Layer* AsLayer() MOZ_OVERRIDE { return this; }
+  virtual ShadowableLayer* AsShadowableLayer() MOZ_OVERRIDE { return this; }
 
-  virtual void ComputeEffectiveTransforms(const gfx::Matrix4x4& aTransformToSurface)
+  virtual void ComputeEffectiveTransforms(const gfx::Matrix4x4& aTransformToSurface) MOZ_OVERRIDE
   {
     DefaultComputeEffectiveTransforms(aTransformToSurface);
   }
 
   void ForceIntermediateSurface() { mUseIntermediateSurface = true; }
 
   void SetSupportsComponentAlphaChildren(bool aSupports) { mSupportsComponentAlphaChildren = aSupports; }
 
--- a/gfx/layers/client/ClientImageLayer.cpp
+++ b/gfx/layers/client/ClientImageLayer.cpp
@@ -42,39 +42,39 @@ protected:
   }
 
   virtual void SetContainer(ImageContainer* aContainer) MOZ_OVERRIDE
   {
     ImageLayer::SetContainer(aContainer);
     mImageClientTypeContainer = CompositableType::UNKNOWN;
   }
 
-  virtual void SetVisibleRegion(const nsIntRegion& aRegion)
+  virtual void SetVisibleRegion(const nsIntRegion& aRegion) MOZ_OVERRIDE
   {
     NS_ASSERTION(ClientManager()->InConstruction(),
                  "Can only set properties in construction phase");
     ImageLayer::SetVisibleRegion(aRegion);
   }
 
-  virtual void RenderLayer();
+  virtual void RenderLayer() MOZ_OVERRIDE;
   
   virtual void ClearCachedResources() MOZ_OVERRIDE
   {
     DestroyBackBuffer();
   }
 
-  virtual void FillSpecificAttributes(SpecificLayerAttributes& aAttrs)
+  virtual void FillSpecificAttributes(SpecificLayerAttributes& aAttrs) MOZ_OVERRIDE
   {
     aAttrs = ImageLayerAttributes(mFilter, mScaleToSize, mScaleMode);
   }
 
-  virtual Layer* AsLayer() { return this; }
-  virtual ShadowableLayer* AsShadowableLayer() { return this; }
+  virtual Layer* AsLayer() MOZ_OVERRIDE { return this; }
+  virtual ShadowableLayer* AsShadowableLayer() MOZ_OVERRIDE { return this; }
 
-  virtual void Disconnect()
+  virtual void Disconnect() MOZ_OVERRIDE
   {
     DestroyBackBuffer();
     ClientLayer::Disconnect();
   }
 
   void DestroyBackBuffer()
   {
     if (mImageClient) {
--- a/gfx/layers/client/ClientLayerManager.h
+++ b/gfx/layers/client/ClientLayerManager.h
@@ -40,68 +40,68 @@ class TextureClientPool;
 
 class ClientLayerManager MOZ_FINAL : public LayerManager
 {
   typedef nsTArray<nsRefPtr<Layer> > LayerRefArray;
 
 public:
   explicit ClientLayerManager(nsIWidget* aWidget);
 
-  virtual void Destroy()
+  virtual void Destroy() MOZ_OVERRIDE
   {
     LayerManager::Destroy();
     ClearCachedResources();
   }
 
 protected:
   virtual ~ClientLayerManager();
 
 public:
-  virtual ShadowLayerForwarder* AsShadowForwarder()
+  virtual ShadowLayerForwarder* AsShadowForwarder() MOZ_OVERRIDE
   {
     return mForwarder;
   }
 
-  virtual ClientLayerManager* AsClientLayerManager()
+  virtual ClientLayerManager* AsClientLayerManager() MOZ_OVERRIDE
   {
     return this;
   }
 
-  virtual int32_t GetMaxTextureSize() const;
+  virtual int32_t GetMaxTextureSize() const MOZ_OVERRIDE;
 
   virtual void SetDefaultTargetConfiguration(BufferMode aDoubleBuffering, ScreenRotation aRotation);
-  virtual void BeginTransactionWithTarget(gfxContext* aTarget);
-  virtual void BeginTransaction();
-  virtual bool EndEmptyTransaction(EndTransactionFlags aFlags = END_DEFAULT);
+  virtual void BeginTransactionWithTarget(gfxContext* aTarget) MOZ_OVERRIDE;
+  virtual void BeginTransaction() MOZ_OVERRIDE;
+  virtual bool EndEmptyTransaction(EndTransactionFlags aFlags = END_DEFAULT) MOZ_OVERRIDE;
   virtual void EndTransaction(DrawPaintedLayerCallback aCallback,
                               void* aCallbackData,
-                              EndTransactionFlags aFlags = END_DEFAULT);
+                              EndTransactionFlags aFlags = END_DEFAULT) MOZ_OVERRIDE;
 
-  virtual LayersBackend GetBackendType() { return LayersBackend::LAYERS_CLIENT; }
+  virtual LayersBackend GetBackendType() MOZ_OVERRIDE { return LayersBackend::LAYERS_CLIENT; }
   virtual LayersBackend GetCompositorBackendType() MOZ_OVERRIDE
   {
     return AsShadowForwarder()->GetCompositorBackendType();
   }
-  virtual void GetBackendName(nsAString& name);
-  virtual const char* Name() const { return "Client"; }
+  virtual void GetBackendName(nsAString& name) MOZ_OVERRIDE;
+  virtual const char* Name() const MOZ_OVERRIDE { return "Client"; }
 
-  virtual void SetRoot(Layer* aLayer);
+  virtual void SetRoot(Layer* aLayer) MOZ_OVERRIDE;
 
-  virtual void Mutated(Layer* aLayer);
+  virtual void Mutated(Layer* aLayer) MOZ_OVERRIDE;
 
-  virtual bool IsOptimizedFor(PaintedLayer* aLayer, PaintedLayerCreationHint aHint);
+  virtual bool IsOptimizedFor(PaintedLayer* aLayer, PaintedLayerCreationHint aHint) MOZ_OVERRIDE;
 
-  virtual already_AddRefed<PaintedLayer> CreatePaintedLayer();
-  virtual already_AddRefed<PaintedLayer> CreatePaintedLayerWithHint(PaintedLayerCreationHint aHint);
-  virtual already_AddRefed<ContainerLayer> CreateContainerLayer();
-  virtual already_AddRefed<ImageLayer> CreateImageLayer();
-  virtual already_AddRefed<CanvasLayer> CreateCanvasLayer();
-  virtual already_AddRefed<ReadbackLayer> CreateReadbackLayer();
-  virtual already_AddRefed<ColorLayer> CreateColorLayer();
-  virtual already_AddRefed<RefLayer> CreateRefLayer();
+  virtual already_AddRefed<PaintedLayer> CreatePaintedLayer() MOZ_OVERRIDE;
+  virtual already_AddRefed<PaintedLayer> CreatePaintedLayerWithHint(PaintedLayerCreationHint aHint) MOZ_OVERRIDE;
+  virtual already_AddRefed<ContainerLayer> CreateContainerLayer() MOZ_OVERRIDE;
+  virtual already_AddRefed<ImageLayer> CreateImageLayer() MOZ_OVERRIDE;
+  virtual already_AddRefed<CanvasLayer> CreateCanvasLayer() MOZ_OVERRIDE;
+  virtual already_AddRefed<ReadbackLayer> CreateReadbackLayer() MOZ_OVERRIDE;
+  virtual already_AddRefed<ColorLayer> CreateColorLayer() MOZ_OVERRIDE;
+  virtual already_AddRefed<RefLayer> CreateRefLayer() MOZ_OVERRIDE;
 
   TextureFactoryIdentifier GetTextureFactoryIdentifier()
   {
     return mForwarder->GetTextureFactoryIdentifier();
   }
 
   virtual void FlushRendering() MOZ_OVERRIDE;
   void SendInvalidRegion(const nsIntRegion& aRegion);
@@ -112,18 +112,18 @@ public:
                                       nsTArray<float>& aFrameIntervals) MOZ_OVERRIDE;
 
   virtual bool NeedsWidgetInvalidation() MOZ_OVERRIDE { return false; }
 
   ShadowableLayer* Hold(Layer* aLayer);
 
   bool HasShadowManager() const { return mForwarder->HasShadowManager(); }
 
-  virtual bool IsCompositingCheap();
-  virtual bool HasShadowManagerInternal() const { return HasShadowManager(); }
+  virtual bool IsCompositingCheap() MOZ_OVERRIDE;
+  virtual bool HasShadowManagerInternal() const MOZ_OVERRIDE { return HasShadowManager(); }
 
   virtual void SetIsFirstPaint() MOZ_OVERRIDE;
 
   TextureClientPool* GetTexturePool(gfx::SurfaceFormat aFormat);
 
   /// Utility methods for managing texture clients.
   void ReturnTextureClientDeferred(TextureClient& aClient);
   void ReturnTextureClient(TextureClient& aClient);
@@ -154,17 +154,17 @@ public:
   void* GetPaintedLayerCallbackData() const
   { return mPaintedLayerCallbackData; }
 
   CompositorChild* GetRemoteRenderer();
 
   CompositorChild* GetCompositorChild();
 
   // Disable component alpha layers with the software compositor.
-  virtual bool ShouldAvoidComponentAlphaLayers() { return !IsCompositingCheap(); }
+  virtual bool ShouldAvoidComponentAlphaLayers() MOZ_OVERRIDE { return !IsCompositingCheap(); }
 
   /**
    * Called for each iteration of a progressive tile update. Updates
    * aMetrics with the current scroll offset and scale being used to composite
    * the primary scrollable layer in this manager, to determine what area
    * intersects with the target composition bounds.
    * aDrawingCritical will be true if the current drawing operation is using
    * the critical displayport.
--- a/gfx/layers/client/ClientPaintedLayer.h
+++ b/gfx/layers/client/ClientPaintedLayer.h
@@ -49,63 +49,63 @@ protected:
     if (mContentClient) {
       mContentClient->OnDetach();
       mContentClient = nullptr;
     }
     MOZ_COUNT_DTOR(ClientPaintedLayer);
   }
 
 public:
-  virtual void SetVisibleRegion(const nsIntRegion& aRegion)
+  virtual void SetVisibleRegion(const nsIntRegion& aRegion) MOZ_OVERRIDE
   {
     NS_ASSERTION(ClientManager()->InConstruction(),
                  "Can only set properties in construction phase");
     PaintedLayer::SetVisibleRegion(aRegion);
   }
-  virtual void InvalidateRegion(const nsIntRegion& aRegion)
+  virtual void InvalidateRegion(const nsIntRegion& aRegion) MOZ_OVERRIDE
   {
     NS_ASSERTION(ClientManager()->InConstruction(),
                  "Can only set properties in construction phase");
     mInvalidRegion.Or(mInvalidRegion, aRegion);
     mInvalidRegion.SimplifyOutward(20);
     mValidRegion.Sub(mValidRegion, mInvalidRegion);
   }
 
-  virtual void RenderLayer() { RenderLayerWithReadback(nullptr); }
+  virtual void RenderLayer() MOZ_OVERRIDE { RenderLayerWithReadback(nullptr); }
 
   virtual void RenderLayerWithReadback(ReadbackProcessor *aReadback) MOZ_OVERRIDE;
 
-  virtual void ClearCachedResources()
+  virtual void ClearCachedResources() MOZ_OVERRIDE
   {
     if (mContentClient) {
       mContentClient->Clear();
     }
     mValidRegion.SetEmpty();
     DestroyBackBuffer();
   }
   
-  virtual void FillSpecificAttributes(SpecificLayerAttributes& aAttrs)
+  virtual void FillSpecificAttributes(SpecificLayerAttributes& aAttrs) MOZ_OVERRIDE
   {
     aAttrs = PaintedLayerAttributes(GetValidRegion());
   }
   
   ClientLayerManager* ClientManager()
   {
     return static_cast<ClientLayerManager*>(mManager);
   }
   
-  virtual Layer* AsLayer() { return this; }
-  virtual ShadowableLayer* AsShadowableLayer() { return this; }
+  virtual Layer* AsLayer() MOZ_OVERRIDE { return this; }
+  virtual ShadowableLayer* AsShadowableLayer() MOZ_OVERRIDE { return this; }
 
   virtual CompositableClient* GetCompositableClient() MOZ_OVERRIDE
   {
     return mContentClient;
   }
 
-  virtual void Disconnect()
+  virtual void Disconnect() MOZ_OVERRIDE
   {
     mContentClient = nullptr;
     ClientLayer::Disconnect();
   }
 
 protected:
   void PaintThebes();
 
--- a/gfx/layers/client/ClientTiledPaintedLayer.h
+++ b/gfx/layers/client/ClientTiledPaintedLayer.h
@@ -46,37 +46,37 @@ public:
 
 protected:
   ~ClientTiledPaintedLayer();
 
   virtual void PrintInfo(std::stringstream& aStream, const char* aPrefix) MOZ_OVERRIDE;
 
 public:
   // Override name to distinguish it from ClientPaintedLayer in layer dumps
-  virtual const char* Name() const { return "TiledPaintedLayer"; }
+  virtual const char* Name() const MOZ_OVERRIDE { return "TiledPaintedLayer"; }
 
   // PaintedLayer
-  virtual Layer* AsLayer() { return this; }
-  virtual void InvalidateRegion(const nsIntRegion& aRegion) {
+  virtual Layer* AsLayer() MOZ_OVERRIDE { return this; }
+  virtual void InvalidateRegion(const nsIntRegion& aRegion) MOZ_OVERRIDE {
     mInvalidRegion.Or(mInvalidRegion, aRegion);
     mInvalidRegion.SimplifyOutward(20);
     mValidRegion.Sub(mValidRegion, mInvalidRegion);
     mLowPrecisionValidRegion.Sub(mLowPrecisionValidRegion, mInvalidRegion);
   }
 
   // Shadow methods
-  virtual void FillSpecificAttributes(SpecificLayerAttributes& aAttrs);
-  virtual ShadowableLayer* AsShadowableLayer() { return this; }
+  virtual void FillSpecificAttributes(SpecificLayerAttributes& aAttrs) MOZ_OVERRIDE;
+  virtual ShadowableLayer* AsShadowableLayer() MOZ_OVERRIDE { return this; }
 
-  virtual void Disconnect()
+  virtual void Disconnect() MOZ_OVERRIDE
   {
     ClientLayer::Disconnect();
   }
 
-  virtual void RenderLayer();
+  virtual void RenderLayer() MOZ_OVERRIDE;
 
   virtual void ClearCachedResources() MOZ_OVERRIDE;
 
   /**
    * Helper method to find the nearest ancestor layers which
    * scroll and have a displayport. The parameters are out-params
    * which hold the return values; the values passed in may be null.
    */
--- a/gfx/layers/client/ContentClient.h
+++ b/gfx/layers/client/ContentClient.h
@@ -132,17 +132,17 @@ class ContentClientBasic MOZ_FINAL : pub
                                    , protected RotatedContentBuffer
 {
 public:
   ContentClientBasic();
 
   typedef RotatedContentBuffer::PaintState PaintState;
   typedef RotatedContentBuffer::ContentType ContentType;
 
-  virtual void Clear() { RotatedContentBuffer::Clear(); }
+  virtual void Clear() MOZ_OVERRIDE { RotatedContentBuffer::Clear(); }
   virtual PaintState BeginPaintBuffer(PaintedLayer* aLayer,
                                       uint32_t aFlags) MOZ_OVERRIDE
   {
     return RotatedContentBuffer::BeginPaint(aLayer, aFlags);
   }
   virtual gfx::DrawTarget* BorrowDrawTargetForPainting(PaintState& aPaintState,
                                                        RotatedContentBuffer::DrawIterator* aIter = nullptr) MOZ_OVERRIDE
   {
@@ -201,17 +201,17 @@ public:
     , mIsNewBuffer(false)
     , mFrontAndBackBufferDiffer(false)
     , mSurfaceFormat(gfx::SurfaceFormat::B8G8R8A8)
   {}
 
   typedef RotatedContentBuffer::PaintState PaintState;
   typedef RotatedContentBuffer::ContentType ContentType;
 
-  virtual void Clear()
+  virtual void Clear() MOZ_OVERRIDE
   {
     RotatedContentBuffer::Clear();
     mTextureClient = nullptr;
     mTextureClientOnWhite = nullptr;
   }
 
   virtual void Dump(std::stringstream& aStream,
                     const char* aPrefix="",
@@ -240,17 +240,17 @@ public:
    * None of the underlying buffer attributes (rect, rotation)
    * are affected by mapping/unmapping.
    */
   virtual void BeginPaint() MOZ_OVERRIDE;
   virtual void EndPaint(nsTArray<ReadbackProcessor::Update>* aReadbackUpdates = nullptr) MOZ_OVERRIDE;
 
   virtual void Updated(const nsIntRegion& aRegionToDraw,
                        const nsIntRegion& aVisibleRegion,
-                       bool aDidSelfCopy);
+                       bool aDidSelfCopy) MOZ_OVERRIDE;
 
   virtual void SwapBuffers(const nsIntRegion& aFrontUpdatedRegion) MOZ_OVERRIDE;
 
   // Expose these protected methods from the superclass.
   virtual const nsIntRect& BufferRect() const
   {
     return RotatedContentBuffer::BufferRect();
   }
@@ -411,22 +411,22 @@ public:
     , mHasBufferOnWhite(false)
   {
     mTextureInfo.mCompositableType = CompositableType::CONTENT_INC;
   }
 
   typedef RotatedContentBuffer::PaintState PaintState;
   typedef RotatedContentBuffer::ContentType ContentType;
 
-  virtual TextureInfo GetTextureInfo() const
+  virtual TextureInfo GetTextureInfo() const MOZ_OVERRIDE
   {
     return mTextureInfo;
   }
 
-  virtual void Clear()
+  virtual void Clear() MOZ_OVERRIDE
   {
     mBufferRect.SetEmpty();
     mHasBuffer = false;
     mHasBufferOnWhite = false;
   }
 
   virtual PaintState BeginPaintBuffer(PaintedLayer* aLayer,
                                       uint32_t aFlags) MOZ_OVERRIDE;
@@ -434,19 +434,19 @@ public:
                                                        RotatedContentBuffer::DrawIterator* aIter = nullptr) MOZ_OVERRIDE;
   virtual void ReturnDrawTargetToBuffer(gfx::DrawTarget*& aReturned) MOZ_OVERRIDE
   {
     BorrowDrawTarget::ReturnDrawTarget(aReturned);
   }
 
   virtual void Updated(const nsIntRegion& aRegionToDraw,
                        const nsIntRegion& aVisibleRegion,
-                       bool aDidSelfCopy);
+                       bool aDidSelfCopy) MOZ_OVERRIDE;
 
-  virtual void EndPaint(nsTArray<ReadbackProcessor::Update>* aReadbackUpdates = nullptr)
+  virtual void EndPaint(nsTArray<ReadbackProcessor::Update>* aReadbackUpdates = nullptr) MOZ_OVERRIDE
   {
     if (IsSurfaceDescriptorValid(mUpdateDescriptor)) {
       mForwarder->DestroySharedSurface(&mUpdateDescriptor);
     }
     if (IsSurfaceDescriptorValid(mUpdateDescriptorOnWhite)) {
       mForwarder->DestroySharedSurface(&mUpdateDescriptorOnWhite);
     }
     ContentClientRemote::EndPaint(aReadbackUpdates);
--- a/gfx/layers/client/ImageClient.h
+++ b/gfx/layers/client/ImageClient.h
@@ -94,17 +94,17 @@ protected:
  */
 class ImageClientSingle : public ImageClient
 {
 public:
   ImageClientSingle(CompositableForwarder* aFwd,
                     TextureFlags aFlags,
                     CompositableType aType);
 
-  virtual bool UpdateImage(ImageContainer* aContainer, uint32_t aContentFlags);
+  virtual bool UpdateImage(ImageContainer* aContainer, uint32_t aContentFlags) MOZ_OVERRIDE;
 
   virtual void OnDetach() MOZ_OVERRIDE;
 
   virtual bool AddTextureClient(TextureClient* aTexture) MOZ_OVERRIDE;
 
   virtual TextureInfo GetTextureInfo() const MOZ_OVERRIDE;
 
   virtual already_AddRefed<Image> CreateImage(ImageFormat aFormat) MOZ_OVERRIDE;
@@ -124,18 +124,18 @@ protected:
  * We store the ImageBridge id in the TextureClientIdentifier.
  */
 class ImageClientBridge : public ImageClient
 {
 public:
   ImageClientBridge(CompositableForwarder* aFwd,
                     TextureFlags aFlags);
 
-  virtual bool UpdateImage(ImageContainer* aContainer, uint32_t aContentFlags);
-  virtual bool Connect() { return false; }
+  virtual bool UpdateImage(ImageContainer* aContainer, uint32_t aContentFlags) MOZ_OVERRIDE;
+  virtual bool Connect() MOZ_OVERRIDE { return false; }
   virtual void Updated() {}
   void SetLayer(ShadowableLayer* aLayer)
   {
     mLayer = aLayer;
   }
 
   virtual TextureInfo GetTextureInfo() const MOZ_OVERRIDE
   {
--- a/gfx/layers/client/TextureClient.cpp
+++ b/gfx/layers/client/TextureClient.cpp
@@ -88,17 +88,17 @@ public:
   , mTextureClient(nullptr)
   , mKeep(nullptr)
   , mIPCOpen(false)
   {
   }
 
   bool Recv__delete__() MOZ_OVERRIDE;
 
-  bool RecvCompositorRecycle()
+  bool RecvCompositorRecycle() MOZ_OVERRIDE
   {
     RECYCLE_LOG("Receive recycle %p (%p)\n", mTextureClient, mWaitForRecycle.get());
     mWaitForRecycle = nullptr;
     return true;
   }
 
   void WaitForCompositorRecycle()
   {
--- a/gfx/layers/client/TextureClient.h
+++ b/gfx/layers/client/TextureClient.h
@@ -553,21 +553,21 @@ class BufferTextureClient : public Textu
                           , public TextureClientYCbCr
 {
 public:
   BufferTextureClient(ISurfaceAllocator* aAllocator, gfx::SurfaceFormat aFormat,
                       gfx::BackendType aBackend, TextureFlags aFlags);
 
   virtual ~BufferTextureClient();
 
-  virtual bool IsAllocated() const = 0;
+  virtual bool IsAllocated() const MOZ_OVERRIDE = 0;
 
   virtual uint8_t* GetBuffer() const = 0;
 
-  virtual gfx::IntSize GetSize() const { return mSize; }
+  virtual gfx::IntSize GetSize() const MOZ_OVERRIDE { return mSize; }
 
   virtual bool Lock(OpenMode aMode) MOZ_OVERRIDE;
 
   virtual void Unlock() MOZ_OVERRIDE;
 
   virtual bool IsLocked() const MOZ_OVERRIDE { return mLocked; }
 
   uint8_t* GetLockedData() const;
--- a/gfx/layers/composite/ContainerLayerComposite.h
+++ b/gfx/layers/composite/ContainerLayerComposite.h
@@ -70,17 +70,17 @@ public:
     for (Layer* l = GetFirstChild(); l; l = l->GetNextSibling()) {
       LayerComposite* child = l->AsLayerComposite();
       child->SetLayerManager(aManager);
     }
   }
 
   virtual void Destroy() MOZ_OVERRIDE;
 
-  LayerComposite* GetFirstChildComposite();
+  LayerComposite* GetFirstChildComposite() MOZ_OVERRIDE;
 
   virtual void RenderLayer(const nsIntRect& aClipRect) MOZ_OVERRIDE;
   virtual void Prepare(const RenderTargetIntRect& aClipRect) MOZ_OVERRIDE;
 
   virtual void ComputeEffectiveTransforms(const gfx::Matrix4x4& aTransformToSurface) MOZ_OVERRIDE
   {
     DefaultComputeEffectiveTransforms(aTransformToSurface);
   }
@@ -136,17 +136,17 @@ protected:
   ~RefLayerComposite();
 
 public:
   /** LayerOGL implementation */
   Layer* GetLayer() MOZ_OVERRIDE { return this; }
 
   void Destroy() MOZ_OVERRIDE;
 
-  LayerComposite* GetFirstChildComposite();
+  LayerComposite* GetFirstChildComposite() MOZ_OVERRIDE;
 
   virtual void RenderLayer(const nsIntRect& aClipRect) MOZ_OVERRIDE;
   virtual void Prepare(const RenderTargetIntRect& aClipRect) MOZ_OVERRIDE;
 
   virtual void ComputeEffectiveTransforms(const gfx::Matrix4x4& aTransformToSurface) MOZ_OVERRIDE
   {
     DefaultComputeEffectiveTransforms(aTransformToSurface);
   }
--- a/gfx/layers/composite/ContentHost.h
+++ b/gfx/layers/composite/ContentHost.h
@@ -120,17 +120,17 @@ public:
     , mLocked(false)
   { }
 
   virtual void Composite(EffectChain& aEffectChain,
                          float aOpacity,
                          const gfx::Matrix4x4& aTransform,
                          const gfx::Filter& aFilter,
                          const gfx::Rect& aClipRect,
-                         const nsIntRegion* aVisibleRegion = nullptr);
+                         const nsIntRegion* aVisibleRegion = nullptr) MOZ_OVERRIDE;
 
   virtual void SetCompositor(Compositor* aCompositor) MOZ_OVERRIDE;
 
   virtual TemporaryRef<gfx::DataSourceSurface> GetAsSurface() MOZ_OVERRIDE;
 
   virtual void Dump(std::stringstream& aStream,
                     const char* aPrefix="",
                     bool aDumpHtml=false) MOZ_OVERRIDE;
@@ -161,17 +161,17 @@ public:
     MOZ_ASSERT(mLocked);
     mTextureHost->Unlock();
     if (mTextureHostOnWhite) {
       mTextureHostOnWhite->Unlock();
     }
     mLocked = false;
   }
 
-  LayerRenderState GetRenderState();
+  LayerRenderState GetRenderState() MOZ_OVERRIDE;
 
   virtual TemporaryRef<TexturedEffect> GenEffect(const gfx::Filter& aFilter) MOZ_OVERRIDE;
 
 protected:
   CompositableTextureHostRef mTextureHost;
   CompositableTextureHostRef mTextureHostOnWhite;
   CompositableTextureSourceRef mTextureSource;
   CompositableTextureSourceRef mTextureSourceOnWhite;
@@ -234,45 +234,45 @@ public:
  * avoid blocking the main thread.
  */
 class ContentHostIncremental : public ContentHostBase
 {
 public:
   explicit ContentHostIncremental(const TextureInfo& aTextureInfo);
   ~ContentHostIncremental();
 
-  virtual CompositableType GetType() { return CompositableType::CONTENT_INC; }
+  virtual CompositableType GetType() MOZ_OVERRIDE { return CompositableType::CONTENT_INC; }
 
   virtual LayerRenderState GetRenderState() MOZ_OVERRIDE { return LayerRenderState(); }
 
   virtual bool CreatedIncrementalTexture(ISurfaceAllocator* aAllocator,
                                          const TextureInfo& aTextureInfo,
                                          const nsIntRect& aBufferRect) MOZ_OVERRIDE;
 
   virtual void UpdateIncremental(TextureIdentifier aTextureId,
                                  SurfaceDescriptor& aSurface,
                                  const nsIntRegion& aUpdated,
                                  const nsIntRect& aBufferRect,
                                  const nsIntPoint& aBufferRotation) MOZ_OVERRIDE;
 
   virtual bool UpdateThebes(const ThebesBufferData& aData,
                             const nsIntRegion& aUpdated,
                             const nsIntRegion& aOldValidRegionBack,
-                            nsIntRegion* aUpdatedRegionBack)
+                            nsIntRegion* aUpdatedRegionBack) MOZ_OVERRIDE
   {
     NS_ERROR("Shouldn't call this");
     return false;
   }
 
   virtual void Composite(EffectChain& aEffectChain,
                          float aOpacity,
                          const gfx::Matrix4x4& aTransform,
                          const gfx::Filter& aFilter,
                          const gfx::Rect& aClipRect,
-                         const nsIntRegion* aVisibleRegion = nullptr);
+                         const nsIntRegion* aVisibleRegion = nullptr) MOZ_OVERRIDE;
 
   virtual void PrintInfo(std::stringstream& aStream, const char* aPrefix) MOZ_OVERRIDE;
 
   virtual bool Lock() MOZ_OVERRIDE {
     MOZ_ASSERT(!mLocked);
     ProcessTextureUpdates();
     mLocked = true;
     return true;
--- a/gfx/layers/composite/ImageHost.h
+++ b/gfx/layers/composite/ImageHost.h
@@ -38,17 +38,17 @@ struct EffectChain;
  * ImageHost. Works with ImageClientSingle and ImageClientBuffered
  */
 class ImageHost : public CompositableHost
 {
 public:
   explicit ImageHost(const TextureInfo& aTextureInfo);
   ~ImageHost();
 
-  virtual CompositableType GetType() { return mTextureInfo.mCompositableType; }
+  virtual CompositableType GetType() MOZ_OVERRIDE { return mTextureInfo.mCompositableType; }
 
   virtual void Composite(EffectChain& aEffectChain,
                          float aOpacity,
                          const gfx::Matrix4x4& aTransform,
                          const gfx::Filter& aFilter,
                          const gfx::Rect& aClipRect,
                          const nsIntRegion* aVisibleRegion = nullptr) MOZ_OVERRIDE;
 
@@ -61,21 +61,21 @@ public:
   virtual void SetCompositor(Compositor* aCompositor) MOZ_OVERRIDE;
 
   virtual void SetPictureRect(const nsIntRect& aPictureRect) MOZ_OVERRIDE
   {
     mPictureRect = aPictureRect;
     mHasPictureRect = true;
   }
 
-  gfx::IntSize GetImageSize() const;
+  gfx::IntSize GetImageSize() const MOZ_OVERRIDE;
 
   virtual LayerRenderState GetRenderState() MOZ_OVERRIDE;
 
-  virtual void PrintInfo(std::stringstream& aStream, const char* aPrefix);
+  virtual void PrintInfo(std::stringstream& aStream, const char* aPrefix) MOZ_OVERRIDE;
 
   virtual void Dump(std::stringstream& aStream,
                     const char* aPrefix = "",
                     bool aDumpHtml = false) MOZ_OVERRIDE;
 
   virtual TemporaryRef<gfx::DataSourceSurface> GetAsSurface() MOZ_OVERRIDE;
 
   virtual bool Lock() MOZ_OVERRIDE;
--- a/gfx/layers/composite/ImageLayerComposite.h
+++ b/gfx/layers/composite/ImageLayerComposite.h
@@ -49,29 +49,29 @@ public:
   {
     LayerComposite::SetLayerManager(aManager);
     mManager = aManager;
     if (mImageHost) {
       mImageHost->SetCompositor(mCompositor);
     }
   }
 
-  virtual void RenderLayer(const nsIntRect& aClipRect);
+  virtual void RenderLayer(const nsIntRect& aClipRect) MOZ_OVERRIDE;
 
   virtual void ComputeEffectiveTransforms(const mozilla::gfx::Matrix4x4& aTransformToSurface) MOZ_OVERRIDE;
 
   virtual void CleanupResources() MOZ_OVERRIDE;
 
   CompositableHost* GetCompositableHost() MOZ_OVERRIDE;
 
   virtual void GenEffectChain(EffectChain& aEffect) MOZ_OVERRIDE;
 
   virtual LayerComposite* AsLayerComposite() MOZ_OVERRIDE { return this; }
 
-  virtual const char* Name() const { return "ImageLayerComposite"; }
+  virtual const char* Name() const MOZ_OVERRIDE { return "ImageLayerComposite"; }
 
 protected:
   virtual void PrintInfo(std::stringstream& aStream, const char* aPrefix) MOZ_OVERRIDE;
 
 private:
   gfx::Filter GetEffectFilter();
 
 private:
--- a/gfx/layers/composite/PaintedLayerComposite.h
+++ b/gfx/layers/composite/PaintedLayerComposite.h
@@ -62,17 +62,17 @@ public:
   virtual void CleanupResources() MOZ_OVERRIDE;
 
   virtual void GenEffectChain(EffectChain& aEffect) MOZ_OVERRIDE;
 
   virtual bool SetCompositableHost(CompositableHost* aHost) MOZ_OVERRIDE;
 
   virtual LayerComposite* AsLayerComposite() MOZ_OVERRIDE { return this; }
 
-  virtual void InvalidateRegion(const nsIntRegion& aRegion)
+  virtual void InvalidateRegion(const nsIntRegion& aRegion) MOZ_OVERRIDE
   {
     NS_RUNTIMEABORT("PaintedLayerComposites can't fill invalidated regions");
   }
 
   void SetValidRegion(const nsIntRegion& aRegion)
   {
     MOZ_LAYERS_LOG_IF_SHADOWABLE(this, ("Layer::Mutated(%p) ValidRegion", this));
     mValidRegion = aRegion;
--- a/gfx/layers/composite/TextureHost.h
+++ b/gfx/layers/composite/TextureHost.h
@@ -729,17 +729,17 @@ public:
     return mTexSource;
   }
 
   virtual gfx::SurfaceFormat GetFormat() const MOZ_OVERRIDE;
 
   virtual gfx::IntSize GetSize() const MOZ_OVERRIDE;
 
 #ifdef MOZ_LAYERS_HAVE_LOG
-  virtual const char* Name() { return "SharedSurfaceTextureHost"; }
+  virtual const char* Name() MOZ_OVERRIDE { return "SharedSurfaceTextureHost"; }
 #endif
 
 protected:
   void EnsureTexSource();
 
   bool mIsLocked;
   gl::SharedSurface* const mSurf;
   RefPtr<Compositor> mCompositor;
--- a/gfx/layers/composite/TiledContentHost.h
+++ b/gfx/layers/composite/TiledContentHost.h
@@ -215,62 +215,62 @@ public:
   {
     return LayerRenderState();
   }
 
 
   virtual bool UpdateThebes(const ThebesBufferData& aData,
                             const nsIntRegion& aUpdated,
                             const nsIntRegion& aOldValidRegionBack,
-                            nsIntRegion* aUpdatedRegionBack)
+                            nsIntRegion* aUpdatedRegionBack) MOZ_OVERRIDE
   {
     NS_ERROR("N/A for tiled layers");
     return false;
   }
 
-  const nsIntRegion& GetValidLowPrecisionRegion() const
+  const nsIntRegion& GetValidLowPrecisionRegion() const MOZ_OVERRIDE
   {
     return mLowPrecisionTiledBuffer.GetValidRegion();
   }
 
-  virtual void SetCompositor(Compositor* aCompositor)
+  virtual void SetCompositor(Compositor* aCompositor) MOZ_OVERRIDE
   {
     CompositableHost::SetCompositor(aCompositor);
     mTiledBuffer.SetCompositor(aCompositor);
     mLowPrecisionTiledBuffer.SetCompositor(aCompositor);
     mOldTiledBuffer.SetCompositor(aCompositor);
     mOldLowPrecisionTiledBuffer.SetCompositor(aCompositor);
   }
 
   virtual bool UseTiledLayerBuffer(ISurfaceAllocator* aAllocator,
                                    const SurfaceDescriptorTiles& aTiledDescriptor) MOZ_OVERRIDE;
 
   void Composite(EffectChain& aEffectChain,
                  float aOpacity,
                  const gfx::Matrix4x4& aTransform,
                  const gfx::Filter& aFilter,
                  const gfx::Rect& aClipRect,
-                 const nsIntRegion* aVisibleRegion = nullptr);
+                 const nsIntRegion* aVisibleRegion = nullptr) MOZ_OVERRIDE;
 
-  virtual CompositableType GetType() { return CompositableType::CONTENT_TILED; }
+  virtual CompositableType GetType() MOZ_OVERRIDE { return CompositableType::CONTENT_TILED; }
 
   virtual TiledLayerComposer* AsTiledLayerComposer() MOZ_OVERRIDE { return this; }
 
   virtual void Attach(Layer* aLayer,
                       Compositor* aCompositor,
                       AttachFlags aFlags = NO_FLAGS) MOZ_OVERRIDE;
 
   virtual void Detach(Layer* aLayer = nullptr,
                       AttachFlags aFlags = NO_FLAGS) MOZ_OVERRIDE;
 
   virtual void Dump(std::stringstream& aStream,
                     const char* aPrefix="",
                     bool aDumpHtml=false) MOZ_OVERRIDE;
 
-  virtual void PrintInfo(std::stringstream& aStream, const char* aPrefix);
+  virtual void PrintInfo(std::stringstream& aStream, const char* aPrefix) MOZ_OVERRIDE;
 
 #if defined(MOZ_WIDGET_GONK) && ANDROID_VERSION >= 17
   /**
    * Store a fence that will signal when the current buffer is no longer being read.
    * Similar to android's GLConsumer::setReleaseFence()
    */
   virtual void SetReleaseFence(const android::sp<android::Fence>& aReleaseFence)
   {
--- a/gfx/layers/ipc/CompositorChild.cpp
+++ b/gfx/layers/ipc/CompositorChild.cpp
@@ -32,22 +32,20 @@ namespace layers {
 
 /*static*/ CompositorChild* CompositorChild::sCompositor;
 
 Atomic<int32_t> CompositableForwarder::sSerialCounter(0);
 
 CompositorChild::CompositorChild(ClientLayerManager *aLayerManager)
   : mLayerManager(aLayerManager)
 {
-  MOZ_COUNT_CTOR(CompositorChild);
 }
 
 CompositorChild::~CompositorChild()
 {
-  MOZ_COUNT_DTOR(CompositorChild);
 }
 
 void
 CompositorChild::Destroy()
 {
   mLayerManager->Destroy();
   mLayerManager = nullptr;
   // start from the end of the array because Destroy() can cause the
@@ -93,17 +91,16 @@ CompositorChild::Create(Transport* aTran
   // We release this ref in ActorDestroy().
   sCompositor = child.forget().take();
 
   int32_t width;
   int32_t height;
   sCompositor->SendGetTileSize(&width, &height);
   gfxPlatform::GetPlatform()->SetTileSize(width, height);
 
-  // We release this ref in ActorDestroy().
   return sCompositor;
 }
 
 /*static*/ CompositorChild*
 CompositorChild::Get()
 {
   // This is only expected to be used in child processes.
   MOZ_ASSERT(XRE_GetProcessType() != GeckoProcessType_Default);
@@ -178,29 +175,36 @@ CompositorChild::ActorDestroy(ActorDestr
   // Due to poor lifetime management of gralloc (and possibly shmems) we will
   // crash at some point in the future when we get destroyed due to abnormal
   // shutdown. Its better just to crash here. On desktop though, we have a chance
   // of recovering.
   if (aWhy == AbnormalShutdown) {
     NS_RUNTIMEABORT("ActorDestroy by IPC channel failure at CompositorChild");
   }
 #endif
-  if (sCompositor) {
-    sCompositor->Release();
-    sCompositor = nullptr;
-  }
+
   // We don't want to release the ref to sCompositor here, during
   // cleanup, because that will cause it to be deleted while it's
   // still being used.  So defer the deletion to after it's not in
   // use.
+  sCompositor = nullptr;
+
   MessageLoop::current()->PostTask(
     FROM_HERE,
     NewRunnableMethod(this, &CompositorChild::Release));
 }
 
+void
+CompositorChild::ShutDown()
+{
+  if (sCompositor) {
+    sCompositor->ActorDestroy(NormalShutdown);
+  }
+}
+
 bool
 CompositorChild::RecvSharedCompositorFrameMetrics(
     const mozilla::ipc::SharedMemoryBasic::Handle& metrics,
     const CrossProcessMutexHandle& handle,
     const uint32_t& aAPZCId)
 {
   SharedFrameMetricsData* data = new SharedFrameMetricsData(metrics, handle, aAPZCId);
   mFrameMetricsTable.Put(data->GetViewID(), data);
--- a/gfx/layers/ipc/CompositorChild.h
+++ b/gfx/layers/ipc/CompositorChild.h
@@ -75,16 +75,18 @@ public:
    * When we get that message, we bounce it to the TabParent via
    * the TabChild
    * @param tabChild The object to bounce the note to.  Non-NULL.
    */
   void RequestNotifyAfterRemotePaint(TabChild* aTabChild);
 
   void CancelNotifyAfterRemotePaint(TabChild* aTabChild);
 
+  static void ShutDown();
+
 private:
   // Private destructor, to discourage deletion outside of Release():
   virtual ~CompositorChild();
 
   virtual PLayerTransactionChild*
     AllocPLayerTransactionChild(const nsTArray<LayersBackend>& aBackendHints,
                                 const uint64_t& aId,
                                 TextureFactoryIdentifier* aTextureFactoryIdentifier,
--- a/gfx/layers/ipc/CompositorParent.cpp
+++ b/gfx/layers/ipc/CompositorParent.cpp
@@ -1381,20 +1381,20 @@ public:
   virtual bool RecvRequestOverfill() MOZ_OVERRIDE { return true; }
   virtual bool RecvWillStop() MOZ_OVERRIDE { return true; }
   virtual bool RecvStop() MOZ_OVERRIDE { return true; }
   virtual bool RecvPause() MOZ_OVERRIDE { return true; }
   virtual bool RecvResume() MOZ_OVERRIDE { return true; }
   virtual bool RecvNotifyChildCreated(const uint64_t& child) MOZ_OVERRIDE;
   virtual bool RecvAdoptChild(const uint64_t& child) MOZ_OVERRIDE { return false; }
   virtual bool RecvMakeSnapshot(const SurfaceDescriptor& aInSnapshot,
-                                const nsIntRect& aRect)
+                                const nsIntRect& aRect) MOZ_OVERRIDE
   { return true; }
   virtual bool RecvFlushRendering() MOZ_OVERRIDE { return true; }
-  virtual bool RecvNotifyRegionInvalidated(const nsIntRegion& aRegion) { return true; }
+  virtual bool RecvNotifyRegionInvalidated(const nsIntRegion& aRegion) MOZ_OVERRIDE { return true; }
   virtual bool RecvStartFrameTimeRecording(const int32_t& aBufferSize, uint32_t* aOutStartIndex) MOZ_OVERRIDE { return true; }
   virtual bool RecvStopFrameTimeRecording(const uint32_t& aStartIndex, InfallibleTArray<float>* intervals) MOZ_OVERRIDE  { return true; }
   virtual bool RecvGetTileSize(int32_t* aWidth, int32_t* aHeight) MOZ_OVERRIDE
   {
     *aWidth = gfxPlatform::GetPlatform()->GetTileWidth();
     *aHeight = gfxPlatform::GetPlatform()->GetTileHeight();
     return true;
   }
--- a/gfx/layers/ipc/ISurfaceAllocator.h
+++ b/gfx/layers/ipc/ISurfaceAllocator.h
@@ -220,17 +220,17 @@ public:
   }
 
   static void WillFree(void* aPointer)
   {
     sAmount -= MallocSizeOfOnFree(aPointer);
   }
 
   NS_IMETHOD CollectReports(nsIHandleReportCallback* aHandleReport,
-                            nsISupports* aData, bool aAnonymize)
+                            nsISupports* aData, bool aAnonymize) MOZ_OVERRIDE
   {
     return MOZ_COLLECT_REPORT(
       "explicit/gfx/heap-textures", KIND_HEAP, UNITS_BYTES, sAmount,
       "Heap memory shared between threads by texture clients and hosts.");
   }
 
 private:
   static mozilla::Atomic<size_t> sAmount;
--- a/gfx/layers/ipc/ImageBridgeChild.h
+++ b/gfx/layers/ipc/ImageBridgeChild.h
@@ -298,24 +298,24 @@ public:
                           mozilla::ipc::SharedMemory::SharedMemoryType aType,
                           mozilla::ipc::Shmem* aShmem) MOZ_OVERRIDE;
   /**
    * See ISurfaceAllocator.h
    * Can be used from any thread.
    * If used outside the ImageBridgeChild thread, it will proxy a synchronous
    * call on the ImageBridgeChild thread.
    */
-  virtual void DeallocShmem(mozilla::ipc::Shmem& aShmem);
+  virtual void DeallocShmem(mozilla::ipc::Shmem& aShmem) MOZ_OVERRIDE;
 
   virtual PTextureChild* CreateTexture(const SurfaceDescriptor& aSharedData,
                                        TextureFlags aFlags) MOZ_OVERRIDE;
 
   virtual bool IsSameProcess() const MOZ_OVERRIDE;
 
-  virtual void SendPendingAsyncMessges();
+  virtual void SendPendingAsyncMessges() MOZ_OVERRIDE;
 
   void MarkShutDown();
 protected:
   ImageBridgeChild();
   bool DispatchAllocShmemInternal(size_t aSize,
                                   SharedMemory::SharedMemoryType aType,
                                   Shmem* aShmem,
                                   bool aUnsafe);
--- a/gfx/layers/ipc/LayerTransactionParent.h
+++ b/gfx/layers/ipc/LayerTransactionParent.h
@@ -58,23 +58,23 @@ public:
   LayerManagerComposite* layer_manager() const { return mLayerManager; }
 
   uint64_t GetId() const { return mId; }
   Layer* GetRoot() const { return mRoot; }
 
   // ISurfaceAllocator
   virtual bool AllocShmem(size_t aSize,
                           ipc::SharedMemory::SharedMemoryType aType,
-                          ipc::Shmem* aShmem) {
+                          ipc::Shmem* aShmem) MOZ_OVERRIDE {
     return PLayerTransactionParent::AllocShmem(aSize, aType, aShmem);
   }
 
   virtual bool AllocUnsafeShmem(size_t aSize,
                                 ipc::SharedMemory::SharedMemoryType aType,
-                                ipc::Shmem* aShmem) {
+                                ipc::Shmem* aShmem) MOZ_OVERRIDE {
     return PLayerTransactionParent::AllocUnsafeShmem(aSize, aType, aShmem);
   }
 
   virtual void DeallocShmem(ipc::Shmem& aShmem) MOZ_OVERRIDE
   {
     PLayerTransactionParent::DeallocShmem(aShmem);
   }
 
--- a/gfx/layers/ipc/ShadowLayers.h
+++ b/gfx/layers/ipc/ShadowLayers.h
@@ -137,17 +137,17 @@ class ShadowLayerForwarder : public Comp
 
 public:
   virtual ~ShadowLayerForwarder();
 
   /**
    * Setup the IPDL actor for aCompositable to be part of layers
    * transactions.
    */
-  void Connect(CompositableClient* aCompositable);
+  void Connect(CompositableClient* aCompositable) MOZ_OVERRIDE;
 
   virtual PTextureChild* CreateTexture(const SurfaceDescriptor& aSharedData,
                                        TextureFlags aFlags) MOZ_OVERRIDE;
 
   virtual void CreatedIncrementalBuffer(CompositableClient* aCompositable,
                                         const TextureInfo& aTextureInfo,
                                         const nsIntRect& aBufferRect) MOZ_OVERRIDE;
 
@@ -264,17 +264,17 @@ public:
                                         const nsIntRegion& aUpdatedRegion,
                                         const nsIntRect& aBufferRect,
                                         const nsIntPoint& aBufferRotation) MOZ_OVERRIDE;
 
   /**
    * Communicate the picture rect of an image to the compositor
    */
   void UpdatePictureRect(CompositableClient* aCompositable,
-                         const nsIntRect& aRect);
+                         const nsIntRect& aRect) MOZ_OVERRIDE;
 
   /**
    * See CompositableForwarder::UpdatedTexture
    */
   virtual void UpdatedTexture(CompositableClient* aCompositable,
                               TextureClient* aTexture,
                               nsIntRegion* aRegion) MOZ_OVERRIDE;
 
@@ -314,17 +314,17 @@ public:
   void SetShadowManager(PLayerTransactionChild* aShadowManager);
 
   void StopReceiveAsyncParentMessge();
 
   void ClearCachedResources();
 
   void Composite();
 
-  virtual void SendPendingAsyncMessges();
+  virtual void SendPendingAsyncMessges() MOZ_OVERRIDE;
 
   /**
    * True if this is forwarding to a LayerManagerComposite.
    */
   bool HasShadowManager() const { return !!mShadowManager; }
   LayerTransactionChild* GetShadowManager() const { return mShadowManager.get(); }
 
   virtual void WindowOverlayChanged() { mWindowOverlayChanged = true; }
--- a/gfx/layers/ipc/SharedBufferManagerParent.h
+++ b/gfx/layers/ipc/SharedBufferManagerParent.h
@@ -50,18 +50,18 @@ public:
   SharedBufferManagerParent(Transport* aTransport, ProcessId aOwner, base::Thread* aThread);
   virtual ~SharedBufferManagerParent();
 
   /**
    * When the IPC channel down or something bad make this Manager die, clear all the buffer reference!
    */
   virtual void ActorDestroy(ActorDestroyReason aWhy) MOZ_OVERRIDE;
 
-  virtual bool RecvAllocateGrallocBuffer(const IntSize&, const uint32_t&, const uint32_t&, mozilla::layers::MaybeMagicGrallocBufferHandle*);
-  virtual bool RecvDropGrallocBuffer(const mozilla::layers::MaybeMagicGrallocBufferHandle& handle);
+  virtual bool RecvAllocateGrallocBuffer(const IntSize&, const uint32_t&, const uint32_t&, mozilla::layers::MaybeMagicGrallocBufferHandle*) MOZ_OVERRIDE;
+  virtual bool RecvDropGrallocBuffer(const mozilla::layers::MaybeMagicGrallocBufferHandle& handle) MOZ_OVERRIDE;
 
   /**
    * Break the buffer's sharing state, decrease buffer reference for both side
    */
   static void DropGrallocBuffer(ProcessId id, mozilla::layers::SurfaceDescriptor aDesc);
 
   // Overriden from IToplevelProtocol
   IToplevelProtocol*
--- a/gfx/layers/ipc/SharedRGBImage.h
+++ b/gfx/layers/ipc/SharedRGBImage.h
@@ -47,21 +47,21 @@ protected:
 
 public:
   virtual ISharedImage* AsSharedImage() MOZ_OVERRIDE { return this; }
 
   virtual TextureClient* GetTextureClient(CompositableClient* aClient) MOZ_OVERRIDE;
 
   virtual uint8_t* GetBuffer() MOZ_OVERRIDE;
 
-  gfx::IntSize GetSize();
+  gfx::IntSize GetSize() MOZ_OVERRIDE;
 
   size_t GetBufferSize();
 
-  TemporaryRef<gfx::SourceSurface> GetAsSourceSurface();
+  TemporaryRef<gfx::SourceSurface> GetAsSourceSurface() MOZ_OVERRIDE;
 
   bool Allocate(gfx::IntSize aSize, gfx::SurfaceFormat aFormat);
 private:
   gfx::IntSize mSize;
   RefPtr<ImageClient> mCompositable;
   RefPtr<BufferTextureClient> mTextureClient;
 };
 
--- a/gfx/layers/opengl/CompositingRenderTargetOGL.h
+++ b/gfx/layers/opengl/CompositingRenderTargetOGL.h
@@ -141,17 +141,17 @@ public:
   gfx::SurfaceFormat GetFormat() const MOZ_OVERRIDE
   {
     // XXX - Should it be implemented ? is the above assert true ?
     MOZ_ASSERT(false, "Not implemented");
     return gfx::SurfaceFormat::UNKNOWN;
   }
 
 #ifdef MOZ_DUMP_PAINTING
-  virtual TemporaryRef<gfx::DataSourceSurface> Dump(Compositor* aCompositor);
+  virtual TemporaryRef<gfx::DataSourceSurface> Dump(Compositor* aCompositor) MOZ_OVERRIDE;
 #endif
 
   const gfx::IntSize& GetInitSize() const {
     return mInitParams.mSize;
   }
 
 private:
   /**
--- a/gfx/layers/opengl/MacIOSurfaceTextureClientOGL.h
+++ b/gfx/layers/opengl/MacIOSurfaceTextureClientOGL.h
@@ -28,17 +28,17 @@ public:
   virtual void Unlock() MOZ_OVERRIDE;
 
   virtual bool IsLocked() const MOZ_OVERRIDE;
 
   virtual bool IsAllocated() const MOZ_OVERRIDE { return !!mSurface; }
 
   virtual bool ToSurfaceDescriptor(SurfaceDescriptor& aOutDescriptor) MOZ_OVERRIDE;
 
-  virtual gfx::IntSize GetSize() const;
+  virtual gfx::IntSize GetSize() const MOZ_OVERRIDE;
 
   virtual bool HasInternalBuffer() const MOZ_OVERRIDE { return false; }
 
   virtual TemporaryRef<gfx::DataSourceSurface> GetAsSurface() MOZ_OVERRIDE;
 
   // This TextureClient should not be used in a context where we use CreateSimilar
   // (ex. component alpha) because the underlying texture data is always created by
   // an external producer.
--- a/gfx/layers/opengl/MacIOSurfaceTextureHostOGL.h
+++ b/gfx/layers/opengl/MacIOSurfaceTextureHostOGL.h
@@ -23,32 +23,32 @@ namespace layers {
 class MacIOSurfaceTextureSourceOGL : public TextureSource
                                    , public TextureSourceOGL
 {
 public:
   MacIOSurfaceTextureSourceOGL(CompositorOGL* aCompositor,
                                MacIOSurface* aSurface);
   virtual ~MacIOSurfaceTextureSourceOGL();
 
-  virtual TextureSourceOGL* AsSourceOGL() { return this; }
+  virtual TextureSourceOGL* AsSourceOGL() MOZ_OVERRIDE { return this; }
 
   virtual void BindTexture(GLenum activetex, gfx::Filter aFilter) MOZ_OVERRIDE;
 
   virtual bool IsValid() const MOZ_OVERRIDE { return !!gl(); }
 
   virtual gfx::IntSize GetSize() const MOZ_OVERRIDE;
 
   virtual gfx::SurfaceFormat GetFormat() const MOZ_OVERRIDE;
 
-  virtual GLenum GetTextureTarget() const { return LOCAL_GL_TEXTURE_RECTANGLE_ARB; }
+  virtual GLenum GetTextureTarget() const MOZ_OVERRIDE { return LOCAL_GL_TEXTURE_RECTANGLE_ARB; }
 
   virtual GLenum GetWrapMode() const MOZ_OVERRIDE { return LOCAL_GL_CLAMP_TO_EDGE; }
 
   // MacIOSurfaceTextureSourceOGL doesn't own any gl texture
-  virtual void DeallocateDeviceData() {}
+  virtual void DeallocateDeviceData() MOZ_OVERRIDE {}
 
   virtual void SetCompositor(Compositor* aCompositor) MOZ_OVERRIDE;
 
   gl::GLContext* gl() const;
 
 protected:
   RefPtr<CompositorOGL> mCompositor;
   RefPtr<MacIOSurface> mSurface;
@@ -84,17 +84,17 @@ public:
     return nullptr; // XXX - implement this (for MOZ_DUMP_PAINTING)
   }
 
   gl::GLContext* gl() const;
 
   virtual gfx::IntSize GetSize() const MOZ_OVERRIDE;
 
 #ifdef MOZ_LAYERS_HAVE_LOG
-  virtual const char* Name() { return "MacIOSurfaceTextureHostOGL"; }
+  virtual const char* Name() MOZ_OVERRIDE { return "MacIOSurfaceTextureHostOGL"; }
 #endif
 
 protected:
   RefPtr<CompositorOGL> mCompositor;
   RefPtr<MacIOSurfaceTextureSourceOGL> mTextureSource;
   RefPtr<MacIOSurface> mSurface;
 };
 
--- a/gfx/layers/opengl/TextureClientOGL.h
+++ b/gfx/layers/opengl/TextureClientOGL.h
@@ -29,17 +29,17 @@ public:
                         TextureFlags aFlags,
                         EGLImageImage* aImage,
                         gfx::IntSize aSize);
 
   virtual bool IsAllocated() const MOZ_OVERRIDE { return true; }
 
   virtual bool HasInternalBuffer() const MOZ_OVERRIDE { return false; }
 
-  virtual gfx::IntSize GetSize() const { return mSize; }
+  virtual gfx::IntSize GetSize() const MOZ_OVERRIDE { return mSize; }
 
   virtual bool ToSurfaceDescriptor(SurfaceDescriptor& aOutDescriptor) MOZ_OVERRIDE;
 
   // Useless functions.
   virtual bool Lock(OpenMode mode) MOZ_OVERRIDE;
 
   virtual void Unlock() MOZ_OVERRIDE;
 
--- a/gfx/layers/opengl/TextureHostOGL.h
+++ b/gfx/layers/opengl/TextureHostOGL.h
@@ -204,17 +204,17 @@ public:
 
   void EnsureBuffer(const nsIntSize& aSize,
                             gfxContentType aContentType);
 
   void CopyTo(const nsIntRect& aSourceRect,
                       DataTextureSource* aDest,
                       const nsIntRect& aDestRect);
 
-  virtual TextureImageTextureSourceOGL* AsTextureImageTextureSource() { return this; }
+  virtual TextureImageTextureSourceOGL* AsTextureImageTextureSource() MOZ_OVERRIDE { return this; }
 
   // TextureSource
 
   virtual void DeallocateDeviceData() MOZ_OVERRIDE
   {
     mTexImage = nullptr;
     SetUpdateSerial(0);
   }
@@ -298,17 +298,17 @@ public:
   virtual void BindTexture(GLenum activetex, gfx::Filter aFilter) MOZ_OVERRIDE;
 
   virtual bool IsValid() const MOZ_OVERRIDE;
 
   virtual gfx::IntSize GetSize() const MOZ_OVERRIDE { return mSize; }
 
   virtual gfx::SurfaceFormat GetFormat() const MOZ_OVERRIDE { return mFormat; }
 
-  virtual GLenum GetTextureTarget() const { return mTextureTarget; }
+  virtual GLenum GetTextureTarget() const MOZ_OVERRIDE { return mTextureTarget; }
 
   virtual GLenum GetWrapMode() const MOZ_OVERRIDE { return LOCAL_GL_CLAMP_TO_EDGE; }
 
   virtual void DeallocateDeviceData() MOZ_OVERRIDE;
 
   virtual void SetCompositor(Compositor* aCompositor) MOZ_OVERRIDE;
 
   void SetSize(gfx::IntSize aSize) { mSize = aSize; }
@@ -434,29 +434,29 @@ class EGLImageTextureSource : public Tex
 public:
   EGLImageTextureSource(CompositorOGL* aCompositor,
                         EGLImage aImage,
                         gfx::SurfaceFormat aFormat,
                         GLenum aTarget,
                         GLenum aWrapMode,
                         gfx::IntSize aSize);
 
-  virtual TextureSourceOGL* AsSourceOGL() { return this; }
+  virtual TextureSourceOGL* AsSourceOGL() MOZ_OVERRIDE { return this; }
 
   virtual void BindTexture(GLenum activetex, gfx::Filter aFilter) MOZ_OVERRIDE;
 
   virtual bool IsValid() const MOZ_OVERRIDE;
 
   virtual gfx::IntSize GetSize() const MOZ_OVERRIDE { return mSize; }
 
   virtual gfx::SurfaceFormat GetFormat() const MOZ_OVERRIDE { return mFormat; }
 
   virtual gfx::Matrix4x4 GetTextureTransform() MOZ_OVERRIDE;
 
-  virtual GLenum GetTextureTarget() const { return mTextureTarget; }
+  virtual GLenum GetTextureTarget() const MOZ_OVERRIDE { return mTextureTarget; }
 
   virtual GLenum GetWrapMode() const MOZ_OVERRIDE { return mWrapMode; }
 
   // We don't own anything.
   virtual void DeallocateDeviceData() MOZ_OVERRIDE {}
 
   virtual void SetCompositor(Compositor* aCompositor) MOZ_OVERRIDE;
 
@@ -501,17 +501,17 @@ public:
   {
     return nullptr; // XXX - implement this (for MOZ_DUMP_PAINTING)
   }
 
   gl::GLContext* gl() const;
 
   virtual gfx::IntSize GetSize() const MOZ_OVERRIDE { return mSize; }
 
-  virtual const char* Name() { return "EGLImageTextureHost"; }
+  virtual const char* Name() MOZ_OVERRIDE { return "EGLImageTextureHost"; }
 
 protected:
   const EGLImage mImage;
   const EGLSync mSync;
   const gfx::IntSize mSize;
   RefPtr<CompositorOGL> mCompositor;
   RefPtr<EGLImageTextureSource> mTextureSource;
 };
--- a/gfx/thebes/gfxPlatform.cpp
+++ b/gfx/thebes/gfxPlatform.cpp
@@ -661,26 +661,29 @@ gfxPlatform::InitLayersIPC()
 /* static */ void
 gfxPlatform::ShutdownLayersIPC()
 {
     if (!sLayersIPCIsUp) {
       return;
     }
     sLayersIPCIsUp = false;
 
-    if (XRE_GetProcessType() == GeckoProcessType_Default)
-    {
+    GeckoProcessType processType = XRE_GetProcessType();
+    if (processType == GeckoProcessType_Default) {
         // This must happen after the shutdown of media and widgets, which
         // are triggered by the NS_XPCOM_SHUTDOWN_OBSERVER_ID notification.
         layers::ImageBridgeChild::ShutDown();
+
 #ifdef MOZ_WIDGET_GONK
         layers::SharedBufferManagerChild::ShutDown();
 #endif
 
         layers::CompositorParent::ShutDown();
+    } else if (processType == GeckoProcessType_Content) {
+        layers::CompositorChild::ShutDown();
     }
 }
 
 gfxPlatform::~gfxPlatform()
 {
     mScreenReferenceSurface = nullptr;
     mScreenReferenceDrawTarget = nullptr;
 
--- a/image/decoders/nsBMPDecoder.h
+++ b/image/decoders/nsBMPDecoder.h
@@ -47,17 +47,17 @@ public:
     int32_t GetCompressedImageSize() const;
 
     // Obtains whether or not a BMP file had alpha data in its 4th byte
     // for 32BPP bitmaps.  Only use after the bitmap has been processed.
     bool HasAlphaData() const;
 
     virtual void WriteInternal(const char* aBuffer, uint32_t aCount,
                                DecodeStrategy aStrategy) MOZ_OVERRIDE;
-    virtual void FinishInternal();
+    virtual void FinishInternal() MOZ_OVERRIDE;
 
 private:
 
     /// Calculates the red-, green- and blueshift in mBitFields using
     /// the bitmasks from mBitFields
     NS_METHOD CalcBitShift();
 
     uint32_t mPos; //< Number of bytes read from aBuffer in WriteInternal()
--- a/image/decoders/nsGIFDecoder2.h
+++ b/image/decoders/nsGIFDecoder2.h
@@ -23,18 +23,18 @@ class nsGIFDecoder2 : public Decoder
 {
 public:
 
   explicit nsGIFDecoder2(RasterImage& aImage);
   ~nsGIFDecoder2();
 
   virtual void WriteInternal(const char* aBuffer, uint32_t aCount,
                              DecodeStrategy aStrategy) MOZ_OVERRIDE;
-  virtual void FinishInternal();
-  virtual Telemetry::ID SpeedHistogram();
+  virtual void FinishInternal() MOZ_OVERRIDE;
+  virtual Telemetry::ID SpeedHistogram() MOZ_OVERRIDE;
 
 private:
   // These functions will be called when the decoder has a decoded row,
   // frame size information, etc.
 
   void      BeginGIF();
   void      BeginImageFrame(uint16_t aDepth);
   void      EndImageFrame();
--- a/image/decoders/nsICODecoder.h
+++ b/image/decoders/nsICODecoder.h
@@ -35,19 +35,19 @@ public:
   // Obtains the height of the icon directory entry
   uint32_t GetRealHeight() const
   {
     return mDirEntry.mHeight == 0 ? 256 : mDirEntry.mHeight;
   }
 
   virtual void WriteInternal(const char* aBuffer, uint32_t aCount,
                              DecodeStrategy aStrategy) MOZ_OVERRIDE;
-  virtual void FinishInternal();
-  virtual bool NeedsNewFrame() const;
-  virtual nsresult AllocateFrame();
+  virtual void FinishInternal() MOZ_OVERRIDE;
+  virtual bool NeedsNewFrame() const MOZ_OVERRIDE;
+  virtual nsresult AllocateFrame() MOZ_OVERRIDE;
 
 private:
   // Writes to the contained decoder and sets the appropriate errors
   // Returns true if there are no errors.
   bool WriteToContainedDecoder(const char* aBuffer, uint32_t aCount,
                                DecodeStrategy aStrategy);
 
   // Processes a single dir entry of the icon resource
--- a/image/decoders/nsJPEGDecoder.h
+++ b/image/decoders/nsJPEGDecoder.h
@@ -50,22 +50,22 @@ class RasterImage;
 struct Orientation;
 
 class nsJPEGDecoder : public Decoder
 {
 public:
   nsJPEGDecoder(RasterImage& aImage, Decoder::DecodeStyle aDecodeStyle);
   virtual ~nsJPEGDecoder();
 
-  virtual void InitInternal();
+  virtual void InitInternal() MOZ_OVERRIDE;
   virtual void WriteInternal(const char* aBuffer, uint32_t aCount,
                              DecodeStrategy aStrategy) MOZ_OVERRIDE;
-  virtual void FinishInternal();
+  virtual void FinishInternal() MOZ_OVERRIDE;
 
-  virtual Telemetry::ID SpeedHistogram();
+  virtual Telemetry::ID SpeedHistogram() MOZ_OVERRIDE;
   void NotifyDone();
 
 protected:
   Orientation ReadOrientationFromEXIF();
   void OutputScanlines(bool* suspend);
 
 public:
   struct jpeg_decompress_struct mInfo;
--- a/image/decoders/nsPNGDecoder.h
+++ b/image/decoders/nsPNGDecoder.h
@@ -22,20 +22,20 @@ namespace image {
 class RasterImage;
 
 class nsPNGDecoder : public Decoder
 {
 public:
   explicit nsPNGDecoder(RasterImage& aImage);
   virtual ~nsPNGDecoder();
 
-  virtual void InitInternal();
+  virtual void InitInternal() MOZ_OVERRIDE;
   virtual void WriteInternal(const char* aBuffer, uint32_t aCount,
                              DecodeStrategy aStrategy) MOZ_OVERRIDE;
-  virtual Telemetry::ID SpeedHistogram();
+  virtual Telemetry::ID SpeedHistogram() MOZ_OVERRIDE;
 
   void CreateFrame(png_uint_32 x_offset, png_uint_32 y_offset,
                    int32_t width, int32_t height,
                    gfx::SurfaceFormat format);
   void EndImageFrame();
 
   // Check if PNG is valid ICO (32bpp RGBA)
   // http://blogs.msdn.com/b/oldnewthing/archive/2010/10/22/10079192.aspx
--- a/image/src/RasterImage.h
+++ b/image/src/RasterImage.h
@@ -148,37 +148,37 @@ public:
   MOZ_DECLARE_REFCOUNTED_TYPENAME(RasterImage)
   NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIPROPERTIES
   NS_DECL_IMGICONTAINER
 #ifdef DEBUG
   NS_DECL_IMGICONTAINERDEBUG
 #endif
 
-  virtual nsresult StartAnimation();
-  virtual nsresult StopAnimation();
+  virtual nsresult StartAnimation() MOZ_OVERRIDE;
+  virtual nsresult StopAnimation() MOZ_OVERRIDE;
 
   // Methods inherited from Image
   nsresult Init(const char* aMimeType,
-                uint32_t aFlags);
+                uint32_t aFlags) MOZ_OVERRIDE;
   virtual nsIntRect FrameRect(uint32_t aWhichFrame) MOZ_OVERRIDE;
   virtual void OnSurfaceDiscarded() MOZ_OVERRIDE;
 
   // Raster-specific methods
   static NS_METHOD WriteToRasterImage(nsIInputStream* aIn, void* aClosure,
                                       const char* aFromRawSegment,
                                       uint32_t aToOffset, uint32_t aCount,
                                       uint32_t* aWriteCount);
 
   /* The total number of frames in this image. */
   uint32_t GetNumFrames() const;
 
-  virtual size_t SizeOfSourceWithComputedFallback(MallocSizeOf aMallocSizeOf) const;
+  virtual size_t SizeOfSourceWithComputedFallback(MallocSizeOf aMallocSizeOf) const MOZ_OVERRIDE;
   virtual size_t SizeOfDecoded(gfxMemoryLocation aLocation,
-                               MallocSizeOf aMallocSizeOf) const;
+                               MallocSizeOf aMallocSizeOf) const MOZ_OVERRIDE;
 
   /* Triggers discarding. */
   void Discard();
 
   /* Callbacks for decoders */
   /** Sets the size and inherent orientation of the container. This should only
    * be called by the decoder. This function may be called multiple times, but
    * will throw an error if subsequent calls do not match the first.
@@ -492,17 +492,17 @@ private: // data
   // Helpers
   bool CanDiscard();
   bool StoringSourceData() const;
 
 protected:
   explicit RasterImage(ProgressTracker* aProgressTracker = nullptr,
                        ImageURL* aURI = nullptr);
 
-  bool ShouldAnimate();
+  bool ShouldAnimate() MOZ_OVERRIDE;
 
   friend class ImageFactory;
 };
 
 inline NS_IMETHODIMP RasterImage::GetAnimationMode(uint16_t *aAnimationMode) {
   return GetAnimationModeInternal(aAnimationMode);
 }
 
--- a/image/src/ShutdownTracker.cpp
+++ b/image/src/ShutdownTracker.cpp
@@ -26,17 +26,17 @@ static bool sShutdownHasStarted = false;
 ///////////////////////////////////////////////////////////////////////////////
 // Implementation
 ///////////////////////////////////////////////////////////////////////////////
 
 struct ShutdownObserver : public nsIObserver
 {
   NS_DECL_ISUPPORTS
 
-  NS_IMETHOD Observe(nsISupports*, const char* aTopic, const char16_t*)
+  NS_IMETHOD Observe(nsISupports*, const char* aTopic, const char16_t*) MOZ_OVERRIDE
   {
     if (strcmp(aTopic, "xpcom-shutdown") != 0) {
       return NS_OK;
     }
 
     nsCOMPtr<nsIObserverService> os = services::GetObserverService();
     if (os) {
       os->RemoveObserver(this, "xpcom-shutdown");
--- a/image/src/VectorImage.h
+++ b/image/src/VectorImage.h
@@ -34,17 +34,17 @@ public:
   NS_DECL_NSIREQUESTOBSERVER
   NS_DECL_NSISTREAMLISTENER
   NS_DECL_IMGICONTAINER
 
   // (no public constructor - use ImageFactory)
 
   // Methods inherited from Image
   nsresult Init(const char* aMimeType,
-                uint32_t aFlags);
+                uint32_t aFlags) MOZ_OVERRIDE;
   virtual nsIntRect FrameRect(uint32_t aWhichFrame) MOZ_OVERRIDE;
 
   virtual size_t SizeOfSourceWithComputedFallback(MallocSizeOf aMallocSizeOf) const MOZ_OVERRIDE;
   virtual size_t SizeOfDecoded(gfxMemoryLocation aLocation,
                                MallocSizeOf aMallocSizeOf) const MOZ_OVERRIDE;
 
   virtual nsresult OnImageDataAvailable(nsIRequest* aRequest,
                                         nsISupports* aContext,
@@ -74,19 +74,19 @@ public:
   void OnSVGDocumentLoaded();
   void OnSVGDocumentError();
 
 protected:
   explicit VectorImage(ProgressTracker* aProgressTracker = nullptr,
                        ImageURL* aURI = nullptr);
   virtual ~VectorImage();
 
-  virtual nsresult StartAnimation();
-  virtual nsresult StopAnimation();
-  virtual bool     ShouldAnimate();
+  virtual nsresult StartAnimation() MOZ_OVERRIDE;
+  virtual nsresult StopAnimation() MOZ_OVERRIDE;
+  virtual bool     ShouldAnimate() MOZ_OVERRIDE;
 
   void CreateSurfaceAndShow(const SVGDrawingParameters& aParams);
   void Show(gfxDrawable* aDrawable, const SVGDrawingParameters& aParams);
 
 private:
   void CancelAllListeners();
   void SendInvalidationNotifications();
 
--- a/image/src/imgLoader.cpp
+++ b/image/src/imgLoader.cpp
@@ -54,17 +54,17 @@ MOZ_DEFINE_MALLOC_SIZE_OF(ImagesMallocSi
 class imgMemoryReporter MOZ_FINAL : public nsIMemoryReporter
 {
   ~imgMemoryReporter() { }
 
 public:
   NS_DECL_ISUPPORTS
 
   NS_IMETHOD CollectReports(nsIHandleReportCallback* aHandleReport,
-                            nsISupports* aData, bool aAnonymize)
+                            nsISupports* aData, bool aAnonymize) MOZ_OVERRIDE
   {
     nsresult rv;
     nsTArray<ImageMemoryCounter> chrome;
     nsTArray<ImageMemoryCounter> content;
     nsTArray<ImageMemoryCounter> uncached;
 
     for (uint32_t i = 0; i < mKnownLoaders.Length(); i++) {
       mKnownLoaders[i]->mChromeCache.EnumerateRead(DoRecordCounter, &chrome);
--- a/ipc/glue/SharedMemory.cpp
+++ b/ipc/glue/SharedMemory.cpp
@@ -21,17 +21,17 @@ class ShmemReporter MOZ_FINAL : public n
 {
   ~ShmemReporter() {}
 
 public:
   NS_DECL_THREADSAFE_ISUPPORTS
 
   NS_IMETHOD
   CollectReports(nsIHandleReportCallback* aHandleReport, nsISupports* aData,
-                 bool aAnonymize)
+                 bool aAnonymize) MOZ_OVERRIDE
   {
     nsresult rv;
     rv = MOZ_COLLECT_REPORT(
       "shmem-allocated", KIND_OTHER, UNITS_BYTES, gShmemAllocated,
       "Memory shared with other processes that is accessible (but not "
       "necessarily mapped).");
     NS_ENSURE_SUCCESS(rv, rv);
 
--- a/ipc/testshell/TestShellParent.h
+++ b/ipc/testshell/TestShellParent.h
@@ -22,20 +22,20 @@ namespace ipc {
 class TestShellCommandParent;
 
 class TestShellParent : public PTestShellParent
 {
 public:
   virtual void ActorDestroy(ActorDestroyReason aWhy) MOZ_OVERRIDE;
 
   PTestShellCommandParent*
-  AllocPTestShellCommandParent(const nsString& aCommand);
+  AllocPTestShellCommandParent(const nsString& aCommand) MOZ_OVERRIDE;
 
   bool
-  DeallocPTestShellCommandParent(PTestShellCommandParent* aActor);
+  DeallocPTestShellCommandParent(PTestShellCommandParent* aActor) MOZ_OVERRIDE;
 
   bool
   CommandDone(TestShellCommandParent* aActor, const nsString& aResponse);
 };
 
 
 class TestShellCommandParent : public PTestShellCommandParent
 {
--- a/js/ipc/JavaScriptLogging.h
+++ b/js/ipc/JavaScriptLogging.h
@@ -114,20 +114,19 @@ class Logging
             side = shared->isParent() ? "parent" : "child";
             ptr = js::UncheckedUnwrap(obj, true);
         } else {
             objDesc = "<cpow>";
             side = shared->isParent() ? "child" : "parent";
             ptr = nullptr;
         }
 
-        out = nsPrintfCString("<%s %s:%d:%p>", side, objDesc, id, ptr);
+        out = nsPrintfCString("<%s %s:%d:%p>", side, objDesc, id.serialNumber(), ptr);
     }
 
-
     void format(const ReceiverObj &obj, nsCString &out) {
         formatObject(true, true, obj.id, out);
     }
 
     void format(const nsTArray<JSParam> &values, nsCString &out) {
         nsAutoCString tmp;
         out.Truncate();
         for (size_t i = 0; i < values.Length(); i++) {
--- a/js/src/asmjs/AsmJSFrameIterator.cpp
+++ b/js/src/asmjs/AsmJSFrameIterator.cpp
@@ -108,44 +108,44 @@ AsmJSFrameIterator::computeLine(uint32_t
 // Prologue/epilogue code generation
 
 // These constants reflect statically-determined offsets in the profiling
 // prologue/epilogue. The offsets are dynamically asserted during code
 // generation.
 #if defined(JS_CODEGEN_X64)
 # if defined(DEBUG)
 static const unsigned PushedRetAddr = 0;
+static const unsigned PostStorePrePopFP = 0;
 # endif
 static const unsigned PushedFP = 10;
 static const unsigned StoredFP = 14;
-static const unsigned PostStorePrePopFP = 0;
 #elif defined(JS_CODEGEN_X86)
 # if defined(DEBUG)
 static const unsigned PushedRetAddr = 0;
+static const unsigned PostStorePrePopFP = 0;
 # endif
 static const unsigned PushedFP = 8;
 static const unsigned StoredFP = 11;
-static const unsigned PostStorePrePopFP = 0;
 #elif defined(JS_CODEGEN_ARM)
 static const unsigned PushedRetAddr = 4;
 static const unsigned PushedFP = 16;
 static const unsigned StoredFP = 20;
 static const unsigned PostStorePrePopFP = 4;
 #elif defined(JS_CODEGEN_MIPS)
 static const unsigned PushedRetAddr = 8;
 static const unsigned PushedFP = 24;
 static const unsigned StoredFP = 28;
 static const unsigned PostStorePrePopFP = 4;
 #elif defined(JS_CODEGEN_NONE)
 # if defined(DEBUG)
 static const unsigned PushedRetAddr = 0;
+static const unsigned PostStorePrePopFP = 0;
 # endif
 static const unsigned PushedFP = 1;
 static const unsigned StoredFP = 1;
-static const unsigned PostStorePrePopFP = 0;
 #else
 # error "Unknown architecture!"
 #endif
 
 static void
 PushRetAddr(MacroAssembler &masm)
 {
 #if defined(JS_CODEGEN_ARM)
--- a/js/src/builtin/Array.js
+++ b/js/src/builtin/Array.js
@@ -651,19 +651,20 @@ function ArrayIteratorIdentity() {
 }
 
 function ArrayIteratorNext() {
     if (!IsObject(this) || !IsArrayIterator(this)) {
         return callFunction(CallArrayIteratorMethodIfWrapped, this,
                             "ArrayIteratorNext");
     }
 
-    var a = UnsafeGetReservedSlot(this, ARRAY_ITERATOR_SLOT_ITERATED_OBJECT);
+    var a = UnsafeGetObjectFromReservedSlot(this, ARRAY_ITERATOR_SLOT_ITERATED_OBJECT);
+    // The index might not be an integer, so we have to do a generic get here.
     var index = UnsafeGetReservedSlot(this, ARRAY_ITERATOR_SLOT_NEXT_INDEX);
-    var itemKind = UnsafeGetReservedSlot(this, ARRAY_ITERATOR_SLOT_ITEM_KIND);
+    var itemKind = UnsafeGetInt32FromReservedSlot(this, ARRAY_ITERATOR_SLOT_ITEM_KIND);
     var result = { value: undefined, done: false };
 
     // FIXME: This should be ToLength, which clamps at 2**53.  Bug 924058.
     if (index >= TO_UINT32(a.length)) {
         // When the above is changed to ToLength, use +1/0 here instead
         // of MAX_UINT32.
         UnsafeSetReservedSlot(this, ARRAY_ITERATOR_SLOT_NEXT_INDEX, 0xffffffff);
         result.done = true;
--- a/js/src/builtin/String.js
+++ b/js/src/builtin/String.js
@@ -184,41 +184,44 @@ function String_repeat(count) {
         if (n)
             S += S;
         else
             break;
     }
     return T;
 }
 
-#define STRING_ITERATOR_SLOT_ITERATED_OBJECT 0
+#define STRING_ITERATOR_SLOT_ITERATED_STRING 0
 #define STRING_ITERATOR_SLOT_NEXT_INDEX 1
 
 // ES6 draft specification, section 21.1.3.27, version 2013-09-27.
 function String_iterator() {
     CheckObjectCoercible(this);
     var S = ToString(this);
     var iterator = NewStringIterator();
-    UnsafeSetReservedSlot(iterator, STRING_ITERATOR_SLOT_ITERATED_OBJECT, S);
+    UnsafeSetReservedSlot(iterator, STRING_ITERATOR_SLOT_ITERATED_STRING, S);
     UnsafeSetReservedSlot(iterator, STRING_ITERATOR_SLOT_NEXT_INDEX, 0);
     return iterator;
 }
 
 function StringIteratorIdentity() {
     return this;
 }
 
 function StringIteratorNext() {
     if (!IsObject(this) || !IsStringIterator(this)) {
         return callFunction(CallStringIteratorMethodIfWrapped, this,
                             "StringIteratorNext");
     }
 
-    var S = UnsafeGetReservedSlot(this, STRING_ITERATOR_SLOT_ITERATED_OBJECT);
-    var index = UnsafeGetReservedSlot(this, STRING_ITERATOR_SLOT_NEXT_INDEX);
+    var S = UnsafeGetStringFromReservedSlot(this, STRING_ITERATOR_SLOT_ITERATED_STRING);
+    // We know that JSString::MAX_LENGTH <= INT32_MAX (and assert this in
+    // SelfHostring.cpp) so our current index can never be anything other than
+    // an Int32Value.
+    var index = UnsafeGetInt32FromReservedSlot(this, STRING_ITERATOR_SLOT_NEXT_INDEX);
     var size = S.length;
     var result = { value: undefined, done: false };
 
     if (index >= size) {
         result.done = true;
         return result;
     }
 
--- a/js/src/builtin/TypedObject.js
+++ b/js/src/builtin/TypedObject.js
@@ -1,37 +1,37 @@
 #include "TypedObjectConstants.h"
 
 ///////////////////////////////////////////////////////////////////////////
 // Getters and setters for various slots.
 
 // Type object slots
 
 #define DESCR_KIND(obj) \
-    UnsafeGetReservedSlot(obj, JS_DESCR_SLOT_KIND)
+    UnsafeGetInt32FromReservedSlot(obj, JS_DESCR_SLOT_KIND)
 #define DESCR_STRING_REPR(obj) \
-    UnsafeGetReservedSlot(obj, JS_DESCR_SLOT_STRING_REPR)
+    UnsafeGetStringFromReservedSlot(obj, JS_DESCR_SLOT_STRING_REPR)
 #define DESCR_ALIGNMENT(obj) \
-    UnsafeGetReservedSlot(obj, JS_DESCR_SLOT_ALIGNMENT)
+    UnsafeGetInt32FromReservedSlot(obj, JS_DESCR_SLOT_ALIGNMENT)
 #define DESCR_SIZE(obj) \
-    UnsafeGetReservedSlot(obj, JS_DESCR_SLOT_SIZE)
+    UnsafeGetInt32FromReservedSlot(obj, JS_DESCR_SLOT_SIZE)
 #define DESCR_OPAQUE(obj) \
-    UnsafeGetReservedSlot(obj, JS_DESCR_SLOT_OPAQUE)
+    UnsafeGetBooleanFromReservedSlot(obj, JS_DESCR_SLOT_OPAQUE)
 #define DESCR_TYPE(obj)   \
-    UnsafeGetReservedSlot(obj, JS_DESCR_SLOT_TYPE)
+    UnsafeGetInt32FromReservedSlot(obj, JS_DESCR_SLOT_TYPE)
 #define DESCR_ARRAY_ELEMENT_TYPE(obj) \
-    UnsafeGetReservedSlot(obj, JS_DESCR_SLOT_ARRAY_ELEM_TYPE)
+    UnsafeGetObjectFromReservedSlot(obj, JS_DESCR_SLOT_ARRAY_ELEM_TYPE)
 #define DESCR_ARRAY_LENGTH(obj) \
-    TO_INT32(UnsafeGetReservedSlot(obj, JS_DESCR_SLOT_ARRAY_LENGTH))
+    TO_INT32(UnsafeGetInt32FromReservedSlot(obj, JS_DESCR_SLOT_ARRAY_LENGTH))
 #define DESCR_STRUCT_FIELD_NAMES(obj) \
-    UnsafeGetReservedSlot(obj, JS_DESCR_SLOT_STRUCT_FIELD_NAMES)
+    UnsafeGetObjectFromReservedSlot(obj, JS_DESCR_SLOT_STRUCT_FIELD_NAMES)
 #define DESCR_STRUCT_FIELD_TYPES(obj) \
-    UnsafeGetReservedSlot(obj, JS_DESCR_SLOT_STRUCT_FIELD_TYPES)
+    UnsafeGetObjectFromReservedSlot(obj, JS_DESCR_SLOT_STRUCT_FIELD_TYPES)
 #define DESCR_STRUCT_FIELD_OFFSETS(obj) \
-    UnsafeGetReservedSlot(obj, JS_DESCR_SLOT_STRUCT_FIELD_OFFSETS)
+    UnsafeGetObjectFromReservedSlot(obj, JS_DESCR_SLOT_STRUCT_FIELD_OFFSETS)
 
 // Other
 
 #define HAS_PROPERTY(obj, prop) \
     callFunction(std_Object_hasOwnProperty, obj, prop)
 
 ///////////////////////////////////////////////////////////////////////////
 // Getting values
--- a/js/src/gc/GCInternals.h
+++ b/js/src/gc/GCInternals.h
@@ -113,20 +113,32 @@ class AutoStopVerifyingBarriers
     {
         restartPreVerifier = gc->endVerifyPreBarriers() && !isShutdown;
         restartPostVerifier = gc->endVerifyPostBarriers() && !isShutdown &&
             JS::IsGenerationalGCEnabled(rt);
         MOZ_GUARD_OBJECT_NOTIFIER_INIT;
     }
 
     ~AutoStopVerifyingBarriers() {
+        // Nasty special case: verification runs a minor GC, which *may* nest
+        // inside of an outer minor GC. This is not allowed by the
+        // gc::Statistics phase tree. So we pause the "real" GC, if in fact one
+        // is in progress.
+        gcstats::Phase outer = gc->stats.currentPhase();
+        if (outer != gcstats::PHASE_NONE)
+            gc->stats.endPhase(outer);
+        MOZ_ASSERT(gc->stats.currentPhase() == gcstats::PHASE_NONE);
+
         if (restartPreVerifier)
             gc->startVerifyPreBarriers();
         if (restartPostVerifier)
             gc->startVerifyPostBarriers();
+
+        if (outer != gcstats::PHASE_NONE)
+            gc->stats.beginPhase(outer);
     }
 };
 #else
 struct AutoStopVerifyingBarriers
 {
     AutoStopVerifyingBarriers(JSRuntime *, bool) {}
 };
 #endif /* JS_GC_ZEAL */
--- a/js/src/gc/GCRuntime.h
+++ b/js/src/gc/GCRuntime.h
@@ -310,19 +310,25 @@ class GCRuntime
     void incFJMinorCollecting() { fjCollectionCounter++; }
     void decFJMinorCollecting() { fjCollectionCounter--; }
 
     bool triggerGC(JS::gcreason::Reason reason);
     void maybeAllocTriggerZoneGC(Zone *zone, const AutoLockGC &lock);
     bool triggerZoneGC(Zone *zone, JS::gcreason::Reason reason);
     bool maybeGC(Zone *zone);
     void maybePeriodicFullGC();
-    void minorGC(JS::gcreason::Reason reason);
+    void minorGC(JS::gcreason::Reason reason) {
+        gcstats::AutoPhase ap(stats, gcstats::PHASE_MINOR_GC);
+        minorGCImpl(reason, nullptr);
+    }
     void minorGC(JSContext *cx, JS::gcreason::Reason reason);
-    void evictNursery(JS::gcreason::Reason reason = JS::gcreason::EVICT_NURSERY) { minorGC(reason); }
+    void evictNursery(JS::gcreason::Reason reason = JS::gcreason::EVICT_NURSERY) {
+        gcstats::AutoPhase ap(stats, gcstats::PHASE_EVICT_NURSERY);
+        minorGCImpl(reason, nullptr);
+    }
     bool gcIfNeeded(JSContext *cx = nullptr);
     void gc(JSGCInvocationKind gckind, JS::gcreason::Reason reason);
     void gcSlice(JSGCInvocationKind gckind, JS::gcreason::Reason reason, int64_t millis = 0);
     void gcFinalSlice(JSGCInvocationKind gckind, JS::gcreason::Reason reason);
     void gcDebugSlice(SliceBudget &budget);
 
     void runDebugGC();
     inline void poke();
@@ -526,16 +532,18 @@ class GCRuntime
     // Free certain LifoAlloc blocks from the background sweep thread.
     void freeUnusedLifoBlocksAfterSweeping(LifoAlloc *lifo);
     void freeAllLifoBlocksAfterSweeping(LifoAlloc *lifo);
 
     // Public here for ReleaseArenaLists and FinalizeTypedArenas.
     void releaseArena(ArenaHeader *aheader, const AutoLockGC &lock);
 
   private:
+    void minorGCImpl(JS::gcreason::Reason reason, Nursery::TypeObjectList *pretenureTypes);
+
     // For ArenaLists::allocateFromArena()
     friend class ArenaLists;
     Chunk *pickChunk(const AutoLockGC &lock,
                      AutoMaybeStartBackgroundAllocation &maybeStartBGAlloc);
     ArenaHeader *allocateArena(Chunk *chunk, Zone *zone, AllocKind kind, const AutoLockGC &lock);
     inline void arenaAllocatedDuringGC(JS::Zone *zone, ArenaHeader *arena);
 
     template <AllowGC allowGC>
--- a/js/src/gc/Iteration.cpp
+++ b/js/src/gc/Iteration.cpp
@@ -20,16 +20,17 @@ using namespace js::gc;
 void
 js::TraceRuntime(JSTracer *trc)
 {
     MOZ_ASSERT(!IS_GC_MARKING_TRACER(trc));
 
     JSRuntime *rt = trc->runtime();
     rt->gc.evictNursery();
     AutoPrepareForTracing prep(rt, WithAtoms);
+    gcstats::AutoPhase ap(rt->gc.stats, gcstats::PHASE_TRACE_HEAP);
     rt->gc.markRuntime(trc);
 }
 
 static void
 IterateCompartmentsArenasCells(JSRuntime *rt, Zone *zone, void *data,
                                JSIterateCompartmentCallback compartmentCallback,
                                IterateArenaCallback arenaCallback,
                                IterateCellCallback cellCallback)
--- a/js/src/gc/Nursery.cpp
+++ b/js/src/gc/Nursery.cpp
@@ -747,18 +747,16 @@ js::Nursery::collect(JSRuntime *rt, JS::
     rt->gc.stats.count(gcstats::STAT_MINOR_GC);
 
     TraceMinorGCStart();
 
     TIME_START(total);
 
     AutoStopVerifyingBarriers av(rt, false);
 
-    gcstats::AutoPhase ap(rt->gc.stats, gcstats::PHASE_MINOR_GC);
-
     // Move objects pointed to by roots from the nursery to the major heap.
     MinorCollectionTracer trc(rt, this);
 
     // Mark the store buffer. This must happen first.
     TIME_START(markValues);
     sb.markValues(&trc);
     TIME_END(markValues);
 
@@ -793,17 +791,20 @@ js::Nursery::collect(JSRuntime *rt, JS::
 #endif
     TIME_END(checkHashTables);
 
     TIME_START(markRuntime);
     rt->gc.markRuntime(&trc);
     TIME_END(markRuntime);
 
     TIME_START(markDebugger);
-    Debugger::markAll(&trc);
+    {
+        gcstats::AutoPhase ap(rt->gc.stats, gcstats::PHASE_MARK_ROOTS);
+        Debugger::markAll(&trc);
+    }
     TIME_END(markDebugger);
 
     TIME_START(clearNewObjectCache);
     rt->newObjectCache.clearNurseryObjects(rt);
     TIME_END(clearNewObjectCache);
 
     // Most of the work is done here. This loop iterates over objects that have
     // been moved to the major heap. If these objects have any outgoing pointers
--- a/js/src/gc/RootMarking.cpp
+++ b/js/src/gc/RootMarking.cpp
@@ -438,65 +438,75 @@ js::gc::MarkForkJoinStack(ForkJoinNurser
 }
 #endif  // JSGC_FJGENERATIONAL
 
 void
 js::gc::GCRuntime::markRuntime(JSTracer *trc,
                                TraceOrMarkRuntime traceOrMark,
                                TraceRootsOrUsedSaved rootsSource)
 {
+    gcstats::AutoPhase ap(stats, gcstats::PHASE_MARK_ROOTS);
+
     MOZ_ASSERT(trc->callback != GCMarker::GrayCallback);
     MOZ_ASSERT(traceOrMark == TraceRuntime || traceOrMark == MarkRuntime);
     MOZ_ASSERT(rootsSource == TraceRoots || rootsSource == UseSavedRoots);
 
     MOZ_ASSERT(!rt->mainThread.suppressGC);
 
     if (traceOrMark == MarkRuntime) {
+        gcstats::AutoPhase ap(stats, gcstats::PHASE_MARK_CCWS);
+
         for (CompartmentsIter c(rt, SkipAtoms); !c.done(); c.next()) {
             if (!c->zone()->isCollecting())
                 c->markCrossCompartmentWrappers(trc);
         }
         Debugger::markAllCrossCompartmentEdges(trc);
     }
 
-    AutoGCRooter::traceAll(trc);
+    {
+        gcstats::AutoPhase ap(stats, gcstats::PHASE_MARK_ROOTERS);
+
+        AutoGCRooter::traceAll(trc);
 
-    if (!rt->isBeingDestroyed()) {
-        MarkExactStackRoots(rt, trc);
-        rt->markSelfHostingGlobal(trc);
-    }
+        if (!rt->isBeingDestroyed()) {
+            MarkExactStackRoots(rt, trc);
+            rt->markSelfHostingGlobal(trc);
+        }
 
-    for (RootRange r = rootsHash.all(); !r.empty(); r.popFront()) {
-        const RootEntry &entry = r.front();
-        const char *name = entry.value().name ? entry.value().name : "root";
-        JSGCRootType type = entry.value().type;
-        void *key = entry.key();
-        if (type == JS_GC_ROOT_VALUE_PTR) {
-            MarkValueRoot(trc, reinterpret_cast<Value *>(key), name);
-        } else if (*reinterpret_cast<void **>(key)){
-            if (type == JS_GC_ROOT_STRING_PTR)
-                MarkStringRoot(trc, reinterpret_cast<JSString **>(key), name);
-            else if (type == JS_GC_ROOT_OBJECT_PTR)
-                MarkObjectRoot(trc, reinterpret_cast<JSObject **>(key), name);
-            else if (type == JS_GC_ROOT_SCRIPT_PTR)
-                MarkScriptRoot(trc, reinterpret_cast<JSScript **>(key), name);
-            else
-                MOZ_CRASH("unexpected js::RootInfo::type value");
+        for (RootRange r = rootsHash.all(); !r.empty(); r.popFront()) {
+            const RootEntry &entry = r.front();
+            const char *name = entry.value().name ? entry.value().name : "root";
+            JSGCRootType type = entry.value().type;
+            void *key = entry.key();
+            if (type == JS_GC_ROOT_VALUE_PTR) {
+                MarkValueRoot(trc, reinterpret_cast<Value *>(key), name);
+            } else if (*reinterpret_cast<void **>(key)){
+                if (type == JS_GC_ROOT_STRING_PTR)
+                    MarkStringRoot(trc, reinterpret_cast<JSString **>(key), name);
+                else if (type == JS_GC_ROOT_OBJECT_PTR)
+                    MarkObjectRoot(trc, reinterpret_cast<JSObject **>(key), name);
+                else if (type == JS_GC_ROOT_SCRIPT_PTR)
+                    MarkScriptRoot(trc, reinterpret_cast<JSScript **>(key), name);
+                else
+                    MOZ_CRASH("unexpected js::RootInfo::type value");
+            }
         }
+
+        MarkPersistentRootedChains(trc);
     }
 
-    MarkPersistentRootedChains(trc);
-
     if (rt->scriptAndCountsVector) {
         ScriptAndCountsVector &vec = *rt->scriptAndCountsVector;
         for (size_t i = 0; i < vec.length(); i++)
             MarkScriptRoot(trc, &vec[i].script, "scriptAndCountsVector");
     }
 
     if (!rt->isBeingDestroyed() && !trc->runtime()->isHeapMinorCollecting()) {
+        gcstats::AutoPhase ap(stats, gcstats::PHASE_MARK_RUNTIME_DATA);
+
         if (traceOrMark == TraceRuntime || rt->atomsCompartment()->zone()->isCollecting()) {
             MarkPermanentAtoms(trc);
             MarkAtoms(trc);
             MarkWellKnownSymbols(trc);
             jit::JitRuntime::Mark(trc);
         }
     }
 
@@ -541,16 +551,18 @@ js::gc::GCRuntime::markRuntime(JSTracer 
             c->lazyArrayBuffers->trace(trc);
     }
 
     MarkInterpreterActivations(&rt->mainThread, trc);
 
     jit::MarkJitActivations(&rt->mainThread, trc);
 
     if (!isHeapMinorCollecting()) {
+        gcstats::AutoPhase ap(stats, gcstats::PHASE_MARK_EMBEDDING);
+
         /*
          * All JSCompartment::markRoots() does is mark the globals for
          * compartments which have been entered. Globals aren't nursery
          * allocated so there's no need to do this for minor GCs.
          */
         for (CompartmentsIter c(rt, SkipAtoms); !c.done(); c.next())
             c->markRoots(trc);
 
--- a/js/src/gc/Statistics.cpp
+++ b/js/src/gc/Statistics.cpp
@@ -1,16 +1,17 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  * vim: set ts=8 sts=4 et sw=4 tw=99:
  * 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 "gc/Statistics.h"
 
+#include "mozilla/ArrayUtils.h"
 #include "mozilla/PodOperations.h"
 #include "mozilla/UniquePtr.h"
 
 #include <ctype.h>
 #include <stdarg.h>
 #include <stdio.h>
 
 #include "jscrashreport.h"
@@ -276,33 +277,63 @@ t(int64_t t)
 
 struct PhaseInfo
 {
     Phase index;
     const char *name;
     Phase parent;
 };
 
+// The zeroth entry in the timing arrays is used for phases that have a
+// unique lineage.
+static const size_t PHASE_DAG_NONE = 0;
+
+// These are really just fields of PhaseInfo, but I have to initialize them
+// programmatically, which prevents making phases[] const. (And marking these
+// fields mutable does not work on Windows; the whole thing gets created in
+// read-only memory anyway.)
+struct ExtraPhaseInfo
+{
+    // Depth in the tree of each phase type
+    size_t depth;
+
+    // Index into the set of parallel arrays of timing data, for parents with
+    // at least one multi-parented child
+    int dagSlot;
+};
+
 static const Phase PHASE_NO_PARENT = PHASE_LIMIT;
 
+struct DagChildEdge {
+    Phase parent;
+    Phase child;
+} dagChildEdges[] = {
+    { PHASE_MARK, PHASE_MARK_ROOTS },
+    { PHASE_MINOR_GC, PHASE_MARK_ROOTS },
+    { PHASE_TRACE_HEAP, PHASE_MARK_ROOTS },
+    { PHASE_EVICT_NURSERY, PHASE_MARK_ROOTS },
+    { PHASE_COMPACT_UPDATE, PHASE_MARK_ROOTS }
+};
+
 /*
  * Note that PHASE_MUTATOR, PHASE_GC_BEGIN, and PHASE_GC_END never have any
  * child phases. If beginPhase is called while one of these is active, they
  * will automatically be suspended and resumed when the phase stack is next
  * empty. Timings for these phases are thus exclusive of any other phase.
  */
 
 static const PhaseInfo phases[] = {
     { PHASE_MUTATOR, "Mutator Running", PHASE_NO_PARENT },
     { PHASE_GC_BEGIN, "Begin Callback", PHASE_NO_PARENT },
     { PHASE_WAIT_BACKGROUND_THREAD, "Wait Background Thread", PHASE_NO_PARENT },
     { PHASE_MARK_DISCARD_CODE, "Mark Discard Code", PHASE_NO_PARENT },
     { PHASE_PURGE, "Purge", PHASE_NO_PARENT },
     { PHASE_MARK, "Mark", PHASE_NO_PARENT },
-        { PHASE_MARK_ROOTS, "Mark Roots", PHASE_MARK },
+        { PHASE_UNMARK, "Unmark", PHASE_MARK },
+        /* PHASE_MARK_ROOTS */
         { PHASE_MARK_DELAYED, "Mark Delayed", PHASE_MARK },
     { PHASE_SWEEP, "Sweep", PHASE_NO_PARENT },
         { PHASE_SWEEP_MARK, "Mark During Sweeping", PHASE_SWEEP },
             { PHASE_SWEEP_MARK_TYPES, "Mark Types During Sweeping", PHASE_SWEEP_MARK },
             { PHASE_SWEEP_MARK_INCOMING_BLACK, "Mark Incoming Black Pointers", PHASE_SWEEP_MARK },
             { PHASE_SWEEP_MARK_WEAK, "Mark Weak", PHASE_SWEEP_MARK },
             { PHASE_SWEEP_MARK_INCOMING_GRAY, "Mark Incoming Gray Pointers", PHASE_SWEEP_MARK },
             { PHASE_SWEEP_MARK_GRAY, "Mark Gray", PHASE_SWEEP_MARK },
@@ -327,29 +358,105 @@ static const PhaseInfo phases[] = {
         { PHASE_SWEEP_STRING, "Sweep String", PHASE_SWEEP },
         { PHASE_SWEEP_SCRIPT, "Sweep Script", PHASE_SWEEP },
         { PHASE_SWEEP_SHAPE, "Sweep Shape", PHASE_SWEEP },
         { PHASE_SWEEP_JITCODE, "Sweep JIT code", PHASE_SWEEP },
         { PHASE_FINALIZE_END, "Finalize End Callback", PHASE_SWEEP },
         { PHASE_DESTROY, "Deallocate", PHASE_SWEEP },
     { PHASE_COMPACT, "Compact", PHASE_NO_PARENT },
         { PHASE_COMPACT_MOVE, "Compact Move", PHASE_COMPACT },
-        { PHASE_COMPACT_UPDATE, "Compact Update", PHASE_COMPACT, },
+        { PHASE_COMPACT_UPDATE, "Compact Update", PHASE_COMPACT },
+            /* PHASE_MARK_ROOTS */
             { PHASE_COMPACT_UPDATE_CELLS, "Compact Update Cells", PHASE_COMPACT_UPDATE, },
     { PHASE_GC_END, "End Callback", PHASE_NO_PARENT },
-    { PHASE_MINOR_GC, "Minor GC", PHASE_NO_PARENT },
+    { PHASE_MINOR_GC, "All Minor GCs", PHASE_NO_PARENT },
+        /* PHASE_MARK_ROOTS */
+    { PHASE_EVICT_NURSERY, "Minor GCs to Evict Nursery", PHASE_NO_PARENT },
+        /* PHASE_MARK_ROOTS */
+    { PHASE_TRACE_HEAP, "Trace Heap", PHASE_NO_PARENT },
+        /* PHASE_MARK_ROOTS */
+    { PHASE_MARK_ROOTS, "Mark Roots", PHASE_MULTI_PARENTS },
+        { PHASE_MARK_CCWS, "Mark Cross Compartment Wrappers", PHASE_MARK_ROOTS },
+        { PHASE_MARK_ROOTERS, "Mark Rooters", PHASE_MARK_ROOTS },
+        { PHASE_MARK_RUNTIME_DATA, "Mark Runtime-wide Data", PHASE_MARK_ROOTS },
+        { PHASE_MARK_EMBEDDING, "Mark Embedding", PHASE_MARK_ROOTS },
+        { PHASE_MARK_COMPARTMENTS, "Mark Compartments", PHASE_MARK_ROOTS },
     { PHASE_LIMIT, nullptr, PHASE_NO_PARENT }
 };
 
+ExtraPhaseInfo phaseExtra[PHASE_LIMIT] = { { 0, 0 } };
+
+// Mapping from all nodes with a multi-parented child to a Vector of all
+// multi-parented children and their descendants. (Single-parented children will
+// not show up in this list.)
+static mozilla::Vector<Phase> dagDescendants[Statistics::MAX_MULTIPARENT_PHASES + 1];
+
+struct AllPhaseIterator {
+    int current;
+    int baseLevel;
+    size_t activeSlot;
+    mozilla::Vector<Phase>::Range descendants;
+
+    explicit AllPhaseIterator(int64_t (*table)[PHASE_LIMIT])
+      : current(0)
+      , baseLevel(0)
+      , activeSlot(PHASE_DAG_NONE)
+      , descendants(dagDescendants[PHASE_DAG_NONE].all()) /* empty range */
+    {
+    }
+
+    void get(Phase *phase, size_t *dagSlot, size_t *level = nullptr) {
+        MOZ_ASSERT(!done());
+        *dagSlot = activeSlot;
+        *phase = descendants.empty() ? Phase(current) : descendants.front();
+        if (level)
+            *level = phaseExtra[*phase].depth + baseLevel;
+    }
+
+    void advance() {
+        MOZ_ASSERT(!done());
+
+        if (!descendants.empty()) {
+            descendants.popFront();
+            if (!descendants.empty())
+                return;
+
+            ++current;
+            activeSlot = PHASE_DAG_NONE;
+            baseLevel = 0;
+            return;
+        }
+
+        if (phaseExtra[current].dagSlot != PHASE_DAG_NONE) {
+            activeSlot = phaseExtra[current].dagSlot;
+            descendants = dagDescendants[activeSlot].all();
+            MOZ_ASSERT(!descendants.empty());
+            baseLevel += phaseExtra[current].depth + 1;
+            return;
+        }
+
+        ++current;
+    }
+
+    bool done() const {
+        return phases[current].parent == PHASE_MULTI_PARENTS;
+    }
+};
+
 static void
-FormatPhaseTimes(StatisticsSerializer &ss, const char *name, int64_t *times)
+FormatPhaseTimes(StatisticsSerializer &ss, const char *name, int64_t (*times)[PHASE_LIMIT])
 {
     ss.beginObject(name);
-    for (unsigned i = 0; phases[i].name; i++)
-        ss.appendIfNonzeroMS(phases[i].name, t(times[phases[i].index]));
+
+    for (AllPhaseIterator iter(times); !iter.done(); iter.advance()) {
+        Phase phase;
+        size_t dagSlot;
+        iter.get(&phase, &dagSlot);
+        ss.appendIfNonzeroMS(phases[phase].name, t(times[dagSlot][phase]));
+    }
     ss.endObject();
 }
 
 void
 Statistics::gcDuration(int64_t *total, int64_t *maxPause)
 {
     *total = *maxPause = 0;
     for (SliceData *slice = slices.begin(); slice != slices.end(); slice++) {
@@ -537,58 +644,68 @@ UniqueChars
 Statistics::formatTotals()
 {
     int64_t total, longest;
     gcDuration(&total, &longest);
 
     const char *format =
 "\
   ---- Totals ----\n\
-    Total Time: %.3f\n\
-    Max Pause: %.3f\n\
+    Total Time: %.3fms\n\
+    Max Pause: %.3fms\n\
 ";
     char buffer[1024];
     memset(buffer, 0, sizeof(buffer));
     JS_snprintf(buffer, sizeof(buffer), format, t(total), t(longest));
     return make_string_copy(buffer);
 }
 
 static int64_t
-SumChildTimes(Phase phase, int64_t *phaseTimes)
+SumChildTimes(size_t phaseSlot, Phase phase, int64_t (*phaseTimes)[PHASE_LIMIT])
 {
+    // Sum the contributions from single-parented children.
     int64_t total = 0;
-    for (unsigned i = 0; phases[i].name; i++) {
+    for (unsigned i = 0; i < PHASE_LIMIT; i++) {
         if (phases[i].parent == phase)
-            total += phaseTimes[phases[i].index];
+            total += phaseTimes[phaseSlot][i];
+    }
+
+    // Sum the contributions from multi-parented children.
+    size_t dagSlot = phaseExtra[phase].dagSlot;
+    if (dagSlot != PHASE_DAG_NONE) {
+        for (size_t i = 0; i < mozilla::ArrayLength(dagChildEdges); i++) {
+            if (dagChildEdges[i].parent == phase) {
+                Phase child = dagChildEdges[i].child;
+                total += phaseTimes[dagSlot][child];
+            }
+        }
     }
     return total;
 }
 
 UniqueChars
-Statistics::formatPhaseTimes(int64_t *phaseTimes)
+Statistics::formatPhaseTimes(int64_t (*phaseTimes)[PHASE_LIMIT])
 {
     static const char *LevelToIndent[] = { "", "  ", "    ", "      " };
     static const int64_t MaxUnaccountedChildTimeUS = 50;
 
     FragmentVector fragments;
     char buffer[128];
-    for (unsigned i = 0; phases[i].name; i++) {
-        unsigned level = 0;
-        unsigned current = i;
-        while (phases[current].parent != PHASE_NO_PARENT) {
-            current = phases[current].parent;
-            level++;
-        }
+    for (AllPhaseIterator iter(phaseTimes); !iter.done(); iter.advance()) {
+        Phase phase;
+        size_t dagSlot;
+        size_t level;
+        iter.get(&phase, &dagSlot, &level);
         MOZ_ASSERT(level < 4);
 
-        int64_t ownTime = phaseTimes[phases[i].index];
-        int64_t childTime = SumChildTimes(Phase(i), phaseTimes);
+        int64_t ownTime = phaseTimes[dagSlot][phase];
+        int64_t childTime = SumChildTimes(dagSlot, phase, phaseTimes);
         if (ownTime > 0) {
             JS_snprintf(buffer, sizeof(buffer), "      %s%s: %.3fms\n",
-                        LevelToIndent[level], phases[i].name, t(ownTime));
+                        LevelToIndent[level], phases[phase].name, t(ownTime));
             if (!fragments.append(make_string_copy(buffer)))
                 return UniqueChars(nullptr);
 
             if (childTime && (ownTime - childTime) > MaxUnaccountedChildTimeUS) {
                 MOZ_ASSERT(level < 3);
                 JS_snprintf(buffer, sizeof(buffer), "      %s%s: %.3fms\n",
                             LevelToIndent[level + 1], "Other", t(ownTime - childTime));
                 if (!fragments.append(make_string_copy(buffer)))
@@ -645,23 +762,72 @@ Statistics::Statistics(JSRuntime *rt)
     fp(nullptr),
     fullFormat(false),
     gcDepth(0),
     nonincrementalReason(nullptr),
     timedGCStart(0),
     preBytes(0),
     maxPauseInInterval(0),
     phaseNestingDepth(0),
+    activeDagSlot(PHASE_DAG_NONE),
     suspendedPhaseNestingDepth(0),
-    sliceCallback(nullptr)
+    sliceCallback(nullptr),
+    abortSlices(false)
 {
     PodArrayZero(phaseTotals);
     PodArrayZero(counts);
     PodArrayZero(phaseStartTimes);
-    PodArrayZero(phaseTimes);
+    for (size_t d = 0; d < MAX_MULTIPARENT_PHASES + 1; d++)
+        PodArrayZero(phaseTimes[d]);
+
+    static bool initialized = false;
+    if (!initialized) {
+        initialized = true;
+
+        for (size_t i = 0; i < PHASE_LIMIT; i++)
+            MOZ_ASSERT(phases[i].index == i);
+
+        // Create a static table of descendants for every phase with multiple
+        // children. This assumes that all descendants come linearly in the
+        // list, which is reasonable since full dags are not supported; any
+        // path from the leaf to the root must encounter at most one node with
+        // multiple parents.
+        size_t dagSlot = 0;
+        for (size_t i = 0; i < mozilla::ArrayLength(dagChildEdges); i++) {
+            Phase parent = dagChildEdges[i].parent;
+            if (!phaseExtra[parent].dagSlot)
+                phaseExtra[parent].dagSlot = ++dagSlot;
+
+            Phase child = dagChildEdges[i].child;
+            MOZ_ASSERT(phases[child].parent == PHASE_MULTI_PARENTS);
+            int j = child;
+            do {
+                dagDescendants[phaseExtra[parent].dagSlot].append(Phase(j));
+                j++;
+            } while (j != PHASE_LIMIT && phases[j].parent != PHASE_MULTI_PARENTS);
+        }
+        MOZ_ASSERT(dagSlot <= MAX_MULTIPARENT_PHASES);
+
+        // Fill in the depth of each node in the tree. Multi-parented nodes
+        // have depth 0.
+        mozilla::Vector<Phase> stack;
+        stack.append(PHASE_LIMIT); // Dummy entry to avoid special-casing the first node
+        for (int i = 0; i < PHASE_LIMIT; i++) {
+            if (phases[i].parent == PHASE_NO_PARENT ||
+                phases[i].parent == PHASE_MULTI_PARENTS)
+            {
+                stack.clear();
+            } else {
+                while (stack.back() != phases[i].parent)
+                    stack.popBack();
+            }
+            phaseExtra[i].depth = stack.length();
+            stack.append(Phase(i));
+        }
+    }
 
     char *env = getenv("MOZ_GCTIMER");
     if (!env || strcmp(env, "none") == 0) {
         fp = nullptr;
         return;
     }
 
     if (strcmp(env, "stdout") == 0) {
@@ -713,31 +879,42 @@ Statistics::clearMaxGCPauseAccumulator()
 }
 
 int64_t
 Statistics::getMaxGCPauseSinceClear()
 {
     return maxPauseInInterval;
 }
 
+static int64_t
+SumPhase(Phase phase, int64_t (*times)[PHASE_LIMIT])
+{
+    int64_t sum = 0;
+    for (size_t i = 0; i < Statistics::MAX_MULTIPARENT_PHASES + 1; i++)
+        sum += times[i][phase];
+    return sum;
+}
+
 void
 Statistics::printStats()
 {
     if (fullFormat) {
         UniqueChars msg = formatDetailedMessage();
         if (msg)
             fprintf(fp, "GC(T+%.3fs) %s\n", t(slices[0].start - startupTime) / 1000.0, msg.get());
     } else {
         int64_t total, longest;
         gcDuration(&total, &longest);
 
+        int64_t markTotal = SumPhase(PHASE_MARK, phaseTimes);
         fprintf(fp, "%f %f %f\n",
                 t(total),
-                t(phaseTimes[PHASE_MARK]),
-                t(phaseTimes[PHASE_SWEEP]));
+                t(markTotal),
+                t(phaseTimes[PHASE_DAG_NONE][PHASE_SWEEP]));
+        MOZ_ASSERT(phaseExtra[PHASE_SWEEP].dagSlot == PHASE_DAG_NONE);
     }
     fflush(fp);
 }
 
 void
 Statistics::beginGC(JSGCInvocationKind kind)
 {
     slices.clearAndFree();
@@ -748,82 +925,94 @@ Statistics::beginGC(JSGCInvocationKind k
     preBytes = runtime->gc.usage.gcBytes();
 }
 
 void
 Statistics::endGC()
 {
     crash::SnapshotGCStack();
 
-    for (int i = 0; i < PHASE_LIMIT; i++)
-        phaseTotals[i] += phaseTimes[i];
+    for (size_t j = 0; j < MAX_MULTIPARENT_PHASES + 1; j++)
+        for (int i = 0; i < PHASE_LIMIT; i++)
+            phaseTotals[j][i] += phaseTimes[j][i];
 
     int64_t total, longest;
     gcDuration(&total, &longest);
 
     int64_t sccTotal, sccLongest;
     sccDurations(&sccTotal, &sccLongest);
 
     runtime->addTelemetry(JS_TELEMETRY_GC_IS_COMPARTMENTAL, !zoneStats.isCollectingAllZones());
     runtime->addTelemetry(JS_TELEMETRY_GC_MS, t(total));
     runtime->addTelemetry(JS_TELEMETRY_GC_MAX_PAUSE_MS, t(longest));
-    runtime->addTelemetry(JS_TELEMETRY_GC_MARK_MS, t(phaseTimes[PHASE_MARK]));
-    runtime->addTelemetry(JS_TELEMETRY_GC_SWEEP_MS, t(phaseTimes[PHASE_SWEEP]));
-    runtime->addTelemetry(JS_TELEMETRY_GC_MARK_ROOTS_MS, t(phaseTimes[PHASE_MARK_ROOTS]));
-    runtime->addTelemetry(JS_TELEMETRY_GC_MARK_GRAY_MS, t(phaseTimes[PHASE_SWEEP_MARK_GRAY]));
+    int64_t markTotal = SumPhase(PHASE_MARK, phaseTimes);
+    int64_t markRootsTotal = SumPhase(PHASE_MARK_ROOTS, phaseTimes);
+    runtime->addTelemetry(JS_TELEMETRY_GC_MARK_MS, t(markTotal));
+    runtime->addTelemetry(JS_TELEMETRY_GC_SWEEP_MS, t(phaseTimes[PHASE_DAG_NONE][PHASE_SWEEP]));
+    runtime->addTelemetry(JS_TELEMETRY_GC_MARK_ROOTS_MS, t(markRootsTotal));
+    runtime->addTelemetry(JS_TELEMETRY_GC_MARK_GRAY_MS, t(phaseTimes[PHASE_DAG_NONE][PHASE_SWEEP_MARK_GRAY]));
     runtime->addTelemetry(JS_TELEMETRY_GC_NON_INCREMENTAL, !!nonincrementalReason);
     runtime->addTelemetry(JS_TELEMETRY_GC_INCREMENTAL_DISABLED, !runtime->gc.isIncrementalGCAllowed());
     runtime->addTelemetry(JS_TELEMETRY_GC_SCC_SWEEP_TOTAL_MS, t(sccTotal));
     runtime->addTelemetry(JS_TELEMETRY_GC_SCC_SWEEP_MAX_PAUSE_MS, t(sccLongest));
 
     double mmu50 = computeMMU(50 * PRMJ_USEC_PER_MSEC);
     runtime->addTelemetry(JS_TELEMETRY_GC_MMU_50, mmu50 * 100);
 
     if (fp)
         printStats();
 
     // Clear the timers at the end of a GC because we accumulate time in
     // between GCs for some (which come before PHASE_GC_BEGIN in the list.)
     PodZero(&phaseStartTimes[PHASE_GC_BEGIN], PHASE_LIMIT - PHASE_GC_BEGIN);
-    PodZero(&phaseTimes[PHASE_GC_BEGIN], PHASE_LIMIT - PHASE_GC_BEGIN);
+    for (size_t d = PHASE_DAG_NONE; d < MAX_MULTIPARENT_PHASES + 1; d++)
+        PodZero(&phaseTimes[d][PHASE_GC_BEGIN], PHASE_LIMIT - PHASE_GC_BEGIN);
+
+    abortSlices = false;
 }
 
 void
 Statistics::beginSlice(const ZoneGCStats &zoneStats, JSGCInvocationKind gckind,
                        JS::gcreason::Reason reason)
 {
     this->zoneStats = zoneStats;
 
     bool first = !runtime->gc.isIncrementalGCInProgress();
     if (first)
         beginGC(gckind);
 
     SliceData data(reason, PRMJ_Now(), GetPageFaultCount());
-    if (!slices.append(data))
-        CrashAtUnhandlableOOM("Failed to allocate statistics slice.");
+    if (!slices.append(data)) {
+        // OOM testing fails if we CrashAtUnhandlableOOM here.
+        abortSlices = true;
+        slices.clear();
+        return;
+    }
 
     runtime->addTelemetry(JS_TELEMETRY_GC_REASON, reason);
 
     // Slice callbacks should only fire for the outermost level
     if (++gcDepth == 1) {
         bool wasFullGC = zoneStats.isCollectingAllZones();
         if (sliceCallback)
             (*sliceCallback)(runtime, first ? JS::GC_CYCLE_BEGIN : JS::GC_SLICE_BEGIN,
                              JS::GCDescription(!wasFullGC));
     }
 }
 
 void
 Statistics::endSlice()
 {
-    slices.back().end = PRMJ_Now();
-    slices.back().endFaults = GetPageFaultCount();
+    if (!abortSlices) {
+        slices.back().end = PRMJ_Now();
+        slices.back().endFaults = GetPageFaultCount();
 
-    runtime->addTelemetry(JS_TELEMETRY_GC_SLICE_MS, t(slices.back().end - slices.back().start));
-    runtime->addTelemetry(JS_TELEMETRY_GC_RESET, !!slices.back().resetReason);
+        runtime->addTelemetry(JS_TELEMETRY_GC_SLICE_MS, t(slices.back().end - slices.back().start));
+        runtime->addTelemetry(JS_TELEMETRY_GC_RESET, !!slices.back().resetReason);
+    }
 
     bool last = !runtime->gc.isIncrementalGCInProgress();
     if (last)
         endGC();
 
     // Slice callbacks should only fire for the outermost level
     if (--gcDepth == 0) {
         bool wasFullGC = zoneStats.isCollectingAllZones();
@@ -841,31 +1030,31 @@ void
 Statistics::startTimingMutator()
 {
     // Should only be called from outside of GC
     MOZ_ASSERT(phaseNestingDepth == 0);
     MOZ_ASSERT(suspendedPhaseNestingDepth == 0);
 
     timedGCTime = 0;
     phaseStartTimes[PHASE_MUTATOR] = 0;
-    phaseTimes[PHASE_MUTATOR] = 0;
+    phaseTimes[PHASE_DAG_NONE][PHASE_MUTATOR] = 0;
     timedGCStart = 0;
 
     beginPhase(PHASE_MUTATOR);
 }
 
 bool
 Statistics::stopTimingMutator(double &mutator_ms, double &gc_ms)
 {
     // This should only be called from outside of GC, while timing the mutator.
     if (phaseNestingDepth != 1 || phaseNesting[0] != PHASE_MUTATOR)
         return false;
 
     endPhase(PHASE_MUTATOR);
-    mutator_ms = t(phaseTimes[PHASE_MUTATOR]);
+    mutator_ms = t(phaseTimes[PHASE_DAG_NONE][PHASE_MUTATOR]);
     gc_ms = t(timedGCTime);
 
     return true;
 }
 
 void
 Statistics::beginPhase(Phase phase)
 {
@@ -883,63 +1072,70 @@ Statistics::beginPhase(Phase phase)
         parent = phaseNestingDepth ? phaseNesting[phaseNestingDepth - 1] : PHASE_NO_PARENT;
     }
 
     // Guard against any other re-entry.
     MOZ_ASSERT(!phaseStartTimes[phase]);
 
     MOZ_ASSERT(phases[phase].index == phase);
     MOZ_ASSERT(phaseNestingDepth < MAX_NESTING);
-    MOZ_ASSERT_IF(gcDepth == 1 && phase != PHASE_MINOR_GC, phases[phase].parent == parent);
+    MOZ_ASSERT(phases[phase].parent == parent || phases[phase].parent == PHASE_MULTI_PARENTS);
 
     phaseNesting[phaseNestingDepth] = phase;
     phaseNestingDepth++;
 
+    if (phases[phase].parent == PHASE_MULTI_PARENTS)
+        activeDagSlot = phaseExtra[parent].dagSlot;
+
     phaseStartTimes[phase] = PRMJ_Now();
 }
 
 void
 Statistics::recordPhaseEnd(Phase phase)
 {
     int64_t now = PRMJ_Now();
 
     if (phase == PHASE_MUTATOR)
         timedGCStart = now;
 
     phaseNestingDepth--;
 
     int64_t t = now - phaseStartTimes[phase];
     if (!slices.empty())
-        slices.back().phaseTimes[phase] += t;
-    phaseTimes[phase] += t;
+        slices.back().phaseTimes[activeDagSlot][phase] += t;
+    phaseTimes[activeDagSlot][phase] += t;
     phaseStartTimes[phase] = 0;
 }
 
 void
 Statistics::endPhase(Phase phase)
 {
     recordPhaseEnd(phase);
 
+    if (phases[phase].parent == PHASE_MULTI_PARENTS)
+        activeDagSlot = PHASE_DAG_NONE;
+
     // When emptying the stack, we may need to resume a callback phase
     // (PHASE_GC_BEGIN/END) or return to timing the mutator (PHASE_MUTATOR).
     if (phaseNestingDepth == 0 && suspendedPhaseNestingDepth > 0) {
         Phase resumePhase = suspendedPhases[--suspendedPhaseNestingDepth];
         if (resumePhase == PHASE_MUTATOR)
             timedGCTime += PRMJ_Now() - timedGCStart;
         beginPhase(resumePhase);
     }
 }
 
 void
 Statistics::endParallelPhase(Phase phase, const GCParallelTask *task)
 {
     phaseNestingDepth--;
 
-    slices.back().phaseTimes[phase] += task->duration();
-    phaseTimes[phase] += task->duration();
+    if (!slices.empty())
+        slices.back().phaseTimes[PHASE_DAG_NONE][phase] += task->duration();
+    phaseTimes[PHASE_DAG_NONE][phase] += task->duration();
     phaseStartTimes[phase] = 0;
 }
 
 int64_t
 Statistics::beginSCC()
 {
     return PRMJ_Now();
 }
@@ -960,16 +1156,19 @@ Statistics::endSCC(unsigned scc, int64_t
  * that means that, for any 50ms window of time, at least 80% of the window is
  * devoted to the mutator. In other words, the GC is running for at most 20% of
  * the window, or 10ms. The GC can run multiple slices during the 50ms window
  * as long as the total time it spends is at most 10ms.
  */
 double
 Statistics::computeMMU(int64_t window)
 {
+    if (abortSlices)
+        return 0.0;
+
     MOZ_ASSERT(!slices.empty());
 
     int64_t gc = slices[0].end - slices[0].start;
     int64_t gcMax = gc;
 
     if (gc >= window)
         return 0.0;
 
--- a/js/src/gc/Statistics.h
+++ b/js/src/gc/Statistics.h
@@ -28,17 +28,17 @@ namespace gcstats {
 
 enum Phase {
     PHASE_MUTATOR,
     PHASE_GC_BEGIN,
     PHASE_WAIT_BACKGROUND_THREAD,
     PHASE_MARK_DISCARD_CODE,
     PHASE_PURGE,
     PHASE_MARK,
-    PHASE_MARK_ROOTS,
+    PHASE_UNMARK,
     PHASE_MARK_DELAYED,
     PHASE_SWEEP,
     PHASE_SWEEP_MARK,
     PHASE_SWEEP_MARK_TYPES,
     PHASE_SWEEP_MARK_INCOMING_BLACK,
     PHASE_SWEEP_MARK_WEAK,
     PHASE_SWEEP_MARK_INCOMING_GRAY,
     PHASE_SWEEP_MARK_GRAY,
@@ -67,18 +67,28 @@ enum Phase {
     PHASE_FINALIZE_END,
     PHASE_DESTROY,
     PHASE_COMPACT,
     PHASE_COMPACT_MOVE,
     PHASE_COMPACT_UPDATE,
     PHASE_COMPACT_UPDATE_CELLS,
     PHASE_GC_END,
     PHASE_MINOR_GC,
+    PHASE_EVICT_NURSERY,
+    PHASE_TRACE_HEAP,
+    PHASE_MARK_ROOTS,
+    PHASE_MARK_CCWS,
+    PHASE_MARK_ROOTERS,
+    PHASE_MARK_RUNTIME_DATA,
+    PHASE_MARK_EMBEDDING,
+    PHASE_MARK_COMPARTMENTS,
 
-    PHASE_LIMIT
+    PHASE_LIMIT,
+    PHASE_NONE = PHASE_LIMIT,
+    PHASE_MULTI_PARENTS
 };
 
 enum Stat {
     STAT_NEW_CHUNK,
     STAT_DESTROY_CHUNK,
     STAT_MINOR_GC,
 
     // Number of times a 'put' into a storebuffer overflowed, triggering a
@@ -106,18 +116,47 @@ struct ZoneGCStats
 
     bool isCollectingAllZones() const { return collectedZoneCount == zoneCount; }
 
     ZoneGCStats()
       : collectedZoneCount(0), zoneCount(0), collectedCompartmentCount(0), compartmentCount(0)
     {}
 };
 
+/*
+ * Struct for collecting timing statistics on a "phase tree". The tree is
+ * specified as a limited DAG, but the timings are collected for the whole tree
+ * that you would get by expanding out the DAG by duplicating subtrees rooted
+ * at nodes with multiple parents.
+ *
+ * During execution, a child phase can be activated multiple times, and the
+ * total time will be accumulated. (So for example, you can start and end
+ * PHASE_MARK_ROOTS multiple times before completing the parent phase.)
+ *
+ * Incremental GC is represented by recording separate timing results for each
+ * slice within the overall GC.
+ */
 struct Statistics
 {
+    /*
+     * Phases are allowed to have multiple parents, though any path from root
+     * to leaf is allowed at most one multi-parented phase. We keep a full set
+     * of timings for each of the multi-parented phases, to be able to record
+     * all the timings in the expanded tree induced by our dag.
+     *
+     * Note that this wastes quite a bit of space, since we have a whole
+     * separate array of timing data containing all the phases. We could be
+     * more clever and keep an array of pointers biased by the offset of the
+     * multi-parented phase, and thereby preserve the simple
+     * timings[slot][PHASE_*] indexing. But the complexity doesn't seem worth
+     * the few hundred bytes of savings. If we want to extend things to full
+     * DAGs, this decision should be reconsidered.
+     */
+    static const size_t MAX_MULTIPARENT_PHASES = 6;
+
     explicit Statistics(JSRuntime *rt);
     ~Statistics();
 
     void beginPhase(Phase phase);
     void endPhase(Phase phase);
     void endParallelPhase(Phase phase, const GCParallelTask *task);
 
     void beginSlice(const ZoneGCStats &zoneStats, JSGCInvocationKind gckind,
@@ -142,16 +181,25 @@ struct Statistics
     char16_t *formatJSON(uint64_t timestamp);
     UniqueChars formatDetailedMessage();
 
     JS::GCSliceCallback setSliceCallback(JS::GCSliceCallback callback);
 
     int64_t clearMaxGCPauseAccumulator();
     int64_t getMaxGCPauseSinceClear();
 
+    // Return the current phase, suppressing the synthetic PHASE_MUTATOR phase.
+    Phase currentPhase() {
+        if (phaseNestingDepth == 0)
+            return PHASE_NONE;
+        if (phaseNestingDepth == 1)
+            return phaseNesting[0] == PHASE_MUTATOR ? PHASE_NONE : phaseNesting[0];
+        return phaseNesting[phaseNestingDepth - 1];
+    }
+
   private:
     JSRuntime *runtime;
 
     int64_t startupTime;
 
     FILE *fp;
     bool fullFormat;
 
@@ -166,85 +214,93 @@ struct Statistics
     JSGCInvocationKind gckind;
 
     const char *nonincrementalReason;
 
     struct SliceData {
         SliceData(JS::gcreason::Reason reason, int64_t start, size_t startFaults)
           : reason(reason), resetReason(nullptr), start(start), startFaults(startFaults)
         {
-            mozilla::PodArrayZero(phaseTimes);
+            for (size_t i = 0; i < MAX_MULTIPARENT_PHASES + 1; i++)
+                mozilla::PodArrayZero(phaseTimes[i]);
         }
 
         JS::gcreason::Reason reason;
         const char *resetReason;
         int64_t start, end;
         size_t startFaults, endFaults;
-        int64_t phaseTimes[PHASE_LIMIT];
+        int64_t phaseTimes[MAX_MULTIPARENT_PHASES + 1][PHASE_LIMIT];
 
         int64_t duration() const { return end - start; }
     };
 
     Vector<SliceData, 8, SystemAllocPolicy> slices;
 
     /* Most recent time when the given phase started. */
     int64_t phaseStartTimes[PHASE_LIMIT];
 
     /* Bookkeeping for GC timings when timingMutator is true */
     int64_t timedGCStart;
     int64_t timedGCTime;
 
     /* Total time in a given phase for this GC. */
-    int64_t phaseTimes[PHASE_LIMIT];
+    int64_t phaseTimes[MAX_MULTIPARENT_PHASES + 1][PHASE_LIMIT];
 
     /* Total time in a given phase over all GCs. */
-    int64_t phaseTotals[PHASE_LIMIT];
+    int64_t phaseTotals[MAX_MULTIPARENT_PHASES + 1][PHASE_LIMIT];
 
     /* Number of events of this type for this GC. */
     unsigned int counts[STAT_LIMIT];
 
     /* Allocated space before the GC started. */
     size_t preBytes;
 
     /* Records the maximum GC pause in an API-controlled interval (in us). */
     int64_t maxPauseInInterval;
 
     /* Phases that are currently on stack. */
     static const size_t MAX_NESTING = 8;
     Phase phaseNesting[MAX_NESTING];
     size_t phaseNestingDepth;
+    size_t activeDagSlot;
 
     /*
      * To avoid recursive nesting, we discontinue a callback phase when any
      * other phases are started. Remember what phase to resume when the inner
      * phases are complete. (And because GCs can nest within the callbacks any
      * number of times, we need a whole stack of of phases to resume.)
      */
     Phase suspendedPhases[MAX_NESTING];
     size_t suspendedPhaseNestingDepth;
 
     /* Sweep times for SCCs of compartments. */
     Vector<int64_t, 0, SystemAllocPolicy> sccTimes;
 
     JS::GCSliceCallback sliceCallback;
 
+    /*
+     * True if we saw an OOM while allocating slices. Slices will not be
+     * individually recorded for the remainder of this GC.
+     */
+    bool abortSlices;
+
     void beginGC(JSGCInvocationKind kind);
     void endGC();
 
     void recordPhaseEnd(Phase phase);
 
     void gcDuration(int64_t *total, int64_t *maxPause);
     void sccDurations(int64_t *total, int64_t *maxPause);
     void printStats();
     bool formatData(StatisticsSerializer &ss, uint64_t timestamp);
 
     UniqueChars formatDescription();
     UniqueChars formatSliceDescription(unsigned i, const SliceData &slice);
     UniqueChars formatTotals();
-    UniqueChars formatPhaseTimes(int64_t *phaseTimes);
+    UniqueChars formatPhaseTimes(int64_t (*phaseTimes)[PHASE_LIMIT]);
 
     double computeMMU(int64_t resolution);
 };
 
 struct AutoGCSlice
 {
     AutoGCSlice(Statistics &stats, const ZoneGCStats &zoneStats, JSGCInvocationKind gckind,
                 JS::gcreason::Reason reason
--- a/js/src/gc/Verifier.cpp
+++ b/js/src/gc/Verifier.cpp
@@ -193,16 +193,18 @@ gc::GCRuntime::startVerifyPreBarriers()
         chunk->bitmap.clear();
 
     number++;
 
     VerifyPreTracer *trc = js_new<VerifyPreTracer>(rt, JSTraceCallback(nullptr));
     if (!trc)
         return;
 
+    gcstats::AutoPhase ap(stats, gcstats::PHASE_TRACE_HEAP);
+
     /*
      * Passing a function pointer directly to js_new trips a compiler bug in
      * MSVC. Work around by filling the pointer after allocating with nullptr.
      */
     trc->setTraceCallback(AccumulateEdge);
 
     const size_t size = 64 * 1024 * 1024;
     trc->root = (VerifyNode *)js_malloc(size);
@@ -490,20 +492,17 @@ js::gc::GCRuntime::endVerifyPostBarriers
     VerifyPostTracer::EdgeSet edges;
     AutoPrepareForTracing prep(rt, SkipAtoms);
 
     /* Visit every entry in the store buffer and put the edges in a hash set. */
     trc->setTraceCallback(PostVerifierCollectStoreBufferEdges);
     if (!edges.init())
         goto oom;
     trc->edges = &edges;
-    {
-        gcstats::AutoPhase ap(stats, gcstats::PHASE_MINOR_GC);
-        storeBuffer.markAll(trc);
-    }
+    storeBuffer.markAll(trc);
 
     /* Walk the heap to find any edges not the the |edges| set. */
     trc->setTraceCallback(PostVerifierVisitEdge);
     for (GCZoneGroupIter zone(rt); !zone.done(); zone.next()) {
         for (size_t kind = 0; kind < FINALIZE_LIMIT; ++kind) {
             for (ZoneCellIterUnderGC cells(zone, AllocKind(kind)); !cells.done(); cells.next()) {
                 Cell *src = cells.getCell();
                 JS_TraceChildren(trc, src, MapAllocToTraceKind(AllocKind(kind)));
--- a/js/src/jit/BaselineIC.cpp
+++ b/js/src/jit/BaselineIC.cpp
@@ -9116,16 +9116,25 @@ GetTemplateObjectForClassHook(JSContext 
         Rooted<TypeDescr *> descr(cx, &args.callee().as<TypeDescr>());
         JSObject *obj = TypedObject::createZeroed(cx, descr, 1, gc::TenuredHeap);
         if (!obj)
             return false;
         templateObject.set(obj);
         return true;
     }
 
+    if (hook == SimdTypeDescr::call) {
+        Rooted<SimdTypeDescr *> descr(cx, &args.callee().as<SimdTypeDescr>());
+        JSObject *obj = TypedObject::createZeroed(cx, descr, 0, gc::TenuredHeap);
+        if (!obj)
+            return false;
+        templateObject.set(obj);
+        return true;
+    }
+
     return true;
 }
 
 static bool
 IsOptimizableCallStringSplit(Value callee, Value thisv, int argc, Value *args)
 {
     if (argc != 1 || !thisv.isString() || !args[0].isString())
         return false;
--- a/js/src/jit/IonBuilder.h
+++ b/js/src/jit/IonBuilder.h
@@ -708,17 +708,20 @@ class IonBuilder
 
     // Oracles.
     InliningDecision canInlineTarget(JSFunction *target, CallInfo &callInfo);
     InliningDecision makeInliningDecision(JSObject *target, CallInfo &callInfo);
     bool selectInliningTargets(ObjectVector &targets, CallInfo &callInfo,
                                BoolVector &choiceSet, uint32_t *numInlineable);
 
     // Native inlining helpers.
+    // The typeset for the return value of our function.  These are
+    // the types it's been observed returning in the past.
     types::TemporaryTypeSet *getInlineReturnTypeSet();
+    // The known MIR type of getInlineReturnTypeSet.
     MIRType getInlineReturnType();
 
     // Array natives.
     InliningStatus inlineArray(CallInfo &callInfo);
     InliningStatus inlineArrayPopShift(CallInfo &callInfo, MArrayPopShift::Mode mode);
     InliningStatus inlineArrayPush(CallInfo &callInfo);
     InliningStatus inlineArrayConcat(CallInfo &callInfo);
     InliningStatus inlineArrayJoin(CallInfo &callInfo);
@@ -768,17 +771,18 @@ class IonBuilder
     bool inlineUnsafeSetTypedObjectArrayElement(CallInfo &callInfo, uint32_t base,
                                                 ScalarTypeDescr::Type arrayType);
     InliningStatus inlineNewDenseArray(CallInfo &callInfo);
     InliningStatus inlineNewDenseArrayForSequentialExecution(CallInfo &callInfo);
     InliningStatus inlineNewDenseArrayForParallelExecution(CallInfo &callInfo);
 
     // Slot intrinsics.
     InliningStatus inlineUnsafeSetReservedSlot(CallInfo &callInfo);
-    InliningStatus inlineUnsafeGetReservedSlot(CallInfo &callInfo);
+    InliningStatus inlineUnsafeGetReservedSlot(CallInfo &callInfo,
+                                               MIRType knownValueType);
 
     // ForkJoin intrinsics
     InliningStatus inlineForkJoinGetSlice(CallInfo &callInfo);
 
     // TypedArray intrinsics.
     InliningStatus inlineIsTypedArray(CallInfo &callInfo);
     InliningStatus inlineTypedArrayLength(CallInfo &callInfo);
 
--- a/js/src/jit/IonTypes.h
+++ b/js/src/jit/IonTypes.h
@@ -384,29 +384,16 @@ enum MIRType
     MIRType_ForkJoinContext,           // js::ForkJoinContext*
     MIRType_Last = MIRType_ForkJoinContext,
     MIRType_Float32x4 = MIRType_Float32 | (2 << VECTOR_SCALE_SHIFT),
     MIRType_Int32x4   = MIRType_Int32   | (2 << VECTOR_SCALE_SHIFT),
     MIRType_Doublex2  = MIRType_Double  | (1 << VECTOR_SCALE_SHIFT)
 };
 
 static inline MIRType
-ElementType(MIRType type)
-{
-    JS_STATIC_ASSERT(MIRType_Last <= ELEMENT_TYPE_MASK);
-    return static_cast<MIRType>((type >> ELEMENT_TYPE_SHIFT) & ELEMENT_TYPE_MASK);
-}
-
-static inline uint32_t
-VectorSize(MIRType type)
-{
-    return 1 << ((type >> VECTOR_SCALE_SHIFT) & VECTOR_SCALE_MASK);
-}
-
-static inline MIRType
 MIRTypeFromValueType(JSValueType type)
 {
     // This function does not deal with magic types. Magic constants should be
     // filtered out in MIRTypeFromValue.
     switch (type) {
       case JSVAL_TYPE_DOUBLE:
         return MIRType_Double;
       case JSVAL_TYPE_INT32:
@@ -561,37 +548,26 @@ IsMagicType(MIRType type)
 }
 
 // Returns the number of vector elements (hereby called "length") for a given
 // SIMD kind. It is the Y part of the name "Foo x Y".
 static inline unsigned
 SimdTypeToLength(MIRType type)
 {
     MOZ_ASSERT(IsSimdType(type));
-    switch (type) {
-      case MIRType_Int32x4:
-      case MIRType_Float32x4:
-        return 4;
-      default: break;
-    }
-    MOZ_CRASH("unexpected SIMD kind");
+    return 1 << ((type >> VECTOR_SCALE_SHIFT) & VECTOR_SCALE_MASK);
 }
 
 static inline MIRType
 SimdTypeToScalarType(MIRType type)
 {
     MOZ_ASSERT(IsSimdType(type));
-    switch (type) {
-      case MIRType_Int32x4:
-        return MIRType_Int32;
-      case MIRType_Float32x4:
-        return MIRType_Float32;
-      default: break;
-    }
-    MOZ_CRASH("unexpected SIMD kind");
+    static_assert(MIRType_Last <= ELEMENT_TYPE_MASK,
+                  "ELEMENT_TYPE_MASK should be larger than the last MIRType");
+    return MIRType((type >> ELEMENT_TYPE_SHIFT) & ELEMENT_TYPE_MASK);
 }
 
 // Indicates a lane in a SIMD register: X for the first lane, Y for the second,
 // Z for the third (if any), W for the fourth (if any).
 enum SimdLane {
     LaneX = 0x0,
     LaneY = 0x1,
     LaneZ = 0x2,
--- a/js/src/jit/JitFrames.cpp
+++ b/js/src/jit/JitFrames.cpp
@@ -722,16 +722,18 @@ HandleException(ResumeFromException *rfe
 
     // Clear any Ion return override that's been set.
     // This may happen if a callVM function causes an invalidation (setting the
     // override), and then fails, bypassing the bailout handlers that would
     // otherwise clear the return override.
     if (cx->runtime()->jitRuntime()->hasIonReturnOverride())
         cx->runtime()->jitRuntime()->takeIonReturnOverride();
 
+    JitActivation *activation = cx->mainThread().activation()->asJit();
+
     // The Debugger onExceptionUnwind hook (reachable via
     // HandleExceptionBaseline below) may cause on-stack recompilation of
     // baseline scripts, which may patch return addresses on the stack. Since
     // JitFrameIterators cache the previous frame's return address when
     // iterating, we need a variant here that is automatically updated should
     // on-stack recompilation occur.
     DebugModeOSRVolatileJitFrameIterator iter(cx);
     while (!iter.isEntry()) {
@@ -783,16 +785,17 @@ HandleException(ResumeFromException *rfe
                 if (!frames.more()) {
                     TraceLogStopEvent(logger, TraceLogger_IonMonkey);
                     TraceLogStopEvent(logger, TraceLogger_Scripts);
                     break;
                 }
                 ++frames;
             }
 
+            activation->removeIonFrameRecovery(iter.jsFrame());
             if (invalidated)
                 ionScript->decrementInvalidationCount(cx->runtime()->defaultFreeOp());
 
         } else if (iter.isBaselineJS()) {
             // It's invalid to call DebugEpilogue twice for the same frame.
             bool calledDebugEpilogue = false;
 
             // Remember the pc we unwound the scope to.
--- a/js/src/jit/MCallOptimize.cpp
+++ b/js/src/jit/MCallOptimize.cpp
@@ -168,17 +168,25 @@ IonBuilder::inlineNativeCall(CallInfo &c
         return inlineUnsafePutElements(callInfo);
     if (native == intrinsic_NewDenseArray)
         return inlineNewDenseArray(callInfo);
 
     // Slot intrinsics.
     if (native == intrinsic_UnsafeSetReservedSlot)
         return inlineUnsafeSetReservedSlot(callInfo);
     if (native == intrinsic_UnsafeGetReservedSlot)
-        return inlineUnsafeGetReservedSlot(callInfo);
+        return inlineUnsafeGetReservedSlot(callInfo, MIRType_Value);
+    if (native == intrinsic_UnsafeGetObjectFromReservedSlot)
+        return inlineUnsafeGetReservedSlot(callInfo, MIRType_Object);
+    if (native == intrinsic_UnsafeGetInt32FromReservedSlot)
+        return inlineUnsafeGetReservedSlot(callInfo, MIRType_Int32);
+    if (native == intrinsic_UnsafeGetStringFromReservedSlot)
+        return inlineUnsafeGetReservedSlot(callInfo, MIRType_String);
+    if (native == intrinsic_UnsafeGetBooleanFromReservedSlot)
+        return inlineUnsafeGetReservedSlot(callInfo, MIRType_Boolean);
 
     // Parallel intrinsics.
     if (native == intrinsic_ShouldForceSequential ||
         native == intrinsic_InParallelSection)
         return inlineForceSequentialOrInParallelSection(callInfo);
     if (native == intrinsic_ForkJoinGetSlice)
         return inlineForkJoinGetSlice(callInfo);
 
@@ -2106,17 +2114,17 @@ IonBuilder::inlineUnsafeSetReservedSlot(
 
     if (NeedsPostBarrier(info(), callInfo.getArg(2)))
         current->add(MPostWriteBarrier::New(alloc(), callInfo.getArg(0), callInfo.getArg(2)));
 
     return InliningStatus_Inlined;
 }
 
 IonBuilder::InliningStatus
-IonBuilder::inlineUnsafeGetReservedSlot(CallInfo &callInfo)
+IonBuilder::inlineUnsafeGetReservedSlot(CallInfo &callInfo, MIRType knownValueType)
 {
     if (callInfo.argc() != 2 || callInfo.constructing())
         return InliningStatus_NotInlined;
     if (callInfo.getArg(0)->type() != MIRType_Object)
         return InliningStatus_NotInlined;
     if (callInfo.getArg(1)->type() != MIRType_Int32)
         return InliningStatus_NotInlined;
 
@@ -2126,16 +2134,27 @@ IonBuilder::inlineUnsafeGetReservedSlot(
         return InliningStatus_NotInlined;
     uint32_t slot = arg->constantValue().toPrivateUint32();
 
     callInfo.setImplicitlyUsedUnchecked();
 
     MLoadFixedSlot *load = MLoadFixedSlot::New(alloc(), callInfo.getArg(0), slot);
     current->add(load);
     current->push(load);
+    if (knownValueType != MIRType_Value) {
+        // We know what type we have in this slot.  Assert that this is in fact
+        // what we've seen coming from this slot in the past, then tell the
+        // MLoadFixedSlot about its result type.  That will make us do an
+        // infallible unbox as part of the slot load and then we'll barrier on
+        // the unbox result.  That way the type barrier code won't end up doing
+        // MIRType checks and conditional unboxing.
+        MOZ_ASSERT_IF(!getInlineReturnTypeSet()->empty(),
+                      getInlineReturnType() == knownValueType);
+        load->setResultType(knownValueType);
+    }
 
     // We don't track reserved slot types, so always emit a barrier.
     if (!pushTypeBarrier(load, getInlineReturnTypeSet(), BarrierKind::TypeSet))
         return InliningStatus_Error;
 
     return InliningStatus_Inlined;
 }
 
--- a/js/src/jit/MIR.h
+++ b/js/src/jit/MIR.h
@@ -1317,16 +1317,17 @@ class MConstant : public MNullaryInstruc
 // Generic constructor of SIMD valuesX4.
 class MSimdValueX4 : public MQuaternaryInstruction
 {
   protected:
     MSimdValueX4(MIRType type, MDefinition *x, MDefinition *y, MDefinition *z, MDefinition *w)
       : MQuaternaryInstruction(x, y, z, w)
     {
         MOZ_ASSERT(IsSimdType(type));
+        MOZ_ASSERT(SimdTypeToLength(type) == 4);
         mozilla::DebugOnly<MIRType> scalarType = SimdTypeToScalarType(type);
         MOZ_ASSERT(scalarType == x->type());
         MOZ_ASSERT(scalarType == y->type());
         MOZ_ASSERT(scalarType == z->type());
         MOZ_ASSERT(scalarType == w->type());
 
         setMovable();
         setResultType(type);
@@ -1336,16 +1337,20 @@ class MSimdValueX4 : public MQuaternaryI
     INSTRUCTION_HEADER(SimdValueX4)
 
     static MSimdValueX4 *New(TempAllocator &alloc, MIRType type, MDefinition *x,
                              MDefinition *y, MDefinition *z, MDefinition *w)
     {
         return new(alloc) MSimdValueX4(type, x, y, z, w);
     }
 
+    bool canConsumeFloat32(MUse *use) const {
+        return SimdTypeToScalarType(type()) == MIRType_Float32;
+    }
+
     AliasSet getAliasSet() const {
         return AliasSet::None();
     }
 
     bool congruentTo(const MDefinition *ins) const {
         return congruentIfOperandsEqual(ins);
     }
 
@@ -1372,16 +1377,20 @@ class MSimdSplatX4 : public MUnaryInstru
   public:
     INSTRUCTION_HEADER(SimdSplatX4)
 
     static MSimdSplatX4 *New(TempAllocator &alloc, MIRType type, MDefinition *v)
     {
         return new(alloc) MSimdSplatX4(type, v);
     }
 
+    bool canConsumeFloat32(MUse *use) const {
+        return SimdTypeToScalarType(type()) == MIRType_Float32;
+    }
+
     AliasSet getAliasSet() const {
         return AliasSet::None();
     }
 
     bool congruentTo(const MDefinition *ins) const {
         return congruentIfOperandsEqual(ins);
     }
 
@@ -1553,16 +1562,20 @@ class MSimdInsertElement : public MBinar
     }
     MDefinition *value() {
         return getOperand(1);
     }
     SimdLane lane() const {
         return lane_;
     }
 
+    bool canConsumeFloat32(MUse *use) const {
+        return use == getUseFor(1) && SimdTypeToScalarType(type()) == MIRType_Float32;
+    }
+
     AliasSet getAliasSet() const {
         return AliasSet::None();
     }
 
     bool congruentTo(const MDefinition *ins) const {
         return binaryCongruentTo(ins) && lane_ == ins->toSimdInsertElement()->lane();
     }
 
@@ -10587,24 +10600,28 @@ class MGetDOMProperty
     bool valueMayBeInSlot() const {
         return info_->isLazilyCachedInSlot;
     }
     MDefinition *object() {
         return getOperand(0);
     }
 
     bool congruentTo(const MDefinition *ins) const {
+        if (!ins->isGetDOMProperty())
+            return false;
+
+        return congruentTo(ins->toGetDOMProperty());
+    }
+
+    bool congruentTo(const MGetDOMProperty *ins) const {
         if (!isDomMovable())
             return false;
 
-        if (!ins->isGetDOMProperty())
-            return false;
-
         // Checking the jitinfo is the same as checking the constant function
-        if (!(info() == ins->toGetDOMProperty()->info()))
+        if (!(info() == ins->info()))
             return false;
 
         return congruentIfOperandsEqual(ins);
     }
 
     AliasSet getAliasSet() const {
         JSJitInfo::AliasSet aliasSet = domAliasSet();
         if (aliasSet == JSJitInfo::AliasNone)
@@ -10617,17 +10634,18 @@ class MGetDOMProperty
 
     bool possiblyCalls() const {
         return true;
     }
 };
 
 class MGetDOMMember : public MGetDOMProperty
 {
-    // We inherit everything from MGetDOMProperty except our possiblyCalls value
+    // We inherit everything from MGetDOMProperty except our
+    // possiblyCalls value and the congruentTo behavior.
     explicit MGetDOMMember(const JSJitInfo *jitinfo)
         : MGetDOMProperty(jitinfo)
     {
     }
 
   public:
     INSTRUCTION_HEADER(GetDOMMember)
 
@@ -10638,16 +10656,23 @@ class MGetDOMMember : public MGetDOMProp
         if (!res || !res->init(alloc, obj, guard, globalGuard))
             return nullptr;
         return res;
     }
 
     bool possiblyCalls() const {
         return false;
     }
+
+    bool congruentTo(const MDefinition *ins) const {
+        if (!ins->isGetDOMMember())
+            return false;
+
+        return MGetDOMProperty::congruentTo(ins->toGetDOMMember());
+    }
 };
 
 class MStringLength
   : public MUnaryInstruction,
     public StringPolicy<0>::Data
 {
     explicit MStringLength(MDefinition *string)
       : MUnaryInstruction(string)
--- a/js/src/jit/x64/MacroAssembler-x64.h
+++ b/js/src/jit/x64/MacroAssembler-x64.h
@@ -1160,19 +1160,16 @@ class MacroAssemblerX64 : public MacroAs
 
     void notBoolean(const ValueOperand &val) {
         xorq(Imm32(1), val.valueReg());
     }
 
     // Unbox any non-double value into dest. Prefer unboxInt32 or unboxBoolean
     // instead if the source type is known.
     void unboxNonDouble(const ValueOperand &src, Register dest) {
-        // In a non-trivial coupling, we're not permitted to use ScratchReg when
-        // src and dest are different registers, because of how extractObject is
-        // implemented.
         if (src.valueReg() == dest) {
             mov(ImmWord(JSVAL_PAYLOAD_MASK), ScratchReg);
             andq(ScratchReg, dest);
         } else {
             mov(ImmWord(JSVAL_PAYLOAD_MASK), dest);
             andq(src.valueReg(), dest);
         }
     }
@@ -1203,20 +1200,17 @@ class MacroAssemblerX64 : public MacroAs
     void unboxObject(const Address &src, Register dest) { unboxNonDouble(Operand(src), dest); }
     void unboxObject(const BaseIndex &src, Register dest) { unboxNonDouble(Operand(src), dest); }
 
     // Extended unboxing API. If the payload is already in a register, returns
     // that register. Otherwise, provides a move to the given scratch register,
     // and returns that.
     Register extractObject(const Address &address, Register scratch) {
         MOZ_ASSERT(scratch != ScratchReg);
-        loadPtr(address, ScratchReg);
-        // We have a special coupling with unboxObject. As long as the registers
-        // aren't equal, it doesn't use ScratchReg.
-        unboxObject(ValueOperand(ScratchReg), scratch);
+        unboxObject(address, scratch);
         return scratch;
     }
     Register extractObject(const ValueOperand &value, Register scratch) {
         MOZ_ASSERT(scratch != ScratchReg);
         unboxObject(value, scratch);
         return scratch;
     }
     Register extractInt32(const ValueOperand &value, Register scratch) {
--- a/js/src/jscntxt.h
+++ b/js/src/jscntxt.h
@@ -958,16 +958,20 @@ bool intrinsic_ThrowError(JSContext *cx,
 bool intrinsic_NewDenseArray(JSContext *cx, unsigned argc, Value *vp);
 bool intrinsic_IsConstructing(JSContext *cx, unsigned argc, Value *vp);
 bool intrinsic_SubstringKernel(JSContext *cx, unsigned argc, Value *vp);
 
 bool intrinsic_UnsafePutElements(JSContext *cx, unsigned argc, Value *vp);
 bool intrinsic_DefineDataProperty(JSContext *cx, unsigned argc, Value *vp);
 bool intrinsic_UnsafeSetReservedSlot(JSContext *cx, unsigned argc, Value *vp);
 bool intrinsic_UnsafeGetReservedSlot(JSContext *cx, unsigned argc, Value *vp);
+bool intrinsic_UnsafeGetObjectFromReservedSlot(JSContext *cx, unsigned argc, Value *vp);
+bool intrinsic_UnsafeGetInt32FromReservedSlot(JSContext *cx, unsigned argc, Value *vp);
+bool intrinsic_UnsafeGetStringFromReservedSlot(JSContext *cx, unsigned argc, Value *vp);
+bool intrinsic_UnsafeGetBooleanFromReservedSlot(JSContext *cx, unsigned argc, Value *vp);
 bool intrinsic_IsPackedArray(JSContext *cx, unsigned argc, Value *vp);
 
 bool intrinsic_ShouldForceSequential(JSContext *cx, unsigned argc, Value *vp);
 bool intrinsic_NewParallelArray(JSContext *cx, unsigned argc, Value *vp);
 bool intrinsic_ForkJoinGetSlice(JSContext *cx, unsigned argc, Value *vp);
 bool intrinsic_InParallelSection(JSContext *cx, unsigned argc, Value *vp);
 
 bool intrinsic_ObjectIsTypedObject(JSContext *cx, unsigned argc, Value *vp);
--- a/js/src/jsgc.cpp
+++ b/js/src/jsgc.cpp
@@ -2645,30 +2645,34 @@ GCRuntime::updatePointersToRelocatedCell
     // as much as possible.
     ArenasToUpdate source(rt);
     if (CanUseExtraThreads())
         updateAllCellPointersParallel(source);
     else
         updateAllCellPointersSerial(&trc, source);
 
     // Mark roots to update them.
-    markRuntime(&trc, MarkRuntime);
-    Debugger::markAll(&trc);
-    Debugger::markAllCrossCompartmentEdges(&trc);
-
-    for (GCCompartmentsIter c(rt); !c.done(); c.next()) {
-        WeakMapBase::markAll(c, &trc);
-        if (c->watchpointMap)
-            c->watchpointMap->markAll(&trc);
-    }
-
-    // Mark all gray roots, making sure we call the trace callback to get the
-    // current set.
-    if (JSTraceDataOp op = grayRootTracer.op)
-        (*op)(&trc, grayRootTracer.data);
+    {
+        markRuntime(&trc, MarkRuntime);
+
+        gcstats::AutoPhase ap(stats, gcstats::PHASE_MARK_ROOTS);
+        Debugger::markAll(&trc);
+        Debugger::markAllCrossCompartmentEdges(&trc);
+
+        for (GCCompartmentsIter c(rt); !c.done(); c.next()) {
+            WeakMapBase::markAll(c, &trc);
+            if (c->watchpointMap)
+                c->watchpointMap->markAll(&trc);
+        }
+
+        // Mark all gray roots, making sure we call the trace callback to get the
+        // current set.
+        if (JSTraceDataOp op = grayRootTracer.op)
+            (*op)(&trc, grayRootTracer.data);
+    }
 
     // Sweep everything to fix up weak pointers
     WatchpointMap::sweepAll(rt);
     Debugger::sweepAll(rt->defaultFreeOp());
     for (GCZonesIter zone(rt); !zone.done(); zone.next()) {
         if (CanRelocateZone(rt, zone))
             rt->gc.sweepZoneAfterCompacting(zone);
     }
@@ -4062,32 +4066,38 @@ GCRuntime::beginMarkPhase(JS::gcreason::
         gcstats::AutoPhase ap(stats, gcstats::PHASE_PURGE);
         purgeRuntime();
     }
 
     /*
      * Mark phase.
      */
     gcstats::AutoPhase ap1(stats, gcstats::PHASE_MARK);
-    gcstats::AutoPhase ap2(stats, gcstats::PHASE_MARK_ROOTS);
-
-    for (GCZonesIter zone(rt); !zone.done(); zone.next()) {
-        /* Unmark everything in the zones being collected. */
-        zone->allocator.arenas.unmarkAll();
-    }
-
-    for (GCCompartmentsIter c(rt); !c.done(); c.next()) {
-        /* Unmark all weak maps in the compartments being collected. */
-        WeakMapBase::unmarkCompartment(c);
-    }
-
-    if (isFull)
-        UnmarkScriptData(rt);
+
+    {
+        gcstats::AutoPhase ap(stats, gcstats::PHASE_UNMARK);
+
+        for (GCZonesIter zone(rt); !zone.done(); zone.next()) {
+            /* Unmark everything in the zones being collected. */
+            zone->allocator.arenas.unmarkAll();
+        }
+
+        for (GCCompartmentsIter c(rt); !c.done(); c.next()) {
+            /* Unmark all weak maps in the compartments being collected. */
+            WeakMapBase::unmarkCompartment(c);
+        }
+
+        if (isFull)
+            UnmarkScriptData(rt);
+    }
 
     markRuntime(gcmarker, MarkRuntime);
+
+    gcstats::AutoPhase ap2(stats, gcstats::PHASE_MARK_ROOTS);
+
     if (isIncremental)
         bufferGrayRoots();
 
     /*
      * This code ensures that if a compartment is "dead", then it will be
      * collected in this GC. A compartment is considered dead if its maybeAlive
      * flag is false. The maybeAlive flag is set if:
      *   (1) the compartment has incoming cross-compartment edges, or
@@ -4105,37 +4115,41 @@ GCRuntime::beginMarkPhase(JS::gcreason::
      *
      * Read barriers and allocations can also cause revival. This might happen
      * during a function like JS_TransplantObject, which iterates over all
      * compartments, live or dead, and operates on their objects. See bug 803376
      * for details on this problem. To avoid the problem, we try to avoid
      * allocation and read barriers during JS_TransplantObject and the like.
      */
 
-    /* Set the maybeAlive flag based on cross-compartment edges. */
-    for (CompartmentsIter c(rt, SkipAtoms); !c.done(); c.next()) {
-        for (JSCompartment::WrapperEnum e(c); !e.empty(); e.popFront()) {
-            const CrossCompartmentKey &key = e.front().key();
-            JSCompartment *dest;
-            switch (key.kind) {
-              case CrossCompartmentKey::ObjectWrapper:
-              case CrossCompartmentKey::DebuggerObject:
-              case CrossCompartmentKey::DebuggerSource:
-              case CrossCompartmentKey::DebuggerEnvironment:
-                dest = static_cast<JSObject *>(key.wrapped)->compartment();
-                break;
-              case CrossCompartmentKey::DebuggerScript:
-                dest = static_cast<JSScript *>(key.wrapped)->compartment();
-                break;
-              default:
-                dest = nullptr;
-                break;
+    {
+        gcstats::AutoPhase ap(stats, gcstats::PHASE_MARK_COMPARTMENTS);
+
+        /* Set the maybeAlive flag based on cross-compartment edges. */
+        for (CompartmentsIter c(rt, SkipAtoms); !c.done(); c.next()) {
+            for (JSCompartment::WrapperEnum e(c); !e.empty(); e.popFront()) {
+                const CrossCompartmentKey &key = e.front().key();
+                JSCompartment *dest;
+                switch (key.kind) {
+                  case CrossCompartmentKey::ObjectWrapper:
+                  case CrossCompartmentKey::DebuggerObject:
+                  case CrossCompartmentKey::DebuggerSource:
+                  case CrossCompartmentKey::DebuggerEnvironment:
+                    dest = static_cast<JSObject *>(key.wrapped)->compartment();
+                    break;
+                  case CrossCompartmentKey::DebuggerScript:
+                    dest = static_cast<JSScript *>(key.wrapped)->compartment();
+                    break;
+                  default:
+                    dest = nullptr;
+                    break;
+                }
+                if (dest)
+                    dest->maybeAlive = true;
             }
-            if (dest)
-                dest->maybeAlive = true;
         }
     }
 
     /*
      * For black roots, code in gc/Marking.cpp will already have set maybeAlive
      * during MarkRuntime.
      */
 
@@ -4295,37 +4309,38 @@ js::gc::MarkingValidator::nonIncremental
     }
 
     /*
      * After this point, the function should run to completion, so we shouldn't
      * do anything fallible.
      */
     initialized = true;
 
-    for (GCCompartmentsIter c(runtime); !c.done(); c.next())
-        WeakMapBase::unmarkCompartment(c);
-
     /* Re-do all the marking, but non-incrementally. */
     js::gc::State state = gc->incrementalState;
     gc->incrementalState = MARK_ROOTS;
 
-    MOZ_ASSERT(gcmarker->isDrained());
-    gcmarker->reset();
-
-    for (auto chunk = gc->allNonEmptyChunks(); !chunk.done(); chunk.next())
-        chunk->bitmap.clear();
-
     {
-        gcstats::AutoPhase ap1(gc->stats, gcstats::PHASE_MARK);
-        gcstats::AutoPhase ap2(gc->stats, gcstats::PHASE_MARK_ROOTS);
+        gcstats::AutoPhase ap(gc->stats, gcstats::PHASE_MARK);
+
+        {
+            gcstats::AutoPhase ap(gc->stats, gcstats::PHASE_UNMARK);
+
+            for (GCCompartmentsIter c(runtime); !c.done(); c.next())
+                WeakMapBase::unmarkCompartment(c);
+
+            MOZ_ASSERT(gcmarker->isDrained());
+            gcmarker->reset();
+
+            for (auto chunk = gc->allNonEmptyChunks(); !chunk.done(); chunk.next())
+                chunk->bitmap.clear();
+        }
+
         gc->markRuntime(gcmarker, GCRuntime::MarkRuntime, GCRuntime::UseSavedRoots);
-    }
-
-    {
-        gcstats::AutoPhase ap1(gc->stats, gcstats::PHASE_MARK);
+
         SliceBudget budget;
         gc->incrementalState = MARK;
         gc->marker.drainMarkStack(budget);
     }
 
     gc->incrementalState = SWEEP;
     {
         gcstats::AutoPhase ap1(gc->stats, gcstats::PHASE_SWEEP);
@@ -6086,17 +6101,17 @@ class AutoDisableStoreBuffer
  *
  * Returns true if we "reset" an existing incremental GC, which would force us
  * to run another cycle.
  */
 MOZ_NEVER_INLINE bool
 GCRuntime::gcCycle(bool incremental, SliceBudget &budget, JSGCInvocationKind gckind,
                    JS::gcreason::Reason reason)
 {
-    minorGC(reason);
+    evictNursery(reason);
 
     /*
      * Marking can trigger many incidental post barriers, some of them for
      * objects which are not going to be live after the GC.
      */
     AutoDisableStoreBuffer adsb(this);
 
     AutoTraceSession session(rt, MajorCollecting);
@@ -6460,40 +6475,38 @@ GCRuntime::onOutOfMallocMemory(const Aut
 
     // Immediately decommit as many arenas as possible in the hopes that this
     // might let the OS scrape together enough pages to satisfy the failing
     // malloc request.
     decommitAllWithoutUnlocking(lock);
 }
 
 void
-GCRuntime::minorGC(JS::gcreason::Reason reason)
+GCRuntime::minorGCImpl(JS::gcreason::Reason reason, Nursery::TypeObjectList *pretenureTypes)
 {
     minorGCRequested = false;
     TraceLoggerThread *logger = TraceLoggerForMainThread(rt);
     AutoTraceLog logMinorGC(logger, TraceLogger_MinorGC);
-    nursery.collect(rt, reason, nullptr);
+    nursery.collect(rt, reason, pretenureTypes);
     MOZ_ASSERT_IF(!rt->mainThread.suppressGC, nursery.isEmpty());
 }
 
+// Alternate to the runtime-taking form that allows marking type objects as
+// needing pretenuring.
 void
 GCRuntime::minorGC(JSContext *cx, JS::gcreason::Reason reason)
 {
-    // Alternate to the runtime-taking form above which allows marking type
-    // objects as needing pretenuring.
-    minorGCRequested = false;
-    TraceLoggerThread *logger = TraceLoggerForMainThread(rt);
-    AutoTraceLog logMinorGC(logger, TraceLogger_MinorGC);
+    gcstats::AutoPhase ap(stats, gcstats::PHASE_MINOR_GC);
+
     Nursery::TypeObjectList pretenureTypes;
-    nursery.collect(rt, reason, &pretenureTypes);
+    minorGCImpl(reason, &pretenureTypes);
     for (size_t i = 0; i < pretenureTypes.length(); i++) {
         if (pretenureTypes[i]->canPreTenure())
             pretenureTypes[i]->setShouldPreTenure(cx);
     }
-    MOZ_ASSERT_IF(!rt->mainThread.suppressGC, nursery.isEmpty());
 }
 
 void
 GCRuntime::disableGenerationalGC()
 {
     if (isGenerationalGCEnabled()) {
         minorGC(JS::gcreason::API);
         nursery.disable();
--- a/js/src/jsgcinlines.h
+++ b/js/src/jsgcinlines.h
@@ -325,41 +325,42 @@ class ZoneCellIter : public ZoneCellIter
     ArenaLists *lists;
     AllocKind kind;
 
   public:
     ZoneCellIter(JS::Zone *zone, AllocKind kind)
       : lists(&zone->allocator.arenas),
         kind(kind)
     {
+        JSRuntime *rt = zone->runtimeFromMainThread();
+
         /*
          * We have a single-threaded runtime, so there's no need to protect
          * against other threads iterating or allocating. However, we do have
          * background finalization; we have to wait for this to finish if it's
          * currently active.
          */
         if (IsBackgroundFinalized(kind) &&
             zone->allocator.arenas.needBackgroundFinalizeWait(kind))
         {
-            zone->runtimeFromMainThread()->gc.waitBackgroundSweepEnd();
+            rt->gc.waitBackgroundSweepEnd();
         }
 
         /* Evict the nursery before iterating so we can see all things. */
-        JSRuntime *rt = zone->runtimeFromMainThread();
         rt->gc.evictNursery();
 
         if (lists->isSynchronizedFreeList(kind)) {
             lists = nullptr;
         } else {
-            MOZ_ASSERT(!zone->runtimeFromMainThread()->isHeapBusy());
+            MOZ_ASSERT(!rt->isHeapBusy());
             lists->copyFreeListToArena(kind);
         }
 
         /* Assert that no GCs can occur while a ZoneCellIter is live. */
-        noAlloc.disallowAlloc(zone->runtimeFromMainThread());
+        noAlloc.disallowAlloc(rt);
 
         init(zone, kind);
     }
 
     ~ZoneCellIter() {
         if (lists)
             lists->clearFreeListInArena(kind);
     }
--- a/js/src/jsinfer.cpp
+++ b/js/src/jsinfer.cpp
@@ -44,51 +44,57 @@ using namespace js::types;
 
 using mozilla::DebugOnly;
 using mozilla::Maybe;
 using mozilla::PodArrayZero;
 using mozilla::PodCopy;
 using mozilla::PodZero;
 
 static inline jsid
-id_prototype(JSContext *cx) {
+id_prototype(JSContext *cx)
+{
     return NameToId(cx->names().prototype);
 }
 
+#ifdef DEBUG
+
 static inline jsid
-id___proto__(JSContext *cx) {
+id___proto__(JSContext *cx)
+{
     return NameToId(cx->names().proto);
 }
 
 static inline jsid
-id_constructor(JSContext *cx) {
+id_constructor(JSContext *cx)
+{
     return NameToId(cx->names().constructor);
 }
 
 static inline jsid
-id_caller(JSContext *cx) {
+id_caller(JSContext *cx)
+{
     return NameToId(cx->names().caller);
 }
 
-#ifdef DEBUG
 const char *
 types::TypeIdStringImpl(jsid id)
 {
     if (JSID_IS_VOID(id))
         return "(index)";
     if (JSID_IS_EMPTY(id))
         return "(new)";
     if (JSID_IS_SYMBOL(id))
         return "(symbol)";
     static char bufs[4][100];
     static unsigned which = 0;
     which = (which + 1) & 3;
     PutEscapedString(bufs[which], 100, JSID_TO_FLAT_STRING(id), 0);
     return bufs[which];
 }
+
 #endif
 
 /////////////////////////////////////////////////////////////////////
 // Logging
 /////////////////////////////////////////////////////////////////////
 
 #ifdef DEBUG
 
--- a/js/src/jsscript.h
+++ b/js/src/jsscript.h
@@ -57,22 +57,22 @@ namespace frontend {
 }
 
 /*
  * Type of try note associated with each catch or finally block, and also with
  * for-in and other kinds of loops. Non-for-in loops do not need these notes
  * for exception unwinding, but storing their boundaries here is helpful for
  * heuristics that need to know whether a given op is inside a loop.
  */
-typedef enum JSTryNoteKind {
+enum JSTryNoteKind {
     JSTRY_CATCH,
     JSTRY_FINALLY,
     JSTRY_ITER,
     JSTRY_LOOP
-} JSTryNoteKind;
+};
 
 /*
  * Exception handling record.
  */
 struct JSTryNote {
     uint8_t         kind;       /* one of JSTryNoteKind */
     uint32_t        stackDepth; /* stack depth upon exception handler entry */
     uint32_t        start;      /* start of the try statement or loop
@@ -1867,19 +1867,23 @@ class LazyScript : public gc::TenuredCel
     // ScriptSourceObject, or nullptr if the script in which this is nested
     // has not been compiled yet. This is never a CCW; we don't clone
     // LazyScripts into other compartments.
     HeapPtrObject sourceObject_;
 
     // Heap allocated table with any free variables or inner functions.
     void *table_;
 
+    // Add padding so LazyScript is gc::Cell aligned. Make padding protected
+    // instead of private to suppress -Wunused-private-field compiler warnings.
+  protected:
 #if JS_BITS_PER_WORD == 32
     uint32_t padding;
 #endif
+  private:
 
     struct PackedView {
         // Assorted bits that should really be in ScriptSourceObject.
         uint32_t version : 8;
 
         uint32_t numFreeVariables : 24;
         uint32_t numInnerFunctions : 23;
 
--- a/js/src/jstypes.h
+++ b/js/src/jstypes.h
@@ -99,17 +99,17 @@
 ** MACROS:      JS_BEGIN_MACRO
 **              JS_END_MACRO
 ** DESCRIPTION:
 **      Macro body brackets so that macros with compound statement definitions
 **      behave syntactically more like functions when called.
 ***********************************************************************/
 #define JS_BEGIN_MACRO  do {
 
-#if defined(_MSC_VER) && _MSC_VER >= 1400
+#if defined(_MSC_VER)
 # define JS_END_MACRO                                                         \
     } __pragma(warning(push)) __pragma(warning(disable:4127))                 \
     while (0) __pragma(warning(pop))
 #else
 # define JS_END_MACRO   } while (0)
 #endif
 
 /***********************************************************************
--- a/js/src/prmjtime.cpp
+++ b/js/src/prmjtime.cpp
@@ -18,27 +18,19 @@
 #include <time.h>
 
 #include "jstypes.h"
 #include "jsutil.h"
 
 #ifdef XP_WIN
 #include <windef.h>
 #include <winbase.h>
-/* VC++ 8.0 or later */
-#if _MSC_VER >= 1400
-#define NS_HAVE_INVALID_PARAMETER_HANDLER 1
-#endif
-#ifdef NS_HAVE_INVALID_PARAMETER_HANDLER
 #include <crtdbg.h>   /* for _CrtSetReportMode */
-#endif
 #include <mmsystem.h> /* for timeBegin/EndPeriod */
-#ifdef NS_HAVE_INVALID_PARAMETER_HANDLER
 #include <stdlib.h>   /* for _set_invalid_parameter_handler */
-#endif
 
 #include "prinit.h"
 
 #endif
 
 #ifdef XP_UNIX
 
 #ifdef _SVID_GETTOD   /* Defined only on Solaris, see Solaris <sys/types.h> */
@@ -250,17 +242,17 @@ PRMJ_Now()
         // cannot maintain the invariant that Date.now() never
         // decreases; the old implementation has this behavior as
         // well.
         needsCalibration = true;
     }
 }
 #endif
 
-#ifdef NS_HAVE_INVALID_PARAMETER_HANDLER
+#ifdef XP_WIN
 static void
 PRMJ_InvalidParameterHandler(const wchar_t *expression,
                              const wchar_t *function,
                              const wchar_t *file,
                              unsigned int   line,
                              uintptr_t      pReserved)
 {
     /* empty */
@@ -270,17 +262,17 @@ PRMJ_InvalidParameterHandler(const wchar
 /* Format a time value into a buffer. Same semantics as strftime() */
 size_t
 PRMJ_FormatTime(char *buf, int buflen, const char *fmt, PRMJTime *prtm)
 {
     size_t result = 0;
 #if defined(XP_UNIX) || defined(XP_WIN)
     struct tm a;
     int fake_tm_year = 0;
-#ifdef NS_HAVE_INVALID_PARAMETER_HANDLER
+#ifdef XP_WIN
     _invalid_parameter_handler oldHandler;
     int oldReportMode;
 #endif
 
     memset(&a, 0, sizeof(struct tm));
 
     a.tm_sec = prtm->tm_sec;
     a.tm_min = prtm->tm_min;
@@ -344,24 +336,24 @@ PRMJ_FormatTime(char *buf, int buflen, c
 
     /*
      * Even with the above, SunOS 4 seems to detonate if tm_zone and tm_gmtoff
      * are null.  This doesn't quite work, though - the timezone is off by
      * tzoff + dst.  (And mktime seems to return -1 for the exact dst
      * changeover time.)
      */
 
-#ifdef NS_HAVE_INVALID_PARAMETER_HANDLER
+#ifdef XP_WIN
     oldHandler = _set_invalid_parameter_handler(PRMJ_InvalidParameterHandler);
     oldReportMode = _CrtSetReportMode(_CRT_ASSERT, 0);
 #endif
 
     result = strftime(buf, buflen, fmt, &a);
 
-#ifdef NS_HAVE_INVALID_PARAMETER_HANDLER
+#ifdef XP_WIN
     _set_invalid_parameter_handler(oldHandler);
     _CrtSetReportMode(_CRT_ASSERT, oldReportMode);
 #endif
 
     if (fake_tm_year && result) {
         char real_year[16];
         char fake_year[16];
         size_t real_year_len;
--- a/js/src/vm/DateTime.cpp
+++ b/js/src/vm/DateTime.cpp
@@ -10,17 +10,19 @@
 
 #include "jsutil.h"
 
 using mozilla::UnspecifiedNaN;
 
 static bool
 ComputeLocalTime(time_t local, struct tm *ptm)
 {
-#ifdef HAVE_LOCALTIME_R
+#if defined(_WIN32)
+    return localtime_s(ptm, &local) == 0;
+#elif defined(HAVE_LOCALTIME_R)
     return localtime_r(&local, ptm);
 #else
     struct tm *otm = localtime(&local);
     if (!otm)
         return false;
     *ptm = *otm;
     return true;
 #endif
--- a/js/src/vm/NativeObject.cpp
+++ b/js/src/vm/NativeObject.cpp
@@ -263,17 +263,17 @@ js::NativeObject::slotInRange(uint32_t s
 {
     uint32_t capacity = numFixedSlots() + numDynamicSlots();
     if (sentinel == SENTINEL_ALLOWED)
         return slot <= capacity;
     return slot < capacity;
 }
 #endif /* DEBUG */
 
-#if defined(_MSC_VER) && _MSC_VER >= 1500
+#if defined(_MSC_VER)
 /*
  * Work around a compiler bug in MSVC9 and above, where inlining this function
  * causes stack pointer offsets to go awry and spp to refer to something higher
  * up the stack.
  */
 MOZ_NEVER_INLINE
 #endif
 Shape *
--- a/js/src/vm/SelfHosting.cpp
+++ b/js/src/vm/SelfHosting.cpp
@@ -575,16 +575,52 @@ js::intrinsic_UnsafeGetReservedSlot(JSCo
     MOZ_ASSERT(args[0].isObject());
     MOZ_ASSERT(args[1].isInt32());
 
     args.rval().set(args[0].toObject().as<NativeObject>().getReservedSlot(args[1].toPrivateUint32()));
     return true;
 }
 
 bool
+js::intrinsic_UnsafeGetObjectFromReservedSlot(JSContext *cx, unsigned argc, Value *vp)
+{
+    if (!intrinsic_UnsafeGetReservedSlot(cx, argc, vp))
+        return false;
+    MOZ_ASSERT(vp->isObject());
+    return true;
+}
+
+bool
+js::intrinsic_UnsafeGetInt32FromReservedSlot(JSContext *cx, unsigned argc, Value *vp)
+{
+    if (!intrinsic_UnsafeGetReservedSlot(cx, argc, vp))
+        return false;
+    MOZ_ASSERT(vp->isInt32());
+    return true;
+}
+
+bool
+js::intrinsic_UnsafeGetStringFromReservedSlot(JSContext *cx, unsigned argc, Value *vp)
+{
+    if (!intrinsic_UnsafeGetReservedSlot(cx, argc, vp))
+        return false;
+    MOZ_ASSERT(vp->isString());
+    return true;
+}
+
+bool
+js::intrinsic_UnsafeGetBooleanFromReservedSlot(JSContext *cx, unsigned argc, Value *vp)
+{
+    if (!intrinsic_UnsafeGetReservedSlot(cx, argc, vp))
+        return false;
+    MOZ_ASSERT(vp->isBoolean());
+    return true;
+}
+
+bool
 js::intrinsic_IsPackedArray(JSContext *cx, unsigned argc, Value *vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
     MOZ_ASSERT(args.length() == 1);
     MOZ_ASSERT(args[0].isObject());
 
     JSObject *obj = &args[0].toObject();
     bool isPacked = obj->is<ArrayObject>() && !obj->hasLazyType() &&
@@ -1070,16 +1106,24 @@ static const JSFunctionSpec intrinsic_fu
     JS_FN("DecompileArg",            intrinsic_DecompileArg,            2,0),
     JS_FN("RuntimeDefaultLocale",    intrinsic_RuntimeDefaultLocale,    0,0),
     JS_FN("SubstringKernel",         intrinsic_SubstringKernel,         3,0),
 
     JS_FN("UnsafePutElements",       intrinsic_UnsafePutElements,       3,0),
     JS_FN("_DefineDataProperty",     intrinsic_DefineDataProperty,      4,0),
     JS_FN("UnsafeSetReservedSlot",   intrinsic_UnsafeSetReservedSlot,   3,0),
     JS_FN("UnsafeGetReservedSlot",   intrinsic_UnsafeGetReservedSlot,   2,0),
+    JS_FN("UnsafeGetObjectFromReservedSlot",
+          intrinsic_UnsafeGetObjectFromReservedSlot, 2, 0),
+    JS_FN("UnsafeGetInt32FromReservedSlot",
+          intrinsic_UnsafeGetInt32FromReservedSlot, 2, 0),
+    JS_FN("UnsafeGetStringFromReservedSlot",
+          intrinsic_UnsafeGetStringFromReservedSlot, 2, 0),
+    JS_FN("UnsafeGetBooleanFromReservedSlot",
+          intrinsic_UnsafeGetBooleanFromReservedSlot, 2, 0),
     JS_FN("IsPackedArray",           intrinsic_IsPackedArray,           1,0),
 
     JS_FN("GetIteratorPrototype",    intrinsic_GetIteratorPrototype,    0,0),
 
     JS_FN("NewArrayIterator",        intrinsic_NewArrayIterator,        0,0),
     JS_FN("IsArrayIterator",         intrinsic_IsArrayIterator,         1,0),
     JS_FN("CallArrayIteratorMethodIfWrapped",
           CallNonGenericSelfhostedMethod<Is<ArrayIteratorObject>>,      2,0),
@@ -1640,8 +1684,12 @@ js::SelfHostedFunction(JSContext *cx, Ha
     return &func.toObject().as<JSFunction>();
 }
 
 bool
 js::IsSelfHostedFunctionWithName(JSFunction *fun, JSAtom *name)
 {
     return fun->isSelfHostedBuiltin() && fun->getExtendedSlot(0).toString() == name;
 }
+
+static_assert(JSString::MAX_LENGTH <= INT32_MAX,
+              "StringIteratorNext in builtin/String.js assumes the stored index "
+              "into the string is an Int32Value");
--- a/js/src/vm/String.cpp
+++ b/js/src/vm/String.cpp
@@ -767,18 +767,20 @@ StaticStrings::trace(JSTracer *trc)
         MarkPermanentAtom(trc, intStaticTable[i], "int-static-string");
 }
 
 template <typename CharT>
 /* static */ bool
 StaticStrings::isStatic(const CharT *chars, size_t length)
 {
     switch (length) {
-      case 1:
-        return chars[0] < UNIT_STATIC_LIMIT;
+      case 1: {
+        char16_t c = chars[0];
+        return c < UNIT_STATIC_LIMIT;
+      }
       case 2:
         return fitsInSmallChar(chars[0]) && fitsInSmallChar(chars[1]);
       case 3:
         if ('1' <= chars[0] && chars[0] <= '9' &&
             '0' <= chars[1] && chars[1] <= '9' &&
             '0' <= chars[2] && chars[2] <= '9') {
             int i = (chars[0] - '0') * 100 +
                       (chars[1] - '0') * 10 +
--- a/layout/reftests/bugs/reftest.list
+++ b/layout/reftests/bugs/reftest.list
@@ -1842,12 +1842,12 @@ test-pref(layout.css.grid.enabled,true) 
 == 1059498-2.html 1059498-1-ref.html
 == 1059498-3.html 1059498-1-ref.html
 fails-if(Android) == 1062792-1.html 1062792-1-ref.html
 == 1062963-floatmanager-reflow.html 1062963-floatmanager-reflow-ref.html
 test-pref(dom.webcomponents.enabled,true) == 1066554-1.html 1066554-1-ref.html
 == 1069716-1.html 1069716-1-ref.html
 == 1078262-1.html about:blank
 test-pref(layout.testing.overlay-scrollbars.always-visible,false) == 1081072-1.html 1081072-1-ref.html
-fuzzy-if(winWidget&&!layersGPUAccelerated,1,31) == 1081185-1.html 1081185-1-ref.html
+fuzzy-if(winWidget&&!layersGPUAccelerated,1,31) fuzzy-if(B2G,128,75) == 1081185-1.html 1081185-1-ref.html   # fuzzy with event-regions, see bug 1107843
 == 1097437-1.html 1097437-1-ref.html
 == 1105137-1.html 1105137-1-ref.html
 fuzzy-if(d2d,36,304) HTTP(..) == 1116480-1-fakeitalic-overflow.html 1116480-1-fakeitalic-overflow-ref.html
--- a/layout/svg/SVGTextFrame.cpp
+++ b/layout/svg/SVGTextFrame.cpp
@@ -895,16 +895,19 @@ TextRenderedRun::GetRunUserSpaceRect(nsP
 
   gfxSkipCharsIterator it = mFrame->EnsureTextRun(nsTextFrame::eInflated);
   gfxTextRun* textRun = mFrame->GetTextRun(nsTextFrame::eInflated);
 
   // Get the content range for this rendered run.
   uint32_t offset, length;
   ConvertOriginalToSkipped(it, mTextFrameContentOffset, mTextFrameContentLength,
                            offset, length);
+  if (length == 0) {
+    return r;
+  }
 
   // Measure that range.
   gfxTextRun::Metrics metrics =
     textRun->MeasureText(offset, length, gfxFont::LOOSE_INK_EXTENTS,
                          nullptr, nullptr);
 
   // Determine the rectangle that covers the rendered run's fill,
   // taking into account the measured vertical overflow due to
@@ -942,16 +945,17 @@ TextRenderedRun::GetRunUserSpaceRect(nsP
 
   // Include the fill if requested.
   if (aFlags & eIncludeFill) {
     r = fill;
   }
 
   // Include the stroke if requested.
   if ((aFlags & eIncludeStroke) &&
+      !fill.IsEmpty() &&
       nsSVGUtils::GetStrokeWidth(mFrame) > 0) {
     r.UnionEdges(nsSVGUtils::PathExtentsToMaxStrokeExtents(fill, mFrame,
                                                            gfxMatrix()));
   }
 
   return r;
 }
 
--- a/modules/libpref/Preferences.cpp
+++ b/modules/libpref/Preferences.cpp
@@ -582,24 +582,17 @@ Preferences::Observe(nsISupports *aSubje
                      const char16_t *someData)
 {
   if (XRE_GetProcessType() == GeckoProcessType_Content)
     return NS_ERROR_NOT_AVAILABLE;
 
   nsresult rv = NS_OK;
 
   if (!nsCRT::strcmp(aTopic, "profile-before-change")) {
-    if (!nsCRT::strcmp(someData, MOZ_UTF16("shutdown-cleanse"))) {
-      if (mCurrentFile) {
-        mCurrentFile->Remove(false);
-        mCurrentFile = nullptr;
-      }
-    } else {
-      rv = SavePrefFile(nullptr);
-    }
+    rv = SavePrefFile(nullptr);
   } else if (!strcmp(aTopic, "load-extension-defaults")) {
     pref_LoadPrefsInDirList(NS_EXT_PREFS_DEFAULTS_DIR_LIST);
   } else if (!nsCRT::strcmp(aTopic, "reload-default-prefs")) {
     // Reload the default prefs from file.
     pref_InitInitialObjects();
   } else if (!nsCRT::strcmp(aTopic, "suspend_process_notification")) {
     // Our process is being suspended. The OS may wake our process later,
     // or it may kill the process. In case our process is going to be killed
--- a/netwerk/base/src/BackgroundFileSaver.h
+++ b/netwerk/base/src/BackgroundFileSaver.h
@@ -49,17 +49,17 @@ public:
    * This is called automatically by the XPCOM infrastructure, and if this
    * fails, the factory will delete this object without returning a reference.
    */
   nsresult Init();
 
   /**
    * Used by nsNSSShutDownList to manage nsNSSShutDownObjects.
    */
-  void virtualDestroyNSSReference();
+  void virtualDestroyNSSReference() MOZ_OVERRIDE;
 
   /**
    * Number of worker threads that are currently running.
    */
   static uint32_t sThreadCount;
 
   /**
    * Maximum number of worker threads reached during the current download session,
@@ -395,17 +395,17 @@ class DigestOutputStream : public nsNSSS
 {
 public:
   NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIOUTPUTSTREAM
   // Constructor. Neither parameter may be null. The caller owns both.
   DigestOutputStream(nsIOutputStream* outputStream, PK11Context* aContext);
 
   // We don't own any NSS objects here, so no need to clean up
-  void virtualDestroyNSSReference() { }
+  void virtualDestroyNSSReference() MOZ_OVERRIDE { }
 
 private:
   ~DigestOutputStream();
 
   // Calls to write are passed to this stream.
   nsCOMPtr<nsIOutputStream> mOutputStream;
   // Digest context used to compute the hash, owned by the caller.
   PK11Context* mDigestContext;
--- a/netwerk/base/src/ProxyAutoConfig.cpp
+++ b/netwerk/base/src/ProxyAutoConfig.cpp
@@ -267,31 +267,31 @@ public:
   PACResolver()
     : mStatus(NS_ERROR_FAILURE)
   {
   }
 
   // nsIDNSListener
   NS_IMETHODIMP OnLookupComplete(nsICancelable *request,
                                  nsIDNSRecord *record,
-                                 nsresult status)
+                                 nsresult status) MOZ_OVERRIDE
   {
     if (mTimer) {
       mTimer->Cancel();
       mTimer = nullptr;
     }
 
     mRequest = nullptr;
     mStatus = status;
     mResponse = record;
     return NS_OK;
   }
 
   // nsITimerCallback
-  NS_IMETHODIMP Notify(nsITimer *timer) 
+  NS_IMETHODIMP Notify(nsITimer *timer) MOZ_OVERRIDE
   {
     if (mRequest)
       mRequest->Cancel(NS_ERROR_NET_TIMEOUT);
     mTimer = nullptr;
     return NS_OK;
   }
 
   nsresult                mStatus;
--- a/netwerk/base/src/nsAsyncStreamCopier.h
+++ b/netwerk/base/src/nsAsyncStreamCopier.h
@@ -26,17 +26,17 @@ public:
     // nsIAsyncStreamCopier2
     // We declare it by hand instead of NS_DECL_NSIASYNCSTREAMCOPIER2
     // as nsIAsyncStreamCopier2 duplicates methods of nsIAsyncStreamCopier
     NS_IMETHOD Init(nsIInputStream *aSource,
                     nsIOutputStream *aSink,
                     nsIEventTarget *aTarget,
                     uint32_t aChunkSize,
                     bool aCloseSource,
-                    bool aCloseSink);
+                    bool aCloseSink) MOZ_OVERRIDE;
 
     nsAsyncStreamCopier();
 
     //-------------------------------------------------------------------------
     // these methods may be called on any thread
 
     bool IsComplete(nsresult *status = nullptr);
     void   Complete(nsresult status);
--- a/netwerk/base/src/nsBufferedStreams.h
+++ b/netwerk/base/src/nsBufferedStreams.h
@@ -77,18 +77,18 @@ public:
 
     nsIInputStream* Source() { 
         return (nsIInputStream*)mStream;
     }
 
 protected:
     virtual ~nsBufferedInputStream() {}