From:  James Teh <jteh@mozilla.com>
Date:  08 Feb 2018 08:26:59 Hong Kong Time
Newsgroup:  news.mozilla.org/mozilla.dev.accessibility
Subject:  

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

NNTP-Posting-Host:  63.245.214.181

Hi Sylvain,

Sorry for the delay in responding to this.

I was still unable to reproduce this myself. However, I've since had
confirmation from several parties previously experiencing this that this is
all working as expected in Firefox 59 beta. It'd be great if you could give
that a try and let me know if it fixes the problem for you.

Note that FindWindow("MozillaWindowClass", NULL) might find the wrong
window in some cases, as there can be top level windows for tool tips, etc.
Based on the output from the test case, I don't think this was the case for
you - it did succeed some of the time - but I thought it worth noting for
future tests.

Jamie

On Thu, Nov 30, 2017 at 2:30 AM,  wrote:

> Le mercredi 29 novembre 2017 09:08:35 UTC+1, James Teh a écrit :
> > Deleting the pref should be fine if that's the only thing you did. That
> does lead me to wonder why your results were different yesterday, though.
> Perhaps there was some confusion regarding the difference with multiple
> tabs?
> >
> > I'll investigate multiple tabs some time soon. I thought I'd already
> investigated this and wasn't able to reproduce, but I'll do some more
> isolated testing.
> >
> > Sent from a mobile device
> >
> > > On 29 Nov 2017, at 5:41 pm, Sylvain Werdefroy 
> wrote:
> > >
> > > Tests above where run with:
> > > browser.tabs.remote.force-enable=true
> > >
> > > After deleting this pref, result is the same.
> > >
> > > How to be sure I'm using a clean profile? (I'll try later today after
> uninstalling Firefox & Firefox Developer Edition and reinstall only the
> last one)
> > >
> > >> On Wed, Nov 29, 2017 at 8:32 AM, James Teh  wrote:
> > >> Were you setting the pref to force enable remote accessibility or to
> disable it? Those prefs are no longer necessary. Multi-process
> accessibility is now enabled by default. It'd be good if you can re-run
> these tests with a clean profile and no prefs changed.
> > >>
> > >>
> > >> Sent from a mobile device
> > >>
> > >>> On 29 Nov 2017, at 5:25 pm, Sylvain Werdefroy 
> wrote:
> > >>>
> > >>> Hi Jamie,
> > >>>
> > >>> Thanks for the test case!
> > >>>
> > >>> First of all: as my Firefox 58 was freshly reinstalled on my
> computer, the browser.tabs.remote.force-enable was not configured, that's
> why the test I ran yesterday failed... sorry for that.
> > >>>
> > >>> Now here are the results:
> > >>>
> > >>> Open Firefox and load example.com in the 1st tab:
> > >>> Window 0003086A
> > >>> accNavigate result -2147467259
> > >>> accNavigate result 0
> > >>>
> > >>> Test passed!
> > >>>
> > >>> But now try to open a 2nd tab, load example.com in this tab, close
> the 1st one, run the test case:
> > >>> Window 0003086A
> > >>> accNavigate result -2147467259
> > >>> accNavigate result -2147467259
> > >>> accNavigate result -2147467259
> > >>> accNavigate result -2147467259
> > >>> accNavigate result -2147467259
> > >>>
> > >>> It seems to be a problem with multiple tabs... for example this test
> case always fails:
> > >>>
> > >>> Open Firefox, open a 2nd tab, example.com in this tab, close the
> 1st one, run the test case:
> > >>> Window 000E08BE
> > >>> accNavigate result -2147467259
> > >>> accNavigate result -2147467259
> > >>> accNavigate result -2147467259
> > >>> accNavigate result -2147467259
> > >>> accNavigate result -2147467259
> > >>>
> > >>> And this one fails randomly:
> > >>>
> > >>> Open Firefox, open a 2nd tab, example.com in this tab, run the test
> case:
> > >>>
> > >>> Sometimes it fails:
> > >>> Window 00120890
> > >>> accNavigate result -2147467259
> > >>> accNavigate result -2147467259
> > >>> accNavigate result -2147467259
> > >>> accNavigate result -2147467259
> > >>> accNavigate result -2147467259
> > >>>
> > >>> Somtimes it succeeds:
> > >>> Window 00110338
> > >>> accNavigate result -2147467259
> > >>> accNavigate result 0
> > >>>
> > >>> Please note my Firefox version has been upgraded, I now run a 58.0b7.
> > >>>
> > >>> Sylvain
> > >>>
> > >>>> On Wed, Nov 29, 2017 at 3:12 AM, James Teh 
> wrote:
> > >>>> 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 
> > >>>> #include 
> > >>>> #include 
> > >>>>
> > >>>> 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,  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
> > >>>>> dev-accessibility@lists.mozilla.org
> > >>>>> https://lists.mozilla.org/listinfo/dev-accessibility
> > >>>>
> > >>>
> > >
>
> Yes, I guess there was confusion regarding multiple tabs (or the new test
> case below) with my tests yesterday.
>
> Here is a new test case that fails:
>
> First replace FindWindow("MozillaWindowClass", WINDOW_TITLE) by
> FindWindow("MozillaWindowClass", NULL) in the source code, so you can
> test with some url changes without compiling each time.
>
> Open Firefox, open example.com, run test case:
> C:\swSSO\Firefox58\Debug>Firefox58.exe
> Window 002412A0
> accNavigate result -2147467259
> accNavigate result 0
> --> OK!
>
> Run test case another time
> C:\swSSO\Firefox58\Debug>Firefox58.exe
> Window 002412A0
> accNavigate result 0
> --> Still OK!
>
> Open mozilla.org in the same tab (no multi tab), run test case:
> C:\swSSO\Firefox58\Debug>Firefox58.exe
> Window 002412A0
> accNavigate result -2147467259
> accNavigate result -2147467259
> accNavigate result -2147467259
> accNavigate result -2147467259
> accNavigate result -2147467259
> --> Not OK... (and as you can see the window handle is unchanged, so this
> is not a FindWindow issue)
>
> Thanks!
>
> Sylvain
> _______________________________________________
> dev-accessibility mailing list
> dev-accessibility@lists.mozilla.org
> https://lists.mozilla.org/listinfo/dev-accessibility
>