Bug 1268544: Remove proxy-specific code paths from IAccessible and IA2 wrappers; r?tbsaunde draft
authorAaron Klotz <aklotz@mozilla.com>
Fri, 22 Jul 2016 14:20:42 -0600
changeset 397130 0c4f83c948f9422de5cd85d7387279167f5d3802
parent 397129 af269c12584896abd07290232ea98938ad6e33d5
child 397131 f192b86419ec85970035a86655a000dfb52334cf
push id25211
push useraklotz@mozilla.com
push dateFri, 05 Aug 2016 07:53:24 +0000
reviewerstbsaunde
bugs1268544
milestone50.0a1
Bug 1268544: Remove proxy-specific code paths from IAccessible and IA2 wrappers; r?tbsaunde MozReview-Commit-ID: J2LxsDU7trH
accessible/windows/ia2/ia2Accessible.cpp
accessible/windows/ia2/ia2AccessibleEditableText.cpp
accessible/windows/ia2/ia2AccessibleHyperlink.cpp
accessible/windows/ia2/ia2AccessibleHypertext.cpp
accessible/windows/ia2/ia2AccessibleText.cpp
accessible/windows/ia2/ia2AccessibleValue.cpp
accessible/windows/msaa/AccessibleWrap.cpp
--- a/accessible/windows/ia2/ia2Accessible.cpp
+++ b/accessible/windows/ia2/ia2Accessible.cpp
@@ -68,24 +68,17 @@ ia2Accessible::get_nRelations(long* aNRe
   if (!aNRelations)
     return E_INVALIDARG;
   *aNRelations = 0;
 
   AccessibleWrap* acc = static_cast<AccessibleWrap*>(this);
   if (acc->IsDefunct())
     return CO_E_OBJNOTCONNECTED;
 
-  if (acc->IsProxy()) {
-    // XXX evaluate performance of collecting all relation targets.
-    nsTArray<RelationType> types;
-    nsTArray<nsTArray<ProxyAccessible*>> targetSets;
-    acc->Proxy()->Relations(&types, &targetSets);
-    *aNRelations = types.Length();
-    return S_OK;
-  }
+  MOZ_ASSERT(!acc->IsProxy());
 
   for (uint32_t idx = 0; idx < ArrayLength(sRelationTypePairs); idx++) {
     if (sRelationTypePairs[idx].second == IA2_RELATION_NULL)
       continue;
 
     Relation rel = acc->RelationByType(sRelationTypePairs[idx].first);
     if (rel.Next())
       (*aNRelations)++;
@@ -104,43 +97,17 @@ ia2Accessible::get_relation(long aRelati
   if (!aRelation || aRelationIndex < 0)
     return E_INVALIDARG;
   *aRelation = nullptr;
 
   AccessibleWrap* acc = static_cast<AccessibleWrap*>(this);
   if (acc->IsDefunct())
     return CO_E_OBJNOTCONNECTED;
 
-  if (acc->IsProxy()) {
-    nsTArray<RelationType> types;
-    nsTArray<nsTArray<ProxyAccessible*>> targetSets;
-    acc->Proxy()->Relations(&types, &targetSets);
-
-    size_t targetSetCount = targetSets.Length();
-    for (size_t i = 0; i < targetSetCount; i++) {
-      uint32_t relTypeIdx = static_cast<uint32_t>(types[i]);
-      MOZ_ASSERT(sRelationTypePairs[relTypeIdx].first == types[i]);
-      if (sRelationTypePairs[relTypeIdx].second == IA2_RELATION_NULL)
-        continue;
-
-      if (static_cast<size_t>(aRelationIndex) == i) {
-        nsTArray<RefPtr<Accessible>> targets;
-        size_t targetCount = targetSets[i].Length();
-        for (size_t j = 0; j < targetCount; j++)
-          targets.AppendElement(WrapperFor(targetSets[i][j]));
-
-        RefPtr<ia2AccessibleRelation> rel =
-          new ia2AccessibleRelation(types[i], Move(targets));
-        rel.forget(aRelation);
-        return S_OK;
-      }
-    }
-
-    return E_INVALIDARG;
-  }
+  MOZ_ASSERT(!acc->IsProxy());
 
   long relIdx = 0;
   for (uint32_t idx = 0; idx < ArrayLength(sRelationTypePairs); idx++) {
     if (sRelationTypePairs[idx].second == IA2_RELATION_NULL)
       continue;
 
     RelationType relationType = sRelationTypePairs[idx].first;
     Relation rel = acc->RelationByType(relationType);
@@ -171,43 +138,17 @@ ia2Accessible::get_relations(long aMaxRe
   if (!aRelation || !aNRelations || aMaxRelations <= 0)
     return E_INVALIDARG;
   *aNRelations = 0;
 
   AccessibleWrap* acc = static_cast<AccessibleWrap*>(this);
   if (acc->IsDefunct())
     return CO_E_OBJNOTCONNECTED;
 
-  if (acc->IsProxy()) {
-    nsTArray<RelationType> types;
-    nsTArray<nsTArray<ProxyAccessible*>> targetSets;
-    acc->Proxy()->Relations(&types, &targetSets);
-
-    size_t count = std::min(targetSets.Length(),
-                            static_cast<size_t>(aMaxRelations));
-    size_t i = 0;
-    while (i < count) {
-      uint32_t relTypeIdx = static_cast<uint32_t>(types[i]);
-      if (sRelationTypePairs[relTypeIdx].second == IA2_RELATION_NULL)
-        continue;
-
-      size_t targetCount = targetSets[i].Length();
-      nsTArray<RefPtr<Accessible>> targets(targetCount);
-      for (size_t j = 0; j < targetCount; j++)
-        targets.AppendElement(WrapperFor(targetSets[i][j]));
-
-      RefPtr<ia2AccessibleRelation> rel =
-        new ia2AccessibleRelation(types[i], Move(targets));
-      rel.forget(aRelation + i);
-      i++;
-    }
-
-    *aNRelations = i;
-    return S_OK;
-  }
+  MOZ_ASSERT(!acc->IsProxy());
 
   for (uint32_t idx = 0; idx < ArrayLength(sRelationTypePairs) &&
        *aNRelations < aMaxRelations; idx++) {
     if (sRelationTypePairs[idx].second == IA2_RELATION_NULL)
       continue;
 
     RelationType relationType = sRelationTypePairs[idx].first;
     Relation rel = acc->RelationByType(relationType);
@@ -238,62 +179,52 @@ ia2Accessible::role(long* aRole)
 
 #define ROLE(_geckoRole, stringRole, atkRole, macRole, \
              msaaRole, ia2Role, nameRule) \
   case roles::_geckoRole: \
     *aRole = ia2Role; \
     break;
 
   a11y::role geckoRole;
-  if (acc->IsProxy())
-    geckoRole = acc->Proxy()->Role();
-  else
-    geckoRole = acc->Role();
+  MOZ_ASSERT(!acc->IsProxy());
+  geckoRole = acc->Role();
   switch (geckoRole) {
 #include "RoleMap.h"
     default:
       MOZ_CRASH("Unknown role.");
   }
 
 #undef ROLE
 
   // Special case, if there is a ROLE_ROW inside of a ROLE_TREE_TABLE, then call
   // the IA2 role a ROLE_OUTLINEITEM.
-  if (acc->IsProxy()) {
-    if (geckoRole == roles::ROW && acc->Proxy()->Parent() &&
-        acc->Proxy()->Parent()->Role() == roles::TREE_TABLE)
+  MOZ_ASSERT(!acc->IsProxy());
+  if (geckoRole == roles::ROW) {
+    Accessible* xpParent = acc->Parent();
+    if (xpParent && xpParent->Role() == roles::TREE_TABLE)
       *aRole = ROLE_SYSTEM_OUTLINEITEM;
-  } else {
-    if (geckoRole == roles::ROW) {
-      Accessible* xpParent = acc->Parent();
-      if (xpParent && xpParent->Role() == roles::TREE_TABLE)
-        *aRole = ROLE_SYSTEM_OUTLINEITEM;
-    }
   }
 
   return S_OK;
 
   A11Y_TRYBLOCK_END
 }
 
 STDMETHODIMP
 ia2Accessible::scrollTo(enum IA2ScrollType aScrollType)
 {
   A11Y_TRYBLOCK_BEGIN
 
   AccessibleWrap* acc = static_cast<AccessibleWrap*>(this);
   if (acc->IsDefunct())
     return CO_E_OBJNOTCONNECTED;
 
-  if (acc->IsProxy()) {
-    acc->Proxy()->ScrollTo(aScrollType);
-  } else {
-    nsCoreUtils::ScrollTo(acc->Document()->PresShell(), acc->GetContent(),
-                          aScrollType);
-  }
+  MOZ_ASSERT(!acc->IsProxy());
+  nsCoreUtils::ScrollTo(acc->Document()->PresShell(), acc->GetContent(),
+                        aScrollType);
 
   return S_OK;
 
   A11Y_TRYBLOCK_END
 }
 
 STDMETHODIMP
 ia2Accessible::scrollToPoint(enum IA2CoordinateType aCoordType,
@@ -304,21 +235,18 @@ ia2Accessible::scrollToPoint(enum IA2Coo
   AccessibleWrap* acc = static_cast<AccessibleWrap*>(this);
   if (acc->IsDefunct())
     return CO_E_OBJNOTCONNECTED;
 
   uint32_t geckoCoordType = (aCoordType == IA2_COORDTYPE_SCREEN_RELATIVE) ?
     nsIAccessibleCoordinateType::COORDTYPE_SCREEN_RELATIVE :
     nsIAccessibleCoordinateType::COORDTYPE_PARENT_RELATIVE;
 
-  if (acc->IsProxy()) {
-    acc->Proxy()->ScrollToPoint(geckoCoordType, aX, aY);
-  } else {
-    acc->ScrollToPoint(geckoCoordType, aX, aY);
-  }
+  MOZ_ASSERT(!acc->IsProxy());
+  acc->ScrollToPoint(geckoCoordType, aX, aY);
 
   return S_OK;
 
   A11Y_TRYBLOCK_END
 }
 
 STDMETHODIMP
 ia2Accessible::get_groupPosition(long* aGroupLevel,
@@ -368,20 +296,18 @@ ia2Accessible::get_states(AccessibleStat
 
   AccessibleWrap* acc = static_cast<AccessibleWrap*>(this);
   if (acc->IsDefunct()) {
     *aStates = IA2_STATE_DEFUNCT;
     return S_OK;
   }
 
   uint64_t state;
-  if (acc->IsProxy())
-    state = acc->Proxy()->State();
-  else
-    state = acc->State();
+  MOZ_ASSERT(!acc->IsProxy());
+  state = acc->State();
 
   if (state & states::INVALID)
     *aStates |= IA2_STATE_INVALID_ENTRY;
   if (state & states::REQUIRED)
     *aStates |= IA2_STATE_REQUIRED;
 
   // The following IA2 states are not supported by Gecko
   // IA2_STATE_ARMED
@@ -543,20 +469,18 @@ ia2Accessible::get_indexInParent(long* a
   if (!aIndexInParent)
     return E_INVALIDARG;
   *aIndexInParent = -1;
 
   AccessibleWrap* acc = static_cast<AccessibleWrap*>(this);
   if (acc->IsDefunct())
     return CO_E_OBJNOTCONNECTED;
 
-  if (acc->IsProxy())
-    *aIndexInParent = acc->Proxy()->IndexInParent();
-  else
-    *aIndexInParent = acc->IndexInParent();
+  MOZ_ASSERT(!acc->IsProxy());
+  *aIndexInParent = acc->IndexInParent();
 
   if (*aIndexInParent == -1)
     return S_FALSE;
 
   return S_OK;
 
   A11Y_TRYBLOCK_END
 }
@@ -627,19 +551,18 @@ ia2Accessible::get_attributes(BSTR* aAtt
 
   // The format is name:value;name:value; with \ for escaping these
   // characters ":;=,\".
   if (!acc->IsProxy()) {
     nsCOMPtr<nsIPersistentProperties> attributes = acc->Attributes();
     return ConvertToIA2Attributes(attributes, aAttributes);
   }
 
-  nsTArray<Attribute> attrs;
-  acc->Proxy()->Attributes(&attrs);
-  return ConvertToIA2Attributes(&attrs, aAttributes);
+  MOZ_ASSERT(!acc->IsProxy());
+  return E_UNEXPECTED;
 
   A11Y_TRYBLOCK_END
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // IAccessible2_2
 
 STDMETHODIMP
@@ -714,31 +637,22 @@ ia2Accessible::get_relationTargetsOfType
   if (!relationType)
     return E_INVALIDARG;
 
   AccessibleWrap* acc = static_cast<AccessibleWrap*>(this);
   if (acc->IsDefunct())
     return CO_E_OBJNOTCONNECTED;
 
   nsTArray<Accessible*> targets;
-  if (acc->IsProxy()) {
-    nsTArray<ProxyAccessible*> targetProxies =
-      acc->Proxy()->RelationByType(*relationType);
-
-    size_t targetCount = aMaxTargets;
-    if (targetProxies.Length() < targetCount)
-      targetCount = targetProxies.Length();
-    for (size_t i = 0; i < targetCount; i++)
-      targets.AppendElement(WrapperFor(targetProxies[i]));
-  } else {
-    Relation rel = acc->RelationByType(*relationType);
-    Accessible* target = nullptr;
-    while ((target = rel.Next()) &&
-           static_cast<long>(targets.Length()) <= aMaxTargets)
-      targets.AppendElement(target);
+  MOZ_ASSERT(!acc->IsProxy());
+  Relation rel = acc->RelationByType(*relationType);
+  Accessible* target = nullptr;
+  while ((target = rel.Next()) &&
+         static_cast<long>(targets.Length()) <= aMaxTargets) {
+    targets.AppendElement(target);
   }
 
   *aNTargets = targets.Length();
   *aTargets = static_cast<IUnknown**>(
     ::CoTaskMemAlloc(sizeof(IUnknown*) * *aNTargets));
   if (!*aTargets)
     return E_OUTOFMEMORY;
 
--- a/accessible/windows/ia2/ia2AccessibleEditableText.cpp
+++ b/accessible/windows/ia2/ia2AccessibleEditableText.cpp
@@ -19,19 +19,17 @@ using namespace mozilla::a11y;
 
 // IAccessibleEditableText
 
 STDMETHODIMP
 ia2AccessibleEditableText::copyText(long aStartOffset, long aEndOffset)
 {
   A11Y_TRYBLOCK_BEGIN
 
-  if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
-    return proxy->CopyText(aStartOffset, aEndOffset) ? S_OK : E_INVALIDARG;
-  }
+  MOZ_ASSERT(!HyperTextProxyFor(this));
 
   HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
   if (textAcc->IsDefunct())
     return CO_E_OBJNOTCONNECTED;
 
   if (!textAcc->IsValidRange(aStartOffset, aEndOffset))
     return E_INVALIDARG;
 
@@ -41,19 +39,17 @@ ia2AccessibleEditableText::copyText(long
   A11Y_TRYBLOCK_END
 }
 
 STDMETHODIMP
 ia2AccessibleEditableText::deleteText(long aStartOffset, long aEndOffset)
 {
   A11Y_TRYBLOCK_BEGIN
 
-    if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
-      return proxy->DeleteText(aStartOffset, aEndOffset) ? S_OK : E_INVALIDARG;
-    }
+  MOZ_ASSERT(!HyperTextProxyFor(this));
 
   HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
   if (textAcc->IsDefunct())
     return CO_E_OBJNOTCONNECTED;
 
   if (!textAcc->IsValidRange(aStartOffset, aEndOffset))
     return E_INVALIDARG;
 
@@ -65,19 +61,17 @@ ia2AccessibleEditableText::deleteText(lo
 
 STDMETHODIMP
 ia2AccessibleEditableText::insertText(long aOffset, BSTR *aText)
 {
   A11Y_TRYBLOCK_BEGIN
 
   uint32_t length = ::SysStringLen(*aText);
   nsAutoString text(*aText, length);
-  if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
-    return proxy->InsertText(text, aOffset) ? S_OK : E_INVALIDARG;
-  }
+  MOZ_ASSERT(!HyperTextProxyFor(this));
 
   HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
   if (textAcc->IsDefunct())
     return CO_E_OBJNOTCONNECTED;
 
   if (!textAcc->IsValidOffset(aOffset))
     return E_INVALIDARG;
 
@@ -87,19 +81,17 @@ ia2AccessibleEditableText::insertText(lo
   A11Y_TRYBLOCK_END
 }
 
 STDMETHODIMP
 ia2AccessibleEditableText::cutText(long aStartOffset, long aEndOffset)
 {
   A11Y_TRYBLOCK_BEGIN
 
-  if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
-    return proxy->CutText(aStartOffset, aEndOffset) ? S_OK : E_INVALIDARG;
-  }
+  MOZ_ASSERT(!HyperTextProxyFor(this));
 
   HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
   if (textAcc->IsDefunct())
     return CO_E_OBJNOTCONNECTED;
 
   if (!textAcc->IsValidRange(aStartOffset, aEndOffset))
     return E_INVALIDARG;
 
@@ -109,19 +101,17 @@ ia2AccessibleEditableText::cutText(long 
   A11Y_TRYBLOCK_END
 }
 
 STDMETHODIMP
 ia2AccessibleEditableText::pasteText(long aOffset)
 {
   A11Y_TRYBLOCK_BEGIN
 
-  if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
-    return proxy->PasteText(aOffset) ? S_OK : E_INVALIDARG;
-  }
+  MOZ_ASSERT(!HyperTextProxyFor(this));
 
   HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
   if (textAcc->IsDefunct())
     return CO_E_OBJNOTCONNECTED;
 
   if (!textAcc->IsValidOffset(aOffset))
     return E_INVALIDARG;
 
--- a/accessible/windows/ia2/ia2AccessibleHyperlink.cpp
+++ b/accessible/windows/ia2/ia2AccessibleHyperlink.cpp
@@ -48,27 +48,17 @@ ia2AccessibleHyperlink::get_anchor(long 
   A11Y_TRYBLOCK_BEGIN
 
   if (!aAnchor)
     return E_INVALIDARG;
 
   VariantInit(aAnchor);
 
   Accessible* thisObj = static_cast<AccessibleWrap*>(this);
-  if (thisObj->IsProxy()) {
-    ProxyAccessible* anchor = thisObj->Proxy()->AnchorAt(aIndex);
-    if (!anchor)
-      return S_FALSE;
-
-    IUnknown* tmp = static_cast<IAccessibleHyperlink*>(WrapperFor(anchor));
-    tmp->AddRef();
-    aAnchor->punkVal = tmp;
-    aAnchor->vt = VT_UNKNOWN;
-    return S_OK;
-  }
+  MOZ_ASSERT(!thisObj->IsProxy());
 
   if (thisObj->IsDefunct())
     return CO_E_OBJNOTCONNECTED;
 
   if (aIndex < 0 || aIndex >= static_cast<long>(thisObj->AnchorCount()))
     return E_INVALIDARG;
 
   if (!thisObj->IsLink())
@@ -92,46 +82,45 @@ ia2AccessibleHyperlink::get_anchor(long 
   A11Y_TRYBLOCK_END
 }
 
 STDMETHODIMP
 ia2AccessibleHyperlink::get_anchorTarget(long aIndex, VARIANT* aAnchorTarget)
 {
   A11Y_TRYBLOCK_BEGIN
 
-  if (!aAnchorTarget)
+  if (!aAnchorTarget) {
     return E_INVALIDARG;
+  }
 
   VariantInit(aAnchorTarget);
 
   Accessible* thisObj = static_cast<AccessibleWrap*>(this);
   nsAutoCString uriStr;
-  if (thisObj->IsProxy()) {
-    bool ok;
-    thisObj->Proxy()->AnchorURIAt(aIndex, uriStr, &ok);
-    if (!ok)
-      return S_FALSE;
+  MOZ_ASSERT(!thisObj->IsProxy());
+  if (thisObj->IsDefunct()) {
+    return CO_E_OBJNOTCONNECTED;
+  }
 
-  } else {
-    if (thisObj->IsDefunct())
-      return CO_E_OBJNOTCONNECTED;
+  if (aIndex < 0 || aIndex >= static_cast<long>(thisObj->AnchorCount())) {
+    return E_INVALIDARG;
+  }
 
-    if (aIndex < 0 || aIndex >= static_cast<long>(thisObj->AnchorCount()))
-      return E_INVALIDARG;
-
-    if (!thisObj->IsLink())
-      return S_FALSE;
+  if (!thisObj->IsLink()) {
+    return S_FALSE;
+  }
 
-    nsCOMPtr<nsIURI> uri = thisObj->AnchorURIAt(aIndex);
-    if (!uri)
-      return S_FALSE;
+  nsCOMPtr<nsIURI> uri = thisObj->AnchorURIAt(aIndex);
+  if (!uri) {
+    return S_FALSE;
+  }
 
-    nsresult rv = uri->GetSpec(uriStr);
-    if (NS_FAILED(rv))
-      return GetHRESULT(rv);
+  nsresult rv = uri->GetSpec(uriStr);
+  if (NS_FAILED(rv)) {
+    return GetHRESULT(rv);
   }
 
   nsAutoString stringURI;
   AppendUTF8toUTF16(uriStr, stringURI);
 
   aAnchorTarget->vt = VT_BSTR;
   aAnchorTarget->bstrVal = ::SysAllocStringLen(stringURI.get(),
                                                stringURI.Length());
@@ -145,21 +134,17 @@ ia2AccessibleHyperlink::get_startIndex(l
 {
   A11Y_TRYBLOCK_BEGIN
 
   if (!aIndex)
     return E_INVALIDARG;
 
   *aIndex = 0;
 
-  if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
-    bool valid;
-    *aIndex = proxy->StartOffset(&valid);
-    return valid ? S_OK : S_FALSE;
-  }
+  MOZ_ASSERT(!HyperTextProxyFor(this));
 
   Accessible* thisObj = static_cast<AccessibleWrap*>(this);
   if (thisObj->IsDefunct())
     return CO_E_OBJNOTCONNECTED;
 
   if (!thisObj->IsLink())
     return S_FALSE;
 
@@ -174,21 +159,17 @@ ia2AccessibleHyperlink::get_endIndex(lon
 {
   A11Y_TRYBLOCK_BEGIN
 
   if (!aIndex)
     return E_INVALIDARG;
 
   *aIndex = 0;
 
-  if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
-    bool valid;
-    *aIndex = proxy->EndOffset(&valid);
-    return valid ? S_OK : S_FALSE;
-  }
+  MOZ_ASSERT(!HyperTextProxyFor(this));
 
   Accessible* thisObj = static_cast<AccessibleWrap*>(this);
   if (thisObj->IsDefunct())
     return CO_E_OBJNOTCONNECTED;
 
   if (!thisObj->IsLink())
     return S_FALSE;
 
@@ -203,20 +184,17 @@ ia2AccessibleHyperlink::get_valid(boolea
 {
   A11Y_TRYBLOCK_BEGIN
 
   if (!aValid)
     return E_INVALIDARG;
 
   *aValid = false;
 
-  if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
-    *aValid = proxy->IsLinkValid();
-    return S_OK;
-  }
+  MOZ_ASSERT(!HyperTextProxyFor(this));
 
   Accessible* thisObj = static_cast<AccessibleWrap*>(this);
   if (thisObj->IsDefunct())
     return CO_E_OBJNOTCONNECTED;
 
   if (!thisObj->IsLink())
     return S_FALSE;
 
--- a/accessible/windows/ia2/ia2AccessibleHypertext.cpp
+++ b/accessible/windows/ia2/ia2AccessibleHypertext.cpp
@@ -21,20 +21,17 @@ ia2AccessibleHypertext::get_nHyperlinks(
 {
   A11Y_TRYBLOCK_BEGIN
 
   if (!aHyperlinkCount)
     return E_INVALIDARG;
 
   *aHyperlinkCount = 0;
 
-  if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
-    *aHyperlinkCount = proxy->LinkCount();
-    return S_OK;
-  }
+  MOZ_ASSERT(!HyperTextProxyFor(this));
 
   HyperTextAccessibleWrap* hyperText = static_cast<HyperTextAccessibleWrap*>(this);
   if (hyperText->IsDefunct())
     return CO_E_OBJNOTCONNECTED;
 
   *aHyperlinkCount = hyperText->LinkCount();
   return S_OK;
 
@@ -48,29 +45,23 @@ ia2AccessibleHypertext::get_hyperlink(lo
   A11Y_TRYBLOCK_BEGIN
 
   if (!aHyperlink)
     return E_INVALIDARG;
 
   *aHyperlink = nullptr;
 
   AccessibleWrap* hyperLink;
-  if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
-    ProxyAccessible* link = proxy->LinkAt(aLinkIndex);
-    if (!link)
-      return E_FAIL;
+  MOZ_ASSERT(!HyperTextProxyFor(this));
+  HyperTextAccessibleWrap* hyperText = static_cast<HyperTextAccessibleWrap*>(this);
+  if (hyperText->IsDefunct()) {
+    return CO_E_OBJNOTCONNECTED;
+  }
 
-    hyperLink = WrapperFor(link);
-  } else {
-    HyperTextAccessibleWrap* hyperText = static_cast<HyperTextAccessibleWrap*>(this);
-    if (hyperText->IsDefunct())
-      return CO_E_OBJNOTCONNECTED;
-
-    hyperLink = static_cast<AccessibleWrap*>(hyperText->LinkAt(aLinkIndex));
-  }
+  hyperLink = static_cast<AccessibleWrap*>(hyperText->LinkAt(aLinkIndex));
 
   if (!hyperLink)
     return E_FAIL;
 
   *aHyperlink =
     static_cast<IAccessibleHyperlink*>(hyperLink);
   (*aHyperlink)->AddRef();
   return S_OK;
@@ -83,20 +74,17 @@ ia2AccessibleHypertext::get_hyperlinkInd
 {
   A11Y_TRYBLOCK_BEGIN
 
   if (!aHyperlinkIndex)
     return E_INVALIDARG;
 
   *aHyperlinkIndex = 0;
 
-  if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
-    *aHyperlinkIndex = proxy->LinkIndexAtOffset(aCharIndex);
-    return S_OK;
-  }
+  MOZ_ASSERT(!HyperTextProxyFor(this));
 
   HyperTextAccessibleWrap* hyperAcc = static_cast<HyperTextAccessibleWrap*>(this);
   if (hyperAcc->IsDefunct())
     return CO_E_OBJNOTCONNECTED;
 
   *aHyperlinkIndex = hyperAcc->LinkIndexAtOffset(aCharIndex);
   return S_OK;
 
--- a/accessible/windows/ia2/ia2AccessibleText.cpp
+++ b/accessible/windows/ia2/ia2AccessibleText.cpp
@@ -25,20 +25,17 @@ bool ia2AccessibleText::sLastTextChangeW
 
 // IAccessibleText
 
 STDMETHODIMP
 ia2AccessibleText::addSelection(long aStartOffset, long aEndOffset)
 {
   A11Y_TRYBLOCK_BEGIN
 
-  if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
-    return proxy->AddToSelection(aStartOffset, aEndOffset) ?
-      S_OK : E_INVALIDARG;
-  }
+  MOZ_ASSERT(!HyperTextProxyFor(this));
 
   HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
   if (textAcc->IsDefunct())
     return CO_E_OBJNOTCONNECTED;
 
   return textAcc->AddToSelection(aStartOffset, aEndOffset) ?
     S_OK : E_INVALIDARG;
 
@@ -55,31 +52,26 @@ ia2AccessibleText::get_attributes(long a
     return E_INVALIDARG;
 
   *aStartOffset = 0;
   *aEndOffset = 0;
   *aTextAttributes = nullptr;
 
   int32_t startOffset = 0, endOffset = 0;
   HRESULT hr;
-  if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
-    AutoTArray<Attribute, 10> attrs;
-    proxy->TextAttributes(true, aOffset, &attrs, &startOffset, &endOffset);
-    hr = AccessibleWrap::ConvertToIA2Attributes(&attrs, aTextAttributes);
-  } else {
-    HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
-    if (textAcc->IsDefunct())
-      return CO_E_OBJNOTCONNECTED;
-
-    nsCOMPtr<nsIPersistentProperties> attributes =
-      textAcc->TextAttributes(true, aOffset, &startOffset, &endOffset);
-
-    hr = AccessibleWrap::ConvertToIA2Attributes(attributes, aTextAttributes);
+  MOZ_ASSERT(!HyperTextProxyFor(this));
+  HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
+  if (textAcc->IsDefunct()) {
+    return CO_E_OBJNOTCONNECTED;
   }
 
+  nsCOMPtr<nsIPersistentProperties> attributes =
+    textAcc->TextAttributes(true, aOffset, &startOffset, &endOffset);
+
+  hr = AccessibleWrap::ConvertToIA2Attributes(attributes, aTextAttributes);
   if (FAILED(hr))
     return hr;
 
   *aStartOffset = startOffset;
   *aEndOffset = endOffset;
 
   return S_OK;
 
@@ -91,25 +83,23 @@ ia2AccessibleText::get_caretOffset(long 
 {
   A11Y_TRYBLOCK_BEGIN
 
   if (!aOffset)
     return E_INVALIDARG;
 
   *aOffset = -1;
 
-  if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
-    *aOffset = proxy->CaretOffset();
-  } else {
-    HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
-    if (textAcc->IsDefunct())
-      return CO_E_OBJNOTCONNECTED;
+  MOZ_ASSERT(!HyperTextProxyFor(this));
+  HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
+  if (textAcc->IsDefunct()) {
+    return CO_E_OBJNOTCONNECTED;
+  }
 
-    *aOffset = textAcc->CaretOffset();
-  }
+  *aOffset = textAcc->CaretOffset();
 
   return *aOffset != -1 ? S_OK : S_FALSE;
 
   A11Y_TRYBLOCK_END
 }
 
 STDMETHODIMP
 ia2AccessibleText::get_characterExtents(long aOffset,
@@ -122,25 +112,22 @@ ia2AccessibleText::get_characterExtents(
   if (!aX || !aY || !aWidth || !aHeight)
     return E_INVALIDARG;
   *aX = *aY = *aWidth = *aHeight = 0;
 
   uint32_t geckoCoordType = (aCoordType == IA2_COORDTYPE_SCREEN_RELATIVE) ?
     nsIAccessibleCoordinateType::COORDTYPE_SCREEN_RELATIVE :
     nsIAccessibleCoordinateType::COORDTYPE_PARENT_RELATIVE;
   nsIntRect rect;
-  if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
-    rect = proxy->CharBounds(aOffset, geckoCoordType);
-  } else {
-    HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
-    if (textAcc->IsDefunct())
-      return CO_E_OBJNOTCONNECTED;
+  MOZ_ASSERT(!HyperTextProxyFor(this));
+  HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
+  if (textAcc->IsDefunct())
+    return CO_E_OBJNOTCONNECTED;
 
-    rect = textAcc->CharBounds(aOffset, geckoCoordType);
-  }
+  rect = textAcc->CharBounds(aOffset, geckoCoordType);
 
   *aX = rect.x;
   *aY = rect.y;
   *aWidth = rect.width;
   *aHeight = rect.height;
   return S_OK;
 
   A11Y_TRYBLOCK_END
@@ -150,25 +137,23 @@ STDMETHODIMP
 ia2AccessibleText::get_nSelections(long* aNSelections)
 {
   A11Y_TRYBLOCK_BEGIN
 
   if (!aNSelections)
     return E_INVALIDARG;
   *aNSelections = 0;
 
-  if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
-    *aNSelections = proxy->SelectionCount();
-  } else {
-    HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
-    if (textAcc->IsDefunct())
-      return CO_E_OBJNOTCONNECTED;
+  MOZ_ASSERT(!HyperTextProxyFor(this));
+  HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
+  if (textAcc->IsDefunct()) {
+    return CO_E_OBJNOTCONNECTED;
+  }
 
-    *aNSelections = textAcc->SelectionCount();
-  }
+  *aNSelections = textAcc->SelectionCount();
 
   return S_OK;
 
   A11Y_TRYBLOCK_END
 }
 
 STDMETHODIMP
 ia2AccessibleText::get_offsetAtPoint(long aX, long aY,
@@ -180,25 +165,23 @@ ia2AccessibleText::get_offsetAtPoint(lon
   if (!aOffset)
     return E_INVALIDARG;
   *aOffset = 0;
 
   uint32_t geckoCoordType = (aCoordType == IA2_COORDTYPE_SCREEN_RELATIVE) ?
     nsIAccessibleCoordinateType::COORDTYPE_SCREEN_RELATIVE :
     nsIAccessibleCoordinateType::COORDTYPE_PARENT_RELATIVE;
 
-  if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
-    *aOffset = proxy->OffsetAtPoint(aX, aY, geckoCoordType);
-  } else {
-    HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
-    if (textAcc->IsDefunct())
-      return CO_E_OBJNOTCONNECTED;
+  MOZ_ASSERT(!HyperTextProxyFor(this));
+  HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
+  if (textAcc->IsDefunct()) {
+    return CO_E_OBJNOTCONNECTED;
+  }
 
-    *aOffset = textAcc->OffsetAtPoint(aX, aY, geckoCoordType);
-  }
+  *aOffset = textAcc->OffsetAtPoint(aX, aY, geckoCoordType);
 
   return *aOffset == -1 ? S_FALSE : S_OK;
 
   A11Y_TRYBLOCK_END
 }
 
 STDMETHODIMP
 ia2AccessibleText::get_selection(long aSelectionIndex, long* aStartOffset,
@@ -206,28 +189,24 @@ ia2AccessibleText::get_selection(long aS
 {
   A11Y_TRYBLOCK_BEGIN
 
   if (!aStartOffset || !aEndOffset)
     return E_INVALIDARG;
   *aStartOffset = *aEndOffset = 0;
 
   int32_t startOffset = 0, endOffset = 0;
-  if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
-    nsString unused;
-    if (!proxy->SelectionBoundsAt(aSelectionIndex, unused, &startOffset,
-                                  &endOffset))
-      return E_INVALIDARG;
-  } else {
-    HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
-    if (textAcc->IsDefunct())
-      return CO_E_OBJNOTCONNECTED;
+  MOZ_ASSERT(!HyperTextProxyFor(this));
+  HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
+  if (textAcc->IsDefunct()) {
+    return CO_E_OBJNOTCONNECTED;
+  }
 
-    if (!textAcc->SelectionBoundsAt(aSelectionIndex, &startOffset, &endOffset))
-      return E_INVALIDARG;
+  if (!textAcc->SelectionBoundsAt(aSelectionIndex, &startOffset, &endOffset)) {
+    return E_INVALIDARG;
   }
 
   *aStartOffset = startOffset;
   *aEndOffset = endOffset;
   return S_OK;
 
   A11Y_TRYBLOCK_END
 }
@@ -238,30 +217,27 @@ ia2AccessibleText::get_text(long aStartO
   A11Y_TRYBLOCK_BEGIN
 
   if (!aText)
     return E_INVALIDARG;
 
   *aText = nullptr;
 
   nsAutoString text;
-  if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
-    if (!proxy->TextSubstring(aStartOffset, aEndOffset, text)) {
-      return E_INVALIDARG;
-    }
-  } else {
-    HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
-    if (textAcc->IsDefunct())
-      return CO_E_OBJNOTCONNECTED;
+  MOZ_ASSERT(!HyperTextProxyFor(this));
+  HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
+  if (textAcc->IsDefunct()) {
+    return CO_E_OBJNOTCONNECTED;
+  }
 
-    if (!textAcc->IsValidRange(aStartOffset, aEndOffset))
-      return E_INVALIDARG;
+  if (!textAcc->IsValidRange(aStartOffset, aEndOffset)) {
+    return E_INVALIDARG;
+  }
 
-    textAcc->TextSubstring(aStartOffset, aEndOffset, text);
-  }
+  textAcc->TextSubstring(aStartOffset, aEndOffset, text);
 
   if (text.IsEmpty())
     return S_FALSE;
 
   *aText = ::SysAllocStringLen(text.get(), text.Length());
   return *aText ? S_OK : E_OUTOFMEMORY;
 
   A11Y_TRYBLOCK_END
@@ -409,39 +385,34 @@ ia2AccessibleText::get_textAtOffset(long
   A11Y_TRYBLOCK_END
 }
 
 STDMETHODIMP
 ia2AccessibleText::removeSelection(long aSelectionIndex)
 {
   A11Y_TRYBLOCK_BEGIN
 
-    if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
-      return proxy->RemoveFromSelection(aSelectionIndex) ? S_OK : E_INVALIDARG;
-    }
+  MOZ_ASSERT(!HyperTextProxyFor(this));
 
   HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
   if (textAcc->IsDefunct())
     return CO_E_OBJNOTCONNECTED;
 
   return textAcc->RemoveFromSelection(aSelectionIndex) ?
     S_OK : E_INVALIDARG;
 
   A11Y_TRYBLOCK_END
 }
 
 STDMETHODIMP
 ia2AccessibleText::setCaretOffset(long aOffset)
 {
   A11Y_TRYBLOCK_BEGIN
 
-    if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
-      proxy->SetCaretOffset(aOffset);
-      return S_OK;
-    }
+  MOZ_ASSERT(!HyperTextProxyFor(this));
 
   HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
   if (textAcc->IsDefunct())
     return CO_E_OBJNOTCONNECTED;
 
   if (!textAcc->IsValidOffset(aOffset))
     return E_INVALIDARG;
 
@@ -452,20 +423,17 @@ ia2AccessibleText::setCaretOffset(long a
 }
 
 STDMETHODIMP
 ia2AccessibleText::setSelection(long aSelectionIndex, long aStartOffset,
                                 long aEndOffset)
 {
   A11Y_TRYBLOCK_BEGIN
 
-  if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
-    return proxy->SetSelectionBoundsAt(aSelectionIndex, aStartOffset,
-                                       aEndOffset) ? S_OK : E_INVALIDARG;
-  }
+  MOZ_ASSERT(!HyperTextProxyFor(this));
 
   HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
   if (textAcc->IsDefunct())
     return CO_E_OBJNOTCONNECTED;
 
   return textAcc->SetSelectionBoundsAt(aSelectionIndex, aStartOffset, aEndOffset) ?
     S_OK : E_INVALIDARG;
 
@@ -476,20 +444,17 @@ STDMETHODIMP
 ia2AccessibleText::get_nCharacters(long* aNCharacters)
 {
   A11Y_TRYBLOCK_BEGIN
 
   if (!aNCharacters)
     return E_INVALIDARG;
   *aNCharacters = 0;
 
-  if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
-    *aNCharacters = proxy->CharacterCount();
-    return S_OK;
-  }
+  MOZ_ASSERT(!HyperTextProxyFor(this));
 
   HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
   if (textAcc->IsDefunct())
     return CO_E_OBJNOTCONNECTED;
 
   *aNCharacters  = textAcc->CharacterCount();
   return S_OK;
 
@@ -497,20 +462,17 @@ ia2AccessibleText::get_nCharacters(long*
 }
 
 STDMETHODIMP
 ia2AccessibleText::scrollSubstringTo(long aStartIndex, long aEndIndex,
                                      enum IA2ScrollType aScrollType)
 {
   A11Y_TRYBLOCK_BEGIN
 
-    if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
-      proxy->ScrollSubstringTo(aStartIndex, aEndIndex, aScrollType);
-      return S_OK;
-    }
+  MOZ_ASSERT(!HyperTextProxyFor(this));
 
   HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
   if (textAcc->IsDefunct())
     return CO_E_OBJNOTCONNECTED;
 
   if (!textAcc->IsValidRange(aStartIndex, aEndIndex))
     return E_INVALIDARG;
 
@@ -526,21 +488,17 @@ ia2AccessibleText::scrollSubstringToPoin
                                           long aX, long aY)
 {
   A11Y_TRYBLOCK_BEGIN
 
   uint32_t geckoCoordType = (aCoordType == IA2_COORDTYPE_SCREEN_RELATIVE) ?
     nsIAccessibleCoordinateType::COORDTYPE_SCREEN_RELATIVE :
     nsIAccessibleCoordinateType::COORDTYPE_PARENT_RELATIVE;
 
-  if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
-    proxy->ScrollSubstringToPoint(aStartIndex, aEndIndex, geckoCoordType, aX,
-                                  aY);
-    return S_OK;
-  }
+  MOZ_ASSERT(!HyperTextProxyFor(this));
 
   HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
   if (textAcc->IsDefunct())
     return CO_E_OBJNOTCONNECTED;
 
   if (!textAcc->IsValidRange(aStartIndex, aEndIndex))
     return E_INVALIDARG;
 
--- a/accessible/windows/ia2/ia2AccessibleValue.cpp
+++ b/accessible/windows/ia2/ia2AccessibleValue.cpp
@@ -50,24 +50,22 @@ ia2AccessibleValue::get_currentValue(VAR
 
   if (!aCurrentValue)
     return E_INVALIDARG;
 
   VariantInit(aCurrentValue);
 
   AccessibleWrap* valueAcc = static_cast<AccessibleWrap*>(this);
   double currentValue;
-  if (valueAcc->IsProxy()) {
-    currentValue = valueAcc->Proxy()->CurValue();
-  } else {
-    if (valueAcc->IsDefunct())
-      return CO_E_OBJNOTCONNECTED;
+  MOZ_ASSERT(!valueAcc->IsProxy());
+  if (valueAcc->IsDefunct()) {
+    return CO_E_OBJNOTCONNECTED;
+  }
 
-    currentValue = valueAcc->CurValue();
-  }
+  currentValue = valueAcc->CurValue();
 
   if (IsNaN(currentValue))
     return S_FALSE;
 
   aCurrentValue->vt = VT_R8;
   aCurrentValue->dblVal = currentValue;
   return S_OK;
 
@@ -78,18 +76,17 @@ STDMETHODIMP
 ia2AccessibleValue::setCurrentValue(VARIANT aValue)
 {
   A11Y_TRYBLOCK_BEGIN
 
   if (aValue.vt != VT_R8)
     return E_INVALIDARG;
 
   AccessibleWrap* valueAcc = static_cast<AccessibleWrap*>(this);
-  if (valueAcc->IsProxy())
-    return valueAcc->Proxy()->SetCurValue(aValue.dblVal) ? S_OK : E_FAIL;
+  MOZ_ASSERT(!valueAcc->IsProxy());
 
   if (valueAcc->IsDefunct())
     return CO_E_OBJNOTCONNECTED;
 
   return valueAcc->SetCurValue(aValue.dblVal) ? S_OK : E_FAIL;
 
   A11Y_TRYBLOCK_END
 }
@@ -101,24 +98,22 @@ ia2AccessibleValue::get_maximumValue(VAR
 
   if (!aMaximumValue)
     return E_INVALIDARG;
 
   VariantInit(aMaximumValue);
 
   AccessibleWrap* valueAcc = static_cast<AccessibleWrap*>(this);
   double maximumValue;
-  if (valueAcc->IsProxy()) {
-    maximumValue = valueAcc->Proxy()->MaxValue();
-  } else {
-    if (valueAcc->IsDefunct())
-      return CO_E_OBJNOTCONNECTED;
+  MOZ_ASSERT(!valueAcc->IsProxy());
+  if (valueAcc->IsDefunct()) {
+    return CO_E_OBJNOTCONNECTED;
+  }
 
-    maximumValue = valueAcc->MaxValue();
-  }
+  maximumValue = valueAcc->MaxValue();
 
   if (IsNaN(maximumValue))
     return S_FALSE;
 
   aMaximumValue->vt = VT_R8;
   aMaximumValue->dblVal = maximumValue;
   return S_OK;
 
@@ -132,24 +127,22 @@ ia2AccessibleValue::get_minimumValue(VAR
 
   if (!aMinimumValue)
     return E_INVALIDARG;
 
   VariantInit(aMinimumValue);
 
   AccessibleWrap* valueAcc = static_cast<AccessibleWrap*>(this);
   double minimumValue;
-  if (valueAcc->IsProxy()) {
-    minimumValue = valueAcc->Proxy()->MinValue();
-  } else {
-    if (valueAcc->IsDefunct())
-      return CO_E_OBJNOTCONNECTED;
+  MOZ_ASSERT(!valueAcc->IsProxy());
+  if (valueAcc->IsDefunct()) {
+    return CO_E_OBJNOTCONNECTED;
+  }
 
-    minimumValue = valueAcc->MinValue();
-  }
+  minimumValue = valueAcc->MinValue();
 
   if (IsNaN(minimumValue))
     return S_FALSE;
 
   aMinimumValue->vt = VT_R8;
   aMinimumValue->dblVal = minimumValue;
   return S_OK;
 
--- a/accessible/windows/msaa/AccessibleWrap.cpp
+++ b/accessible/windows/msaa/AccessibleWrap.cpp
@@ -182,26 +182,16 @@ AccessibleWrap::get_accParent( IDispatch
   if (!ppdispParent)
     return E_INVALIDARG;
 
   *ppdispParent = nullptr;
 
   if (IsDefunct())
     return CO_E_OBJNOTCONNECTED;
 
-  if (IsProxy()) {
-    ProxyAccessible* proxy = Proxy();
-    ProxyAccessible* parent = proxy->Parent();
-    if (!parent)
-      return S_FALSE;
-
-    *ppdispParent = NativeAccessible(WrapperFor(parent));
-    return S_OK;
-  }
-
   DocAccessible* doc = AsDoc();
   if (doc) {
     // Return window system accessible object for root document and tab document
     // accessibles.
     if (!doc->ParentDocument() ||
         (nsWinUtils::IsWindowEmulationStarted() &&
          nsCoreUtils::IsTabDocument(doc->DocumentNode()))) {
       HWND hwnd = static_cast<HWND>(doc->GetNativeWindow());
@@ -231,25 +221,16 @@ AccessibleWrap::get_accChildCount( long 
   if (!pcountChildren)
     return E_INVALIDARG;
 
   *pcountChildren = 0;
 
   if (IsDefunct())
     return CO_E_OBJNOTCONNECTED;
 
-  if (IsProxy()) {
-    ProxyAccessible* proxy = Proxy();
-    if (proxy->MustPruneChildren())
-      return S_OK;
-
-    *pcountChildren = proxy->ChildrenCount();
-    return S_OK;
-  }
-
   if (nsAccUtils::MustPrune(this))
     return S_OK;
 
   *pcountChildren = ChildCount();
   return S_OK;
 
   A11Y_TRYBLOCK_END
 }
@@ -304,20 +285,17 @@ AccessibleWrap::get_accName(
   Accessible* xpAccessible = GetXPAccessibleFor(varChild);
   if (!xpAccessible)
     return E_INVALIDARG;
 
   if (xpAccessible->IsDefunct())
     return CO_E_OBJNOTCONNECTED;
 
   nsAutoString name;
-  if (xpAccessible->IsProxy())
-    xpAccessible->Proxy()->Name(name);
-  else
-    xpAccessible->Name(name);
+  xpAccessible->Name(name);
 
   // The name was not provided, e.g. no alt attribute for an image. A screen
   // reader may choose to invent its own accessible name, e.g. from an image src
   // attribute. Refer to eNoNameOnPurpose return value.
   if (name.IsVoid())
     return S_FALSE;
 
   *pszName = ::SysAllocStringLen(name.get(), name.Length());
@@ -346,20 +324,16 @@ AccessibleWrap::get_accValue(
 
   Accessible* xpAccessible = GetXPAccessibleFor(varChild);
   if (!xpAccessible)
     return E_INVALIDARG;
 
   if (xpAccessible->IsDefunct())
     return CO_E_OBJNOTCONNECTED;
 
-  // TODO make this work with proxies.
-  if (IsProxy())
-    return E_NOTIMPL;
-
   nsAutoString value;
   xpAccessible->Value(value);
 
   // See bug 438784: need to expose URL on doc's value attribute. For this,
   // reverting part of fix for bug 425693 to make this MSAA method behave
   // IAccessible2-style.
   if (value.IsEmpty())
     return S_FALSE;
@@ -389,20 +363,17 @@ AccessibleWrap::get_accDescription(VARIA
   Accessible* xpAccessible = GetXPAccessibleFor(varChild);
   if (!xpAccessible)
     return E_INVALIDARG;
 
   if (xpAccessible->IsDefunct())
     return CO_E_OBJNOTCONNECTED;
 
   nsAutoString description;
-  if (IsProxy())
-    xpAccessible->Proxy()->Description(description);
-  else
-    xpAccessible->Description(description);
+  xpAccessible->Description(description);
 
   *pszDescription = ::SysAllocStringLen(description.get(),
                                         description.Length());
   return *pszDescription ? S_OK : E_OUTOFMEMORY;
 
   A11Y_TRYBLOCK_END
 }
 
@@ -424,26 +395,22 @@ AccessibleWrap::get_accRole(
   Accessible* xpAccessible = GetXPAccessibleFor(varChild);
   if (!xpAccessible)
     return E_INVALIDARG;
 
   if (xpAccessible->IsDefunct())
     return CO_E_OBJNOTCONNECTED;
 
   a11y::role geckoRole;
-  if (xpAccessible->IsProxy()) {
-    geckoRole = xpAccessible->Proxy()->Role();
-  } else {
 #ifdef DEBUG
-    NS_ASSERTION(nsAccUtils::IsTextInterfaceSupportCorrect(xpAccessible),
-                 "Does not support Text when it should");
+  NS_ASSERTION(nsAccUtils::IsTextInterfaceSupportCorrect(xpAccessible),
+               "Does not support Text when it should");
 #endif
 
-    geckoRole = xpAccessible->Role();
-  }
+  geckoRole = xpAccessible->Role();
 
   uint32_t msaaRole = 0;
 
 #define ROLE(_geckoRole, stringRole, atkRole, macRole, \
              _msaaRole, ia2Role, nameRule) \
   case roles::_geckoRole: \
     msaaRole = _msaaRole; \
     break;
@@ -454,39 +421,29 @@ AccessibleWrap::get_accRole(
       MOZ_CRASH("Unknown role.");
   }
 
 #undef ROLE
 
   // Special case, if there is a ROLE_ROW inside of a ROLE_TREE_TABLE, then call the MSAA role
   // a ROLE_OUTLINEITEM for consistency and compatibility.
   // We need this because ARIA has a role of "row" for both grid and treegrid
-  if (xpAccessible->IsProxy()) {
-      if (geckoRole == roles::ROW
-          && xpAccessible->Proxy()->Parent()->Role() == roles::TREE_TABLE)
-        msaaRole = ROLE_SYSTEM_OUTLINEITEM;
-  } else {
-    if (geckoRole == roles::ROW) {
-      Accessible* xpParent = Parent();
-      if (xpParent && xpParent->Role() == roles::TREE_TABLE)
-        msaaRole = ROLE_SYSTEM_OUTLINEITEM;
-    }
+  if (geckoRole == roles::ROW) {
+    Accessible* xpParent = Parent();
+    if (xpParent && xpParent->Role() == roles::TREE_TABLE)
+      msaaRole = ROLE_SYSTEM_OUTLINEITEM;
   }
-  
+
   // -- Try enumerated role
   if (msaaRole != USE_ROLE_STRING) {
     pvarRole->vt = VT_I4;
     pvarRole->lVal = msaaRole;  // Normal enumerated role
     return S_OK;
   }
 
-  // XXX bug 798492 make this work with proxies?
-  if (IsProxy())
-  return E_FAIL;
-
   // -- Try BSTR role
   // Could not map to known enumerated MSAA role like ROLE_BUTTON
   // Use BSTR role to expose role attribute or tag name + namespace
   nsIContent *content = xpAccessible->GetContent();
   if (!content)
     return E_FAIL;
 
   if (content->IsElement()) {
@@ -547,21 +504,17 @@ AccessibleWrap::get_accState(
   // MSAA only has 31 states and the lowest 31 bits of our state bit mask
   // are the same states as MSAA.
   // Note: we map the following Gecko states to different MSAA states:
   //   REQUIRED -> ALERT_LOW
   //   ALERT -> ALERT_MEDIUM
   //   INVALID -> ALERT_HIGH
   //   CHECKABLE -> MARQUEED
 
-  uint64_t state;
-  if (xpAccessible->IsProxy())
-    state = xpAccessible->Proxy()->State();
-  else
-    state = State();
+  uint64_t state = State();
 
   uint32_t msaaState = 0;
   nsAccUtils::To32States(state, &msaaState, nullptr);
   pvarState->lVal = msaaState;
   return S_OK;
 
   A11Y_TRYBLOCK_END
 }
@@ -617,20 +570,16 @@ AccessibleWrap::get_accKeyboardShortcut(
 
   Accessible* acc = GetXPAccessibleFor(varChild);
   if (!acc)
     return E_INVALIDARG;
 
   if (acc->IsDefunct())
     return CO_E_OBJNOTCONNECTED;
 
-  // TODO make this work with proxies.
-  if (acc->IsProxy())
-    return E_NOTIMPL;
-
   KeyBinding keyBinding = acc->AccessKey();
   if (keyBinding.IsEmpty())
     keyBinding = acc->KeyboardShortcut();
 
   nsAutoString shortcut;
   keyBinding.ToString(shortcut);
 
   *pszKeyboardShortcut = ::SysAllocStringLen(shortcut.get(),
@@ -656,23 +605,17 @@ AccessibleWrap::get_accFocus(
   // VT_I4:       lVal is CHILDID_SELF. The object itself has the keyboard focus.
   // VT_I4:       lVal contains the child ID of the child element with the keyboard focus.
   // VT_DISPATCH: pdispVal member is the address of the IDispatch interface
   //              for the child object with the keyboard focus.
   if (IsDefunct())
     return CO_E_OBJNOTCONNECTED;
 
   // Return the current IAccessible child that has focus
-  Accessible* focusedAccessible;
-  if (IsProxy()) {
-    ProxyAccessible* proxy = Proxy()->FocusedChild();
-    focusedAccessible = proxy ? WrapperFor(proxy) : nullptr;
-  } else {
-    focusedAccessible = FocusedChild();
-  }
+  Accessible* focusedAccessible = FocusedChild();
 
   if (focusedAccessible == this) {
     pvarChild->vt = VT_I4;
     pvarChild->lVal = CHILDID_SELF;
   }
   else if (focusedAccessible) {
     pvarChild->vt = VT_DISPATCH;
     pvarChild->pdispVal = NativeAccessible(focusedAccessible);
@@ -824,33 +767,19 @@ AccessibleWrap::get_accSelection(VARIANT
     return E_INVALIDARG;
 
   VariantInit(pvarChildren);
   pvarChildren->vt = VT_EMPTY;
 
   if (IsDefunct())
     return CO_E_OBJNOTCONNECTED;
 
-  // TODO make this work with proxies.
-  if (IsProxy())
-    return E_NOTIMPL;
-
   if (IsSelect()) {
     AutoTArray<Accessible*, 10> selectedItems;
-    if (IsProxy()) {
-      nsTArray<ProxyAccessible*> proxies;
-      Proxy()->SelectedItems(&proxies);
-
-      uint32_t selectedCount = proxies.Length();
-      for (uint32_t i = 0; i < selectedCount; i++) {
-        selectedItems.AppendElement(WrapperFor(proxies[i]));
-      }
-    } else {
-      SelectedItems(&selectedItems);
-    }
+    SelectedItems(&selectedItems);
 
     // 1) Create and initialize the enumeration
     RefPtr<AccessibleEnumerator> pEnum = new AccessibleEnumerator(selectedItems);
     pvarChildren->vt = VT_UNKNOWN;    // this must be VT_UNKNOWN for an IEnumVARIANT
     NS_ADDREF(pvarChildren->punkVal = pEnum);
   }
   return S_OK;
 
@@ -875,21 +804,17 @@ AccessibleWrap::get_accDefaultAction(
   Accessible* xpAccessible = GetXPAccessibleFor(varChild);
   if (!xpAccessible)
     return E_INVALIDARG;
 
   if (xpAccessible->IsDefunct())
     return CO_E_OBJNOTCONNECTED;
 
   nsAutoString defaultAction;
-  if (xpAccessible->IsProxy()) {
-    xpAccessible->Proxy()->ActionNameAt(0, defaultAction);
-  } else {
-    xpAccessible->ActionNameAt(0, defaultAction);
-  }
+  xpAccessible->ActionNameAt(0, defaultAction);
 
   *pszDefaultAction = ::SysAllocStringLen(defaultAction.get(),
                                           defaultAction.Length());
   return *pszDefaultAction ? S_OK : E_OUTOFMEMORY;
 
   A11Y_TRYBLOCK_END
 }
 
@@ -907,52 +832,32 @@ AccessibleWrap::accSelect(
   Accessible* xpAccessible = GetXPAccessibleFor(varChild);
   if (!xpAccessible)
     return E_INVALIDARG;
 
   if (xpAccessible->IsDefunct())
     return CO_E_OBJNOTCONNECTED;
 
   if (flagsSelect & SELFLAG_TAKEFOCUS) {
-    if (xpAccessible->IsProxy()) {
-      xpAccessible->Proxy()->TakeFocus();
-    } else {
-      xpAccessible->TakeFocus();
-    }
-
+    xpAccessible->TakeFocus();
     return S_OK;
   }
 
   if (flagsSelect & SELFLAG_TAKESELECTION) {
-    if (xpAccessible->IsProxy()) {
-      xpAccessible->Proxy()->TakeSelection();
-    } else {
-      xpAccessible->TakeSelection();
-    }
-
+    xpAccessible->TakeSelection();
     return S_OK;
   }
 
   if (flagsSelect & SELFLAG_ADDSELECTION) {
-    if (xpAccessible->IsProxy()) {
-      xpAccessible->Proxy()->SetSelected(true);
-    } else {
-      xpAccessible->SetSelected(true);
-    }
-
+    xpAccessible->SetSelected(true);
     return S_OK;
   }
 
   if (flagsSelect & SELFLAG_REMOVESELECTION) {
-    if (xpAccessible->IsProxy()) {
-      xpAccessible->Proxy()->SetSelected(false);
-    } else {
-      xpAccessible->SetSelected(false);
-    }
-
+    xpAccessible->SetSelected(false);
     return S_OK;
   }
 
   return E_FAIL;
 
   A11Y_TRYBLOCK_END
 }
 
@@ -979,22 +884,17 @@ AccessibleWrap::accLocation(
 
   Accessible* xpAccessible = GetXPAccessibleFor(varChild);
   if (!xpAccessible)
     return E_INVALIDARG;
 
   if (xpAccessible->IsDefunct())
     return CO_E_OBJNOTCONNECTED;
 
-  nsIntRect rect;
-  if (xpAccessible->IsProxy()) {
-    rect = xpAccessible->Proxy()->Bounds();
-  } else {
-    rect = xpAccessible->Bounds();
-  }
+  nsIntRect rect = xpAccessible->Bounds();
 
   *pxLeft = rect.x;
   *pyTop = rect.y;
   *pcxWidth = rect.width;
   *pcyHeight = rect.height;
   return S_OK;
 
   A11Y_TRYBLOCK_END
@@ -1018,16 +918,32 @@ AccessibleWrap::accNavigate(
 
   Accessible* accessible = GetXPAccessibleFor(varStart);
   if (!accessible)
     return E_INVALIDARG;
 
   if (accessible->IsDefunct())
     return CO_E_OBJNOTCONNECTED;
 
+  // Make sure that varStart != CHILDID_SELF so we don't infinitely recurse
+  if (accessible->IsProxy() && varStart.vt == VT_I4 &&
+      varStart.lVal != CHILDID_SELF) {
+    // Now that we have the starting object, delegate this request to that
+    // object as a self-relative request...
+    RefPtr<IAccessible> comProxy;
+    accessible->GetNativeInterface((void**) getter_AddRefs(comProxy));
+    if (!comProxy) {
+      return E_UNEXPECTED;
+    }
+    VARIANT selfChildId;
+    selfChildId.vt = VT_I4;
+    selfChildId.lVal = CHILDID_SELF;
+    return comProxy->accNavigate(navDir, selfChildId, pvarEndUpAt);
+  }
+
   Accessible* navAccessible = nullptr;
   Maybe<RelationType> xpRelation;
 
 #define RELATIONTYPE(geckoType, stringType, atkType, msaaType, ia2Type) \
   case msaaType: \
     xpRelation.emplace(RelationType::geckoType); \
     break;
 
@@ -1075,26 +991,18 @@ AccessibleWrap::accNavigate(
       return E_INVALIDARG;
   }
 
 #undef RELATIONTYPE
 
   pvarEndUpAt->vt = VT_EMPTY;
 
   if (xpRelation) {
-    if (accessible->IsProxy()) {
-      nsTArray<ProxyAccessible*> targets =
-        accessible->Proxy()->RelationByType(*xpRelation);
-      if (targets.Length()) {
-        navAccessible = WrapperFor(targets[0]);
-      }
-    } else {
-      Relation rel = RelationByType(*xpRelation);
-      navAccessible = rel.Next();
-    }
+    Relation rel = RelationByType(*xpRelation);
+    navAccessible = rel.Next();
   }
 
   if (!navAccessible)
     return E_FAIL;
 
   pvarEndUpAt->pdispVal = NativeAccessible(navAccessible);
   pvarEndUpAt->vt = VT_DISPATCH;
   return S_OK;
@@ -1113,25 +1021,17 @@ AccessibleWrap::accHitTest(
   if (!pvarChild)
     return E_INVALIDARG;
 
   VariantInit(pvarChild);
 
   if (IsDefunct())
     return CO_E_OBJNOTCONNECTED;
 
-  Accessible* accessible = nullptr;
-  if (IsProxy()) {
-    ProxyAccessible* proxy = Proxy()->ChildAtPoint(xLeft, yTop, eDirectChild);
-    if (proxy) {
-      accessible = WrapperFor(proxy);
-    }
-  } else {
-    accessible = ChildAtPoint(xLeft, yTop, eDirectChild);
-  }
+  Accessible* accessible = ChildAtPoint(xLeft, yTop, eDirectChild);
 
   // if we got a child
   if (accessible) {
     // if the child is us
     if (accessible == this) {
       pvarChild->vt = VT_I4;
       pvarChild->lVal = CHILDID_SELF;
     } else { // its not create an Accessible for it.
@@ -1159,20 +1059,16 @@ AccessibleWrap::accDoDefaultAction(
 
   Accessible* xpAccessible = GetXPAccessibleFor(varChild);
   if (!xpAccessible)
     return E_INVALIDARG;
 
   if (xpAccessible->IsDefunct())
     return CO_E_OBJNOTCONNECTED;
 
-  // TODO make this work with proxies.
-  if (xpAccessible->IsProxy())
-    return xpAccessible->Proxy()->DoAction(0) ? S_OK : E_INVALIDARG;
-
   return xpAccessible->DoAction(0) ? S_OK : E_INVALIDARG;
 
   A11Y_TRYBLOCK_END
 }
 
 STDMETHODIMP
 AccessibleWrap::put_accName(
       /* [optional][in] */ VARIANT varChild,