Bug 1269369 - add support for GetID XPCOM method on Windows with e10s. r=tbsaunde

MozReview-Commit-ID: KXhDeNW3Oaw
This commit is contained in:
Yura Zenevich 2016-11-24 11:29:14 -05:00
parent 485f64c28c
commit 4a9e23d316
5 changed files with 37 additions and 4 deletions

View File

@ -12,6 +12,7 @@ interface IGeckoCustom : IUnknown
{
[propget] HRESULT ID([out, retval] unsigned __int64* aID);
[propget] HRESULT anchorCount([out, retval] long* aCount);
[propget] HRESULT DOMNodeID([out, retval] BSTR* aID);
}

View File

@ -706,5 +706,23 @@ ProxyAccessible::AnchorAt(uint32_t aIdx)
return proxyAnchor;
}
void
ProxyAccessible::DOMNodeID(nsString& aID)
{
aID.Truncate();
RefPtr<IGeckoCustom> custom = QueryInterface<IGeckoCustom>(this);
if (!custom) {
return;
}
BSTR result;
HRESULT hr = custom->get_DOMNodeID(&result);
_bstr_t resultWrap(result, false);
if (FAILED(hr)) {
return;
}
aID = (wchar_t*)resultWrap;
}
} // namespace a11y
} // namespace mozilla

View File

@ -20,6 +20,23 @@ GeckoCustom::get_anchorCount(long* aCount)
return S_OK;
}
HRESULT
GeckoCustom::get_DOMNodeID(BSTR* aID)
{
nsIContent* content = mAcc->GetContent();
if (!content) {
return S_OK;
}
nsIAtom* id = content->GetID();
if (id) {
nsAutoString idStr;
id->ToString(idStr);
*aID = ::SysAllocStringLen(idStr.get(), idStr.Length());
}
return S_OK;
}
STDMETHODIMP
GeckoCustom::get_ID(uint64_t* aID)
{

View File

@ -27,6 +27,7 @@ public:
DECL_IUNKNOWN
virtual STDMETHODIMP get_anchorCount(long* aCount);
virtual STDMETHODIMP get_DOMNodeID(BSTR* aID);
virtual STDMETHODIMP get_ID(uint64_t* aID);
private:

View File

@ -195,9 +195,6 @@ xpcAccessible::GetDOMNode(nsIDOMNode** aDOMNode)
NS_IMETHODIMP
xpcAccessible::GetId(nsAString& aID)
{
#if defined(XP_WIN)
return NS_ERROR_NOT_IMPLEMENTED;
#else
ProxyAccessible* proxy = IntlGeneric().AsProxy();
if (!proxy) {
return NS_ERROR_FAILURE;
@ -208,7 +205,6 @@ xpcAccessible::GetId(nsAString& aID)
aID.Assign(id);
return NS_OK;
#endif
}
NS_IMETHODIMP