Bug 1438193 - part11-4: Name r=surkov
authorTokio Kajitsuka <kajitsuka-tokio@g.ecc.u-tokyo.ac.jp>
Wed, 16 May 2018 01:13:02 +0900
changeset 475332 dfc05d5ae732ce78aa4076fac0fe5b2684925dbd
parent 475331 44b9d7960ab76edab58761b6d30be05b1138b72e
child 475333 152d027ef89db37d54da440898e66fd82aaea40b
push id1757
push userffxbld-merge
push dateFri, 24 Aug 2018 17:02:43 +0000
treeherdermozilla-release@736023aebdb1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssurkov
bugs1438193
milestone62.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1438193 - part11-4: Name r=surkov turn Name & ARIAName & NativeName into const functions
accessible/atk/ApplicationAccessibleWrap.cpp
accessible/atk/ApplicationAccessibleWrap.h
accessible/generic/Accessible.cpp
accessible/generic/Accessible.h
accessible/generic/ApplicationAccessible.cpp
accessible/generic/ApplicationAccessible.h
accessible/generic/DocAccessible.cpp
accessible/generic/DocAccessible.h
accessible/generic/HyperTextAccessible.cpp
accessible/generic/HyperTextAccessible.h
accessible/generic/ImageAccessible.cpp
accessible/generic/ImageAccessible.h
accessible/generic/RootAccessible.cpp
accessible/generic/RootAccessible.h
accessible/generic/TextLeafAccessible.cpp
accessible/generic/TextLeafAccessible.h
accessible/html/HTMLElementAccessibles.cpp
accessible/html/HTMLElementAccessibles.h
accessible/html/HTMLFormControlAccessible.cpp
accessible/html/HTMLFormControlAccessible.h
accessible/html/HTMLImageMapAccessible.cpp
accessible/html/HTMLImageMapAccessible.h
accessible/html/HTMLListAccessible.cpp
accessible/html/HTMLListAccessible.h
accessible/html/HTMLSelectAccessible.cpp
accessible/html/HTMLSelectAccessible.h
accessible/html/HTMLTableAccessible.cpp
accessible/html/HTMLTableAccessible.h
accessible/xul/XULAlertAccessible.cpp
accessible/xul/XULAlertAccessible.h
accessible/xul/XULElementAccessibles.cpp
accessible/xul/XULElementAccessibles.h
accessible/xul/XULFormControlAccessible.cpp
accessible/xul/XULFormControlAccessible.h
accessible/xul/XULListboxAccessible.cpp
accessible/xul/XULListboxAccessible.h
accessible/xul/XULMenuAccessible.cpp
accessible/xul/XULMenuAccessible.h
accessible/xul/XULTabAccessible.cpp
accessible/xul/XULTabAccessible.h
accessible/xul/XULTreeAccessible.cpp
accessible/xul/XULTreeAccessible.h
accessible/xul/XULTreeGridAccessible.cpp
accessible/xul/XULTreeGridAccessible.h
--- a/accessible/atk/ApplicationAccessibleWrap.cpp
+++ b/accessible/atk/ApplicationAccessibleWrap.cpp
@@ -73,17 +73,17 @@ toplevel_event_watcher(GSignalInvocation
 
     }
   }
 
   return TRUE;
 }
 
 ENameValueFlag
-ApplicationAccessibleWrap::Name(nsString& aName)
+ApplicationAccessibleWrap::Name(nsString& aName) const
 {
   // ATK doesn't provide a way to obtain an application name (for example,
   // Firefox or Thunderbird) like IA2 does. Thus let's return an application
   // name as accessible name that was used to get a branding name (for example,
   // Minefield aka nightly Firefox or Daily aka nightly Thunderbird).
   AppName(aName);
   return eNameOK;
 }
--- a/accessible/atk/ApplicationAccessibleWrap.h
+++ b/accessible/atk/ApplicationAccessibleWrap.h
@@ -14,17 +14,17 @@ namespace a11y {
 
 class ApplicationAccessibleWrap: public ApplicationAccessible
 {
 public:
   ApplicationAccessibleWrap();
   virtual ~ApplicationAccessibleWrap();
 
   // Accessible
-  virtual mozilla::a11y::ENameValueFlag Name(nsString& aName) override;
+  virtual mozilla::a11y::ENameValueFlag Name(nsString& aName) const override;
   virtual bool InsertChildAt(uint32_t aIdx, Accessible* aChild) override;
   virtual bool RemoveChild(Accessible* aChild) override;
 
   /**
    * Return the atk object for app root accessible.
    */
   virtual void GetNativeInterface(void** aOutAccessible) override;
 };
--- a/accessible/generic/Accessible.cpp
+++ b/accessible/generic/Accessible.cpp
@@ -119,17 +119,17 @@ Accessible::Accessible(nsIContent* aCont
 }
 
 Accessible::~Accessible()
 {
   NS_ASSERTION(!mDoc, "LastRelease was never called!?!");
 }
 
 ENameValueFlag
-Accessible::Name(nsString& aName)
+Accessible::Name(nsString& aName) const
 {
   aName.Truncate();
 
   if (!HasOwnContent())
     return eNameOK;
 
   ARIAName(aName);
   if (!aName.IsEmpty())
@@ -1995,17 +1995,17 @@ Accessible::Shutdown()
   mContent = nullptr;
   mDoc = nullptr;
   if (SelectionMgr() && SelectionMgr()->AccessibleWithCaret(nullptr) == this)
     SelectionMgr()->ResetCaretOffset();
 }
 
 // Accessible protected
 void
-Accessible::ARIAName(nsString& aName)
+Accessible::ARIAName(nsString& aName) const
 {
   // aria-labelledby now takes precedence over aria-label
   nsresult rv = nsTextEquivUtils::
     GetTextEquivFromIDRefs(this, nsGkAtoms::aria_labelledby, aName);
   if (NS_SUCCEEDED(rv)) {
     aName.CompressWhitespace();
   }
 
@@ -2014,17 +2014,17 @@ Accessible::ARIAName(nsString& aName)
       mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::aria_label,
                                      aName)) {
     aName.CompressWhitespace();
   }
 }
 
 // Accessible protected
 ENameValueFlag
