mshtml: Added Invoke(DISPID_READYSTATE) implementation.

This commit is contained in:
Jacek Caban 2008-01-04 01:49:05 +01:00 committed by Alexandre Julliard
parent 667df8e47f
commit c6ac960f4a
2 changed files with 37 additions and 3 deletions

View File

@ -229,8 +229,24 @@ static HRESULT WINAPI HTMLDocument_Invoke(IHTMLDocument2 *iface, DISPID dispIdMe
REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr) VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
{ {
FIXME("(%p)->(%d %s %d %d %p %p %p %p)\n", iface, dispIdMember, debugstr_guid(riid), HTMLDocument *This = HTMLDOC_THIS(iface);
TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr); lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
switch(dispIdMember) {
case DISPID_READYSTATE:
if(!(wFlags & DISPATCH_PROPERTYGET))
return E_INVALIDARG;
V_VT(pVarResult) = VT_I4;
V_I4(pVarResult) = This->readystate;
return S_OK;
default:
FIXME("Unsupported dispid %d\n", dispIdMember);
}
return E_NOTIMPL; return E_NOTIMPL;
} }

View File

@ -146,6 +146,7 @@ static int stream_read, protocol_read;
static enum load_state_t { static enum load_state_t {
LD_DOLOAD, LD_DOLOAD,
LD_LOADING, LD_LOADING,
LD_LOADED,
LD_INTERACTIVE, LD_INTERACTIVE,
LD_COMPLETE, LD_COMPLETE,
LD_NO LD_NO
@ -2392,7 +2393,9 @@ static LRESULT WINAPI wnd_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam
static void _test_readyState(unsigned line, IUnknown *unk) static void _test_readyState(unsigned line, IUnknown *unk)
{ {
IHTMLDocument2 *htmldoc; IHTMLDocument2 *htmldoc;
DISPPARAMS dispparams;
BSTR state; BSTR state;
VARIANT out;
HRESULT hres; HRESULT hres;
static const WCHAR wszUninitialized[] = {'u','n','i','n','i','t','i','a','l','i','z','e','d',0}; static const WCHAR wszUninitialized[] = {'u','n','i','n','i','t','i','a','l','i','z','e','d',0};
@ -2403,6 +2406,7 @@ static void _test_readyState(unsigned line, IUnknown *unk)
static const LPCWSTR expected_state[] = { static const LPCWSTR expected_state[] = {
wszUninitialized, wszUninitialized,
wszLoading, wszLoading,
NULL,
wszInteractive, wszInteractive,
wszComplete, wszComplete,
wszUninitialized wszUninitialized
@ -2426,7 +2430,21 @@ static void _test_readyState(unsigned line, IUnknown *unk)
debugstr_w(state), load_state); debugstr_w(state), load_state);
SysFreeString(state); SysFreeString(state);
IHTMLDocument_Release(htmldoc); dispparams.cArgs = 0;
dispparams.cNamedArgs = 0;
dispparams.rgdispidNamedArgs = NULL;
dispparams.rgvarg = NULL;
VariantInit(&out);
hres = IHTMLDocument2_Invoke(htmldoc, DISPID_READYSTATE, &IID_NULL, 0, DISPATCH_PROPERTYGET,
&dispparams, &out, NULL, NULL);
ok(hres == S_OK, "Invoke(DISPID_READYSTATE) failed: %08x\n", hres);
ok_(__FILE__,line) (V_VT(&out) == VT_I4, "V_VT(out)=%d\n", V_VT(&out));
ok_(__FILE__,line) (V_I4(&out) == load_state%5, "VT_I4(out)=%d, expected %d\n", V_I4(&out), load_state%5);
IHTMLDocument2_Release(htmldoc);
} }
static void test_ConnectionPoint(IConnectionPointContainer *container, REFIID riid) static void test_ConnectionPoint(IConnectionPointContainer *container, REFIID riid)