Re: Firefox 56+ : IAccessible.accNavigate(NAVRELATION_EMBEDS) fails with 0x80004005 (E_FAIL)

James Teh <[email protected]> Wed, 29 Nov 2017 12:12:44 +1000
Newsgroups gmane.comp.mozilla.accessibility
Message-ID <CAPHL6CyjYf4PZi_kYtbvuKZZFZ+L0JzjQh561mLCeK8iwS7Lmg@mail.gmail.com>
Hi Sylvain,

I can't reproduce this in Windows 10 with Firefox 58b6 64 bit. I wrote my
own complete test case so we can test with exactly the same code. It'd be
great if you could compile the following C++ code. Then, start Firefox,
load example.com and run the test case. Here's the code:

---

// embeds.cpp: Test NAVRELATION_EMBEDS.
// Compile with:
//   cl /EHsc embeds.cpp user32.lib oleacc.lib ole32.lib oleaut32.lib

#include <windows.h>
#include <oleacc.h>
#include <iostream>

using namespace std;

// Tweak as needed to find the Firefox window.
// This title works if using a Firefox release
// with example.com loaded in the active tab.
const char WINDOW_TITLE[] = "Example Domain - Mozilla Firefox";

const long NAVRELATION_EMBEDS = 0x1009;

int main()
{
  CoInitialize(NULL);
  HWND window = FindWindow("MozillaWindowClass", WINDOW_TITLE);
  cout << "Window " << window << endl;
  if (!window) {
    cout << "Failed to get window" << endl;
    return 1;
  }
  IAccessible* rootAcc;
  HRESULT hr = AccessibleObjectFromWindow(window, OBJID_CLIENT,
    IID_IAccessible, (void**)&rootAcc);
  if (FAILED(hr)) {
    cout << "AccessibleObjectFromWindow failed with " << hr << endl;
    return 1;
  }
  VARIANT child;
  child.vt = VT_I4;
  child.lVal = CHILDID_SELF;
  VARIANT target;
  for (int i = 0; i < 5; ++i) {
    hr = rootAcc->accNavigate(NAVRELATION_EMBEDS, child, &target);
    cout << "accNavigate result " << hr << endl;
    if (hr == S_OK) {
      target.pdispVal->Release();
      break;
    }
    Sleep(1000);
  }
  rootAcc->Release();
}

---

When I do this, I get the following:

Window 006F0AFE
accNavigate result -2147467259
accNavigate result 0

So, the first try fails, but the second succeeds.

Jamie

On Wed, Nov 29, 2017 at 2:12 AM, <[email protected]> wrote:

> Hi Jamie,
>
> Thanks for your answer. Unfortunately, this does not fix the problem,
> including when focusing the Firefox window before calling accNavigate().
>
> Here is my source code:
> // w is the main Firefox window handle ("MozillaWindowClass")
> hr=AccessibleObjectFromWindow(w,(DWORD)OBJID_CLIENT,IID_
> IAccessible,(void**)&pAccessible);
> if (FAILED(hr)) { TRACE((TRACE_ERROR,_F_,"AccessibleObjectFromWindow(
> IID_IAccessible)=0x%08lx",hr)); goto end; }
>
> for (int i=0;i<50;i++) // test every second
> {
>         hr=pAccessible->accNavigate(0x1009,vtMe,&vtResult); //
> NAVRELATION_EMBEDS = 0x1009
>         TRACE((TRACE_DEBUG,_F_,"accNavigate(NAVRELATION_
> EMBEDS)=0x%08lx",hr));
>         if (hr==S_OK) break;
>         Sleep(1000);
> }
>
> And the result is:
> 28/11-16:36:55:949 accNavigate(NAVRELATION_EMBEDS)=0x80004005
> 28/11-16:36:56:955 accNavigate(NAVRELATION_EMBEDS)=0x80004005
> 28/11-16:36:57:959 accNavigate(NAVRELATION_EMBEDS)=0x80004005
> 28/11-16:36:58:965 accNavigate(NAVRELATION_EMBEDS)=0x80004005
> 28/11-16:36:59:969 accNavigate(NAVRELATION_EMBEDS)=0x80004005
> ...
>
> My testing environment is Windows 10 (10.0.15063) and Firefox 58.0b6 (64
> bits).
>
> Thanks!
>
> Sylvain
> _______________________________________________
> dev-accessibility mailing list
> [email protected]
> https://lists.mozilla.org/listinfo/dev-accessibility
>