Commit d6bb86e8 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Added IHTMLFrameBase2::onload property implementation.

parent 9c45b34c
......@@ -28,6 +28,7 @@
#include "mshtml_private.h"
#include "binding.h"
#include "htmlevent.h"
#include "wine/debug.h"
......@@ -593,15 +594,19 @@ static HRESULT WINAPI HTMLFrameBase2_get_contentWindow(IHTMLFrameBase2 *iface, I
static HRESULT WINAPI HTMLFrameBase2_put_onload(IHTMLFrameBase2 *iface, VARIANT v)
{
HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
return E_NOTIMPL;
TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
return set_node_event(&This->element.node, EVENTID_LOAD, &v);
}
static HRESULT WINAPI HTMLFrameBase2_get_onload(IHTMLFrameBase2 *iface, VARIANT *p)
{
HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface);
FIXME("(%p)->(%p)\n", This, p);
return E_NOTIMPL;
TRACE("(%p)->(%p)\n", This, p);
return get_node_event(&This->element.node, EVENTID_LOAD, p);
}
static HRESULT WINAPI HTMLFrameBase2_put_onreadystatechange(IHTMLFrameBase2 *iface, VARIANT v)
......
......@@ -83,6 +83,7 @@ DEFINE_EXPECT(submit_onclick_attached);
DEFINE_EXPECT(submit_onclick_attached_check_cancel);
DEFINE_EXPECT(submit_onclick_setret);
DEFINE_EXPECT(elem2_cp_onclick);
DEFINE_EXPECT(iframe_onload);
static HWND container_hwnd = NULL;
static IHTMLWindow2 *window;
......@@ -243,6 +244,18 @@ static IHTMLElement3 *_get_elem3_iface(unsigned line, IUnknown *unk)
return elem3;
}
#define get_iframe_iface(u) _get_iframe_iface(__LINE__,u)
static IHTMLIFrameElement *_get_iframe_iface(unsigned line, IUnknown *unk)
{
IHTMLIFrameElement *iframe;
HRESULT hres;
hres = IUnknown_QueryInterface(unk, &IID_IHTMLIFrameElement, (void**)&iframe);
ok_(__FILE__,line)(hres == S_OK, "QueryInterface(IID_IHTMLIFrameElement) failed: %08x\n", hres);
return iframe;
}
#define doc_get_body(d) _doc_get_body(__LINE__,d)
static IHTMLElement *_doc_get_body(unsigned line, IHTMLDocument2 *doc)
{
......@@ -993,6 +1006,17 @@ static HRESULT WINAPI submit_onclick(IDispatchEx *iface, DISPID id, LCID lcid, W
EVENT_HANDLER_FUNC_OBJ(submit_onclick);
static HRESULT WINAPI iframe_onload(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp,
VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
{
CHECK_EXPECT(iframe_onload);
test_event_args(&DIID_DispHTMLIFrame, id, wFlags, pdp, pvarRes, pei, pspCaller);
test_event_src("IFRAME");
return S_OK;
}
EVENT_HANDLER_FUNC_OBJ(iframe_onload);
static HRESULT WINAPI submit_onclick_attached(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp,
VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
{
......@@ -2058,6 +2082,8 @@ static void test_submit(IHTMLDocument2 *doc)
CHECK_CALLED(submit_onclick_attached_check_cancel);
CHECK_CALLED(submit_onclick_attached);
if(1)pump_msgs(NULL);
IHTMLElement_Release(submit);
}
......@@ -2144,16 +2170,21 @@ static IHTMLDocument2* get_iframe_doc(IHTMLIFrameElement *iframe)
static void test_iframe_connections(IHTMLDocument2 *doc)
{
HRESULT hres;
IHTMLFrameBase2 *frame_base2;
IHTMLIFrameElement *iframe;
IHTMLDocument2 *iframes_doc;
DWORD cookie;
IConnectionPoint *cp;
IHTMLElement *element = find_element_by_id(doc, "ifr");
IHTMLElement *element;
VARIANT v;
BSTR str;
HRESULT hres;
trace("iframe tests...\n");
hres = IHTMLElement_QueryInterface(element, &IID_IHTMLIFrameElement, (void**)&iframe);
element = find_element_by_id(doc, "ifr");
iframe = get_iframe_iface((IUnknown*)element);
IHTMLElement_Release(element);
ok(hres == S_OK, "QueryInterface(IID_IHTMLIFrameElement) failed: %08x\n", hres);
iframes_doc = get_iframe_doc(iframe);
IHTMLIFrameElement_Release(iframe);
......@@ -2165,6 +2196,36 @@ static void test_iframe_connections(IHTMLDocument2 *doc)
IConnectionPoint_Release(cp);
ok(hres == CONNECT_E_NOCONNECTION, "Unadvise returned %08x, expected CONNECT_E_NOCONNECTION\n", hres);
unregister_cp((IUnknown*)iframes_doc, &IID_IDispatch, cookie);
hres = IHTMLIFrameElement_QueryInterface(iframe, &IID_IHTMLFrameBase2, (void**)&frame_base2);
ok(hres == S_OK, "Could not get IHTMLFrameBase2 iface: %08x\n", hres);
V_VT(&v) = VT_DISPATCH;
V_DISPATCH(&v) = (IDispatch*)&iframe_onload_obj;
hres = IHTMLFrameBase2_put_onload(frame_base2, v);
ok(hres == S_OK, "put_onload failed: %08x\n", hres);
IHTMLFrameBase2_Release(frame_base2);
str = a2bstr("about:blank");
hres = IHTMLDocument2_put_URL(iframes_doc, str);
ok(hres == S_OK, "put_URL failed: %08x\n", hres);
SysFreeString(str);
SET_EXPECT(iframe_onload);
pump_msgs(&called_iframe_onload);
CHECK_CALLED(iframe_onload);
str = a2bstr("about:test");
hres = IHTMLDocument2_put_URL(iframes_doc, str);
ok(hres == S_OK, "put_URL failed: %08x\n", hres);
SysFreeString(str);
SET_EXPECT(iframe_onload);
pump_msgs(&called_iframe_onload);
CHECK_CALLED(iframe_onload);
IHTMLDocument2_Release(iframes_doc);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment