QueryService() with IID_ISimpleDOMNode failed with e10s

Rajesh V R <[email protected]> Wed, 22 Feb 2017 04:42:16 -0800 (PST)
Newsgroups gmane.comp.mozilla.accessibility
Message-ID <[email protected]>
I am trying to find the URL from Mozilla window using VC++ project. For doing this, I used QueryService() API with parameter IID_ISimpleDOMNode". But the API fails on Windows 7 machines (both 32 bit and 64 bit) with Mozilla Version- 49.0.1. Sample code is given below:


// header files
#include "ISimpleDOMNode.h"
#include "ISimpleDOMText.h"
#include "ISimpleDOMDocument.h"

// GUIDs
const GUID refguid = {0x0c539790, 0x12e4, 0x11cf, 0xb6, 0x61, 0x00, 0xaa, 0x00, 0x4c, 0xd6, 0xd8};
const IID IID_ISimpleDOMNode= {0x1814ceeb,0x49e2,0x407f,0xaf,0x99,0xfa,0x75,0x5a,0x7d,0x26,0x07};
const IID IID_ISimpleDOMText= {0x4e747be5,0x2052,0x4265,0x8a,0xf0,0x8e,0xca,0xd7,0xaa,0xd1,0xc0};
const IID IID_ISimpleDOMDocument= {0x0D68D6D0,0xD93D,0x4d08,0xA3,0x0D,0xF0,0x0D,0xD1,0xF4,0x5B,0x24};

Void FindURLfromWindow(HWND hwnd)
{
	try
	{
		if(hwnd)
		{
			IAccessible *pAccBrowser = NULL;
			HRESULT hr = AccessibleObjectFromWindow(hwnd, OBJID_CLIENT, IID_IAccessible, (void**)&pAccBrowser);
			if(SUCCEEDED(hr) && (pAccBrowser))
			{
				VARIANT vtStart; 
				VARIANT vtResult;
				vtStart.vt = VT_I4;
				vtStart.lVal = CHILDID_SELF;
				/////////////////////////////
				hr = pAccBrowser->accNavigate(NAVRELATION_EMBEDS,vtStart,&vtResult);
				if(SUCCEEDED(hr))
				{
					IDispatch *pDisp = vtResult.pdispVal;
					IAccessible *pAccDoc = NULL; 
					hr = pDisp->QueryInterface(IID_IAccessible,(void **)&pAccDoc); 
					if(SUCCEEDED(hr) && (pAccDoc))
					{
						hr = pAccDoc->QueryInterface(IID_IServiceProvider, (void **)&pServProv); 
						if(SUCCEEDED(hr) && (pServProv))
						{
							ISimpleDOMNode *pNode = NULL; 
							hr = pServProv->QueryService(refguid, IID_ISimpleDOMNode,(void **)&pNode); //failed in Windows 7
							if(SUCCEEDED(hr) && (pNode))
							{
								ISimpleDOMDocument *pDoc = NULL; 
								hr = pNode->QueryInterface(IID_ISimpleDOMDocument, (void **)&pDoc); 
								if(SUCCEEDED(hr) && (pDoc))
								{
									BSTR bstrUrl = NULL;
									hr = pDoc->get_URL(&bstrUrl); 
									if(SUCCEEDED(hr) && (bstrUrl))
									{
										//success
									}
								}
							}
						}
					}
				}
			}
		}
	}
	catch(...)
	{
	}
}
//

Kindly help me to solve this issue.