-Accessible::NativeName(nsString& aName)
+Accessible::NativeName(nsString& aName) const
 {
   if (mContent->IsHTMLElement()) {
     Accessible* label = nullptr;
     HTMLLabelIterator iter(Document(), this);
     while ((label = iter.Next())) {
       nsTextEquivUtils::AppendTextEquivFromContent(this, label->GetContent(),
                                                    &aName);
       aName.CompressWhitespace();
--- a/accessible/generic/Accessible.h
+++ b/accessible/generic/Accessible.h
@@ -203,17 +203,17 @@ public:
   void Help(nsString& aHelp) const { aHelp.Truncate(); }
 
   /**
    * Get the name of this accessible.
    *
    * Note: aName.IsVoid() when name was left empty by the author on purpose.
    * aName.IsEmpty() when the author missed name, AT can try to repair a name.
    */
-  virtual ENameValueFlag Name(nsString& aName);
+  virtual ENameValueFlag Name(nsString& aName) const;
 
   /**
    * Maps ARIA state attributes to state of accessible. Note the given state
    * argument should hold states for accessible before you pass it into this
    * method.
    *
    * @param  [in/out] where to fill the states into.
    */
@@ -984,17 +984,17 @@ public:
 
 protected:
   virtual ~Accessible();
 
   /**
    * Return the accessible name provided by native markup. It doesn't take
    * into account ARIA markup used to specify the name.
    */
-  virtual mozilla::a11y::ENameValueFlag NativeName(nsString& aName);
+  virtual mozilla::a11y::ENameValueFlag NativeName(nsString& aName) const;
 
   /**
    * Return the accessible description provided by native markup. It doesn't take
    * into account ARIA markup used to specify the description.
    */
   virtual void NativeDescription(nsString& aDescription);
 
   /**
@@ -1065,17 +1065,17 @@ protected:
   mozilla::a11y::role ARIATransformRole(mozilla::a11y::role aRole) const;
 
   //////////////////////////////////////////////////////////////////////////////
   // Name helpers
 
   /**
    * Returns the accessible name specified by ARIA.
    */
-  void ARIAName(nsString& aName);
+  void ARIAName(nsString& aName) const;
 
   /**
    * Return the name for XUL element.
    */
   static void XULElmName(DocAccessible* aDocument,
                          nsIContent* aElm, nsString& aName);
 
   // helper method to verify frames
--- a/accessible/generic/ApplicationAccessible.cpp
+++ b/accessible/generic/ApplicationAccessible.cpp
@@ -29,17 +29,17 @@ ApplicationAccessible::ApplicationAccess
   mAppInfo = do_GetService("@mozilla.org/xre/app-info;1");
   MOZ_ASSERT(mAppInfo, "no application info");
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsIAccessible
 
 ENameValueFlag
-ApplicationAccessible::Name(nsString& aName)
+ApplicationAccessible::Name(nsString& aName) const
 {
   aName.Truncate();
 
   nsCOMPtr<nsIStringBundleService> bundleService =
     mozilla::services::GetStringBundleService();
 
   NS_ASSERTION(bundleService, "String bundle service must be present!");
   if (!bundleService)
--- a/accessible/generic/ApplicationAccessible.h
+++ b/accessible/generic/ApplicationAccessible.h
@@ -35,17 +35,17 @@ public:
   NS_INLINE_DECL_REFCOUNTING_INHERITED(ApplicationAccessible, AccessibleWrap)
 
   // Accessible
   virtual void Shutdown() override;
   virtual nsIntRect Bounds() const override;
   virtual nsRect BoundsInAppUnits() const override;
   virtual already_AddRefed<nsIPersistentProperties> NativeAttributes() override;
   virtual GroupPos GroupPosition() override;
-  virtual ENameValueFlag Name(nsString& aName) override;
+  virtual ENameValueFlag Name(nsString& aName) const override;
   virtual void ApplyARIAState(uint64_t* aState) const override;
   virtual void Description(nsString& aDescription) override;
   virtual void Value(nsString& aValue) override;
   virtual mozilla::a11y::role NativeRole() const override;
   virtual uint64_t State() override;
   virtual uint64_t NativeState() override;
   virtual Relation RelationByType(RelationType aType) const override;
 
--- a/accessible/generic/DocAccessible.cpp
+++ b/accessible/generic/DocAccessible.cpp
@@ -165,17 +165,17 @@ NS_INTERFACE_MAP_END_INHERITING(HyperTex
 
 NS_IMPL_ADDREF_INHERITED(DocAccessible, HyperTextAccessible)
 NS_IMPL_RELEASE_INHERITED(DocAccessible, HyperTextAccessible)
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsIAccessible
 
 ENameValueFlag
-DocAccessible::Name(nsString& aName)
+DocAccessible::Name(nsString& aName) const
 {
   aName.Truncate();
 
   if (mParent) {
     mParent->Name(aName); // Allow owning iframe to override the name
   }
   if (aName.IsEmpty()) {
     // Allow name via aria-labelledby or title attribute
--- a/accessible/generic/DocAccessible.h
+++ b/accessible/generic/DocAccessible.h
@@ -64,17 +64,17 @@ public:
 
   // Accessible
   virtual void Init();
   virtual void Shutdown() override;
   virtual nsIFrame* GetFrame() const override;
   virtual nsINode* GetNode() const override { return mDocumentNode; }
   nsIDocument* DocumentNode() const { return mDocumentNode; }
 
-  virtual mozilla::a11y::ENameValueFlag Name(nsString& aName) override;
+  virtual mozilla::a11y::ENameValueFlag Name(nsString& aName) const override;
   virtual void Description(nsString& aDescription) override;
   virtual Accessible* FocusedChild() override;
   virtual mozilla::a11y::role NativeRole() const override;
   virtual uint64_t NativeState() override;
   virtual uint64_t NativeInteractiveState() const override;
   virtual bool NativelyUnavailable() const override;
   virtual void ApplyARIAState(uint64_t* aState) const override;
   virtual already_AddRefed<nsIPersistentProperties> Attributes() override;
--- a/accessible/generic/HyperTextAccessible.cpp
+++ b/accessible/generic/HyperTextAccessible.cpp
@@ -1863,17 +1863,17 @@ HyperTextAccessible::RangeAtPoint(int32_
   }
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // Accessible public
 
 // Accessible protected
 ENameValueFlag
-HyperTextAccessible::NativeName(nsString& aName)
+HyperTextAccessible::NativeName(nsString& aName) const
 {
   // Check @alt attribute for invalid img elements.
   bool hasImgAlt = false;
   if (mContent->IsHTMLElement(nsGkAtoms::img)) {
     hasImgAlt =
       mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::alt, aName);
     if (!aName.IsEmpty())
       return eNameOK;
--- a/accessible/generic/HyperTextAccessible.h
+++ b/accessible/generic/HyperTextAccessible.h
@@ -430,17 +430,17 @@ public:
    * Return DOM selection object for the accessible.
    */
   dom::Selection* DOMSelection() const;
 
 protected:
   virtual ~HyperTextAccessible() { }
 
   // Accessible
-  virtual ENameValueFlag NativeName(nsString& aName) override;
+  virtual ENameValueFlag NativeName(nsString& aName) const override;
 
   // HyperTextAccessible
 
   /**
    * Transform magic offset into text offset.
    */
   index_t ConvertMagicOffset(int32_t aOffset) const;
 
--- a/accessible/generic/ImageAccessible.cpp
+++ b/accessible/generic/ImageAccessible.cpp
@@ -66,17 +66,17 @@ ImageAccessible::NativeState()
     if (animated)
       state |= states::ANIMATED;
   }
 
   return state;
 }
 
 ENameValueFlag
-ImageAccessible::NativeName(nsString& aName)
+ImageAccessible::NativeName(nsString& aName) const
 {
   bool hasAltAttrib =
     mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::alt, aName);
   if (!aName.IsEmpty())
     return eNameOK;
 
   ENameValueFlag nameFlag = Accessible::NativeName(aName);
   if (!aName.IsEmpty())
--- a/accessible/generic/ImageAccessible.h
+++ b/accessible/generic/ImageAccessible.h
@@ -34,17 +34,17 @@ public:
   // ImageAccessible
   nsIntPoint Position(uint32_t aCoordType);
   nsIntSize Size();
 
 protected:
   virtual ~ImageAccessible();
 
   // Accessible
-  virtual ENameValueFlag NativeName(nsString& aName) override;
+  virtual ENameValueFlag NativeName(nsString& aName) const override;
 
 private:
   /**
    * Return whether the element has a longdesc URI.
    */
   bool HasLongDesc() const
   {
     nsCOMPtr<nsIURI> uri = GetLongDescURI();
--- a/accessible/generic/RootAccessible.cpp
+++ b/accessible/generic/RootAccessible.cpp
@@ -68,17 +68,17 @@ RootAccessible::
 RootAccessible::~RootAccessible()
 {
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // Accessible
 
 ENameValueFlag
-RootAccessible::Name(nsString& aName)
+RootAccessible::Name(nsString& aName) const
 {
   aName.Truncate();
 
   if (ARIARoleMap()) {
     Accessible::Name(aName);
     if (!aName.IsEmpty())
       return eNameOK;
   }
--- a/accessible/generic/RootAccessible.h
+++ b/accessible/generic/RootAccessible.h
@@ -24,17 +24,17 @@ class RootAccessible : public DocAccessi
 public:
   RootAccessible(nsIDocument* aDocument, nsIPresShell* aPresShell);
 
   // nsIDOMEventListener
   NS_DECL_NSIDOMEVENTLISTENER
 
   // Accessible
   virtual void Shutdown() override;
-  virtual mozilla::a11y::ENameValueFlag Name(nsString& aName) override;
+  virtual mozilla::a11y::ENameValueFlag Name(nsString& aName) const override;
   virtual Relation RelationByType(RelationType aType) const override;
   virtual mozilla::a11y::role NativeRole() const override;
   virtual uint64_t NativeState() override;
 
   // RootAccessible
 
   /**
    * Notify that the sub document presshell was activated.
--- a/accessible/generic/TextLeafAccessible.cpp
+++ b/accessible/generic/TextLeafAccessible.cpp
@@ -41,14 +41,14 @@ TextLeafAccessible::NativeRole() const
 void
 TextLeafAccessible::AppendTextTo(nsAString& aText, uint32_t aStartOffset,
                                  uint32_t aLength)
 {
   aText.Append(Substring(mText, aStartOffset, aLength));
 }
 
 ENameValueFlag
-TextLeafAccessible::Name(nsString& aName)
+TextLeafAccessible::Name(nsString& aName) const
 {
   // Text node, ARIA can't be used.
   aName = mText;
   return eNameOK;
 }
--- a/accessible/generic/TextLeafAccessible.h
+++ b/accessible/generic/TextLeafAccessible.h
@@ -19,17 +19,17 @@ class TextLeafAccessible : public Linkab
 public:
   TextLeafAccessible(nsIContent* aContent, DocAccessible* aDoc);
   virtual ~TextLeafAccessible();
 
   // Accessible
   virtual mozilla::a11y::role NativeRole() const override;
   virtual void AppendTextTo(nsAString& aText, uint32_t aStartOffset = 0,
                             uint32_t aLength = UINT32_MAX) override;
-  virtual ENameValueFlag Name(nsString& aName) override;
+  virtual ENameValueFlag Name(nsString& aName) const override;
 
   // TextLeafAccessible
   void SetText(const nsAString& aText) { mText = aText; }
   const nsString& Text() const { return mText; }
 
 protected:
   nsString mText;
 };
--- a/accessible/html/HTMLElementAccessibles.cpp
+++ b/accessible/html/HTMLElementAccessibles.cpp
@@ -41,28 +41,28 @@ HTMLBRAccessible::NativeRole() const
 
 uint64_t
 HTMLBRAccessible::NativeState()
 {
   return states::READONLY;
 }
 
 ENameValueFlag
-HTMLBRAccessible::NativeName(nsString& aName)
+HTMLBRAccessible::NativeName(nsString& aName) const
 {
   aName = static_cast<char16_t>('\n');    // Newline char
   return eNameOK;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // HTMLLabelAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
 ENameValueFlag
-HTMLLabelAccessible::NativeName(nsString& aName)
+HTMLLabelAccessible::NativeName(nsString& aName) const
 {
   nsTextEquivUtils::GetNameFromSubtree(this, aName);
   return aName.IsEmpty() ? eNameOK : eNameFromSubtree;
 }
 
 Relation
 HTMLLabelAccessible::RelationByType(RelationType aType) const
 {
--- a/accessible/html/HTMLElementAccessibles.h
+++ b/accessible/html/HTMLElementAccessibles.h
@@ -39,17 +39,17 @@ public:
   }
 
   // Accessible
   virtual a11y::role NativeRole() const override;
   virtual uint64_t NativeState() override;
 
 protected:
   // Accessible
-  virtual ENameValueFlag NativeName(nsString& aName) override;
+  virtual ENameValueFlag NativeName(nsString& aName) const override;
 };
 
 /**
  * Used for HTML label element.
  */
 class HTMLLabelAccessible : public HyperTextAccessibleWrap
 {
 public:
@@ -65,17 +65,17 @@ public:
 
   // ActionAccessible
   virtual uint8_t ActionCount() override;
   virtual void ActionNameAt(uint8_t aIndex, nsAString& aName) override;
   virtual bool DoAction(uint8_t aIndex) override;
 
 protected:
   virtual ~HTMLLabelAccessible() {}
-  virtual ENameValueFlag NativeName(nsString& aName) override;
+  virtual ENameValueFlag NativeName(nsString& aName) const override;
 };
 
 /**
  * Used for HTML output element.
  */
 class HTMLOutputAccessible : public HyperTextAccessibleWrap
 {
 public:
--- a/accessible/html/HTMLFormControlAccessible.cpp
+++ b/accessible/html/HTMLFormControlAccessible.cpp
@@ -235,17 +235,17 @@ HTMLButtonAccessible::NativeState()
 
 role
 HTMLButtonAccessible::NativeRole() const
 {
   return roles::PUSHBUTTON;
 }
 
 ENameValueFlag
-HTMLButtonAccessible::NativeName(nsString& aName)
+HTMLButtonAccessible::NativeName(nsString& aName) const
 {
   // No need to check @value attribute for buttons since this attribute results
   // in native anonymous text node and the name is calculated from subtree.
   // The same magic works for @alt and @value attributes in case of type="image"
   // element that has no valid @src (note if input@type="image" has an image
   // then neither @alt nor @value attributes are used to generate a visual label
   // and thus we need to obtain the accessible name directly from attribute
   // value). Also the same algorithm works in case of default labels for
@@ -314,17 +314,17 @@ HTMLTextFieldAccessible::NativeAttribute
                              NS_LITERAL_STRING("searchbox"));
     }
   }
 
   return attributes.forget();
 }
 
 ENameValueFlag
-HTMLTextFieldAccessible::NativeName(nsString& aName)
+HTMLTextFieldAccessible::NativeName(nsString& aName) const
 {
   ENameValueFlag nameFlag = Accessible::NativeName(aName);
   if (!aName.IsEmpty())
     return nameFlag;
 
   // If part of compound of XUL widget then grab a name from XUL widget element.
   nsIContent* widgetElm = XULWidgetElm();
   if (widgetElm)
@@ -715,17 +715,17 @@ HTMLGroupboxAccessible::GetLegend() cons
       return legendContent;
     }
   }
 
   return nullptr;
 }
 
 ENameValueFlag
-HTMLGroupboxAccessible::NativeName(nsString& aName)
+HTMLGroupboxAccessible::NativeName(nsString& aName) const
 {
   ENameValueFlag nameFlag = Accessible::NativeName(aName);
   if (!aName.IsEmpty())
     return nameFlag;
 
   nsIContent* legendContent = GetLegend();
   if (legendContent)
     nsTextEquivUtils::AppendTextEquivFromContent(this, legendContent, &aName);
@@ -774,17 +774,17 @@ HTMLLegendAccessible::RelationByType(Rel
 
 HTMLFigureAccessible::
   HTMLFigureAccessible(nsIContent* aContent, DocAccessible* aDoc) :
   HyperTextAccessibleWrap(aContent, aDoc)
 {
 }
 
 ENameValueFlag
-HTMLFigureAccessible::NativeName(nsString& aName)
+HTMLFigureAccessible::NativeName(nsString& aName) const
 {
   ENameValueFlag nameFlag = HyperTextAccessibleWrap::NativeName(aName);
   if (!aName.IsEmpty())
     return nameFlag;
 
   nsIContent* captionContent = Caption();
   if (captionContent)
     nsTextEquivUtils::AppendTextEquivFromContent(this, captionContent, &aName);
--- a/accessible/html/HTMLFormControlAccessible.h
+++ b/accessible/html/HTMLFormControlAccessible.h
@@ -93,17 +93,17 @@ public:
   virtual void ActionNameAt(uint8_t aIndex, nsAString& aName) override;
   virtual bool DoAction(uint8_t aIndex) override;
 
   // Widgets
   virtual bool IsWidget() const override;
 
 protected:
   // Accessible
-  virtual ENameValueFlag NativeName(nsString& aName) override;
+  virtual ENameValueFlag NativeName(nsString& aName) const override;
 };
 
 
 /**
  * Accessible for HTML input@type="text", input@type="password", textarea and
  * other HTML text controls.
  */
 class HTMLTextFieldAccessible final : public HyperTextAccessibleWrap
@@ -135,17 +135,17 @@ public:
   // Widgets
   virtual bool IsWidget() const override;
   virtual Accessible* ContainerWidget() const override;
 
 protected:
   virtual ~HTMLTextFieldAccessible() {}
 
   // Accessible
-  virtual ENameValueFlag NativeName(nsString& aName) override;
+  virtual ENameValueFlag NativeName(nsString& aName) const override;
 
   /**
    * Return a XUL widget element this input is part of.
    */
   nsIContent* XULWidgetElm() const { return mContent->GetBindingParent(); }
 };
 
 
@@ -224,17 +224,17 @@ public:
   HTMLGroupboxAccessible(nsIContent* aContent, DocAccessible* aDoc);
 
   // Accessible
   virtual mozilla::a11y::role NativeRole() const override;
   virtual Relation RelationByType(RelationType aType) const override;
 
 protected:
   // Accessible
-  virtual ENameValueFlag NativeName(nsString& aName) override;
+  virtual ENameValueFlag NativeName(nsString& aName) const override;
 
   // HTMLGroupboxAccessible
   nsIContent* GetLegend() const;
 };
 
 
 /**
  * Accessible for HTML legend element.
@@ -256,17 +256,17 @@ class HTMLFigureAccessible : public Hype
 public:
   HTMLFigureAccessible(nsIContent* aContent, DocAccessible* aDoc);
 
   // Accessible
   virtual Relation RelationByType(RelationType aType) const override;
 
 protected:
   // Accessible
-  virtual ENameValueFlag NativeName(nsString& aName) override;
+  virtual ENameValueFlag NativeName(nsString& aName) const override;
 
   // HTMLLegendAccessible
   nsIContent* Caption() const;
 };
 
 
 /**
  * Accessible for HTML5 figcaption element.
--- a/accessible/html/HTMLImageMapAccessible.cpp
+++ b/accessible/html/HTMLImageMapAccessible.cpp
@@ -138,17 +138,17 @@ HTMLAreaAccessible::
   // manages its tree itself.
   mStateFlags |= eNotNodeMapEntry;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // HTMLAreaAccessible: Accessible
 
 ENameValueFlag
-HTMLAreaAccessible::NativeName(nsString& aName)
+HTMLAreaAccessible::NativeName(nsString& aName) const
 {
   ENameValueFlag nameFlag = Accessible::NativeName(aName);
   if (!aName.IsEmpty())
     return nameFlag;
 
   if (!mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::alt, aName))
     Value(aName);
 
--- a/accessible/html/HTMLImageMapAccessible.h
+++ b/accessible/html/HTMLImageMapAccessible.h
@@ -65,17 +65,17 @@ public:
   virtual uint32_t StartOffset() override;
   virtual uint32_t EndOffset() override;
 
   virtual bool IsAcceptableChild(nsIContent* aEl) const override
     { return false; }
 
 protected:
   // Accessible
-  virtual ENameValueFlag NativeName(nsString& aName) override;
+  virtual ENameValueFlag NativeName(nsString& aName) const override;
 };
 
 
 ////////////////////////////////////////////////////////////////////////////////
 // Accessible downcasting method
 
 inline HTMLImageMapAccessible*
 Accessible::AsImageMap()
--- a/accessible/html/HTMLListAccessible.cpp
+++ b/accessible/html/HTMLListAccessible.cpp
@@ -142,17 +142,17 @@ HTMLListBulletAccessible::
 nsIFrame*
 HTMLListBulletAccessible::GetFrame() const
 {
   nsBlockFrame* blockFrame = do_QueryFrame(mContent->GetPrimaryFrame());
   return blockFrame ? blockFrame->GetBullet() : nullptr;
 }
 
 ENameValueFlag
-HTMLListBulletAccessible::Name(nsString &aName)
+HTMLListBulletAccessible::Name(nsString& aName) const
 {
   aName.Truncate();
 
   // Native anonymous content, ARIA can't be used. Get list bullet text.
   nsBlockFrame* blockFrame = do_QueryFrame(mContent->GetPrimaryFrame());
   if (blockFrame) {
     blockFrame->GetSpokenBulletText(aName);
   }
--- a/accessible/html/HTMLListAccessible.h
+++ b/accessible/html/HTMLListAccessible.h
@@ -75,17 +75,17 @@ private:
 class HTMLListBulletAccessible : public LeafAccessible
 {
 public:
   HTMLListBulletAccessible(nsIContent* aContent, DocAccessible* aDoc);
   virtual ~HTMLListBulletAccessible() { }
 
   // Accessible
   virtual nsIFrame* GetFrame() const override;
-  virtual ENameValueFlag Name(nsString& aName) override;
+  virtual ENameValueFlag Name(nsString& aName) const override;
   virtual a11y::role NativeRole() const override;
   virtual uint64_t NativeState() override;
   virtual void AppendTextTo(nsAString& aText, uint32_t aStartOffset = 0,
                             uint32_t aLength = UINT32_MAX) override;
 
   // HTMLListBulletAccessible
 
   /**
--- a/accessible/html/HTMLSelectAccessible.cpp
+++ b/accessible/html/HTMLSelectAccessible.cpp
@@ -143,17 +143,17 @@ HTMLSelectOptionAccessible::NativeRole()
 {
   if (GetCombobox())
     return roles::COMBOBOX_OPTION;
 
   return roles::OPTION;
 }
 
 ENameValueFlag
-HTMLSelectOptionAccessible::NativeName(nsString& aName)
+HTMLSelectOptionAccessible::NativeName(nsString& aName) const
 {
   // CASE #1 -- great majority of the cases
   // find the label attribute - this is what the W3C says we should use
   mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::label, aName);
   if (!aName.IsEmpty())
     return eNameOK;
 
   // CASE #2 -- no label parameter, get the first child,
--- a/accessible/html/HTMLSelectAccessible.h
+++ b/accessible/html/HTMLSelectAccessible.h
@@ -78,17 +78,17 @@ public:
   virtual void ActionNameAt(uint8_t aIndex, nsAString& aName) override;
   virtual bool DoAction(uint8_t aIndex) override;
 
   // Widgets
   virtual Accessible* ContainerWidget() const override;
 
 protected:
   // Accessible
-  virtual ENameValueFlag NativeName(nsString& aName) override;
+  virtual ENameValueFlag NativeName(nsString& aName) const override;
 
 private:
 
   /**
    * Return a select accessible the option belongs to if any.
    */
   Accessible* GetSelect() const
   {
--- a/accessible/html/HTMLTableAccessible.cpp
+++ b/accessible/html/HTMLTableAccessible.cpp
@@ -405,17 +405,17 @@ HTMLTableAccessible::NativeRole() const
 
 uint64_t
 HTMLTableAccessible::NativeState()
 {
   return Accessible::NativeState() | states::READONLY;
 }
 
 ENameValueFlag
-HTMLTableAccessible::NativeName(nsString& aName)
+HTMLTableAccessible::NativeName(nsString& aName) const
 {
   ENameValueFlag nameFlag = Accessible::NativeName(aName);
   if (!aName.IsEmpty())
     return nameFlag;
 
   // Use table caption as a name.
   Accessible* caption = Caption();
   if (caption) {
--- a/accessible/html/HTMLTableAccessible.h
+++ b/accessible/html/HTMLTableAccessible.h
@@ -168,17 +168,17 @@ public:
   virtual Relation RelationByType(RelationType aRelationType) const override;
 
   virtual bool InsertChildAt(uint32_t aIndex, Accessible* aChild) override;
 
 protected:
   virtual ~HTMLTableAccessible() {}
 
   // Accessible
-  virtual ENameValueFlag NativeName(nsString& aName) override;
+  virtual ENameValueFlag NativeName(nsString& aName) const 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/xul/XULAlertAccessible.cpp
+++ b/accessible/xul/XULAlertAccessible.cpp
@@ -34,17 +34,17 @@ XULAlertAccessible::NativeRole() const
 
 uint64_t
 XULAlertAccessible::NativeState()
 {
   return Accessible::NativeState() | states::ALERT;
 }
 
 ENameValueFlag
-XULAlertAccessible::Name(nsString& aName)
+XULAlertAccessible::Name(nsString& aName) const
 {
   // Screen readers need to read contents of alert, not the accessible name.
   // If we have both some screen readers will read the alert twice.
   aName.Truncate();
   return eNameOK;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
--- a/accessible/xul/XULAlertAccessible.h
+++ b/accessible/xul/XULAlertAccessible.h
@@ -18,17 +18,17 @@ namespace a11y {
 class XULAlertAccessible : public AccessibleWrap
 {
 public:
   XULAlertAccessible(nsIContent* aContent, DocAccessible* aDoc);
 
   NS_INLINE_DECL_REFCOUNTING_INHERITED(XULAlertAccessible, AccessibleWrap)
 
   // Accessible
-  virtual mozilla::a11y::ENameValueFlag Name(nsString& aName) override;
+  virtual mozilla::a11y::ENameValueFlag Name(nsString& aName) const override;
   virtual a11y::role NativeRole() const override;
   virtual uint64_t NativeState() override;
 
   // Widgets
   virtual bool IsWidget() const override;
   virtual Accessible* ContainerWidget() const override;
 
 protected:
--- a/accessible/xul/XULElementAccessibles.cpp
+++ b/accessible/xul/XULElementAccessibles.cpp
@@ -57,17 +57,17 @@ XULLabelAccessible::
 void
 XULLabelAccessible::Shutdown()
 {
   mValueTextLeaf = nullptr;
   HyperTextAccessibleWrap::Shutdown();
 }
 
 ENameValueFlag
-XULLabelAccessible::NativeName(nsString& aName)
+XULLabelAccessible::NativeName(nsString& aName) const
 {
   // if the value attr doesn't exist, the screen reader must get the accessible text
   // from the accessible text interface or from the children
   if (mValueTextLeaf)
     return mValueTextLeaf->Name(aName);
 
   return Accessible::NativeName(aName);
 }
@@ -183,17 +183,17 @@ void
 XULLinkAccessible::Value(nsString& aValue)
 {
   aValue.Truncate();
 
   mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::href, aValue);
 }
 
 ENameValueFlag
-XULLinkAccessible::NativeName(nsString& aName)
+XULLinkAccessible::NativeName(nsString& aName) const
 {
   mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::value, aName);
   if (!aName.IsEmpty())
     return eNameOK;
 
   nsTextEquivUtils::GetNameFromSubtree(this, aName);
   return aName.IsEmpty() ? eNameOK : eNameFromSubtree;
 }
--- a/accessible/xul/XULElementAccessibles.h
+++ b/accessible/xul/XULElementAccessibles.h
@@ -27,17 +27,17 @@ public:
   virtual a11y::role NativeRole() const override;
   virtual uint64_t NativeState() override;
   virtual Relation RelationByType(RelationType aType) const override;
 
   void UpdateLabelValue(const nsString& aValue);
 
 protected:
   // Accessible
-  virtual ENameValueFlag NativeName(nsString& aName) override;
+  virtual ENameValueFlag NativeName(nsString& aName) const override;
 
 private:
   RefPtr<XULLabelTextLeafAccessible> mValueTextLeaf;
 };
 
 inline XULLabelAccessible*
 Accessible::AsXULLabel()
 {
@@ -99,17 +99,17 @@ public:
   virtual uint32_t StartOffset() override;
   virtual uint32_t EndOffset() override;
   virtual already_AddRefed<nsIURI> AnchorURIAt(uint32_t aAnchorIndex) override;
 
 protected:
   virtual ~XULLinkAccessible();
 
   // Accessible
-  virtual ENameValueFlag NativeName(nsString& aName) override;
+  virtual ENameValueFlag NativeName(nsString& aName) const override;
 
   enum { eAction_Jump = 0 };
 
 };
 
 } // namespace a11y
 } // namespace mozilla
 
--- a/accessible/xul/XULFormControlAccessible.cpp
+++ b/accessible/xul/XULFormControlAccessible.cpp
@@ -353,17 +353,17 @@ XULGroupboxAccessible::
 
 role
 XULGroupboxAccessible::NativeRole() const
 {
   return roles::GROUPING;
 }
 
 ENameValueFlag
-XULGroupboxAccessible::NativeName(nsString& aName)
+XULGroupboxAccessible::NativeName(nsString& aName) const
 {
   // XXX: we use the first related accessible only.
   Accessible* label =
     RelationByType(RelationType::LABELLED_BY).Next();
   if (label)
     return label->Name(aName);
 
   return eNameOK;
@@ -579,17 +579,17 @@ XULToolbarAccessible::
 
 role
 XULToolbarAccessible::NativeRole() const
 {
   return roles::TOOLBAR;
 }
 
 ENameValueFlag
-XULToolbarAccessible::NativeName(nsString& aName)
+XULToolbarAccessible::NativeName(nsString& aName) const
 {
   if (mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::toolbarname, aName))
     aName.CompressWhitespace();
 
   return eNameOK;
 }
 
 
--- a/accessible/xul/XULFormControlAccessible.h
+++ b/accessible/xul/XULFormControlAccessible.h
@@ -110,17 +110,17 @@ public:
   XULGroupboxAccessible(nsIContent* aContent, DocAccessible* aDoc);
 
   // Accessible
   virtual mozilla::a11y::role NativeRole() const override;
   virtual Relation RelationByType(RelationType aType) const override;
 
 protected:
   // Accessible
-  virtual ENameValueFlag NativeName(nsString& aName) override;
+  virtual ENameValueFlag NativeName(nsString& aName) const override;
 };
 
 /**
  * Used for XUL radio element (radio button).
  */
 class XULRadioButtonAccessible : public RadioButtonAccessible
 {
 
@@ -189,17 +189,17 @@ class XULToolbarAccessible : public Acce
 public:
   XULToolbarAccessible(nsIContent* aContent, DocAccessible* aDoc);
 
   // Accessible
   virtual mozilla::a11y::role NativeRole() const override;
 
 protected:
   // Accessible
-  virtual ENameValueFlag NativeName(nsString& aName) override;
+  virtual ENameValueFlag NativeName(nsString& aName) const override;
 };
 
 /**
  * Used for XUL toolbarseparator element.
  */
 class XULToolbarSeparatorAccessible : public LeafAccessible
 {
 public:
--- a/accessible/xul/XULListboxAccessible.cpp
+++ b/accessible/xul/XULListboxAccessible.cpp
@@ -572,17 +572,17 @@ XULListitemAccessible::Description(nsStr
 ////////////////////////////////////////////////////////////////////////////////
 // XULListitemAccessible: Accessible
 
 /**
   * If there is a Listcell as a child ( not anonymous ) use it, otherwise
   *   default to getting the name from GetXULName
   */
 ENameValueFlag
-XULListitemAccessible::NativeName(nsString& aName)
+XULListitemAccessible::NativeName(nsString& aName) const
 {
   nsIContent* childContent = mContent->GetFirstChild();
   if (childContent) {
     if (childContent->NodeInfo()->Equals(nsGkAtoms::listcell,
                                          kNameSpaceID_XUL)) {
       childContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::label, aName);
       return eNameOK;
     }
--- a/accessible/xul/XULListboxAccessible.h
+++ b/accessible/xul/XULListboxAccessible.h
@@ -122,17 +122,17 @@ public:
 
   // Widgets
   virtual Accessible* ContainerWidget() const override;
 
 protected:
   virtual ~XULListitemAccessible();
 
   // Accessible
-  virtual ENameValueFlag NativeName(nsString& aName) override;
+  virtual ENameValueFlag NativeName(nsString& aName) const override;
 
   // XULListitemAccessible
 
   /**
    * Return listbox accessible for the listitem.
    */
   Accessible* GetListAccessible() const;
 
--- a/accessible/xul/XULMenuAccessible.cpp
+++ b/accessible/xul/XULMenuAccessible.cpp
@@ -128,17 +128,17 @@ XULMenuitemAccessible::NativeInteractive
 
     return states::UNAVAILABLE | states::FOCUSABLE | states::SELECTABLE;
   }
 
   return states::FOCUSABLE | states::SELECTABLE;
 }
 
 ENameValueFlag
-XULMenuitemAccessible::NativeName(nsString& aName)
+XULMenuitemAccessible::NativeName(nsString& aName) const
 {
   mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::label, aName);
   return eNameOK;
 }
 
 void
 XULMenuitemAccessible::Description(nsString& aDescription)
 {
@@ -357,17 +357,17 @@ uint64_t
 XULMenuSeparatorAccessible::NativeState()
 {
   // Isn't focusable, but can be offscreen/invisible -- only copy those states
   return XULMenuitemAccessible::NativeState() &
     (states::OFFSCREEN | states::INVISIBLE);
 }
 
 ENameValueFlag
-XULMenuSeparatorAccessible::NativeName(nsString& aName)
+XULMenuSeparatorAccessible::NativeName(nsString& aName) const
 {
   return eNameOK;
 }
 
 role
 XULMenuSeparatorAccessible::NativeRole() const
 {
   return roles::SEPARATOR;
@@ -435,17 +435,17 @@ XULMenupopupAccessible::NativeState()
 
   if (state & states::INVISIBLE)
     state |= states::OFFSCREEN | states::COLLAPSED;
 
   return state;
 }
 
 ENameValueFlag
-XULMenupopupAccessible::NativeName(nsString& aName)
+XULMenupopupAccessible::NativeName(nsString& aName) const
 {
   nsIContent* content = mContent;
   while (content && aName.IsEmpty()) {
     if (content->IsElement()) {
       content->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::label, aName);
     }
     content = content->GetFlattenedTreeParent();
   }
@@ -539,17 +539,17 @@ XULMenupopupAccessible::ContainerWidget(
 
 XULMenubarAccessible::
   XULMenubarAccessible(nsIContent* aContent, DocAccessible* aDoc) :
   AccessibleWrap(aContent, aDoc)
 {
 }
 
 ENameValueFlag
-XULMenubarAccessible::NativeName(nsString& aName)
+XULMenubarAccessible::NativeName(nsString& aName) const
 {
   aName.AssignLiteral("Application");
   return eNameOK;
 }
 
 role
 XULMenubarAccessible::NativeRole() const
 {
--- a/accessible/xul/XULMenuAccessible.h
+++ b/accessible/xul/XULMenuAccessible.h
@@ -39,17 +39,17 @@ public:
 
   // Widgets
   virtual bool IsActiveWidget() const override;
   virtual bool AreItemsOperable() const override;
   virtual Accessible* ContainerWidget() const override;
 
 protected:
   // Accessible
-  virtual ENameValueFlag NativeName(nsString& aName) override;
+  virtual ENameValueFlag NativeName(nsString& aName) const override;
 };
 
 /**
  * Used for XUL menuseparator element.
  */
 class XULMenuSeparatorAccessible : public XULMenuitemAccessible
 {
 public:
@@ -61,17 +61,17 @@ public:
 
   // ActionAccessible
   virtual uint8_t ActionCount() override;
   virtual void ActionNameAt(uint8_t aIndex, nsAString& aName) override;
   virtual bool DoAction(uint8_t aIndex) override;
 
 protected:
   // Accessible
-  virtual ENameValueFlag NativeName(nsString& aName) override;
+  virtual ENameValueFlag NativeName(nsString& aName) const override;
 };
 
 
 /**
  * Used for XUL menupopup and panel.
  */
 class XULMenupopupAccessible : public XULSelectControlAccessible
 {
@@ -86,17 +86,17 @@ public:
   virtual bool IsWidget() const override;
   virtual bool IsActiveWidget() const override;
   virtual bool AreItemsOperable() const override;
 
   virtual Accessible* ContainerWidget() const override;
 
 protected:
   // Accessible
-  virtual ENameValueFlag NativeName(nsString& aName) override;
+  virtual ENameValueFlag NativeName(nsString& aName) const override;
 };
 
 /**
  * Used for XUL menubar element.
  */
 class XULMenubarAccessible : public AccessibleWrap
 {
 public:
@@ -108,15 +108,15 @@ public:
   // Widget
   virtual bool IsActiveWidget() const override;
   virtual bool AreItemsOperable() const override;
   virtual Accessible* CurrentItem() const override;
   virtual void SetCurrentItem(const Accessible* aItem) override;
 
 protected:
   // Accessible
-  virtual ENameValueFlag NativeName(nsString& aName) override;
+  virtual ENameValueFlag NativeName(nsString& aName) const override;
 };
 
 } // namespace a11y
 } // namespace mozilla
 
 #endif
--- a/accessible/xul/XULTabAccessible.cpp
+++ b/accessible/xul/XULTabAccessible.cpp
@@ -150,17 +150,17 @@ XULTabsAccessible::ActionCount()
 
 void
 XULTabsAccessible::Value(nsString& aValue)
 {
   aValue.Truncate();
 }
 
 ENameValueFlag
-XULTabsAccessible::NativeName(nsString& aName)
+XULTabsAccessible::NativeName(nsString& aName) const
 {
   // no name
   return eNameOK;
 }
 
 
 ////////////////////////////////////////////////////////////////////////////////
 // XULTabpanelsAccessible
--- a/accessible/xul/XULTabAccessible.h
+++ b/accessible/xul/XULTabAccessible.h
@@ -49,17 +49,17 @@ public:
   virtual void Value(nsString& aValue) override;
   virtual a11y::role NativeRole() const override;
 
   // ActionAccessible
   virtual uint8_t ActionCount() override;
 
 protected:
   // Accessible
-  virtual ENameValueFlag NativeName(nsString& aName) override;
+  virtual ENameValueFlag NativeName(nsString& aName) const override;
 };
 
 
 /**
  * A container of tab panels, xul:tabpanels element.
  */
 class XULTabpanelsAccessible : public AccessibleWrap
 {
--- a/accessible/xul/XULTreeAccessible.cpp
+++ b/accessible/xul/XULTreeAccessible.cpp
@@ -1094,17 +1094,17 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(
 NS_INTERFACE_MAP_END_INHERITING(XULTreeItemAccessibleBase)
 NS_IMPL_ADDREF_INHERITED(XULTreeItemAccessible, XULTreeItemAccessibleBase)
 NS_IMPL_RELEASE_INHERITED(XULTreeItemAccessible, XULTreeItemAccessibleBase)
 
 ////////////////////////////////////////////////////////////////////////////////
 // XULTreeItemAccessible: nsIAccessible implementation
 
 ENameValueFlag
-XULTreeItemAccessible::Name(nsString& aName)
+XULTreeItemAccessible::Name(nsString& aName) const
 {
   aName.Truncate();
 
   GetCellName(mColumn, aName);
   return eNameOK;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
--- a/accessible/xul/XULTreeAccessible.h
+++ b/accessible/xul/XULTreeAccessible.h
@@ -229,17 +229,17 @@ public:
 
   // nsISupports and cycle collection
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(XULTreeItemAccessible,
                                            XULTreeItemAccessibleBase)
 
   // Accessible
   virtual void Shutdown() override;
-  virtual ENameValueFlag Name(nsString& aName) override;
+  virtual ENameValueFlag Name(nsString& aName) const override;
   virtual a11y::role NativeRole() const override;
 
   // XULTreeItemAccessibleBase
   virtual void RowInvalidated(int32_t aStartColIdx, int32_t aEndColIdx) override;
 
 protected:
   virtual ~XULTreeItemAccessible();
 
--- a/accessible/xul/XULTreeGridAccessible.cpp
+++ b/accessible/xul/XULTreeGridAccessible.cpp
@@ -288,17 +288,17 @@ XULTreeGridRowAccessible::Shutdown()
 
 role
 XULTreeGridRowAccessible::NativeRole() const
 {
   return roles::ROW;
 }
 
 ENameValueFlag
-XULTreeGridRowAccessible::Name(nsString& aName)
+XULTreeGridRowAccessible::Name(nsString& aName) const
 {
   aName.Truncate();
 
   // XXX: the row name sholdn't be a concatenation of cell names (bug 664384).
   nsCOMPtr<nsITreeColumn> column = nsCoreUtils::GetFirstSensibleColumn(mTree);
   while (column) {
     if (!aName.IsEmpty())
       aName.Append(' ');
@@ -471,17 +471,17 @@ XULTreeGridCellAccessible::Shutdown()
 
 Accessible*
 XULTreeGridCellAccessible::FocusedChild()
 {
   return nullptr;
 }
 
 ENameValueFlag
-XULTreeGridCellAccessible::Name(nsString& aName)
+XULTreeGridCellAccessible::Name(nsString& aName) const
 {
   aName.Truncate();
 
   if (!mTreeView)
     return eNameOK;
 
   mTreeView->GetCellText(mRow, mColumn, aName);
 
--- a/accessible/xul/XULTreeGridAccessible.h
+++ b/accessible/xul/XULTreeGridAccessible.h
@@ -77,17 +77,17 @@ public:
   // nsISupports and cycle collection
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(XULTreeGridRowAccessible,
                                            XULTreeItemAccessibleBase)
 
   // Accessible
   virtual void Shutdown() override;
   virtual a11y::role NativeRole() const override;
-  virtual ENameValueFlag Name(nsString& aName) override;
+  virtual ENameValueFlag Name(nsString& aName) const override;
   virtual Accessible* ChildAtPoint(int32_t aX, int32_t aY,
                                    EWhichChildAtPoint aWhichChild) override;
 
   virtual Accessible* GetChildAt(uint32_t aIndex) const override;
   virtual uint32_t ChildCount() const override;
 
   // XULTreeItemAccessibleBase
   XULTreeGridCellAccessible* GetCellAccessible(nsITreeColumn* aColumn)
@@ -123,17 +123,17 @@ public:
   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(XULTreeGridCellAccessible,
                                            LeafAccessible)
 
   // Accessible
   virtual void Shutdown() override;
   virtual TableCellAccessible* AsTableCell() override { return this; }
   virtual nsRect BoundsInAppUnits() const override;
   virtual nsIntRect BoundsInCSSPixels() const override;
-  virtual ENameValueFlag Name(nsString& aName) override;
+  virtual ENameValueFlag Name(nsString& aName) const override;
   virtual Accessible* FocusedChild() override;
   virtual already_AddRefed<nsIPersistentProperties> NativeAttributes() override;
   virtual int32_t IndexInParent() const override;
   virtual Relation RelationByType(RelationType aType) const override;
   virtual a11y::role NativeRole() const override;
   virtual uint64_t NativeState() override;
   virtual uint64_t NativeInteractiveState() const override;