2009-09-06 19:06:38 +02:00
|
|
|
/*
|
2011-02-28 13:14:32 +01:00
|
|
|
* Copyright 2008-2011 Jacek Caban for CodeWeavers
|
2009-09-06 19:06:38 +02:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define COBJMACROS
|
|
|
|
#define CONST_VTABLE
|
|
|
|
|
|
|
|
#include <wine/test.h>
|
|
|
|
#include <stdarg.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#include "windef.h"
|
|
|
|
#include "winbase.h"
|
|
|
|
#include "ole2.h"
|
|
|
|
#include "mshtml.h"
|
2009-11-23 19:29:04 +01:00
|
|
|
#include "mshtmdid.h"
|
2009-09-06 19:06:38 +02:00
|
|
|
#include "docobj.h"
|
|
|
|
#include "hlink.h"
|
|
|
|
#include "dispex.h"
|
|
|
|
|
|
|
|
#define DEFINE_EXPECT(func) \
|
|
|
|
static BOOL expect_ ## func = FALSE, called_ ## func = FALSE
|
|
|
|
|
|
|
|
#define SET_EXPECT(func) \
|
|
|
|
do { called_ ## func = FALSE; expect_ ## func = TRUE; } while(0)
|
|
|
|
|
|
|
|
#define CHECK_EXPECT2(func) \
|
|
|
|
do { \
|
|
|
|
trace(#func "\n"); \
|
|
|
|
ok(expect_ ##func, "unexpected call " #func "\n"); \
|
|
|
|
called_ ## func = TRUE; \
|
|
|
|
}while(0)
|
|
|
|
|
|
|
|
#define CHECK_EXPECT(func) \
|
|
|
|
do { \
|
|
|
|
CHECK_EXPECT2(func); \
|
|
|
|
expect_ ## func = FALSE; \
|
|
|
|
}while(0)
|
|
|
|
|
|
|
|
#define CHECK_CALLED(func) \
|
|
|
|
do { \
|
|
|
|
ok(called_ ## func, "expected " #func "\n"); \
|
|
|
|
expect_ ## func = called_ ## func = FALSE; \
|
|
|
|
}while(0)
|
|
|
|
|
|
|
|
DEFINE_EXPECT(document_onclick);
|
|
|
|
DEFINE_EXPECT(body_onclick);
|
2010-07-17 13:31:43 +02:00
|
|
|
DEFINE_EXPECT(doc_onclick_attached);
|
2009-09-06 19:06:38 +02:00
|
|
|
DEFINE_EXPECT(div_onclick);
|
|
|
|
DEFINE_EXPECT(div_onclick_attached);
|
2017-10-25 18:14:05 +02:00
|
|
|
DEFINE_EXPECT(div_onclick_capture);
|
|
|
|
DEFINE_EXPECT(div_onclick_bubble);
|
2009-09-06 19:06:38 +02:00
|
|
|
DEFINE_EXPECT(timeout);
|
2009-11-23 19:29:04 +01:00
|
|
|
DEFINE_EXPECT(doccp_onclick);
|
2019-06-19 16:54:17 +02:00
|
|
|
DEFINE_EXPECT(doccp2_onclick);
|
2011-02-28 13:14:32 +01:00
|
|
|
DEFINE_EXPECT(doccp_onclick_cancel);
|
2010-01-24 21:37:52 +01:00
|
|
|
DEFINE_EXPECT(div_onclick_disp);
|
2011-05-09 16:23:07 +02:00
|
|
|
DEFINE_EXPECT(invoke_onclick);
|
2009-11-30 18:03:02 +01:00
|
|
|
DEFINE_EXPECT(iframe_onreadystatechange_loading);
|
|
|
|
DEFINE_EXPECT(iframe_onreadystatechange_interactive);
|
|
|
|
DEFINE_EXPECT(iframe_onreadystatechange_complete);
|
2010-03-18 01:04:45 +01:00
|
|
|
DEFINE_EXPECT(iframedoc_onreadystatechange);
|
2010-03-18 01:06:28 +01:00
|
|
|
DEFINE_EXPECT(img_onload);
|
2012-04-05 13:58:20 +02:00
|
|
|
DEFINE_EXPECT(img_onerror);
|
2016-06-23 15:32:56 +02:00
|
|
|
DEFINE_EXPECT(link_onload);
|
2011-02-06 22:16:14 +01:00
|
|
|
DEFINE_EXPECT(input_onfocus);
|
2012-04-10 12:53:24 +02:00
|
|
|
DEFINE_EXPECT(input_onblur);
|
2016-04-04 13:22:46 +02:00
|
|
|
DEFINE_EXPECT(div_onfocusin);
|
|
|
|
DEFINE_EXPECT(div_onfocusout);
|
2011-02-28 13:14:32 +01:00
|
|
|
DEFINE_EXPECT(form_onsubmit);
|
|
|
|
DEFINE_EXPECT(form_onclick);
|
|
|
|
DEFINE_EXPECT(submit_onclick);
|
2012-04-16 13:48:46 +02:00
|
|
|
DEFINE_EXPECT(submit_onclick_cancel);
|
2011-02-28 13:14:32 +01:00
|
|
|
DEFINE_EXPECT(submit_onclick_attached);
|
2012-04-16 13:48:46 +02:00
|
|
|
DEFINE_EXPECT(submit_onclick_attached_check_cancel);
|
2011-07-27 16:45:49 +02:00
|
|
|
DEFINE_EXPECT(submit_onclick_setret);
|
2013-03-15 15:02:31 +01:00
|
|
|
DEFINE_EXPECT(elem2_cp_onclick);
|
2014-03-11 19:01:09 +01:00
|
|
|
DEFINE_EXPECT(iframe_onload);
|
2009-09-06 19:06:38 +02:00
|
|
|
|
|
|
|
static HWND container_hwnd = NULL;
|
|
|
|
static IHTMLWindow2 *window;
|
|
|
|
static IOleDocumentView *view;
|
2014-03-13 14:13:30 +01:00
|
|
|
static BOOL is_ie9plus;
|
2017-09-29 19:57:30 +02:00
|
|
|
static int document_mode;
|
2017-10-25 18:13:26 +02:00
|
|
|
static unsigned in_fire_event;
|
2009-09-06 19:06:38 +02:00
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
LONG x;
|
|
|
|
LONG y;
|
|
|
|
LONG offset_x;
|
|
|
|
LONG offset_y;
|
|
|
|
} xy_test_t;
|
|
|
|
|
|
|
|
static const xy_test_t no_xy = {-10,-10,-10,-10};
|
|
|
|
|
|
|
|
static const char empty_doc_str[] =
|
|
|
|
"<html></html>";
|
|
|
|
|
2017-09-29 19:57:30 +02:00
|
|
|
static const char empty_doc_ie9_str[] =
|
|
|
|
"<html>"
|
|
|
|
"<head><meta http-equiv=\"x-ua-compatible\" content=\"IE=9\" /></head>"
|
|
|
|
"</html>";
|
2009-09-06 19:06:38 +02:00
|
|
|
|
2009-11-30 18:03:02 +01:00
|
|
|
static const char readystate_doc_str[] =
|
2010-03-18 01:06:28 +01:00
|
|
|
"<html><body><iframe id=\"iframe\"></iframe></body></html>";
|
|
|
|
|
2017-09-29 19:57:30 +02:00
|
|
|
static const char readystate_doc_ie9_str[] =
|
|
|
|
"<html>"
|
|
|
|
"<head><meta http-equiv=\"x-ua-compatible\" content=\"IE=9\" /></head>"
|
|
|
|
"<body><iframe id=\"iframe\"></iframe></body></html>";
|
|
|
|
|
2010-03-18 01:06:28 +01:00
|
|
|
static const char img_doc_str[] =
|
|
|
|
"<html><body><img id=\"imgid\"></img></body></html>";
|
2009-11-30 18:03:02 +01:00
|
|
|
|
2016-06-23 15:32:56 +02:00
|
|
|
static const char link_doc_str[] =
|
|
|
|
"<html><body><link id=\"linkid\" rel=\"stylesheet\" type=\"text/css\"></link></body></html>";
|
|
|
|
|
2011-02-06 22:16:14 +01:00
|
|
|
static const char input_doc_str[] =
|
2016-04-04 13:22:46 +02:00
|
|
|
"<html><body><div id=\"divid\"><input id=\"inputid\"></input></div></body></html>";
|
2011-02-06 22:16:14 +01:00
|
|
|
|
2011-02-27 05:14:59 +01:00
|
|
|
static const char iframe_doc_str[] =
|
|
|
|
"<html><body><iframe id=\"ifr\">Testing</iframe></body></html>";
|
|
|
|
|
2009-09-06 19:06:38 +02:00
|
|
|
static BOOL iface_cmp(IUnknown *iface1, IUnknown *iface2)
|
|
|
|
{
|
|
|
|
IUnknown *unk1, *unk2;
|
|
|
|
|
|
|
|
if(iface1 == iface2)
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
IUnknown_QueryInterface(iface1, &IID_IUnknown, (void**)&unk1);
|
|
|
|
IUnknown_Release(unk1);
|
2017-10-09 15:10:41 +02:00
|
|
|
IUnknown_QueryInterface(iface2, &IID_IUnknown, (void**)&unk2);
|
2009-09-06 19:06:38 +02:00
|
|
|
IUnknown_Release(unk2);
|
|
|
|
|
|
|
|
return unk1 == unk2;
|
|
|
|
}
|
|
|
|
|
|
|
|
#define test_disp(u,id) _test_disp(__LINE__,u,id)
|
|
|
|
static void _test_disp(unsigned line, IUnknown *unk, const IID *diid)
|
|
|
|
{
|
|
|
|
IDispatchEx *dispex;
|
|
|
|
ITypeInfo *typeinfo;
|
|
|
|
UINT ticnt;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
hres = IUnknown_QueryInterface(unk, &IID_IDispatchEx, (void**)&dispex);
|
|
|
|
ok_(__FILE__,line) (hres == S_OK, "Could not get IDispatch: %08x\n", hres);
|
|
|
|
if(FAILED(hres))
|
|
|
|
return;
|
|
|
|
|
|
|
|
ticnt = 0xdeadbeef;
|
|
|
|
hres = IDispatchEx_GetTypeInfoCount(dispex, &ticnt);
|
|
|
|
ok_(__FILE__,line) (hres == S_OK, "GetTypeInfoCount failed: %08x\n", hres);
|
|
|
|
ok_(__FILE__,line) (ticnt == 1, "ticnt=%u\n", ticnt);
|
|
|
|
|
|
|
|
hres = IDispatchEx_GetTypeInfo(dispex, 0, 0, &typeinfo);
|
|
|
|
ok_(__FILE__,line) (hres == S_OK, "GetTypeInfo failed: %08x\n", hres);
|
|
|
|
|
|
|
|
if(SUCCEEDED(hres)) {
|
|
|
|
TYPEATTR *type_attr;
|
|
|
|
|
|
|
|
hres = ITypeInfo_GetTypeAttr(typeinfo, &type_attr);
|
|
|
|
ok_(__FILE__,line) (hres == S_OK, "GetTypeAttr failed: %08x\n", hres);
|
2017-09-29 19:57:30 +02:00
|
|
|
if(diid)
|
|
|
|
ok_(__FILE__,line) (IsEqualGUID(&type_attr->guid, diid), "unexpected guid %s\n",
|
|
|
|
wine_dbgstr_guid(&type_attr->guid));
|
2009-09-06 19:06:38 +02:00
|
|
|
|
|
|
|
ITypeInfo_ReleaseTypeAttr(typeinfo, type_attr);
|
|
|
|
ITypeInfo_Release(typeinfo);
|
|
|
|
}
|
|
|
|
|
|
|
|
IDispatchEx_Release(dispex);
|
|
|
|
}
|
|
|
|
|
|
|
|
#define get_doc3_iface(u) _get_doc3_iface(__LINE__,u)
|
|
|
|
static IHTMLDocument3 *_get_doc3_iface(unsigned line, IUnknown *unk)
|
|
|
|
{
|
|
|
|
IHTMLDocument3 *doc3;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
hres = IUnknown_QueryInterface(unk, &IID_IHTMLDocument3, (void**)&doc3);
|
|
|
|
ok_(__FILE__,line) (hres == S_OK, "Could not get IHTMLDocument3 iface: %08x\n", hres);
|
|
|
|
|
|
|
|
return doc3;
|
|
|
|
}
|
|
|
|
|
|
|
|
#define get_elem_iface(u) _get_elem_iface(__LINE__,u)
|
|
|
|
static IHTMLElement *_get_elem_iface(unsigned line, IUnknown *unk)
|
|
|
|
{
|
|
|
|
IHTMLElement *elem;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
hres = IUnknown_QueryInterface(unk, &IID_IHTMLElement, (void**)&elem);
|
|
|
|
ok_(__FILE__,line) (hres == S_OK, "Could not get IHTMLElement iface: %08x\n", hres);
|
|
|
|
|
|
|
|
return elem;
|
|
|
|
}
|
|
|
|
|
|
|
|
#define get_elem2_iface(u) _get_elem2_iface(__LINE__,u)
|
|
|
|
static IHTMLElement2 *_get_elem2_iface(unsigned line, IUnknown *unk)
|
|
|
|
{
|
|
|
|
IHTMLElement2 *elem2;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
hres = IUnknown_QueryInterface(unk, &IID_IHTMLElement2, (void**)&elem2);
|
|
|
|
ok_(__FILE__,line) (hres == S_OK, "Could not get IHTMLElement2 iface: %08x\n", hres);
|
|
|
|
|
|
|
|
return elem2;
|
|
|
|
}
|
|
|
|
|
2009-10-13 00:42:37 +02:00
|
|
|
#define get_elem3_iface(u) _get_elem3_iface(__LINE__,u)
|
|
|
|
static IHTMLElement3 *_get_elem3_iface(unsigned line, IUnknown *unk)
|
|
|
|
{
|
|
|
|
IHTMLElement3 *elem3;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
hres = IUnknown_QueryInterface(unk, &IID_IHTMLElement3, (void**)&elem3);
|
|
|
|
ok_(__FILE__,line) (hres == S_OK, "Could not get IHTMLElement3 iface: %08x\n", hres);
|
|
|
|
|
|
|
|
return elem3;
|
|
|
|
}
|
|
|
|
|
2016-04-04 13:22:46 +02:00
|
|
|
#define get_elem4_iface(u) _get_elem4_iface(__LINE__,u)
|
|
|
|
static IHTMLElement4 *_get_elem4_iface(unsigned line, IUnknown *unk)
|
|
|
|
{
|
|
|
|
IHTMLElement4 *elem4;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
hres = IUnknown_QueryInterface(unk, &IID_IHTMLElement4, (void**)&elem4);
|
|
|
|
ok_(__FILE__,line) (hres == S_OK, "Could not get IHTMLElement4 iface: %08x\n", hres);
|
|
|
|
|
|
|
|
return elem4;
|
|
|
|
}
|
|
|
|
|
2014-03-11 19:01:09 +01:00
|
|
|
#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;
|
|
|
|
}
|
|
|
|
|
2009-09-06 19:06:38 +02:00
|
|
|
#define doc_get_body(d) _doc_get_body(__LINE__,d)
|
|
|
|
static IHTMLElement *_doc_get_body(unsigned line, IHTMLDocument2 *doc)
|
|
|
|
{
|
|
|
|
IHTMLElement *body = NULL;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
hres = IHTMLDocument2_get_body(doc, &body);
|
|
|
|
ok_(__FILE__,line) (hres == S_OK, "get_body failed: %08x\n", hres);
|
|
|
|
ok_(__FILE__,line) (body != NULL, "body == NULL\n");
|
|
|
|
|
|
|
|
return body;
|
|
|
|
}
|
|
|
|
|
|
|
|
#define get_elem_id(d,i) _get_elem_id(__LINE__,d,i)
|
2020-02-12 00:32:46 +01:00
|
|
|
static IHTMLElement *_get_elem_id(unsigned line, IHTMLDocument2 *doc, const WCHAR *id)
|
2009-09-06 19:06:38 +02:00
|
|
|
{
|
|
|
|
IHTMLDocument3 *doc3 = _get_doc3_iface(line, (IUnknown*)doc);
|
|
|
|
IHTMLElement *elem;
|
|
|
|
BSTR str;
|
|
|
|
HRESULT hres;
|
|
|
|
|
2020-02-12 00:32:46 +01:00
|
|
|
str = SysAllocString(id);
|
2009-09-06 19:06:38 +02:00
|
|
|
hres = IHTMLDocument3_getElementById(doc3, str, &elem);
|
|
|
|
SysFreeString(str);
|
|
|
|
IHTMLDocument3_Release(doc3);
|
|
|
|
ok_(__FILE__,line) (hres == S_OK, "getElementById failed: %08x\n", hres);
|
2016-04-04 18:02:04 +02:00
|
|
|
ok_(__FILE__,line) (elem != NULL, "elem == NULL\n");
|
2009-09-06 19:06:38 +02:00
|
|
|
|
|
|
|
return elem;
|
|
|
|
}
|
|
|
|
|
|
|
|
#define test_elem_tag(u,n) _test_elem_tag(__LINE__,u,n)
|
2020-02-12 00:32:47 +01:00
|
|
|
static void _test_elem_tag(unsigned line, IUnknown *unk, const WCHAR *extag)
|
2009-09-06 19:06:38 +02:00
|
|
|
{
|
|
|
|
IHTMLElement *elem = _get_elem_iface(line, unk);
|
|
|
|
BSTR tag;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
hres = IHTMLElement_get_tagName(elem, &tag);
|
|
|
|
IHTMLElement_Release(elem);
|
|
|
|
ok_(__FILE__, line) (hres == S_OK, "get_tagName failed: %08x\n", hres);
|
2020-02-12 00:32:47 +01:00
|
|
|
ok_(__FILE__, line) (!lstrcmpW(tag, extag), "got tag: %s, expected %s\n", wine_dbgstr_w(tag), wine_dbgstr_w(extag));
|
2009-09-06 19:06:38 +02:00
|
|
|
|
|
|
|
SysFreeString(tag);
|
|
|
|
}
|
|
|
|
|
|
|
|
#define get_event_obj() _get_event_obj(__LINE__)
|
|
|
|
static IHTMLEventObj *_get_event_obj(unsigned line)
|
|
|
|
{
|
|
|
|
IHTMLEventObj *event = NULL;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
hres = IHTMLWindow2_get_event(window, &event);
|
|
|
|
ok_(__FILE__,line) (hres == S_OK, "get_event failed: %08x\n", hres);
|
|
|
|
ok_(__FILE__,line) (event != NULL, "event = NULL\n");
|
2017-09-29 19:57:30 +02:00
|
|
|
|
|
|
|
/* Native IE uses an undocumented DIID in IE9+ mode */
|
|
|
|
_test_disp(line, (IUnknown*)event, document_mode < 9 ? &DIID_DispCEventObj : NULL);
|
2009-09-06 19:06:38 +02:00
|
|
|
|
|
|
|
return event;
|
|
|
|
}
|
|
|
|
|
2017-09-29 19:57:30 +02:00
|
|
|
#define set_elem_innerhtml(e,t) _set_elem_innerhtml(__LINE__,e,t)
|
2020-02-12 00:32:46 +01:00
|
|
|
static void _set_elem_innerhtml(unsigned line, IHTMLElement *elem, const WCHAR *inner_html)
|
2017-09-29 19:57:30 +02:00
|
|
|
{
|
|
|
|
BSTR html;
|
|
|
|
HRESULT hres;
|
|
|
|
|
2020-02-12 00:32:46 +01:00
|
|
|
html = SysAllocString(inner_html);
|
2017-09-29 19:57:30 +02:00
|
|
|
hres = IHTMLElement_put_innerHTML(elem, html);
|
|
|
|
ok_(__FILE__,line)(hres == S_OK, "put_innerHTML failed: %08x\n", hres);
|
|
|
|
SysFreeString(html);
|
|
|
|
}
|
|
|
|
|
2009-10-13 00:42:37 +02:00
|
|
|
#define elem_fire_event(a,b,c) _elem_fire_event(__LINE__,a,b,c)
|
2020-02-12 00:32:46 +01:00
|
|
|
static void _elem_fire_event(unsigned line, IUnknown *unk, const WCHAR *event, VARIANT *evobj)
|
2009-10-13 00:42:37 +02:00
|
|
|
{
|
|
|
|
IHTMLElement3 *elem3 = _get_elem3_iface(line, unk);
|
|
|
|
VARIANT_BOOL b;
|
|
|
|
BSTR str;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
b = 100;
|
2020-02-12 00:32:46 +01:00
|
|
|
str = SysAllocString(event);
|
2017-10-25 18:13:26 +02:00
|
|
|
in_fire_event++;
|
2009-10-13 00:42:37 +02:00
|
|
|
hres = IHTMLElement3_fireEvent(elem3, str, evobj, &b);
|
2017-10-25 18:13:26 +02:00
|
|
|
in_fire_event--;
|
2009-10-13 00:42:37 +02:00
|
|
|
SysFreeString(str);
|
|
|
|
ok_(__FILE__,line)(hres == S_OK, "fireEvent failed: %08x\n", hres);
|
|
|
|
ok_(__FILE__,line)(b == VARIANT_TRUE, "fireEvent returned %x\n", b);
|
|
|
|
}
|
|
|
|
|
2009-09-06 19:06:38 +02:00
|
|
|
#define test_event_args(a,b,c,d,e,f,g) _test_event_args(__LINE__,a,b,c,d,e,f,g)
|
|
|
|
static void _test_event_args(unsigned line, const IID *dispiid, DISPID id, WORD wFlags, DISPPARAMS *pdp,
|
|
|
|
VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
|
|
|
|
{
|
|
|
|
ok_(__FILE__,line) (id == DISPID_VALUE, "id = %d\n", id);
|
|
|
|
ok_(__FILE__,line) (wFlags == DISPATCH_METHOD, "wFlags = %x\n", wFlags);
|
|
|
|
ok_(__FILE__,line) (pdp != NULL, "pdp == NULL\n");
|
2017-09-29 19:57:30 +02:00
|
|
|
ok_(__FILE__,line) (pdp->cArgs == (document_mode < 9 ? 1 : 2), "pdp->cArgs = %d\n", pdp->cArgs);
|
2009-09-06 19:06:38 +02:00
|
|
|
ok_(__FILE__,line) (pdp->cNamedArgs == 1, "pdp->cNamedArgs = %d\n", pdp->cNamedArgs);
|
|
|
|
ok_(__FILE__,line) (pdp->rgdispidNamedArgs[0] == DISPID_THIS, "pdp->rgdispidNamedArgs[0] = %d\n",
|
|
|
|
pdp->rgdispidNamedArgs[0]);
|
|
|
|
ok_(__FILE__,line) (V_VT(pdp->rgvarg) == VT_DISPATCH, "V_VT(rgvarg) = %d\n", V_VT(pdp->rgvarg));
|
2017-09-29 19:57:30 +02:00
|
|
|
if(pdp->cArgs > 1)
|
2017-10-25 18:13:26 +02:00
|
|
|
ok_(__FILE__,line) (V_VT(pdp->rgvarg+1) == VT_DISPATCH, "V_VT(rgvarg) = %d\n", V_VT(pdp->rgvarg+1));
|
2009-09-06 19:06:38 +02:00
|
|
|
ok_(__FILE__,line) (pvarRes != NULL, "pvarRes == NULL\n");
|
2018-01-05 06:02:30 +01:00
|
|
|
ok_(__FILE__,line) (pei != NULL, "pei == NULL\n");
|
2009-09-06 19:06:38 +02:00
|
|
|
ok_(__FILE__,line) (!pspCaller, "pspCaller != NULL\n");
|
|
|
|
|
|
|
|
if(dispiid)
|
|
|
|
_test_disp(line, (IUnknown*)V_DISPATCH(pdp->rgvarg), dispiid);
|
2017-10-25 18:13:26 +02:00
|
|
|
|
|
|
|
if(pdp->cArgs > 1) {
|
|
|
|
IHTMLEventObj *window_event, *event_obj;
|
|
|
|
IDOMEvent *event;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
hres = IDispatch_QueryInterface(V_DISPATCH(pdp->rgvarg+1), &IID_IDOMEvent, (void**)&event);
|
|
|
|
if(in_fire_event)
|
|
|
|
ok(hres == E_NOINTERFACE, "QI(IID_IDOMEvent) returned %08x\n", hres);
|
|
|
|
else
|
|
|
|
ok(hres == S_OK, "Could not get IDOMEvent iface: %08x\n", hres);
|
|
|
|
|
|
|
|
hres = IDispatch_QueryInterface(V_DISPATCH(pdp->rgvarg+1), &IID_IHTMLEventObj, (void**)&event_obj);
|
|
|
|
if(in_fire_event)
|
|
|
|
ok(hres == S_OK, "Could not get IDOMEventObj iface: %08x\n", hres);
|
|
|
|
else
|
|
|
|
ok(hres == E_NOINTERFACE, "QI(IID_IHTMLEventObj) returned %08x\n", hres);
|
|
|
|
|
|
|
|
if(event)
|
|
|
|
IDOMEvent_Release(event);
|
|
|
|
if(event_obj)
|
|
|
|
IHTMLEventObj_Release(event_obj);
|
|
|
|
|
|
|
|
hres = IHTMLWindow2_get_event(window, &window_event);
|
|
|
|
ok(hres == S_OK, "get_event failed: %08x\n", hres);
|
|
|
|
if(window_event) {
|
|
|
|
todo_wine_if(in_fire_event)
|
|
|
|
ok(!iface_cmp((IUnknown*)V_DISPATCH(pdp->rgvarg+1), (IUnknown*)window_event),
|
|
|
|
"window_event != event arg\n");
|
|
|
|
IHTMLEventObj_Release(window_event);
|
|
|
|
}
|
|
|
|
}
|
2009-09-06 19:06:38 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#define test_attached_event_args(a,b,c,d,e) _test_attached_event_args(__LINE__,a,b,c,d,e)
|
|
|
|
static void _test_attached_event_args(unsigned line, DISPID id, WORD wFlags, DISPPARAMS *pdp,
|
|
|
|
VARIANT *pvarRes, EXCEPINFO *pei)
|
|
|
|
{
|
|
|
|
IHTMLEventObj *event;
|
|
|
|
|
|
|
|
ok(id == DISPID_VALUE, "id = %d\n", id);
|
|
|
|
ok(wFlags == DISPATCH_METHOD, "wFlags = %x\n", wFlags);
|
|
|
|
ok(pdp != NULL, "pDispParams == NULL\n");
|
|
|
|
ok(pdp->cArgs == 1, "pdp->cArgs = %d\n", pdp->cArgs);
|
|
|
|
ok(!pdp->cNamedArgs, "pdp->cNamedArgs = %d\n", pdp->cNamedArgs);
|
|
|
|
ok(!pdp->rgdispidNamedArgs, "pdp->rgdispidNamedArgs = %p\n", pdp->rgdispidNamedArgs);
|
|
|
|
ok(pdp->rgvarg != NULL, "rgvarg = NULL\n");
|
|
|
|
ok(pvarRes != NULL, "pvarRes = NULL\n");
|
|
|
|
ok(pei != NULL, "pei = NULL\n");
|
|
|
|
ok(V_VT(pvarRes) == VT_EMPTY, "V_VT(pVarRes) = %d\n", V_VT(pvarRes));
|
|
|
|
ok(V_VT(pdp->rgvarg) == VT_DISPATCH, "V_VT(pdp->rgvarg) = %d\n", V_VT(pdp->rgvarg));
|
|
|
|
ok(V_DISPATCH(pdp->rgvarg) != NULL, "V_DISPATCH(pdp->rgvarg) = %p\n", V_DISPATCH(pdp->rgvarg));
|
|
|
|
|
|
|
|
event = _get_event_obj(line);
|
2017-10-09 15:10:41 +02:00
|
|
|
todo_wine
|
|
|
|
ok(!iface_cmp((IUnknown*)event, (IUnknown*)V_DISPATCH(pdp->rgvarg)), "event != arg0\n");
|
2009-09-06 19:06:38 +02:00
|
|
|
IHTMLEventObj_Release(event);
|
|
|
|
}
|
|
|
|
|
2009-12-06 13:43:25 +01:00
|
|
|
#define get_event_src() _get_event_src(__LINE__)
|
2009-11-30 18:03:02 +01:00
|
|
|
static IHTMLElement *_get_event_src(unsigned line)
|
2009-09-06 19:06:38 +02:00
|
|
|
{
|
|
|
|
IHTMLEventObj *event = _get_event_obj(line);
|
|
|
|
IHTMLElement *src_elem = NULL;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
hres = IHTMLEventObj_get_srcElement(event, &src_elem);
|
|
|
|
IHTMLEventObj_Release(event);
|
|
|
|
ok_(__FILE__,line) (hres == S_OK, "get_srcElement failed: %08x\n", hres);
|
|
|
|
|
2009-11-30 18:03:02 +01:00
|
|
|
return src_elem;
|
|
|
|
}
|
|
|
|
|
|
|
|
#define test_event_src(t) _test_event_src(__LINE__,t)
|
2020-02-12 00:32:47 +01:00
|
|
|
static void _test_event_src(unsigned line, const WCHAR *src_tag)
|
2009-11-30 18:03:02 +01:00
|
|
|
{
|
|
|
|
IHTMLElement *src_elem = _get_event_src(line);
|
|
|
|
|
2009-09-06 19:06:38 +02:00
|
|
|
if(src_tag) {
|
|
|
|
ok_(__FILE__,line) (src_elem != NULL, "src_elem = NULL\n");
|
|
|
|
_test_elem_tag(line, (IUnknown*)src_elem, src_tag);
|
|
|
|
IHTMLElement_Release(src_elem);
|
|
|
|
}else {
|
|
|
|
ok_(__FILE__,line) (!src_elem, "src_elem != NULL\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void _test_event_altkey(unsigned line, IHTMLEventObj *event, VARIANT_BOOL exval)
|
|
|
|
{
|
|
|
|
VARIANT_BOOL b;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
hres = IHTMLEventObj_get_altKey(event, &b);
|
|
|
|
ok_(__FILE__,line)(hres == S_OK, "get_altKey failed: %08x\n", hres);
|
|
|
|
ok_(__FILE__,line)(b == exval, "altKey = %x, expected %x\n", b, exval);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void _test_event_ctrlkey(unsigned line, IHTMLEventObj *event, VARIANT_BOOL exval)
|
|
|
|
{
|
|
|
|
VARIANT_BOOL b;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
hres = IHTMLEventObj_get_ctrlKey(event, &b);
|
|
|
|
ok_(__FILE__,line)(hres == S_OK, "get_ctrlKey failed: %08x\n", hres);
|
|
|
|
ok_(__FILE__,line)(b == exval, "ctrlKey = %x, expected %x\n", b, exval);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void _test_event_shiftkey(unsigned line, IHTMLEventObj *event, VARIANT_BOOL exval)
|
|
|
|
{
|
|
|
|
VARIANT_BOOL b;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
hres = IHTMLEventObj_get_shiftKey(event, &b);
|
|
|
|
ok_(__FILE__,line)(hres == S_OK, "get_shiftKey failed: %08x\n", hres);
|
|
|
|
ok_(__FILE__,line)(b == exval, "shiftKey = %x, expected %x\n", b, exval);
|
|
|
|
}
|
|
|
|
|
2012-04-16 13:48:46 +02:00
|
|
|
#define test_event_cancelbubble(a,b) _test_event_cancelbubble(__LINE__,a,b)
|
2009-09-06 19:06:38 +02:00
|
|
|
static void _test_event_cancelbubble(unsigned line, IHTMLEventObj *event, VARIANT_BOOL exval)
|
|
|
|
{
|
|
|
|
VARIANT_BOOL b;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
hres = IHTMLEventObj_get_cancelBubble(event, &b);
|
|
|
|
ok_(__FILE__,line)(hres == S_OK, "get_cancelBubble failed: %08x\n", hres);
|
|
|
|
ok_(__FILE__,line)(b == exval, "cancelBubble = %x, expected %x\n", b, exval);
|
|
|
|
}
|
|
|
|
|
2020-02-12 00:32:47 +01:00
|
|
|
static void _test_event_fromelem(unsigned line, IHTMLEventObj *event, const WCHAR *from_tag)
|
2009-09-06 19:06:38 +02:00
|
|
|
{
|
|
|
|
IHTMLElement *elem;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
hres = IHTMLEventObj_get_fromElement(event, &elem);
|
|
|
|
ok_(__FILE__,line)(hres == S_OK, "get_fromElement failed: %08x\n", hres);
|
|
|
|
if(from_tag)
|
|
|
|
_test_elem_tag(line, (IUnknown*)elem, from_tag);
|
|
|
|
else
|
|
|
|
ok_(__FILE__,line)(elem == NULL, "fromElement != NULL\n");
|
|
|
|
if(elem)
|
|
|
|
IHTMLElement_Release(elem);
|
|
|
|
}
|
|
|
|
|
2020-02-12 00:32:47 +01:00
|
|
|
static void _test_event_toelem(unsigned line, IHTMLEventObj *event, const WCHAR *to_tag)
|
2009-09-06 19:06:38 +02:00
|
|
|
{
|
|
|
|
IHTMLElement *elem;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
hres = IHTMLEventObj_get_toElement(event, &elem);
|
|
|
|
ok_(__FILE__,line)(hres == S_OK, "get_toElement failed: %08x\n", hres);
|
|
|
|
if(to_tag)
|
|
|
|
_test_elem_tag(line, (IUnknown*)elem, to_tag);
|
|
|
|
else
|
|
|
|
ok_(__FILE__,line)(elem == NULL, "toElement != NULL\n");
|
|
|
|
if(elem)
|
|
|
|
IHTMLElement_Release(elem);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void _test_event_keycode(unsigned line, IHTMLEventObj *event, LONG exl)
|
|
|
|
{
|
|
|
|
LONG l;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
hres = IHTMLEventObj_get_keyCode(event, &l);
|
|
|
|
ok_(__FILE__,line)(hres == S_OK, "get_keyCode failed: %08x\n", hres);
|
|
|
|
ok_(__FILE__,line)(l == exl, "keyCode = %x, expected %x\n", l, exl);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void _test_event_button(unsigned line, IHTMLEventObj *event, LONG exl)
|
|
|
|
{
|
|
|
|
LONG l;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
hres = IHTMLEventObj_get_button(event, &l);
|
|
|
|
ok_(__FILE__,line)(hres == S_OK, "get_button failed: %08x\n", hres);
|
|
|
|
ok_(__FILE__,line)(l == exl, "button = %x, expected %x\n", l, exl);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void _test_event_reason(unsigned line, IHTMLEventObj *event, LONG exl)
|
|
|
|
{
|
|
|
|
LONG l;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
hres = IHTMLEventObj_get_reason(event, &l);
|
|
|
|
ok_(__FILE__,line)(hres == S_OK, "get_reason failed: %08x\n", hres);
|
|
|
|
ok_(__FILE__,line)(l == exl, "reason = %x, expected %x\n", l, exl);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void _test_event_x(unsigned line, IHTMLEventObj *event, LONG exl)
|
|
|
|
{
|
|
|
|
LONG l;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
hres = IHTMLEventObj_get_x(event, &l);
|
|
|
|
ok_(__FILE__,line)(hres == S_OK, "get_x failed: %08x\n", hres);
|
2010-06-19 22:25:12 +02:00
|
|
|
if(exl != -10) /* don't test the exact value */
|
2009-09-06 19:06:38 +02:00
|
|
|
ok_(__FILE__,line)(l == exl, "x = %d, expected %d\n", l, exl);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void _test_event_y(unsigned line, IHTMLEventObj *event, LONG exl)
|
|
|
|
{
|
|
|
|
LONG l;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
hres = IHTMLEventObj_get_y(event, &l);
|
|
|
|
ok_(__FILE__,line)(hres == S_OK, "get_y failed: %08x\n", hres);
|
2010-06-19 22:25:12 +02:00
|
|
|
if(exl != -10) /* don't test the exact value */
|
2009-09-06 19:06:38 +02:00
|
|
|
ok_(__FILE__,line)(l == exl, "y = %d, expected %d\n", l, exl);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void _test_event_clientx(unsigned line, IHTMLEventObj *event, LONG exl)
|
|
|
|
{
|
|
|
|
LONG l;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
hres = IHTMLEventObj_get_clientX(event, &l);
|
|
|
|
ok_(__FILE__,line)(hres == S_OK, "get_clientX failed: %08x\n", hres);
|
2010-06-19 22:25:12 +02:00
|
|
|
if(exl != -10) /* don't test the exact value */
|
2009-09-06 19:06:38 +02:00
|
|
|
ok_(__FILE__,line)(l == exl, "clientX = %d, expected %d\n", l, exl);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void _test_event_clienty(unsigned line, IHTMLEventObj *event, LONG exl)
|
|
|
|
{
|
|
|
|
LONG l;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
hres = IHTMLEventObj_get_clientY(event, &l);
|
|
|
|
ok_(__FILE__,line)(hres == S_OK, "get_clientY failed: %08x\n", hres);
|
2010-06-19 22:25:12 +02:00
|
|
|
if(exl != -10) /* don't test the exact value */
|
2009-09-06 19:06:38 +02:00
|
|
|
ok_(__FILE__,line)(l == exl, "clientY = %d, expected %d\n", l, exl);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void _test_event_offsetx(unsigned line, IHTMLEventObj *event, LONG exl)
|
|
|
|
{
|
|
|
|
LONG l;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
hres = IHTMLEventObj_get_offsetX(event, &l);
|
|
|
|
ok_(__FILE__,line)(hres == S_OK, "get_offsetX failed: %08x\n", hres);
|
2010-06-19 22:25:12 +02:00
|
|
|
if(exl != -10) /* don't test the exact value */
|
2009-09-06 19:06:38 +02:00
|
|
|
ok_(__FILE__,line)(l == exl, "offsetX = %d, expected %d\n", l, exl);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void _test_event_offsety(unsigned line, IHTMLEventObj *event, LONG exl)
|
|
|
|
{
|
|
|
|
LONG l;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
hres = IHTMLEventObj_get_offsetY(event, &l);
|
|
|
|
ok_(__FILE__,line)(hres == S_OK, "get_offsetY failed: %08x\n", hres);
|
2010-06-19 22:25:12 +02:00
|
|
|
if(exl != -10) /* don't test the exact value */
|
2009-09-06 19:06:38 +02:00
|
|
|
ok_(__FILE__,line)(l == exl, "offsetY = %d, expected %d\n", l, exl);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void _test_event_screenx(unsigned line, IHTMLEventObj *event, LONG exl)
|
|
|
|
{
|
|
|
|
LONG l;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
hres = IHTMLEventObj_get_screenX(event, &l);
|
|
|
|
ok_(__FILE__,line)(hres == S_OK, "get_screenX failed: %08x\n", hres);
|
2010-06-19 22:25:12 +02:00
|
|
|
if(exl != -10) /* don't test the exact value */
|
2009-09-06 19:06:38 +02:00
|
|
|
ok_(__FILE__,line)(l == exl, "screenX = %d, expected %d\n", l, exl);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void _test_event_screeny(unsigned line, IHTMLEventObj *event, LONG exl)
|
|
|
|
{
|
|
|
|
LONG l;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
hres = IHTMLEventObj_get_screenY(event, &l);
|
|
|
|
ok_(__FILE__,line)(hres == S_OK, "get_screenY failed: %08x\n", hres);
|
2010-06-19 22:25:12 +02:00
|
|
|
if(exl != -10) /* don't test the exact value for -10 */
|
2009-09-06 19:06:38 +02:00
|
|
|
ok_(__FILE__,line)(l == exl, "screenY = %d, expected %d\n", l, exl);
|
|
|
|
}
|
|
|
|
|
2020-02-12 00:32:47 +01:00
|
|
|
static void _test_event_type(unsigned line, IHTMLEventObj *event, const WCHAR *exstr)
|
2009-09-06 19:06:38 +02:00
|
|
|
{
|
|
|
|
BSTR str;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
hres = IHTMLEventObj_get_type(event, &str);
|
|
|
|
ok_(__FILE__,line)(hres == S_OK, "get_type failed: %08x\n", hres);
|
2020-02-12 00:32:47 +01:00
|
|
|
ok_(__FILE__,line)(!lstrcmpW(str, exstr), "type = %s, expected %s\n", wine_dbgstr_w(str), wine_dbgstr_w(exstr));
|
2009-09-06 19:06:38 +02:00
|
|
|
}
|
|
|
|
|
2020-02-12 00:32:47 +01:00
|
|
|
static void _test_event_qualifier(unsigned line, IHTMLEventObj *event, const WCHAR *exstr)
|
2009-09-06 19:06:38 +02:00
|
|
|
{
|
|
|
|
BSTR str;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
hres = IHTMLEventObj_get_qualifier(event, &str);
|
|
|
|
ok_(__FILE__,line)(hres == S_OK, "get_qualifier failed: %08x\n", hres);
|
|
|
|
if(exstr)
|
2020-02-12 00:32:47 +01:00
|
|
|
ok_(__FILE__,line)(!lstrcmpW(str, exstr), "qualifier = %s, expected %s\n", wine_dbgstr_w(str),
|
|
|
|
wine_dbgstr_w(exstr));
|
2009-09-06 19:06:38 +02:00
|
|
|
else
|
|
|
|
ok_(__FILE__,line)(!str, "qualifier != NULL\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
static void _test_event_srcfilter(unsigned line, IHTMLEventObj *event)
|
|
|
|
{
|
|
|
|
IDispatch *disp;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
hres = IHTMLEventObj_get_srcFilter(event, &disp);
|
|
|
|
ok_(__FILE__,line)(hres == S_OK, "get_srcFilter failed: %08x\n", hres);
|
|
|
|
ok_(__FILE__,line)(!disp, "srcFilter != NULL\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
#define test_event_obj(t,x) _test_event_obj(__LINE__,t,x)
|
2020-02-12 00:32:47 +01:00
|
|
|
static void _test_event_obj(unsigned line, const WCHAR *type, const xy_test_t *xy)
|
2009-09-06 19:06:38 +02:00
|
|
|
{
|
|
|
|
IHTMLEventObj *event = _get_event_obj(line);
|
2017-10-25 18:13:26 +02:00
|
|
|
IDOMEvent *dom_event;
|
2009-09-06 19:06:38 +02:00
|
|
|
VARIANT v;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
_test_event_altkey(line, event, VARIANT_FALSE);
|
|
|
|
_test_event_ctrlkey(line, event, VARIANT_FALSE);
|
|
|
|
_test_event_shiftkey(line, event, VARIANT_FALSE);
|
|
|
|
_test_event_cancelbubble(line, event, VARIANT_FALSE);
|
|
|
|
_test_event_fromelem(line, event, NULL);
|
|
|
|
_test_event_toelem(line, event, NULL);
|
|
|
|
_test_event_keycode(line, event, 0);
|
|
|
|
_test_event_button(line, event, 0);
|
|
|
|
_test_event_type(line, event, type);
|
|
|
|
_test_event_qualifier(line, event, NULL);
|
|
|
|
_test_event_reason(line, event, 0);
|
|
|
|
_test_event_srcfilter(line, event);
|
|
|
|
_test_event_x(line, event, xy->x);
|
|
|
|
_test_event_y(line, event, xy->y);
|
|
|
|
_test_event_clientx(line, event, -10);
|
|
|
|
_test_event_clienty(line, event, -10);
|
|
|
|
_test_event_offsetx(line, event, xy->offset_x);
|
|
|
|
_test_event_offsety(line, event, xy->offset_y);
|
|
|
|
_test_event_screenx(line, event, -10);
|
|
|
|
_test_event_screeny(line, event, -10);
|
|
|
|
|
2011-11-16 15:26:49 +01:00
|
|
|
V_VT(&v) = VT_NULL;
|
2009-09-06 19:06:38 +02:00
|
|
|
hres = IHTMLEventObj_get_returnValue(event, &v);
|
|
|
|
ok_(__FILE__,line)(hres == S_OK, "get_returnValue failed: %08x\n", hres);
|
2017-09-29 19:57:30 +02:00
|
|
|
/* Depending on source of event, returnValue may be true bool in IE9+ mode */
|
|
|
|
ok_(__FILE__,line)(V_VT(&v) == VT_EMPTY || (document_mode >= 9 && V_VT(&v) == VT_BOOL),
|
|
|
|
"V_VT(returnValue) = %d\n", V_VT(&v));
|
|
|
|
if(V_VT(&v) == VT_BOOL)
|
|
|
|
ok_(__FILE__,line)(V_BOOL(&v) == VARIANT_TRUE, "V_BOOL(returnValue) = %x\n", V_BOOL(&v));
|
2009-09-06 19:06:38 +02:00
|
|
|
|
2017-10-25 18:13:26 +02:00
|
|
|
hres = IHTMLEventObj_QueryInterface(event, &IID_IDOMEvent, (void**)&dom_event);
|
|
|
|
ok(hres == E_NOINTERFACE, "Could not get IDOMEvent iface: %08x\n", hres);
|
|
|
|
|
2009-09-06 19:06:38 +02:00
|
|
|
IHTMLEventObj_Release(event);
|
|
|
|
}
|
|
|
|
|
|
|
|
#define elem_attach_event(a,b,c) _elem_attach_event(__LINE__,a,b,c)
|
2020-02-12 00:32:46 +01:00
|
|
|
static void _elem_attach_event(unsigned line, IUnknown *unk, const WCHAR *namew, IDispatch *disp)
|
2009-09-06 19:06:38 +02:00
|
|
|
{
|
|
|
|
IHTMLElement2 *elem = _get_elem2_iface(line, unk);
|
|
|
|
VARIANT_BOOL res;
|
|
|
|
BSTR name;
|
|
|
|
HRESULT hres;
|
|
|
|
|
2020-02-12 00:32:46 +01:00
|
|
|
name = SysAllocString(namew);
|
2009-09-06 19:06:38 +02:00
|
|
|
hres = IHTMLElement2_attachEvent(elem, name, disp, &res);
|
|
|
|
IHTMLElement2_Release(elem);
|
|
|
|
SysFreeString(name);
|
|
|
|
ok_(__FILE__,line)(hres == S_OK, "attachEvent failed: %08x\n", hres);
|
|
|
|
ok_(__FILE__,line)(res == VARIANT_TRUE, "attachEvent returned %x\n", res);
|
|
|
|
}
|
|
|
|
|
2017-10-25 18:14:05 +02:00
|
|
|
#define add_event_listener(a,b,c,d) _add_event_listener(__LINE__,a,b,c,d)
|
2020-02-12 00:32:46 +01:00
|
|
|
static void _add_event_listener(unsigned line, IUnknown *unk, const WCHAR *type, IDispatch *listener, VARIANT_BOOL use_capture)
|
2017-10-25 18:14:05 +02:00
|
|
|
{
|
|
|
|
IEventTarget *event_target;
|
|
|
|
BSTR str;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
hres = IUnknown_QueryInterface(unk, &IID_IEventTarget, (void**)&event_target);
|
|
|
|
ok_(__FILE__,line)(hres == S_OK, "Could not get IEventTarget iface: %08x\n", hres);
|
|
|
|
|
2020-02-12 00:32:46 +01:00
|
|
|
str = SysAllocString(type);
|
2017-10-25 18:14:05 +02:00
|
|
|
hres = IEventTarget_addEventListener(event_target, str, listener, use_capture);
|
|
|
|
SysFreeString(str);
|
|
|
|
ok_(__FILE__,line)(hres == S_OK, "addEventListener failed: %08x\n", hres);
|
|
|
|
|
|
|
|
IEventTarget_Release(event_target);
|
|
|
|
}
|
|
|
|
|
|
|
|
#define remove_event_listener(a,b,c,d) _remove_event_listener(__LINE__,a,b,c,d)
|
2020-02-12 00:32:46 +01:00
|
|
|
static void _remove_event_listener(unsigned line, IUnknown *unk, const WCHAR *type, IDispatch *listener, VARIANT_BOOL use_capture)
|
2017-10-25 18:14:05 +02:00
|
|
|
{
|
|
|
|
IEventTarget *event_target;
|
|
|
|
BSTR str;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
hres = IUnknown_QueryInterface(unk, &IID_IEventTarget, (void**)&event_target);
|
|
|
|
ok_(__FILE__,line)(hres == S_OK, "Could not get IEventTarget iface: %08x\n", hres);
|
|
|
|
|
2020-02-12 00:32:46 +01:00
|
|
|
str = SysAllocString(type);
|
2017-10-25 18:14:05 +02:00
|
|
|
hres = IEventTarget_removeEventListener(event_target, str, listener, use_capture);
|
|
|
|
SysFreeString(str);
|
|
|
|
ok_(__FILE__,line)(hres == S_OK, "removeEventListener failed: %08x\n", hres);
|
|
|
|
|
|
|
|
IEventTarget_Release(event_target);
|
|
|
|
}
|
|
|
|
|
2010-02-08 21:49:37 +01:00
|
|
|
#define elem_detach_event(a,b,c) _elem_detach_event(__LINE__,a,b,c)
|
2020-02-12 00:32:46 +01:00
|
|
|
static void _elem_detach_event(unsigned line, IUnknown *unk, const WCHAR *namew, IDispatch *disp)
|
2010-02-08 21:49:37 +01:00
|
|
|
{
|
|
|
|
IHTMLElement2 *elem = _get_elem2_iface(line, unk);
|
|
|
|
BSTR name;
|
|
|
|
HRESULT hres;
|
|
|
|
|
2020-02-12 00:32:46 +01:00
|
|
|
name = SysAllocString(namew);
|
2010-02-08 21:49:37 +01:00
|
|
|
hres = IHTMLElement2_detachEvent(elem, name, disp);
|
|
|
|
IHTMLElement2_Release(elem);
|
|
|
|
SysFreeString(name);
|
|
|
|
ok_(__FILE__,line)(hres == S_OK, "detachEvent failed: %08x\n", hres);
|
|
|
|
}
|
|
|
|
|
2010-07-17 13:31:43 +02:00
|
|
|
#define doc_attach_event(a,b,c) _doc_attach_event(__LINE__,a,b,c)
|
2020-02-12 00:32:46 +01:00
|
|
|
static void _doc_attach_event(unsigned line, IHTMLDocument2 *doc, const WCHAR *namew, IDispatch *disp)
|
2010-07-17 13:31:43 +02:00
|
|
|
{
|
|
|
|
IHTMLDocument3 *doc3 = _get_doc3_iface(line, (IUnknown*)doc);
|
|
|
|
VARIANT_BOOL res;
|
|
|
|
BSTR name;
|
|
|
|
HRESULT hres;
|
|
|
|
|
2020-02-12 00:32:46 +01:00
|
|
|
name = SysAllocString(namew);
|
2010-07-17 13:31:43 +02:00
|
|
|
hres = IHTMLDocument3_attachEvent(doc3, name, disp, &res);
|
|
|
|
IHTMLDocument3_Release(doc3);
|
|
|
|
SysFreeString(name);
|
|
|
|
ok_(__FILE__,line)(hres == S_OK, "attachEvent failed: %08x\n", hres);
|
|
|
|
ok_(__FILE__,line)(res == VARIANT_TRUE, "attachEvent returned %x\n", res);
|
|
|
|
}
|
|
|
|
|
|
|
|
#define doc_detach_event(a,b,c) _doc_detach_event(__LINE__,a,b,c)
|
2020-02-12 00:32:46 +01:00
|
|
|
static void _doc_detach_event(unsigned line, IHTMLDocument2 *doc, const WCHAR *namew, IDispatch *disp)
|
2010-07-17 13:31:43 +02:00
|
|
|
{
|
|
|
|
IHTMLDocument3 *doc3 = _get_doc3_iface(line, (IUnknown*)doc);
|
|
|
|
BSTR name;
|
|
|
|
HRESULT hres;
|
|
|
|
|
2020-02-12 00:32:46 +01:00
|
|
|
name = SysAllocString(namew);
|
2010-07-17 13:31:43 +02:00
|
|
|
hres = IHTMLDocument3_detachEvent(doc3, name, disp);
|
|
|
|
IHTMLDocument3_Release(doc3);
|
|
|
|
SysFreeString(name);
|
|
|
|
ok_(__FILE__,line)(hres == S_OK, "detachEvent failed: %08x\n", hres);
|
|
|
|
}
|
|
|
|
|
2009-09-06 19:06:38 +02:00
|
|
|
static HRESULT WINAPI DispatchEx_QueryInterface(IDispatchEx *iface, REFIID riid, void **ppv)
|
|
|
|
{
|
|
|
|
if(IsEqualGUID(riid, &IID_IUnknown)
|
|
|
|
|| IsEqualGUID(riid, &IID_IDispatch)
|
|
|
|
|| IsEqualGUID(riid, &IID_IDispatchEx))
|
|
|
|
*ppv = iface;
|
|
|
|
else {
|
2017-09-29 19:57:30 +02:00
|
|
|
*ppv = NULL;
|
2009-09-06 19:06:38 +02:00
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2010-01-24 21:37:52 +01:00
|
|
|
static HRESULT WINAPI Dispatch_QueryInterface(IDispatchEx *iface, REFIID riid, void **ppv)
|
|
|
|
{
|
2017-09-29 19:57:30 +02:00
|
|
|
if(IsEqualGUID(riid, &IID_IUnknown)
|
2010-01-24 21:37:52 +01:00
|
|
|
|| IsEqualGUID(riid, &IID_IDispatch)) {
|
|
|
|
*ppv = iface;
|
|
|
|
}else {
|
2017-09-29 19:57:30 +02:00
|
|
|
*ppv = NULL;
|
2010-01-24 21:37:52 +01:00
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2009-09-06 19:06:38 +02:00
|
|
|
static ULONG WINAPI DispatchEx_AddRef(IDispatchEx *iface)
|
|
|
|
{
|
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI DispatchEx_Release(IDispatchEx *iface)
|
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI DispatchEx_GetTypeInfoCount(IDispatchEx *iface, UINT *pctinfo)
|
|
|
|
{
|
|
|
|
ok(0, "unexpected call\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI DispatchEx_GetTypeInfo(IDispatchEx *iface, UINT iTInfo,
|
|
|
|
LCID lcid, ITypeInfo **ppTInfo)
|
|
|
|
{
|
|
|
|
ok(0, "unexpected call\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI DispatchEx_GetIDsOfNames(IDispatchEx *iface, REFIID riid,
|
|
|
|
LPOLESTR *rgszNames, UINT cNames,
|
|
|
|
LCID lcid, DISPID *rgDispId)
|
|
|
|
{
|
|
|
|
ok(0, "unexpected call\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI DispatchEx_Invoke(IDispatchEx *iface, DISPID dispIdMember,
|
|
|
|
REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
|
|
|
|
VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
|
|
|
|
{
|
|
|
|
ok(0, "unexpected call\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI DispatchEx_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD grfdex, DISPID *pid)
|
|
|
|
{
|
|
|
|
ok(0, "unexpected call\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI DispatchEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp,
|
|
|
|
VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
|
|
|
|
{
|
|
|
|
ok(0, "unexpected call\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI DispatchEx_DeleteMemberByName(IDispatchEx *iface, BSTR bstrName, DWORD grfdex)
|
|
|
|
{
|
2009-11-30 15:31:08 +01:00
|
|
|
ok(0, "unexpected call %s %x\n", wine_dbgstr_w(bstrName), grfdex);
|
2009-09-06 19:06:38 +02:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI DispatchEx_DeleteMemberByDispID(IDispatchEx *iface, DISPID id)
|
|
|
|
{
|
|
|
|
ok(0, "unexpected call\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI DispatchEx_GetMemberProperties(IDispatchEx *iface, DISPID id, DWORD grfdexFetch, DWORD *pgrfdex)
|
|
|
|
{
|
|
|
|
ok(0, "unexpected call\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI DispatchEx_GetMemberName(IDispatchEx *iface, DISPID id, BSTR *pbstrName)
|
|
|
|
{
|
|
|
|
ok(0, "unexpected call\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI DispatchEx_GetNextDispID(IDispatchEx *iface, DWORD grfdex, DISPID id, DISPID *pid)
|
|
|
|
{
|
|
|
|
ok(0, "unexpected call\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI DispatchEx_GetNameSpaceParent(IDispatchEx *iface, IUnknown **ppunk)
|
|
|
|
{
|
|
|
|
ok(0, "unexpected call\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
#define EVENT_HANDLER_FUNC_OBJ(event) \
|
|
|
|
static IDispatchExVtbl event ## FuncVtbl = { \
|
|
|
|
DispatchEx_QueryInterface, \
|
|
|
|
DispatchEx_AddRef, \
|
|
|
|
DispatchEx_Release, \
|
|
|
|
DispatchEx_GetTypeInfoCount, \
|
|
|
|
DispatchEx_GetTypeInfo, \
|
|
|
|
DispatchEx_GetIDsOfNames, \
|
|
|
|
DispatchEx_Invoke, \
|
|
|
|
DispatchEx_GetDispID, \
|
|
|
|
event, \
|
|
|
|
DispatchEx_DeleteMemberByName, \
|
|
|
|
DispatchEx_DeleteMemberByDispID, \
|
|
|
|
DispatchEx_GetMemberProperties, \
|
|
|
|
DispatchEx_GetMemberName, \
|
|
|
|
DispatchEx_GetNextDispID, \
|
|
|
|
DispatchEx_GetNameSpaceParent \
|
|
|
|
}; \
|
|
|
|
static IDispatchEx event ## _obj = { &event ## FuncVtbl };
|
|
|
|
|
|
|
|
static HRESULT WINAPI document_onclick(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp,
|
|
|
|
VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
|
|
|
|
{
|
|
|
|
IHTMLDocument3 *doc3;
|
|
|
|
CHECK_EXPECT(document_onclick);
|
|
|
|
test_event_args(NULL, id, wFlags, pdp, pvarRes, pei, pspCaller);
|
|
|
|
doc3 = get_doc3_iface((IUnknown*)V_DISPATCH(pdp->rgvarg));
|
|
|
|
IHTMLDocument3_Release(doc3);
|
2020-02-12 00:32:47 +01:00
|
|
|
test_event_src(L"DIV");
|
|
|
|
test_event_obj(L"click", &no_xy);
|
2009-09-06 19:06:38 +02:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
EVENT_HANDLER_FUNC_OBJ(document_onclick);
|
|
|
|
|
|
|
|
static HRESULT WINAPI div_onclick(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp,
|
|
|
|
VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
|
|
|
|
{
|
|
|
|
CHECK_EXPECT(div_onclick);
|
|
|
|
test_event_args(NULL, id, wFlags, pdp, pvarRes, pei, pspCaller);
|
2020-02-12 00:32:47 +01:00
|
|
|
test_event_src(L"DIV");
|
|
|
|
test_event_obj(L"click", &no_xy);
|
2009-09-06 19:06:38 +02:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
EVENT_HANDLER_FUNC_OBJ(div_onclick);
|
|
|
|
|
|
|
|
static HRESULT WINAPI div_onclick_attached(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp,
|
|
|
|
VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
|
|
|
|
{
|
|
|
|
CHECK_EXPECT(div_onclick_attached);
|
|
|
|
|
|
|
|
test_attached_event_args(id, wFlags, pdp, pvarRes, pei);
|
2020-02-12 00:32:47 +01:00
|
|
|
test_event_src(L"DIV");
|
2009-09-06 19:06:38 +02:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
EVENT_HANDLER_FUNC_OBJ(div_onclick_attached);
|
|
|
|
|
2010-07-17 13:31:43 +02:00
|
|
|
static HRESULT WINAPI doc_onclick_attached(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp,
|
|
|
|
VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
|
|
|
|
{
|
|
|
|
CHECK_EXPECT(doc_onclick_attached);
|
|
|
|
|
|
|
|
test_attached_event_args(id, wFlags, pdp, pvarRes, pei);
|
2020-02-12 00:32:47 +01:00
|
|
|
test_event_src(L"DIV");
|
2010-07-17 13:31:43 +02:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
EVENT_HANDLER_FUNC_OBJ(doc_onclick_attached);
|
|
|
|
|
2009-09-06 19:06:38 +02:00
|
|
|
static HRESULT WINAPI body_onclick(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp,
|
|
|
|
VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
|
|
|
|
{
|
|
|
|
CHECK_EXPECT(body_onclick);
|
2017-09-29 19:57:30 +02:00
|
|
|
/* Native IE returns undocumented DIID in IE9+ mode */
|
|
|
|
test_event_args(document_mode < 9 ? &DIID_DispHTMLBody : NULL, id, wFlags, pdp, pvarRes, pei, pspCaller);
|
2020-02-12 00:32:47 +01:00
|
|
|
test_event_src(L"DIV");
|
2009-09-06 19:06:38 +02:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
EVENT_HANDLER_FUNC_OBJ(body_onclick);
|
|
|
|
|
2017-10-25 18:14:05 +02:00
|
|
|
static HRESULT WINAPI div_onclick_capture(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp,
|
|
|
|
VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
|
|
|
|
{
|
|
|
|
CHECK_EXPECT(div_onclick_capture);
|
|
|
|
|
|
|
|
test_event_args(NULL, id, wFlags, pdp, pvarRes, pei, pspCaller);
|
2020-02-12 00:32:47 +01:00
|
|
|
test_event_src(L"DIV");
|
2017-10-25 18:14:05 +02:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
EVENT_HANDLER_FUNC_OBJ(div_onclick_capture);
|
|
|
|
|
|
|
|
static HRESULT WINAPI div_onclick_bubble(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp,
|
|
|
|
VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
|
|
|
|
{
|
|
|
|
CHECK_EXPECT(div_onclick_bubble);
|
|
|
|
|
|
|
|
test_event_args(NULL, id, wFlags, pdp, pvarRes, pei, pspCaller);
|
2020-02-12 00:32:47 +01:00
|
|
|
test_event_src(L"DIV");
|
2017-10-25 18:14:05 +02:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
EVENT_HANDLER_FUNC_OBJ(div_onclick_bubble);
|
|
|
|
|
2010-03-18 01:06:28 +01:00
|
|
|
static HRESULT WINAPI img_onload(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp,
|
|
|
|
VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
|
|
|
|
{
|
|
|
|
CHECK_EXPECT(img_onload);
|
|
|
|
test_event_args(&DIID_DispHTMLImg, id, wFlags, pdp, pvarRes, pei, pspCaller);
|
2020-02-12 00:32:47 +01:00
|
|
|
test_event_src(L"IMG");
|
2010-03-18 01:06:28 +01:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
EVENT_HANDLER_FUNC_OBJ(img_onload);
|
|
|
|
|
2016-06-23 15:32:56 +02:00
|
|
|
static HRESULT WINAPI link_onload(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp,
|
|
|
|
VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
|
|
|
|
{
|
|
|
|
CHECK_EXPECT(link_onload);
|
|
|
|
test_event_args(&DIID_DispHTMLLinkElement, id, wFlags, pdp, pvarRes, pei, pspCaller);
|
2020-02-12 00:32:47 +01:00
|
|
|
test_event_src(L"LINK");
|
2016-06-23 15:32:56 +02:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
EVENT_HANDLER_FUNC_OBJ(link_onload);
|
|
|
|
|
2016-05-02 14:06:30 +02:00
|
|
|
static HRESULT WINAPI unattached_img_onload(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp,
|
|
|
|
VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
|
|
|
|
{
|
|
|
|
IHTMLElement *event_src;
|
|
|
|
|
|
|
|
CHECK_EXPECT(img_onload);
|
|
|
|
|
|
|
|
test_event_args(&DIID_DispHTMLImg, id, wFlags, pdp, pvarRes, pei, pspCaller);
|
|
|
|
event_src = get_event_src();
|
|
|
|
todo_wine
|
|
|
|
ok(!event_src, "event_src != NULL\n");
|
|
|
|
if(event_src)
|
|
|
|
IHTMLElement_Release(event_src);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
EVENT_HANDLER_FUNC_OBJ(unattached_img_onload);
|
|
|
|
|
2012-04-05 13:58:20 +02:00
|
|
|
static HRESULT WINAPI img_onerror(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp,
|
|
|
|
VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
|
|
|
|
{
|
|
|
|
CHECK_EXPECT(img_onerror);
|
|
|
|
test_event_args(&DIID_DispHTMLImg, id, wFlags, pdp, pvarRes, pei, pspCaller);
|
2020-02-12 00:32:47 +01:00
|
|
|
test_event_src(L"IMG");
|
2012-04-05 13:58:20 +02:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
EVENT_HANDLER_FUNC_OBJ(img_onerror);
|
|
|
|
|
2011-02-06 22:16:14 +01:00
|
|
|
static HRESULT WINAPI input_onfocus(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp,
|
|
|
|
VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
|
|
|
|
{
|
|
|
|
CHECK_EXPECT(input_onfocus);
|
|
|
|
test_event_args(&DIID_DispHTMLInputElement, id, wFlags, pdp, pvarRes, pei, pspCaller);
|
2020-02-12 00:32:47 +01:00
|
|
|
test_event_src(L"INPUT");
|
2011-02-06 22:16:14 +01:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
EVENT_HANDLER_FUNC_OBJ(input_onfocus);
|
|
|
|
|
2016-04-04 13:22:46 +02:00
|
|
|
static HRESULT WINAPI div_onfocusin(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp,
|
|
|
|
VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
|
|
|
|
{
|
|
|
|
CHECK_EXPECT(div_onfocusin);
|
|
|
|
test_event_args(NULL /* FIXME: &DIID_DispHTMLDivElement */, id, wFlags, pdp, pvarRes, pei, pspCaller);
|
2020-02-12 00:32:47 +01:00
|
|
|
test_event_src(L"INPUT");
|
2016-04-04 13:22:46 +02:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
EVENT_HANDLER_FUNC_OBJ(div_onfocusin);
|
|
|
|
|
|
|
|
static HRESULT WINAPI div_onfocusout(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp,
|
|
|
|
VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
|
|
|
|
{
|
|
|
|
CHECK_EXPECT(div_onfocusout);
|
|
|
|
test_event_args(NULL /* FIXME: &DIID_DispHTMLDivElement */, id, wFlags, pdp, pvarRes, pei, pspCaller);
|
2020-02-12 00:32:47 +01:00
|
|
|
test_event_src(L"INPUT");
|
2016-04-04 13:22:46 +02:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
EVENT_HANDLER_FUNC_OBJ(div_onfocusout);
|
|
|
|
|
2012-04-10 12:53:24 +02:00
|
|
|
static HRESULT WINAPI input_onblur(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp,
|
|
|
|
VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
|
|
|
|
{
|
|
|
|
CHECK_EXPECT(input_onblur);
|
|
|
|
test_event_args(&DIID_DispHTMLInputElement, id, wFlags, pdp, pvarRes, pei, pspCaller);
|
2020-02-12 00:32:47 +01:00
|
|
|
test_event_src(L"INPUT");
|
2012-04-10 12:53:24 +02:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
EVENT_HANDLER_FUNC_OBJ(input_onblur);
|
|
|
|
|
2011-02-28 13:14:32 +01:00
|
|
|
static HRESULT WINAPI form_onsubmit(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp,
|
|
|
|
VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
|
|
|
|
{
|
|
|
|
CHECK_EXPECT(form_onsubmit);
|
|
|
|
test_event_args(NULL, id, wFlags, pdp, pvarRes, pei, pspCaller);
|
2020-02-12 00:32:47 +01:00
|
|
|
test_event_src(L"FORM");
|
2011-02-28 13:14:32 +01:00
|
|
|
|
|
|
|
V_VT(pvarRes) = VT_BOOL;
|
|
|
|
V_BOOL(pvarRes) = VARIANT_FALSE;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
EVENT_HANDLER_FUNC_OBJ(form_onsubmit);
|
|
|
|
|
|
|
|
static HRESULT WINAPI form_onclick(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp,
|
|
|
|
VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
|
|
|
|
{
|
|
|
|
CHECK_EXPECT(form_onclick);
|
|
|
|
test_event_args(NULL, id, wFlags, pdp, pvarRes, pei, pspCaller);
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
EVENT_HANDLER_FUNC_OBJ(form_onclick);
|
|
|
|
|
|
|
|
static HRESULT WINAPI submit_onclick(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp,
|
|
|
|
VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
|
|
|
|
{
|
|
|
|
CHECK_EXPECT(submit_onclick);
|
|
|
|
test_event_args(NULL, id, wFlags, pdp, pvarRes, pei, pspCaller);
|
2020-02-12 00:32:47 +01:00
|
|
|
test_event_src(L"INPUT");
|
2011-02-28 13:14:32 +01:00
|
|
|
|
|
|
|
V_VT(pvarRes) = VT_BOOL;
|
|
|
|
V_BOOL(pvarRes) = VARIANT_FALSE;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
EVENT_HANDLER_FUNC_OBJ(submit_onclick);
|
|
|
|
|
2014-03-11 19:01:09 +01:00
|
|
|
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);
|
2020-02-12 00:32:47 +01:00
|
|
|
test_event_src(L"IFRAME");
|
2014-03-11 19:01:09 +01:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
EVENT_HANDLER_FUNC_OBJ(iframe_onload);
|
|
|
|
|
2011-02-28 13:14:32 +01:00
|
|
|
static HRESULT WINAPI submit_onclick_attached(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp,
|
|
|
|
VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
|
|
|
|
{
|
|
|
|
CHECK_EXPECT(submit_onclick_attached);
|
|
|
|
test_attached_event_args(id, wFlags, pdp, pvarRes, pei);
|
2020-02-12 00:32:47 +01:00
|
|
|
test_event_src(L"INPUT");
|
2011-02-28 13:14:32 +01:00
|
|
|
|
|
|
|
V_VT(pvarRes) = VT_BOOL;
|
|
|
|
V_BOOL(pvarRes) = VARIANT_FALSE;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
EVENT_HANDLER_FUNC_OBJ(submit_onclick_attached);
|
|
|
|
|
2012-04-16 13:48:46 +02:00
|
|
|
static HRESULT WINAPI submit_onclick_attached_check_cancel(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp,
|
|
|
|
VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
|
|
|
|
{
|
|
|
|
IHTMLEventObj *event;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
CHECK_EXPECT(submit_onclick_attached_check_cancel);
|
|
|
|
test_attached_event_args(id, wFlags, pdp, pvarRes, pei);
|
2020-02-12 00:32:47 +01:00
|
|
|
test_event_src(L"INPUT");
|
2012-04-16 13:48:46 +02:00
|
|
|
|
|
|
|
event = NULL;
|
|
|
|
hres = IHTMLWindow2_get_event(window, &event);
|
|
|
|
ok(hres == S_OK, "get_event failed: %08x\n", hres);
|
|
|
|
ok(event != NULL, "event == NULL\n");
|
|
|
|
|
|
|
|
test_event_cancelbubble(event, VARIANT_TRUE);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
EVENT_HANDLER_FUNC_OBJ(submit_onclick_attached_check_cancel);
|
|
|
|
|
2011-07-27 16:45:49 +02:00
|
|
|
static VARIANT onclick_retval, onclick_event_retval;
|
|
|
|
|
|
|
|
static HRESULT WINAPI submit_onclick_setret(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp,
|
|
|
|
VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
|
|
|
|
{
|
|
|
|
IHTMLEventObj *event;
|
2015-05-04 19:14:25 +02:00
|
|
|
VARIANT v;
|
2011-07-27 16:45:49 +02:00
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
CHECK_EXPECT(submit_onclick_setret);
|
|
|
|
test_event_args(NULL, id, wFlags, pdp, pvarRes, pei, pspCaller);
|
2020-02-12 00:32:47 +01:00
|
|
|
test_event_src(L"INPUT");
|
2011-07-27 16:45:49 +02:00
|
|
|
|
|
|
|
event = NULL;
|
|
|
|
hres = IHTMLWindow2_get_event(window, &event);
|
|
|
|
ok(hres == S_OK, "get_event failed: %08x\n", hres);
|
|
|
|
ok(event != NULL, "event == NULL\n");
|
|
|
|
|
2015-05-04 19:14:25 +02:00
|
|
|
V_VT(&v) = VT_ERROR;
|
|
|
|
hres = IHTMLEventObj_get_returnValue(event, &v);
|
|
|
|
ok(hres == S_OK, "get_returnValue failed: %08x\n", hres);
|
2017-09-29 19:57:30 +02:00
|
|
|
if(document_mode < 9) {
|
|
|
|
ok(V_VT(&v) == VT_EMPTY, "V_VT(returnValue) = %d\n", V_VT(&v));
|
|
|
|
}else todo_wine {
|
|
|
|
ok(V_VT(&v) == VT_BOOL, "V_VT(returnValue) = %d\n", V_VT(&v));
|
|
|
|
ok(V_BOOL(&v) == VARIANT_TRUE, "V_BOOL(returnValue) = %x\n", V_BOOL(&v));
|
|
|
|
}
|
2015-05-04 19:14:25 +02:00
|
|
|
|
2011-07-27 16:45:49 +02:00
|
|
|
hres = IHTMLEventObj_put_returnValue(event, onclick_event_retval);
|
|
|
|
ok(hres == S_OK, "put_returnValue failed: %08x\n", hres);
|
|
|
|
|
2015-05-04 19:14:25 +02:00
|
|
|
V_VT(&v) = VT_ERROR;
|
|
|
|
hres = IHTMLEventObj_get_returnValue(event, &v);
|
|
|
|
ok(hres == S_OK, "get_returnValue failed: %08x\n", hres);
|
|
|
|
ok(VarCmp(&v, &onclick_event_retval, 0, 0) == VARCMP_EQ, "unexpected returnValue\n");
|
|
|
|
|
2015-05-29 18:12:12 +02:00
|
|
|
IHTMLEventObj_Release(event);
|
2011-07-27 16:45:49 +02:00
|
|
|
*pvarRes = onclick_retval;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
EVENT_HANDLER_FUNC_OBJ(submit_onclick_setret);
|
|
|
|
|
2012-04-16 13:48:46 +02:00
|
|
|
static HRESULT WINAPI submit_onclick_cancel(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp,
|
|
|
|
VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
|
|
|
|
{
|
|
|
|
IHTMLEventObj *event;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
CHECK_EXPECT(submit_onclick_cancel);
|
|
|
|
test_event_args(NULL, id, wFlags, pdp, pvarRes, pei, pspCaller);
|
2020-02-12 00:32:47 +01:00
|
|
|
test_event_src(L"INPUT");
|
2012-04-16 13:48:46 +02:00
|
|
|
|
|
|
|
event = NULL;
|
|
|
|
hres = IHTMLWindow2_get_event(window, &event);
|
|
|
|
ok(hres == S_OK, "get_event failed: %08x\n", hres);
|
|
|
|
ok(event != NULL, "event == NULL\n");
|
|
|
|
|
|
|
|
test_event_cancelbubble(event, VARIANT_FALSE);
|
|
|
|
|
|
|
|
hres = IHTMLEventObj_put_cancelBubble(event, VARIANT_TRUE);
|
|
|
|
ok(hres == S_OK, "put_returnValue failed: %08x\n", hres);
|
|
|
|
|
|
|
|
test_event_cancelbubble(event, VARIANT_TRUE);
|
2015-05-29 18:12:12 +02:00
|
|
|
IHTMLEventObj_Release(event);
|
2012-04-16 13:48:46 +02:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
EVENT_HANDLER_FUNC_OBJ(submit_onclick_cancel);
|
|
|
|
|
2010-03-18 01:04:45 +01:00
|
|
|
static HRESULT WINAPI iframedoc_onreadystatechange(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp,
|
|
|
|
VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
|
|
|
|
{
|
|
|
|
IHTMLEventObj *event = NULL;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
CHECK_EXPECT2(iframedoc_onreadystatechange);
|
2017-09-29 19:57:30 +02:00
|
|
|
test_event_args(document_mode < 9 ? &DIID_DispHTMLDocument : NULL, id, wFlags, pdp, pvarRes, pei, pspCaller);
|
2010-03-18 01:04:45 +01:00
|
|
|
|
|
|
|
event = (void*)0xdeadbeef;
|
|
|
|
hres = IHTMLWindow2_get_event(window, &event);
|
|
|
|
ok(hres == S_OK, "get_event failed: %08x\n", hres);
|
|
|
|
ok(!event, "event = %p\n", event);
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
EVENT_HANDLER_FUNC_OBJ(iframedoc_onreadystatechange);
|
|
|
|
|
2009-11-30 18:03:02 +01:00
|
|
|
static HRESULT WINAPI iframe_onreadystatechange(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp,
|
|
|
|
VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
|
|
|
|
{
|
2010-03-18 01:04:45 +01:00
|
|
|
IHTMLWindow2 *iframe_window;
|
|
|
|
IHTMLDocument2 *iframe_doc;
|
2009-11-30 18:03:02 +01:00
|
|
|
IHTMLFrameBase2 *iframe;
|
|
|
|
IHTMLElement2 *elem2;
|
|
|
|
IHTMLElement *elem;
|
|
|
|
VARIANT v;
|
2010-03-18 01:04:45 +01:00
|
|
|
BSTR str, str2;
|
2009-11-30 18:03:02 +01:00
|
|
|
HRESULT hres;
|
|
|
|
|
2017-09-29 19:57:30 +02:00
|
|
|
test_event_args(document_mode < 9 ? &DIID_DispHTMLIFrame : NULL, id, wFlags, pdp, pvarRes, pei, pspCaller);
|
2020-02-12 00:32:47 +01:00
|
|
|
test_event_src(L"IFRAME");
|
2009-11-30 18:03:02 +01:00
|
|
|
|
|
|
|
elem = get_event_src();
|
|
|
|
elem2 = get_elem2_iface((IUnknown*)elem);
|
|
|
|
IHTMLElement_Release(elem);
|
|
|
|
|
|
|
|
V_VT(&v) = VT_EMPTY;
|
|
|
|
hres = IHTMLElement2_get_readyState(elem2, &v);
|
|
|
|
ok(hres == S_OK, "get_readyState failed: %08x\n", hres);
|
|
|
|
ok(V_VT(&v) == VT_BSTR, "V_VT(readyState) = %d\n", V_VT(&v));
|
|
|
|
|
|
|
|
hres = IHTMLElement2_QueryInterface(elem2, &IID_IHTMLFrameBase2, (void**)&iframe);
|
|
|
|
IHTMLElement2_Release(elem2);
|
|
|
|
ok(hres == S_OK, "Could not get IHTMLFrameBase2 iface: %08x\n", hres);
|
|
|
|
|
|
|
|
str = NULL;
|
|
|
|
hres = IHTMLFrameBase2_get_readyState(iframe, &str);
|
|
|
|
ok(hres == S_OK, "get_readyState failed: %08x\n", hres);
|
|
|
|
ok(str != NULL, "readyState == NULL\n");
|
|
|
|
ok(!lstrcmpW(str, V_BSTR(&v)), "ready states differ\n");
|
|
|
|
VariantClear(&v);
|
|
|
|
|
2010-03-18 01:04:45 +01:00
|
|
|
hres = IHTMLFrameBase2_get_contentWindow(iframe, &iframe_window);
|
|
|
|
ok(hres == S_OK, "get_contentDocument failed: %08x\n", hres);
|
|
|
|
|
|
|
|
hres = IHTMLWindow2_get_document(iframe_window, &iframe_doc);
|
|
|
|
IHTMLWindow2_Release(iframe_window);
|
|
|
|
ok(hres == S_OK, "get_document failed: %08x\n", hres);
|
|
|
|
|
|
|
|
hres = IHTMLDocument2_get_readyState(iframe_doc, &str2);
|
2011-02-09 22:43:51 +01:00
|
|
|
ok(hres == S_OK, "get_document failed: %08x\n", hres);
|
2010-03-18 01:04:45 +01:00
|
|
|
ok(!lstrcmpW(str, str2), "unexpected document readyState %s\n", wine_dbgstr_w(str2));
|
|
|
|
SysFreeString(str2);
|
|
|
|
|
2020-02-12 00:32:47 +01:00
|
|
|
if(!lstrcmpW(str, L"loading")) {
|
2009-11-30 18:03:02 +01:00
|
|
|
CHECK_EXPECT(iframe_onreadystatechange_loading);
|
2010-03-18 01:04:45 +01:00
|
|
|
|
|
|
|
V_VT(&v) = VT_DISPATCH;
|
|
|
|
V_DISPATCH(&v) = (IDispatch*)&iframedoc_onreadystatechange_obj;
|
|
|
|
hres = IHTMLDocument2_put_onreadystatechange(iframe_doc, v);
|
|
|
|
ok(hres == S_OK, "put_onreadystatechange: %08x\n", hres);
|
2020-02-12 00:32:47 +01:00
|
|
|
}else if(!lstrcmpW(str, L"interactive"))
|
2009-11-30 18:03:02 +01:00
|
|
|
CHECK_EXPECT(iframe_onreadystatechange_interactive);
|
2020-02-12 00:32:47 +01:00
|
|
|
else if(!lstrcmpW(str, L"complete"))
|
2009-11-30 18:03:02 +01:00
|
|
|
CHECK_EXPECT(iframe_onreadystatechange_complete);
|
|
|
|
else
|
|
|
|
ok(0, "unexpected state %s\n", wine_dbgstr_w(str));
|
|
|
|
|
2011-01-20 11:49:12 +01:00
|
|
|
SysFreeString(str);
|
2010-03-18 01:04:45 +01:00
|
|
|
IHTMLDocument2_Release(iframe_doc);
|
|
|
|
IHTMLFrameBase2_Release(iframe);
|
2009-11-30 18:03:02 +01:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
EVENT_HANDLER_FUNC_OBJ(iframe_onreadystatechange);
|
|
|
|
|
2009-09-06 19:06:38 +02:00
|
|
|
static HRESULT WINAPI nocall(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp,
|
|
|
|
VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
|
|
|
|
{
|
|
|
|
ok(0, "unexpected call\n");
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
EVENT_HANDLER_FUNC_OBJ(nocall);
|
|
|
|
|
2009-11-23 19:29:04 +01:00
|
|
|
#define CONNECTION_POINT_OBJ(cpname, diid) \
|
|
|
|
static HRESULT WINAPI cpname ## _QueryInterface(IDispatchEx *iface, REFIID riid, void **ppv) \
|
|
|
|
{ \
|
|
|
|
*ppv = NULL; \
|
|
|
|
if(IsEqualGUID(riid, &IID_IUnknown) \
|
|
|
|
|| IsEqualGUID(riid, &IID_IDispatch) \
|
|
|
|
|| IsEqualGUID(riid, &diid)) \
|
|
|
|
*ppv = iface; \
|
|
|
|
else { \
|
2014-01-29 23:10:43 +01:00
|
|
|
ok(0, "unexpected riid %s\n", wine_dbgstr_guid(riid)); \
|
2009-11-23 19:29:04 +01:00
|
|
|
return E_NOINTERFACE; \
|
|
|
|
} \
|
|
|
|
return S_OK; \
|
|
|
|
} \
|
|
|
|
static IDispatchExVtbl cpname ## Vtbl = { \
|
|
|
|
cpname ## _QueryInterface, \
|
|
|
|
DispatchEx_AddRef, \
|
|
|
|
DispatchEx_Release, \
|
|
|
|
DispatchEx_GetTypeInfoCount, \
|
|
|
|
DispatchEx_GetTypeInfo, \
|
|
|
|
DispatchEx_GetIDsOfNames, \
|
|
|
|
cpname, \
|
|
|
|
DispatchEx_GetDispID, \
|
|
|
|
DispatchEx_InvokeEx, \
|
|
|
|
DispatchEx_DeleteMemberByName, \
|
|
|
|
DispatchEx_DeleteMemberByDispID, \
|
|
|
|
DispatchEx_GetMemberProperties, \
|
|
|
|
DispatchEx_GetMemberName, \
|
|
|
|
DispatchEx_GetNextDispID, \
|
|
|
|
DispatchEx_GetNameSpaceParent \
|
|
|
|
}; \
|
|
|
|
static IDispatchEx cpname ## _obj = { &cpname ## Vtbl }
|
|
|
|
|
2019-06-19 16:54:17 +02:00
|
|
|
#define test_cp_args(a,b,c,d,e,f,g) _test_cp_args(__LINE__,a,b,c,d,e,f,g)
|
|
|
|
static void _test_cp_args(unsigned line, REFIID riid, WORD flags, DISPPARAMS *dp, VARIANT *vres, EXCEPINFO *ei, UINT *argerr, BOOL use_events2)
|
2009-11-23 19:29:04 +01:00
|
|
|
{
|
2014-01-29 23:10:43 +01:00
|
|
|
ok_(__FILE__,line)(IsEqualGUID(&IID_NULL, riid), "riid = %s\n", wine_dbgstr_guid(riid));
|
2009-11-23 19:29:04 +01:00
|
|
|
ok_(__FILE__,line)(flags == DISPATCH_METHOD, "flags = %x\n", flags);
|
|
|
|
ok_(__FILE__,line)(dp != NULL, "dp == NULL\n");
|
2019-06-19 16:54:17 +02:00
|
|
|
if (use_events2)
|
|
|
|
{
|
|
|
|
IHTMLEventObj *event;
|
|
|
|
HRESULT hr;
|
|
|
|
ok_(__FILE__,line)(dp->cArgs == 1, "dp->cArgs = %d\n", dp->cArgs);
|
|
|
|
ok_(__FILE__,line)(dp->rgvarg != NULL, "dp->rgvarg = %p\n", dp->rgvarg);
|
|
|
|
ok_(__FILE__,line)(V_VT(&dp->rgvarg[0]) == VT_DISPATCH, "vt = %d\n", V_VT(&dp->rgvarg[0]));
|
|
|
|
hr = IDispatch_QueryInterface(V_DISPATCH(&dp->rgvarg[0]), &IID_IHTMLEventObj, (void **)&event);
|
|
|
|
ok_(__FILE__,line)(hr == S_OK, "Could not get IHTMLEventObj iface: %08x\n", hr);
|
|
|
|
IHTMLEventObj_Release(event);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ok_(__FILE__,line)(!dp->cArgs, "dp->cArgs = %d\n", dp->cArgs);
|
|
|
|
ok_(__FILE__,line)(!dp->rgvarg, "dp->rgvarg = %p\n", dp->rgvarg);
|
|
|
|
}
|
2009-11-23 19:29:04 +01:00
|
|
|
ok_(__FILE__,line)(!dp->cNamedArgs, "dp->cNamedArgs = %d\n", dp->cNamedArgs);
|
|
|
|
ok_(__FILE__,line)(!dp->rgdispidNamedArgs, "dp->rgdispidNamedArgs = %p\n", dp->rgdispidNamedArgs);
|
|
|
|
ok_(__FILE__,line)(vres != NULL, "vres == NULL\n");
|
|
|
|
ok_(__FILE__,line)(V_VT(vres) == VT_EMPTY, "V_VT(vres) = %d\n", V_VT(vres));
|
|
|
|
ok_(__FILE__,line)(ei != NULL, "ei == NULL\n");
|
|
|
|
ok_(__FILE__,line)(argerr != NULL, "argerr == NULL\n");
|
|
|
|
}
|
|
|
|
|
2013-03-15 15:02:31 +01:00
|
|
|
#define test_cp_eventarg(a,b,c,d,e,f) _test_cp_eventarg(__LINE__,a,b,c,d,e,f)
|
|
|
|
static void _test_cp_eventarg(unsigned line, REFIID riid, WORD flags, DISPPARAMS *dp, VARIANT *vres, EXCEPINFO *ei, UINT *argerr)
|
|
|
|
{
|
|
|
|
IHTMLEventObj *event;
|
|
|
|
|
2014-01-29 23:10:43 +01:00
|
|
|
ok_(__FILE__,line)(IsEqualGUID(&IID_NULL, riid), "riid = %s\n", wine_dbgstr_guid(riid));
|
2013-03-15 15:02:31 +01:00
|
|
|
ok_(__FILE__,line)(flags == DISPATCH_METHOD, "flags = %x\n", flags);
|
|
|
|
ok_(__FILE__,line)(dp != NULL, "dp == NULL\n");
|
|
|
|
ok_(__FILE__,line)(dp->cArgs == 1, "dp->cArgs = %d\n", dp->cArgs);
|
|
|
|
ok_(__FILE__,line)(dp->rgvarg != NULL, "dp->rgvarg = %p\n", dp->rgvarg);
|
|
|
|
ok_(__FILE__,line)(!dp->cNamedArgs, "dp->cNamedArgs = %d\n", dp->cNamedArgs);
|
|
|
|
ok_(__FILE__,line)(!dp->rgdispidNamedArgs, "dp->rgdispidNamedArgs = %p\n", dp->rgdispidNamedArgs);
|
|
|
|
ok_(__FILE__,line)(vres != NULL, "vres == NULL\n");
|
|
|
|
ok_(__FILE__,line)(V_VT(vres) == VT_EMPTY, "V_VT(vres) = %d\n", V_VT(vres));
|
|
|
|
ok_(__FILE__,line)(ei != NULL, "ei == NULL\n");
|
|
|
|
ok_(__FILE__,line)(argerr != NULL, "argerr == NULL\n");
|
|
|
|
|
|
|
|
ok(V_VT(dp->rgvarg) == VT_DISPATCH, "V_VT(dp->rgvarg) = %d\n", V_VT(dp->rgvarg));
|
|
|
|
ok(V_DISPATCH(dp->rgvarg) != NULL, "V_DISPATCH(dp->rgvarg) = %p\n", V_DISPATCH(dp->rgvarg));
|
|
|
|
|
|
|
|
event = _get_event_obj(line);
|
2017-10-09 15:10:41 +02:00
|
|
|
todo_wine
|
|
|
|
ok(!iface_cmp((IUnknown*)event, (IUnknown*)V_DISPATCH(dp->rgvarg)), "event != arg0\n");
|
2013-03-15 15:02:31 +01:00
|
|
|
IHTMLEventObj_Release(event);
|
|
|
|
}
|
|
|
|
|
2009-11-23 19:29:04 +01:00
|
|
|
static HRESULT WINAPI doccp(IDispatchEx *iface, DISPID dispIdMember,
|
|
|
|
REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pdp,
|
|
|
|
VARIANT *pVarResult, EXCEPINFO *pei, UINT *puArgErr)
|
|
|
|
{
|
|
|
|
switch(dispIdMember) {
|
|
|
|
case DISPID_HTMLDOCUMENTEVENTS_ONCLICK:
|
|
|
|
CHECK_EXPECT(doccp_onclick);
|
2019-06-19 16:54:17 +02:00
|
|
|
test_cp_args(riid, wFlags, pdp, pVarResult, pei, puArgErr, FALSE);
|
2009-11-23 19:29:04 +01:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ok(0, "unexpected call %d\n", dispIdMember);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
CONNECTION_POINT_OBJ(doccp, DIID_HTMLDocumentEvents);
|
|
|
|
|
2019-06-19 16:54:17 +02:00
|
|
|
static HRESULT WINAPI doccp2(IDispatchEx *iface, DISPID dispIdMember,
|
|
|
|
REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pdp,
|
|
|
|
VARIANT *pVarResult, EXCEPINFO *pei, UINT *puArgErr)
|
|
|
|
{
|
|
|
|
switch(dispIdMember) {
|
|
|
|
case DISPID_HTMLDOCUMENTEVENTS_ONCLICK:
|
|
|
|
CHECK_EXPECT(doccp2_onclick);
|
|
|
|
test_cp_args(riid, wFlags, pdp, pVarResult, pei, puArgErr, TRUE);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ok(0, "unexpected call %d\n", dispIdMember);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
CONNECTION_POINT_OBJ(doccp2, DIID_HTMLDocumentEvents2);
|
|
|
|
|
2011-02-28 13:14:32 +01:00
|
|
|
static HRESULT WINAPI doccp_onclick_cancel(IDispatchEx *iface, DISPID dispIdMember,
|
|
|
|
REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pdp, VARIANT *pVarResult, EXCEPINFO *pei, UINT *puArgErr)
|
|
|
|
{
|
|
|
|
switch(dispIdMember) {
|
|
|
|
case DISPID_HTMLDOCUMENTEVENTS_ONCLICK:
|
|
|
|
CHECK_EXPECT(doccp_onclick_cancel);
|
2019-06-19 16:54:17 +02:00
|
|
|
test_cp_args(riid, wFlags, pdp, pVarResult, pei, puArgErr, FALSE);
|
2011-02-28 13:14:32 +01:00
|
|
|
V_VT(pVarResult) = VT_BOOL;
|
|
|
|
V_BOOL(pVarResult) = VARIANT_FALSE;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ok(0, "unexpected call %d\n", dispIdMember);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
CONNECTION_POINT_OBJ(doccp_onclick_cancel, DIID_HTMLDocumentEvents);
|
|
|
|
|
2013-03-15 15:02:31 +01:00
|
|
|
static HRESULT WINAPI elem2_cp(IDispatchEx *iface, DISPID dispIdMember, REFIID riid, LCID lcid,
|
|
|
|
WORD wFlags, DISPPARAMS *pdp, VARIANT *pVarResult, EXCEPINFO *pei, UINT *puArgErr)
|
|
|
|
{
|
|
|
|
switch(dispIdMember) {
|
|
|
|
case DISPID_HTMLDOCUMENTEVENTS_ONCLICK:
|
|
|
|
CHECK_EXPECT(elem2_cp_onclick);
|
|
|
|
test_cp_eventarg(riid, wFlags, pdp, pVarResult, pei, puArgErr);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ok(0, "unexpected call %d\n", dispIdMember);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
CONNECTION_POINT_OBJ(elem2_cp, DIID_HTMLElementEvents2);
|
|
|
|
|
2009-09-06 19:06:38 +02:00
|
|
|
static HRESULT WINAPI timeoutFunc_Invoke(IDispatchEx *iface, DISPID dispIdMember,
|
|
|
|
REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
|
|
|
|
VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
|
|
|
|
{
|
|
|
|
CHECK_EXPECT(timeout);
|
|
|
|
|
|
|
|
ok(dispIdMember == DISPID_VALUE, "dispIdMember = %d\n", dispIdMember);
|
2014-01-29 23:10:43 +01:00
|
|
|
ok(IsEqualGUID(&IID_NULL, riid), "riid = %s\n", wine_dbgstr_guid(riid));
|
2009-09-06 19:06:38 +02:00
|
|
|
ok(wFlags == DISPATCH_METHOD, "wFlags = %x\n", wFlags);
|
|
|
|
ok(!lcid, "lcid = %x\n", lcid);
|
|
|
|
ok(pDispParams != NULL, "pDispParams == NULL\n");
|
|
|
|
ok(!pDispParams->cArgs, "pdp->cArgs = %d\n", pDispParams->cArgs);
|
|
|
|
ok(!pDispParams->cNamedArgs, "pdp->cNamedArgs = %d\n", pDispParams->cNamedArgs);
|
|
|
|
ok(!pDispParams->rgdispidNamedArgs, "pdp->rgdispidNamedArgs = %p\n", pDispParams->rgdispidNamedArgs);
|
|
|
|
ok(!pDispParams->rgvarg, "rgvarg = %p\n", pDispParams->rgvarg);
|
|
|
|
ok(pVarResult != NULL, "pVarResult = NULL\n");
|
|
|
|
ok(pExcepInfo != NULL, "pExcepInfo = NULL\n");
|
|
|
|
ok(!puArgErr, "puArgErr = %p\n", puArgErr);
|
|
|
|
ok(V_VT(pVarResult) == VT_EMPTY, "V_VT(pVarResult) = %d\n", V_VT(pVarResult));
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2011-03-09 05:27:16 +01:00
|
|
|
static const IDispatchExVtbl timeoutFuncVtbl = {
|
2009-09-06 19:06:38 +02:00
|
|
|
DispatchEx_QueryInterface,
|
|
|
|
DispatchEx_AddRef,
|
|
|
|
DispatchEx_Release,
|
|
|
|
DispatchEx_GetTypeInfoCount,
|
|
|
|
DispatchEx_GetTypeInfo,
|
|
|
|
DispatchEx_GetIDsOfNames,
|
|
|
|
timeoutFunc_Invoke,
|
|
|
|
DispatchEx_GetDispID,
|
|
|
|
DispatchEx_InvokeEx,
|
|
|
|
DispatchEx_DeleteMemberByName,
|
|
|
|
DispatchEx_DeleteMemberByDispID,
|
|
|
|
DispatchEx_GetMemberProperties,
|
|
|
|
DispatchEx_GetMemberName,
|
|
|
|
DispatchEx_GetNextDispID,
|
|
|
|
DispatchEx_GetNameSpaceParent
|
|
|
|
};
|
|
|
|
|
|
|
|
static IDispatchEx timeoutFunc = { &timeoutFuncVtbl };
|
|
|
|
|
2016-05-02 15:39:34 +02:00
|
|
|
static HRESULT WINAPI timeoutFunc2_Invoke(IDispatchEx *iface, DISPID dispIdMember,
|
|
|
|
REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
|
|
|
|
VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
|
|
|
|
{
|
|
|
|
ok(0, "unexpected call\n");
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const IDispatchExVtbl timeoutFunc2Vtbl = {
|
|
|
|
DispatchEx_QueryInterface,
|
|
|
|
DispatchEx_AddRef,
|
|
|
|
DispatchEx_Release,
|
|
|
|
DispatchEx_GetTypeInfoCount,
|
|
|
|
DispatchEx_GetTypeInfo,
|
|
|
|
DispatchEx_GetIDsOfNames,
|
|
|
|
timeoutFunc2_Invoke,
|
|
|
|
DispatchEx_GetDispID,
|
|
|
|
DispatchEx_InvokeEx,
|
|
|
|
DispatchEx_DeleteMemberByName,
|
|
|
|
DispatchEx_DeleteMemberByDispID,
|
|
|
|
DispatchEx_GetMemberProperties,
|
|
|
|
DispatchEx_GetMemberName,
|
|
|
|
DispatchEx_GetNextDispID,
|
|
|
|
DispatchEx_GetNameSpaceParent
|
|
|
|
};
|
|
|
|
|
|
|
|
static IDispatchEx timeoutFunc2 = { &timeoutFunc2Vtbl };
|
|
|
|
|
2010-01-24 21:37:52 +01:00
|
|
|
static HRESULT WINAPI div_onclick_disp_Invoke(IDispatchEx *iface, DISPID id,
|
|
|
|
REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pdp,
|
|
|
|
VARIANT *pvarRes, EXCEPINFO *pei, UINT *puArgErr)
|
|
|
|
{
|
|
|
|
CHECK_EXPECT(div_onclick_disp);
|
|
|
|
|
|
|
|
test_attached_event_args(id, wFlags, pdp, pvarRes, pei);
|
|
|
|
|
2014-01-29 23:10:43 +01:00
|
|
|
ok(IsEqualGUID(&IID_NULL, riid), "riid = %s\n", wine_dbgstr_guid(riid));
|
2010-01-24 21:37:52 +01:00
|
|
|
ok(!puArgErr, "puArgErr = %p\n", puArgErr);
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2011-03-09 05:27:16 +01:00
|
|
|
static const IDispatchExVtbl div_onclick_dispVtbl = {
|
2010-01-24 21:37:52 +01:00
|
|
|
Dispatch_QueryInterface,
|
|
|
|
DispatchEx_AddRef,
|
|
|
|
DispatchEx_Release,
|
|
|
|
DispatchEx_GetTypeInfoCount,
|
|
|
|
DispatchEx_GetTypeInfo,
|
|
|
|
DispatchEx_GetIDsOfNames,
|
|
|
|
div_onclick_disp_Invoke,
|
|
|
|
};
|
|
|
|
|
|
|
|
static IDispatchEx div_onclick_disp = { &div_onclick_dispVtbl };
|
|
|
|
|
2009-09-06 19:06:38 +02:00
|
|
|
static void pump_msgs(BOOL *b)
|
|
|
|
{
|
|
|
|
MSG msg;
|
2011-02-06 22:16:14 +01:00
|
|
|
|
|
|
|
if(b) {
|
|
|
|
while(!*b && GetMessageW(&msg, NULL, 0, 0)) {
|
|
|
|
TranslateMessage(&msg);
|
2013-10-10 12:53:34 +02:00
|
|
|
DispatchMessageW(&msg);
|
2011-02-06 22:16:14 +01:00
|
|
|
}
|
|
|
|
}else {
|
2015-02-21 18:04:34 +01:00
|
|
|
while(PeekMessageW(&msg, NULL, 0, 0, PM_REMOVE)) {
|
2011-02-06 22:16:14 +01:00
|
|
|
TranslateMessage(&msg);
|
2013-10-10 12:53:34 +02:00
|
|
|
DispatchMessageW(&msg);
|
2011-02-06 22:16:14 +01:00
|
|
|
}
|
2009-09-06 19:06:38 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-11-23 19:29:04 +01:00
|
|
|
static IConnectionPoint *get_cp(IUnknown *unk, REFIID riid)
|
|
|
|
{
|
|
|
|
IConnectionPointContainer *cp_container;
|
|
|
|
IConnectionPoint *cp;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
hres = IUnknown_QueryInterface(unk, &IID_IConnectionPointContainer, (void**)&cp_container);
|
|
|
|
ok(hres == S_OK, "Could not get IConnectionPointContainer: %08x\n", hres);
|
|
|
|
|
|
|
|
hres = IConnectionPointContainer_FindConnectionPoint(cp_container, riid, &cp);
|
|
|
|
IConnectionPointContainer_Release(cp_container);
|
|
|
|
ok(hres == S_OK, "FindConnectionPoint failed: %08x\n", hres);
|
|
|
|
|
|
|
|
return cp;
|
|
|
|
}
|
|
|
|
|
|
|
|
static DWORD register_cp(IUnknown *unk, REFIID riid, IUnknown *sink)
|
|
|
|
{
|
|
|
|
IConnectionPoint *cp;
|
|
|
|
DWORD cookie;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
cp = get_cp(unk, riid);
|
|
|
|
hres = IConnectionPoint_Advise(cp, sink, &cookie);
|
|
|
|
IConnectionPoint_Release(cp);
|
|
|
|
ok(hres == S_OK, "Advise failed: %08x\n", hres);
|
|
|
|
|
|
|
|
return cookie;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void unregister_cp(IUnknown *unk, REFIID riid, DWORD cookie)
|
|
|
|
{
|
|
|
|
IConnectionPoint *cp;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
cp = get_cp(unk, riid);
|
|
|
|
hres = IConnectionPoint_Unadvise(cp, cookie);
|
|
|
|
IConnectionPoint_Release(cp);
|
|
|
|
ok(hres == S_OK, "Unadvise failed: %08x\n", hres);
|
|
|
|
}
|
|
|
|
|
2011-05-09 16:23:07 +02:00
|
|
|
static HRESULT WINAPI EventDispatch_QueryInterface(IDispatch *iface, REFIID riid, void **ppv)
|
|
|
|
{
|
|
|
|
if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IDispatch, riid)) {
|
|
|
|
*ppv = iface;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
ok(0, "Unexpected call\n");
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static DWORD WINAPI EventDispatch_AddRef(IDispatch *iface)
|
|
|
|
{
|
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
static DWORD WINAPI EventDispatch_Release(IDispatch *iface)
|
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI EventDispatch_GetTypeInfoCount(IDispatch *iface, UINT *pctinfo)
|
|
|
|
{
|
|
|
|
ok(0, "Unexpected call\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI EventDispatch_GetTypeInfo(IDispatch *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
|
|
|
|
{
|
|
|
|
ok(0, "Unexpected call\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI EventDispatch_GetIDsOfNames(IDispatch *iface, REFIID riid, LPOLESTR *rgszNames,
|
|
|
|
UINT cNames, LCID lcid, DISPID *rgDispId)
|
|
|
|
{
|
|
|
|
ok(0, "Unexpected call\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI EventDispatch_Invoke(IDispatch *iface, DISPID dispIdMember, REFIID riid,
|
|
|
|
LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
|
|
|
|
EXCEPINFO *pExcepInfo, UINT *puArgErr)
|
|
|
|
{
|
2014-01-29 23:10:43 +01:00
|
|
|
ok(IsEqualGUID(&IID_NULL, riid), "riid = %s\n", wine_dbgstr_guid(riid));
|
2011-05-09 16:23:07 +02:00
|
|
|
ok(pDispParams != NULL, "pDispParams == NULL\n");
|
|
|
|
ok(pExcepInfo != NULL, "pExcepInfo == NULL\n");
|
|
|
|
ok(puArgErr != NULL, "puArgErr == NULL\n");
|
|
|
|
ok(V_VT(pVarResult) == 0, "V_VT(pVarResult) = %d\n", V_VT(pVarResult));
|
|
|
|
ok(wFlags == DISPATCH_METHOD, "wFlags = %d\n", wFlags);
|
|
|
|
|
|
|
|
switch(dispIdMember) {
|
|
|
|
case DISPID_HTMLDOCUMENTEVENTS_ONCLICK:
|
|
|
|
CHECK_EXPECT2(invoke_onclick);
|
|
|
|
break;
|
|
|
|
case DISPID_HTMLDOCUMENTEVENTS2_ONPROPERTYCHANGE:
|
|
|
|
case DISPID_HTMLDOCUMENTEVENTS2_ONREADYSTATECHANGE:
|
|
|
|
case 1027:
|
|
|
|
case 1034:
|
|
|
|
case 1037:
|
|
|
|
case 1044:
|
|
|
|
case 1045:
|
|
|
|
case 1047:
|
|
|
|
case 1048:
|
|
|
|
case 1049:
|
|
|
|
break; /* TODO */
|
|
|
|
default:
|
|
|
|
ok(0, "Unexpected call: %d\n", dispIdMember);
|
|
|
|
}
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const IDispatchVtbl EventDispatchVtbl = {
|
|
|
|
EventDispatch_QueryInterface,
|
|
|
|
EventDispatch_AddRef,
|
|
|
|
EventDispatch_Release,
|
|
|
|
EventDispatch_GetTypeInfoCount,
|
|
|
|
EventDispatch_GetTypeInfo,
|
|
|
|
EventDispatch_GetIDsOfNames,
|
|
|
|
EventDispatch_Invoke
|
|
|
|
};
|
|
|
|
|
|
|
|
static IDispatch EventDispatch = { &EventDispatchVtbl };
|
|
|
|
|
2020-02-12 00:32:46 +01:00
|
|
|
static void set_body_html(IHTMLDocument2 *doc, const WCHAR *html)
|
2017-09-29 19:57:30 +02:00
|
|
|
{
|
|
|
|
IHTMLElement *body = doc_get_body(doc);
|
|
|
|
set_elem_innerhtml(body, html);
|
|
|
|
IHTMLElement_Release(body);
|
|
|
|
}
|
|
|
|
|
2009-09-06 19:06:38 +02:00
|
|
|
static void test_onclick(IHTMLDocument2 *doc)
|
|
|
|
{
|
2019-06-19 16:54:17 +02:00
|
|
|
DWORD events_cp_cookie, events2_cp_cookie, elem2_cp_cookie;
|
2009-09-06 19:06:38 +02:00
|
|
|
IHTMLElement *div, *body;
|
|
|
|
VARIANT v;
|
|
|
|
HRESULT hres;
|
|
|
|
|
2017-09-29 19:57:30 +02:00
|
|
|
trace("onclick tests in document mode %d\n", document_mode);
|
|
|
|
|
2020-02-12 00:32:46 +01:00
|
|
|
set_body_html(doc, L"<div id=\"clickdiv\""
|
2017-09-29 19:57:30 +02:00
|
|
|
" style=\"text-align: center; background: red; font-size: 32\">"
|
|
|
|
"click here"
|
|
|
|
"</div>");
|
|
|
|
|
2011-05-09 16:23:07 +02:00
|
|
|
register_cp((IUnknown*)doc, &IID_IDispatch, (IUnknown*)&EventDispatch);
|
|
|
|
|
2020-02-12 00:32:46 +01:00
|
|
|
div = get_elem_id(doc, L"clickdiv");
|
2009-09-06 19:06:38 +02:00
|
|
|
|
2020-02-12 00:32:46 +01:00
|
|
|
elem_attach_event((IUnknown*)div, L"abcde", (IDispatch*)&nocall_obj);
|
|
|
|
elem_attach_event((IUnknown*)div, L"onclick", (IDispatch*)&div_onclick_attached_obj);
|
2009-09-06 19:06:38 +02:00
|
|
|
|
|
|
|
V_VT(&v) = VT_EMPTY;
|
|
|
|
hres = IHTMLElement_get_onclick(div, &v);
|
|
|
|
ok(hres == S_OK, "get_onclick failed: %08x\n", hres);
|
|
|
|
ok(V_VT(&v) == VT_NULL, "V_VT(onclick) = %d\n", V_VT(&v));
|
|
|
|
|
2009-12-06 22:10:24 +01:00
|
|
|
V_VT(&v) = VT_EMPTY;
|
|
|
|
hres = IHTMLElement_put_onclick(div, v);
|
2017-09-29 19:57:30 +02:00
|
|
|
ok(hres == (document_mode < 9 ? E_NOTIMPL : S_OK), "put_onclick failed: %08x\n", hres);
|
|
|
|
|
|
|
|
V_VT(&v) = VT_EMPTY;
|
|
|
|
hres = IHTMLElement_get_onclick(div, &v);
|
|
|
|
ok(hres == S_OK, "get_onclick failed: %08x\n", hres);
|
|
|
|
ok(V_VT(&v) == VT_NULL, "V_VT(onclick) = %d\n", V_VT(&v));
|
2009-12-06 22:10:24 +01:00
|
|
|
|
2011-09-02 14:18:18 +02:00
|
|
|
V_VT(&v) = VT_BSTR;
|
2020-02-12 00:32:46 +01:00
|
|
|
V_BSTR(&v) = SysAllocString(L"function();");
|
2011-09-02 14:18:18 +02:00
|
|
|
hres = IHTMLElement_put_onclick(div, v);
|
2015-03-10 18:27:31 +01:00
|
|
|
ok(hres == S_OK, "put_onclick failed: %08x\n", hres);
|
2017-09-29 19:57:30 +02:00
|
|
|
SysFreeString(V_BSTR(&v));
|
2011-09-02 14:18:18 +02:00
|
|
|
|
2017-09-29 19:57:30 +02:00
|
|
|
V_VT(&v) = VT_EMPTY;
|
|
|
|
hres = IHTMLElement_get_onclick(div, &v);
|
|
|
|
ok(hres == S_OK, "get_onclick failed: %08x\n", hres);
|
|
|
|
if(document_mode < 9) {
|
2011-09-02 14:18:18 +02:00
|
|
|
ok(V_VT(&v) == VT_BSTR, "V_VT(onclick) = %d\n", V_VT(&v));
|
2020-02-12 00:32:47 +01:00
|
|
|
ok(!lstrcmpW(V_BSTR(&v), L"function();"), "V_BSTR(onclick) = %s\n", wine_dbgstr_w(V_BSTR(&v)));
|
2017-09-29 19:57:30 +02:00
|
|
|
}else {
|
|
|
|
todo_wine
|
|
|
|
ok(V_VT(&v) == VT_NULL, "V_VT(onclick) = %d\n", V_VT(&v));
|
2011-09-02 14:18:18 +02:00
|
|
|
}
|
|
|
|
VariantClear(&v);
|
|
|
|
|
2009-09-06 19:06:38 +02:00
|
|
|
V_VT(&v) = VT_DISPATCH;
|
|
|
|
V_DISPATCH(&v) = (IDispatch*)&div_onclick_obj;
|
|
|
|
hres = IHTMLElement_put_onclick(div, v);
|
|
|
|
ok(hres == S_OK, "put_onclick failed: %08x\n", hres);
|
|
|
|
|
2010-06-19 22:25:32 +02:00
|
|
|
V_VT(&v) = VT_NULL;
|
|
|
|
hres = IHTMLElement_put_ondblclick(div, v);
|
|
|
|
ok(hres == S_OK, "put_ondblclick failed: %08x\n", hres);
|
|
|
|
|
2009-09-06 19:06:38 +02:00
|
|
|
V_VT(&v) = VT_EMPTY;
|
|
|
|
hres = IHTMLElement_get_onclick(div, &v);
|
|
|
|
ok(hres == S_OK, "get_onclick failed: %08x\n", hres);
|
|
|
|
ok(V_VT(&v) == VT_DISPATCH, "V_VT(onclick) = %d\n", V_VT(&v));
|
|
|
|
ok(V_DISPATCH(&v) == (IDispatch*)&div_onclick_obj, "V_DISPATCH(onclick) != onclickFunc\n");
|
|
|
|
VariantClear(&v);
|
|
|
|
|
|
|
|
V_VT(&v) = VT_EMPTY;
|
|
|
|
hres = IHTMLDocument2_get_onclick(doc, &v);
|
|
|
|
ok(hres == S_OK, "get_onclick failed: %08x\n", hres);
|
|
|
|
ok(V_VT(&v) == VT_NULL, "V_VT(onclick) = %d\n", V_VT(&v));
|
|
|
|
|
|
|
|
V_VT(&v) = VT_DISPATCH;
|
|
|
|
V_DISPATCH(&v) = (IDispatch*)&document_onclick_obj;
|
|
|
|
hres = IHTMLDocument2_put_onclick(doc, v);
|
|
|
|
ok(hres == S_OK, "put_onclick failed: %08x\n", hres);
|
|
|
|
|
|
|
|
V_VT(&v) = VT_EMPTY;
|
|
|
|
hres = IHTMLDocument2_get_onclick(doc, &v);
|
|
|
|
ok(hres == S_OK, "get_onclick failed: %08x\n", hres);
|
|
|
|
ok(V_VT(&v) == VT_DISPATCH, "V_VT(onclick) = %d\n", V_VT(&v));
|
|
|
|
ok(V_DISPATCH(&v) == (IDispatch*)&document_onclick_obj, "V_DISPATCH(onclick) != onclickFunc\n");
|
|
|
|
VariantClear(&v);
|
|
|
|
|
2017-10-25 18:14:05 +02:00
|
|
|
if(document_mode >= 9) {
|
2020-02-12 00:32:46 +01:00
|
|
|
add_event_listener((IUnknown*)div, L"click", (IDispatch*)&div_onclick_capture_obj, VARIANT_TRUE);
|
|
|
|
add_event_listener((IUnknown*)div, L"click", (IDispatch*)&div_onclick_bubble_obj, VARIANT_FALSE);
|
2017-10-25 18:14:05 +02:00
|
|
|
}
|
|
|
|
|
2009-09-06 19:06:38 +02:00
|
|
|
body = doc_get_body(doc);
|
|
|
|
|
|
|
|
V_VT(&v) = VT_DISPATCH;
|
|
|
|
V_DISPATCH(&v) = (IDispatch*)&body_onclick_obj;
|
|
|
|
hres = IHTMLElement_put_onclick(body, v);
|
|
|
|
ok(hres == S_OK, "put_onclick failed: %08x\n", hres);
|
|
|
|
|
2017-10-25 18:14:05 +02:00
|
|
|
if(winetest_interactive && document_mode < 9) {
|
2009-09-06 19:06:38 +02:00
|
|
|
SET_EXPECT(div_onclick);
|
|
|
|
SET_EXPECT(div_onclick_attached);
|
|
|
|
SET_EXPECT(body_onclick);
|
|
|
|
SET_EXPECT(document_onclick);
|
2011-05-09 16:23:07 +02:00
|
|
|
SET_EXPECT(invoke_onclick);
|
2009-09-06 19:06:38 +02:00
|
|
|
pump_msgs(&called_document_onclick);
|
|
|
|
CHECK_CALLED(div_onclick);
|
|
|
|
CHECK_CALLED(div_onclick_attached);
|
|
|
|
CHECK_CALLED(body_onclick);
|
|
|
|
CHECK_CALLED(document_onclick);
|
2011-05-11 23:15:10 +02:00
|
|
|
CHECK_CALLED(invoke_onclick);
|
2009-09-06 19:06:38 +02:00
|
|
|
}
|
|
|
|
|
2009-10-13 00:42:37 +02:00
|
|
|
SET_EXPECT(div_onclick);
|
|
|
|
SET_EXPECT(div_onclick_attached);
|
2017-10-25 18:14:05 +02:00
|
|
|
if(document_mode >= 9) {
|
|
|
|
SET_EXPECT(div_onclick_capture);
|
|
|
|
SET_EXPECT(div_onclick_bubble);
|
|
|
|
}
|
2009-10-13 00:42:37 +02:00
|
|
|
SET_EXPECT(body_onclick);
|
|
|
|
SET_EXPECT(document_onclick);
|
2011-05-09 16:23:07 +02:00
|
|
|
SET_EXPECT(invoke_onclick);
|
2009-10-13 00:42:37 +02:00
|
|
|
|
|
|
|
hres = IHTMLElement_click(div);
|
|
|
|
ok(hres == S_OK, "click failed: %08x\n", hres);
|
|
|
|
|
|
|
|
CHECK_CALLED(div_onclick);
|
|
|
|
CHECK_CALLED(div_onclick_attached);
|
2017-10-25 18:14:05 +02:00
|
|
|
if(document_mode >= 9) {
|
|
|
|
CHECK_CALLED(div_onclick_capture);
|
|
|
|
CHECK_CALLED(div_onclick_bubble);
|
|
|
|
}
|
2009-10-13 00:42:37 +02:00
|
|
|
CHECK_CALLED(body_onclick);
|
|
|
|
CHECK_CALLED(document_onclick);
|
2011-05-11 23:15:10 +02:00
|
|
|
CHECK_CALLED(invoke_onclick);
|
2009-10-13 00:42:37 +02:00
|
|
|
|
|
|
|
SET_EXPECT(div_onclick);
|
|
|
|
SET_EXPECT(div_onclick_attached);
|
|
|
|
SET_EXPECT(body_onclick);
|
|
|
|
SET_EXPECT(document_onclick);
|
2011-05-09 16:23:07 +02:00
|
|
|
SET_EXPECT(invoke_onclick);
|
2009-10-13 00:42:37 +02:00
|
|
|
|
|
|
|
V_VT(&v) = VT_EMPTY;
|
2020-02-12 00:32:46 +01:00
|
|
|
elem_fire_event((IUnknown*)div, L"onclick", &v);
|
2009-10-13 00:42:37 +02:00
|
|
|
|
|
|
|
CHECK_CALLED(div_onclick);
|
|
|
|
CHECK_CALLED(div_onclick_attached);
|
|
|
|
CHECK_CALLED(body_onclick);
|
|
|
|
CHECK_CALLED(document_onclick);
|
2011-05-11 23:15:10 +02:00
|
|
|
CHECK_CALLED(invoke_onclick);
|
2009-10-13 00:42:37 +02:00
|
|
|
|
2019-06-19 16:54:17 +02:00
|
|
|
events_cp_cookie = register_cp((IUnknown*)doc, &DIID_HTMLDocumentEvents, (IUnknown*)&doccp_obj);
|
|
|
|
events2_cp_cookie = register_cp((IUnknown*)doc, &DIID_HTMLDocumentEvents2, (IUnknown*)&doccp2_obj);
|
2020-02-12 00:32:46 +01:00
|
|
|
elem_attach_event((IUnknown*)div, L"onclick", (IDispatch*)&div_onclick_disp);
|
|
|
|
doc_attach_event(doc, L"onclick", (IDispatch*)&doc_onclick_attached_obj);
|
2009-11-23 19:29:04 +01:00
|
|
|
|
|
|
|
SET_EXPECT(div_onclick);
|
2010-01-24 21:37:52 +01:00
|
|
|
SET_EXPECT(div_onclick_disp);
|
2009-11-23 19:29:04 +01:00
|
|
|
SET_EXPECT(div_onclick_attached);
|
2017-10-25 18:14:05 +02:00
|
|
|
if(document_mode >= 9) {
|
|
|
|
SET_EXPECT(div_onclick_capture);
|
|
|
|
SET_EXPECT(div_onclick_bubble);
|
|
|
|
}
|
2009-11-23 19:29:04 +01:00
|
|
|
SET_EXPECT(body_onclick);
|
|
|
|
SET_EXPECT(document_onclick);
|
2010-07-17 13:31:43 +02:00
|
|
|
SET_EXPECT(doc_onclick_attached);
|
2009-11-23 19:29:04 +01:00
|
|
|
SET_EXPECT(doccp_onclick);
|
2019-06-19 16:54:17 +02:00
|
|
|
SET_EXPECT(doccp2_onclick);
|
2011-05-09 16:23:07 +02:00
|
|
|
SET_EXPECT(invoke_onclick);
|
2009-11-23 19:29:04 +01:00
|
|
|
|
|
|
|
hres = IHTMLElement_click(div);
|
|
|
|
ok(hres == S_OK, "click failed: %08x\n", hres);
|
|
|
|
|
|
|
|
CHECK_CALLED(div_onclick);
|
2010-01-24 21:37:52 +01:00
|
|
|
CHECK_CALLED(div_onclick_disp);
|
2009-11-23 19:29:04 +01:00
|
|
|
CHECK_CALLED(div_onclick_attached);
|
2017-10-25 18:14:05 +02:00
|
|
|
if(document_mode >= 9) {
|
|
|
|
CHECK_CALLED(div_onclick_capture);
|
|
|
|
CHECK_CALLED(div_onclick_bubble);
|
|
|
|
}
|
2009-11-23 19:29:04 +01:00
|
|
|
CHECK_CALLED(body_onclick);
|
|
|
|
CHECK_CALLED(document_onclick);
|
2010-07-17 13:31:43 +02:00
|
|
|
CHECK_CALLED(doc_onclick_attached);
|
2009-11-23 19:29:04 +01:00
|
|
|
CHECK_CALLED(doccp_onclick);
|
2019-06-19 16:54:17 +02:00
|
|
|
CHECK_CALLED(doccp2_onclick);
|
2011-05-11 23:15:10 +02:00
|
|
|
CHECK_CALLED(invoke_onclick);
|
2009-11-23 19:29:04 +01:00
|
|
|
|
2013-03-15 15:02:31 +01:00
|
|
|
elem2_cp_cookie = register_cp((IUnknown*)div, &DIID_HTMLElementEvents2, (IUnknown*)&elem2_cp_obj);
|
|
|
|
|
|
|
|
SET_EXPECT(div_onclick);
|
|
|
|
SET_EXPECT(div_onclick_disp);
|
|
|
|
SET_EXPECT(div_onclick_attached);
|
2017-10-25 18:14:05 +02:00
|
|
|
if(document_mode >= 9) {
|
|
|
|
SET_EXPECT(div_onclick_capture);
|
|
|
|
SET_EXPECT(div_onclick_bubble);
|
|
|
|
}
|
2013-03-15 15:02:31 +01:00
|
|
|
SET_EXPECT(elem2_cp_onclick);
|
|
|
|
SET_EXPECT(body_onclick);
|
|
|
|
SET_EXPECT(document_onclick);
|
|
|
|
SET_EXPECT(doc_onclick_attached);
|
|
|
|
SET_EXPECT(doccp_onclick);
|
2019-06-19 16:54:17 +02:00
|
|
|
SET_EXPECT(doccp2_onclick);
|
2013-03-15 15:02:31 +01:00
|
|
|
SET_EXPECT(invoke_onclick);
|
|
|
|
|
|
|
|
trace("click >>>\n");
|
|
|
|
hres = IHTMLElement_click(div);
|
|
|
|
ok(hres == S_OK, "click failed: %08x\n", hres);
|
|
|
|
trace("click <<<\n");
|
|
|
|
|
|
|
|
CHECK_CALLED(div_onclick);
|
|
|
|
CHECK_CALLED(div_onclick_disp);
|
|
|
|
CHECK_CALLED(div_onclick_attached);
|
2017-10-25 18:14:05 +02:00
|
|
|
if(document_mode >= 9) {
|
|
|
|
CHECK_CALLED(div_onclick_capture);
|
|
|
|
CHECK_CALLED(div_onclick_bubble);
|
|
|
|
}
|
2013-03-15 15:02:31 +01:00
|
|
|
CHECK_CALLED(elem2_cp_onclick);
|
|
|
|
CHECK_CALLED(body_onclick);
|
|
|
|
CHECK_CALLED(document_onclick);
|
|
|
|
CHECK_CALLED(doc_onclick_attached);
|
|
|
|
CHECK_CALLED(doccp_onclick);
|
2019-06-19 16:54:17 +02:00
|
|
|
CHECK_CALLED(doccp2_onclick);
|
2013-03-15 15:02:31 +01:00
|
|
|
CHECK_CALLED(invoke_onclick);
|
|
|
|
|
|
|
|
unregister_cp((IUnknown*)div, &DIID_HTMLElementEvents2, elem2_cp_cookie);
|
2019-06-19 16:54:17 +02:00
|
|
|
unregister_cp((IUnknown*)doc, &DIID_HTMLDocumentEvents, events_cp_cookie);
|
|
|
|
unregister_cp((IUnknown*)doc, &DIID_HTMLDocumentEvents2, events2_cp_cookie);
|
2009-11-23 19:29:04 +01:00
|
|
|
|
2010-02-08 21:49:37 +01:00
|
|
|
V_VT(&v) = VT_NULL;
|
|
|
|
hres = IHTMLElement_put_onclick(div, v);
|
|
|
|
ok(hres == S_OK, "put_onclick failed: %08x\n", hres);
|
|
|
|
|
|
|
|
hres = IHTMLElement_get_onclick(div, &v);
|
|
|
|
ok(hres == S_OK, "get_onclick failed: %08x\n", hres);
|
|
|
|
ok(V_VT(&v) == VT_NULL, "get_onclick returned vt %d\n", V_VT(&v));
|
|
|
|
|
2020-02-12 00:32:46 +01:00
|
|
|
elem_detach_event((IUnknown*)div, L"onclick", (IDispatch*)&div_onclick_disp);
|
|
|
|
elem_detach_event((IUnknown*)div, L"onclick", (IDispatch*)&div_onclick_disp);
|
|
|
|
elem_detach_event((IUnknown*)div, L"test", (IDispatch*)&div_onclick_disp);
|
|
|
|
doc_detach_event(doc, L"onclick", (IDispatch*)&doc_onclick_attached_obj);
|
2010-02-08 21:49:37 +01:00
|
|
|
|
2017-10-25 18:14:05 +02:00
|
|
|
if(document_mode >= 9) {
|
2020-02-12 00:32:46 +01:00
|
|
|
remove_event_listener((IUnknown*)div, L"click", (IDispatch*)&div_onclick_capture_obj, VARIANT_TRUE);
|
|
|
|
remove_event_listener((IUnknown*)div, L"click", (IDispatch*)&div_onclick_bubble_obj, VARIANT_FALSE);
|
2017-10-25 18:14:05 +02:00
|
|
|
}
|
|
|
|
|
2010-02-08 21:49:37 +01:00
|
|
|
SET_EXPECT(div_onclick_attached);
|
|
|
|
SET_EXPECT(body_onclick);
|
|
|
|
SET_EXPECT(document_onclick);
|
2011-05-09 16:23:07 +02:00
|
|
|
SET_EXPECT(invoke_onclick);
|
2010-02-08 21:49:37 +01:00
|
|
|
|
|
|
|
hres = IHTMLElement_click(div);
|
|
|
|
ok(hres == S_OK, "click failed: %08x\n", hres);
|
|
|
|
|
|
|
|
CHECK_CALLED(div_onclick_attached);
|
|
|
|
CHECK_CALLED(body_onclick);
|
|
|
|
CHECK_CALLED(document_onclick);
|
2011-05-11 23:15:10 +02:00
|
|
|
CHECK_CALLED(invoke_onclick);
|
2010-02-08 21:49:37 +01:00
|
|
|
|
2009-09-06 19:06:38 +02:00
|
|
|
IHTMLElement_Release(div);
|
|
|
|
IHTMLElement_Release(body);
|
|
|
|
}
|
|
|
|
|
2009-11-30 18:03:02 +01:00
|
|
|
static void test_onreadystatechange(IHTMLDocument2 *doc)
|
|
|
|
{
|
|
|
|
IHTMLFrameBase *iframe;
|
|
|
|
IHTMLElement2 *elem2;
|
|
|
|
IHTMLElement *elem;
|
|
|
|
VARIANT v;
|
|
|
|
BSTR str;
|
|
|
|
HRESULT hres;
|
|
|
|
|
2020-02-12 00:32:46 +01:00
|
|
|
elem = get_elem_id(doc, L"iframe");
|
2009-11-30 18:03:02 +01:00
|
|
|
elem2 = get_elem2_iface((IUnknown*)elem);
|
|
|
|
IHTMLElement_Release(elem);
|
|
|
|
|
|
|
|
V_VT(&v) = VT_EMPTY;
|
|
|
|
hres = IHTMLElement2_get_onreadystatechange(elem2, &v);
|
|
|
|
ok(hres == S_OK, "get_onreadystatechange failed: %08x\n", hres);
|
|
|
|
ok(V_VT(&v) == VT_NULL, "V_VT(onreadystatechange) = %d\n", V_VT(&v));
|
|
|
|
|
|
|
|
V_VT(&v) = VT_DISPATCH;
|
|
|
|
V_DISPATCH(&v) = (IDispatch*)&iframe_onreadystatechange_obj;
|
|
|
|
hres = IHTMLElement2_put_onreadystatechange(elem2, v);
|
|
|
|
ok(hres == S_OK, "put_onreadystatechange failed: %08x\n", hres);
|
|
|
|
|
|
|
|
V_VT(&v) = VT_EMPTY;
|
|
|
|
hres = IHTMLElement2_get_onreadystatechange(elem2, &v);
|
|
|
|
ok(hres == S_OK, "get_onreadystatechange failed: %08x\n", hres);
|
|
|
|
ok(V_VT(&v) == VT_DISPATCH, "V_VT(onreadystatechange) = %d\n", V_VT(&v));
|
|
|
|
ok(V_DISPATCH(&v) == (IDispatch*)&iframe_onreadystatechange_obj, "unexpected onreadystatechange value\n");
|
|
|
|
|
|
|
|
hres = IHTMLElement2_QueryInterface(elem2, &IID_IHTMLFrameBase, (void**)&iframe);
|
|
|
|
IHTMLElement2_Release(elem2);
|
|
|
|
ok(hres == S_OK, "Could not get IHTMLFrameBase iface: %08x\n", hres);
|
|
|
|
|
2020-02-12 00:32:46 +01:00
|
|
|
hres = IHTMLFrameBase_put_src(iframe, (str = SysAllocString(L"about:blank")));
|
2009-11-30 18:03:02 +01:00
|
|
|
SysFreeString(str);
|
|
|
|
ok(hres == S_OK, "put_src failed: %08x\n", hres);
|
|
|
|
|
|
|
|
SET_EXPECT(iframe_onreadystatechange_loading);
|
2010-03-18 01:04:45 +01:00
|
|
|
SET_EXPECT(iframedoc_onreadystatechange);
|
2009-11-30 18:03:02 +01:00
|
|
|
SET_EXPECT(iframe_onreadystatechange_interactive);
|
|
|
|
SET_EXPECT(iframe_onreadystatechange_complete);
|
|
|
|
pump_msgs(&called_iframe_onreadystatechange_complete);
|
|
|
|
CHECK_CALLED(iframe_onreadystatechange_loading);
|
2010-03-18 01:04:45 +01:00
|
|
|
CHECK_CALLED(iframedoc_onreadystatechange);
|
2009-11-30 18:03:02 +01:00
|
|
|
CHECK_CALLED(iframe_onreadystatechange_interactive);
|
|
|
|
CHECK_CALLED(iframe_onreadystatechange_complete);
|
|
|
|
|
|
|
|
IHTMLFrameBase_Release(iframe);
|
|
|
|
}
|
|
|
|
|
2010-03-18 01:06:28 +01:00
|
|
|
static void test_imgload(IHTMLDocument2 *doc)
|
|
|
|
{
|
|
|
|
IHTMLImgElement *img;
|
|
|
|
IHTMLElement *elem;
|
|
|
|
VARIANT v;
|
|
|
|
BSTR str;
|
|
|
|
HRESULT hres;
|
|
|
|
|
2020-02-12 00:32:46 +01:00
|
|
|
elem = get_elem_id(doc, L"imgid");
|
2010-03-18 01:06:28 +01:00
|
|
|
hres = IHTMLElement_QueryInterface(elem, &IID_IHTMLImgElement, (void**)&img);
|
|
|
|
IHTMLElement_Release(elem);
|
|
|
|
ok(hres == S_OK, "Could not get IHTMLImgElement iface: %08x\n", hres);
|
|
|
|
|
|
|
|
V_VT(&v) = VT_EMPTY;
|
|
|
|
hres = IHTMLImgElement_get_onload(img, &v);
|
|
|
|
ok(hres == S_OK, "get_onload failed: %08x\n", hres);
|
|
|
|
ok(V_VT(&v) == VT_NULL, "V_VT(onload) = %d\n", V_VT(&v));
|
|
|
|
|
|
|
|
V_VT(&v) = VT_DISPATCH;
|
|
|
|
V_DISPATCH(&v) = (IDispatch*)&img_onload_obj;
|
|
|
|
hres = IHTMLImgElement_put_onload(img, v);
|
|
|
|
ok(hres == S_OK, "put_onload failed: %08x\n", hres);
|
|
|
|
|
|
|
|
V_VT(&v) = VT_EMPTY;
|
|
|
|
hres = IHTMLImgElement_get_onload(img, &v);
|
|
|
|
ok(hres == S_OK, "get_onload failed: %08x\n", hres);
|
|
|
|
ok(V_VT(&v) == VT_DISPATCH, "V_VT(onload) = %d\n", V_VT(&v));
|
|
|
|
ok(V_DISPATCH(&v) == (IDispatch*)&img_onload_obj, "V_DISPATCH(onload) != onloadkFunc\n");
|
|
|
|
VariantClear(&v);
|
|
|
|
|
2012-04-05 13:58:20 +02:00
|
|
|
V_VT(&v) = VT_DISPATCH;
|
|
|
|
V_DISPATCH(&v) = (IDispatch*)&img_onerror_obj;
|
|
|
|
hres = IHTMLImgElement_put_onerror(img, v);
|
|
|
|
ok(hres == S_OK, "put_onerror failed: %08x\n", hres);
|
|
|
|
|
|
|
|
V_VT(&v) = VT_EMPTY;
|
|
|
|
hres = IHTMLImgElement_get_onerror(img, &v);
|
|
|
|
ok(hres == S_OK, "get_onerror failed: %08x\n", hres);
|
|
|
|
ok(V_VT(&v) == VT_DISPATCH, "V_VT(onerror) = %d\n", V_VT(&v));
|
|
|
|
ok(V_DISPATCH(&v) == (IDispatch*)&img_onerror_obj, "V_DISPATCH(onerror) != onerrorFunc\n");
|
|
|
|
VariantClear(&v);
|
|
|
|
|
2020-02-12 00:32:46 +01:00
|
|
|
str = SysAllocString(L"http://test.winehq.org/tests/winehq_snapshot/index_files/winehq_logo_text.png");
|
2010-03-18 01:06:28 +01:00
|
|
|
hres = IHTMLImgElement_put_src(img, str);
|
|
|
|
ok(hres == S_OK, "put_src failed: %08x\n", hres);
|
|
|
|
SysFreeString(str);
|
|
|
|
|
|
|
|
SET_EXPECT(img_onload);
|
|
|
|
pump_msgs(&called_img_onload);
|
|
|
|
CHECK_CALLED(img_onload);
|
|
|
|
|
2012-04-05 13:58:20 +02:00
|
|
|
SET_EXPECT(img_onerror);
|
|
|
|
|
2020-02-12 00:32:46 +01:00
|
|
|
str = SysAllocString(L"about:blank");
|
2012-04-05 13:58:20 +02:00
|
|
|
hres = IHTMLImgElement_put_src(img, str);
|
|
|
|
ok(hres == S_OK, "put_src failed: %08x\n", hres);
|
|
|
|
SysFreeString(str);
|
|
|
|
|
|
|
|
pump_msgs(&called_img_onerror); /* FIXME: should not be needed */
|
|
|
|
|
|
|
|
CHECK_CALLED(img_onerror);
|
|
|
|
|
2010-03-18 01:06:28 +01:00
|
|
|
IHTMLImgElement_Release(img);
|
2016-05-02 14:06:30 +02:00
|
|
|
|
|
|
|
/* test onload on unattached image */
|
2020-02-12 00:32:46 +01:00
|
|
|
hres = IHTMLDocument2_createElement(doc, (str = SysAllocString(L"img")), &elem);
|
2016-05-02 14:06:30 +02:00
|
|
|
SysFreeString(str);
|
|
|
|
ok(hres == S_OK, "createElement(img) failed: %08x\n", hres);
|
|
|
|
|
|
|
|
hres = IHTMLElement_QueryInterface(elem, &IID_IHTMLImgElement, (void**)&img);
|
|
|
|
IHTMLElement_Release(elem);
|
|
|
|
ok(hres == S_OK, "Could not get IHTMLImgElement iface: %08x\n", hres);
|
|
|
|
|
|
|
|
V_VT(&v) = VT_EMPTY;
|
|
|
|
hres = IHTMLImgElement_get_onload(img, &v);
|
|
|
|
ok(hres == S_OK, "get_onload failed: %08x\n", hres);
|
|
|
|
ok(V_VT(&v) == VT_NULL, "V_VT(onload) = %d\n", V_VT(&v));
|
|
|
|
|
|
|
|
V_VT(&v) = VT_DISPATCH;
|
|
|
|
V_DISPATCH(&v) = (IDispatch*)&unattached_img_onload_obj;
|
|
|
|
hres = IHTMLImgElement_put_onload(img, v);
|
|
|
|
ok(hres == S_OK, "put_onload failed: %08x\n", hres);
|
|
|
|
|
|
|
|
V_VT(&v) = VT_EMPTY;
|
|
|
|
hres = IHTMLImgElement_get_onload(img, &v);
|
|
|
|
ok(hres == S_OK, "get_onload failed: %08x\n", hres);
|
|
|
|
ok(V_VT(&v) == VT_DISPATCH, "V_VT(onload) = %d\n", V_VT(&v));
|
|
|
|
ok(V_DISPATCH(&v) == (IDispatch*)&unattached_img_onload_obj, "incorrect V_DISPATCH(onload)\n");
|
|
|
|
VariantClear(&v);
|
|
|
|
|
2020-02-12 00:32:46 +01:00
|
|
|
str = SysAllocString(L"http://test.winehq.org/tests/winehq_snapshot/index_files/winehq_logo_text.png?v=1");
|
2016-05-02 14:06:30 +02:00
|
|
|
hres = IHTMLImgElement_put_src(img, str);
|
|
|
|
ok(hres == S_OK, "put_src failed: %08x\n", hres);
|
|
|
|
SysFreeString(str);
|
|
|
|
|
|
|
|
SET_EXPECT(img_onload);
|
|
|
|
pump_msgs(&called_img_onload);
|
|
|
|
CHECK_CALLED(img_onload);
|
|
|
|
|
|
|
|
IHTMLImgElement_Release(img);
|
2010-03-18 01:06:28 +01:00
|
|
|
}
|
|
|
|
|
2016-06-23 15:32:56 +02:00
|
|
|
static void test_link_load(IHTMLDocument2 *doc)
|
|
|
|
{
|
|
|
|
IHTMLLinkElement *link;
|
|
|
|
IHTMLElement *elem;
|
|
|
|
VARIANT v;
|
|
|
|
BSTR str;
|
|
|
|
HRESULT hres;
|
|
|
|
|
2020-02-12 00:32:46 +01:00
|
|
|
elem = get_elem_id(doc, L"linkid");
|
2016-06-23 15:32:56 +02:00
|
|
|
hres = IHTMLElement_QueryInterface(elem, &IID_IHTMLLinkElement, (void**)&link);
|
|
|
|
IHTMLElement_Release(elem);
|
|
|
|
ok(hres == S_OK, "Could not get IHTMLLinkElement iface: %08x\n", hres);
|
|
|
|
|
|
|
|
V_VT(&v) = VT_EMPTY;
|
|
|
|
hres = IHTMLLinkElement_get_onload(link, &v);
|
|
|
|
ok(hres == S_OK, "get_onload failed: %08x\n", hres);
|
|
|
|
ok(V_VT(&v) == VT_NULL, "V_VT(onload) = %d\n", V_VT(&v));
|
|
|
|
|
|
|
|
V_VT(&v) = VT_DISPATCH;
|
|
|
|
V_DISPATCH(&v) = (IDispatch*)&link_onload_obj;
|
|
|
|
hres = IHTMLLinkElement_put_onload(link, v);
|
|
|
|
ok(hres == S_OK, "put_onload failed: %08x\n", hres);
|
|
|
|
|
|
|
|
V_VT(&v) = VT_EMPTY;
|
|
|
|
hres = IHTMLLinkElement_get_onload(link, &v);
|
|
|
|
ok(hres == S_OK, "get_onload failed: %08x\n", hres);
|
|
|
|
ok(V_VT(&v) == VT_DISPATCH, "V_VT(onload) = %d\n", V_VT(&v));
|
|
|
|
ok(V_DISPATCH(&v) == (IDispatch*)&link_onload_obj, "V_DISPATCH(onload) != onloadkFunc\n");
|
|
|
|
VariantClear(&v);
|
|
|
|
|
2020-02-12 00:32:46 +01:00
|
|
|
str = SysAllocString(L"http://test.winehq.org/tests/winehq_snapshot/index_files/styles.css");
|
2016-06-23 15:32:56 +02:00
|
|
|
hres = IHTMLLinkElement_put_href(link, str);
|
|
|
|
ok(hres == S_OK, "put_src failed: %08x\n", hres);
|
|
|
|
SysFreeString(str);
|
|
|
|
|
|
|
|
SET_EXPECT(link_onload);
|
|
|
|
pump_msgs(&called_link_onload);
|
|
|
|
CHECK_CALLED(link_onload);
|
|
|
|
|
|
|
|
IHTMLLinkElement_Release(link);
|
|
|
|
}
|
|
|
|
|
2011-02-06 22:16:14 +01:00
|
|
|
static void test_focus(IHTMLDocument2 *doc)
|
|
|
|
{
|
|
|
|
IHTMLElement2 *elem2;
|
2016-04-04 13:22:46 +02:00
|
|
|
IHTMLElement4 *div;
|
2011-02-06 22:16:14 +01:00
|
|
|
IHTMLElement *elem;
|
|
|
|
VARIANT v;
|
|
|
|
HRESULT hres;
|
|
|
|
|
2020-02-12 00:32:46 +01:00
|
|
|
elem = get_elem_id(doc, L"inputid");
|
2011-02-06 22:16:14 +01:00
|
|
|
elem2 = get_elem2_iface((IUnknown*)elem);
|
|
|
|
IHTMLElement_Release(elem);
|
|
|
|
|
2020-02-12 00:32:46 +01:00
|
|
|
elem = get_elem_id(doc, L"divid");
|
2016-04-04 13:22:46 +02:00
|
|
|
div = get_elem4_iface((IUnknown*)elem);
|
|
|
|
IHTMLElement_Release(elem);
|
|
|
|
|
2011-02-06 22:16:14 +01:00
|
|
|
V_VT(&v) = VT_EMPTY;
|
|
|
|
hres = IHTMLElement2_get_onfocus(elem2, &v);
|
|
|
|
ok(hres == S_OK, "get_onfocus failed: %08x\n", hres);
|
|
|
|
ok(V_VT(&v) == VT_NULL, "V_VT(onfocus) = %d\n", V_VT(&v));
|
|
|
|
|
|
|
|
V_VT(&v) = VT_DISPATCH;
|
|
|
|
V_DISPATCH(&v) = (IDispatch*)&input_onfocus_obj;
|
|
|
|
hres = IHTMLElement2_put_onfocus(elem2, v);
|
|
|
|
ok(hres == S_OK, "put_onfocus failed: %08x\n", hres);
|
|
|
|
|
|
|
|
V_VT(&v) = VT_EMPTY;
|
|
|
|
hres = IHTMLElement2_get_onfocus(elem2, &v);
|
|
|
|
ok(hres == S_OK, "get_onfocus failed: %08x\n", hres);
|
|
|
|
ok(V_VT(&v) == VT_DISPATCH, "V_VT(onfocus) = %d\n", V_VT(&v));
|
|
|
|
ok(V_DISPATCH(&v) == (IDispatch*)&input_onfocus_obj, "V_DISPATCH(onfocus) != onfocusFunc\n");
|
|
|
|
VariantClear(&v);
|
|
|
|
|
2016-04-04 13:22:46 +02:00
|
|
|
V_VT(&v) = VT_DISPATCH;
|
|
|
|
V_DISPATCH(&v) = (IDispatch*)&div_onfocusin_obj;
|
|
|
|
hres = IHTMLElement4_put_onfocusin(div, v);
|
|
|
|
ok(hres == S_OK, "put_onfocusin failed: %08x\n", hres);
|
|
|
|
|
|
|
|
V_VT(&v) = VT_EMPTY;
|
|
|
|
hres = IHTMLElement4_get_onfocusin(div, &v);
|
|
|
|
ok(hres == S_OK, "get_onfocusin failed: %08x\n", hres);
|
|
|
|
ok(V_VT(&v) == VT_DISPATCH, "V_VT(onfocusin) = %d\n", V_VT(&v));
|
|
|
|
ok(V_DISPATCH(&v) == (IDispatch*)&div_onfocusin_obj, "V_DISPATCH(onfocus) != onfocusFunc\n");
|
|
|
|
VariantClear(&v);
|
|
|
|
|
|
|
|
V_VT(&v) = VT_EMPTY;
|
|
|
|
hres = IHTMLElement2_get_onfocus(elem2, &v);
|
|
|
|
ok(hres == S_OK, "get_onfocus failed: %08x\n", hres);
|
|
|
|
ok(V_VT(&v) == VT_DISPATCH, "V_VT(onfocus) = %d\n", V_VT(&v));
|
|
|
|
ok(V_DISPATCH(&v) == (IDispatch*)&input_onfocus_obj, "V_DISPATCH(onfocus) != onfocusFunc\n");
|
|
|
|
VariantClear(&v);
|
|
|
|
|
2011-02-06 22:16:14 +01:00
|
|
|
if(!winetest_interactive)
|
|
|
|
ShowWindow(container_hwnd, SW_SHOW);
|
|
|
|
|
|
|
|
SetFocus(NULL);
|
|
|
|
ok(!IsChild(container_hwnd, GetFocus()), "focus belongs to document window\n");
|
|
|
|
|
|
|
|
hres = IHTMLWindow2_focus(window);
|
|
|
|
ok(hres == S_OK, "focus failed: %08x\n", hres);
|
|
|
|
|
|
|
|
ok(IsChild(container_hwnd, GetFocus()), "focus does not belong to document window\n");
|
|
|
|
pump_msgs(NULL);
|
|
|
|
|
2016-04-04 13:22:46 +02:00
|
|
|
SET_EXPECT(div_onfocusin);
|
2011-02-06 22:16:14 +01:00
|
|
|
SET_EXPECT(input_onfocus);
|
|
|
|
hres = IHTMLElement2_focus(elem2);
|
2016-04-04 13:22:46 +02:00
|
|
|
ok(hres == S_OK, "focus failed: %08x\n", hres);
|
2011-02-06 22:16:14 +01:00
|
|
|
pump_msgs(NULL);
|
2016-04-04 13:22:46 +02:00
|
|
|
CHECK_CALLED(div_onfocusin);
|
2011-02-06 22:16:14 +01:00
|
|
|
CHECK_CALLED(input_onfocus);
|
2016-04-04 13:22:46 +02:00
|
|
|
|
|
|
|
SET_EXPECT(div_onfocusin);
|
|
|
|
V_VT(&v) = VT_EMPTY;
|
2020-02-12 00:32:46 +01:00
|
|
|
elem_fire_event((IUnknown*)elem2, L"onfocusin", &v);
|
2016-04-04 13:22:46 +02:00
|
|
|
CHECK_CALLED(div_onfocusin);
|
2011-02-06 22:16:14 +01:00
|
|
|
|
2012-04-10 12:53:24 +02:00
|
|
|
V_VT(&v) = VT_DISPATCH;
|
|
|
|
V_DISPATCH(&v) = (IDispatch*)&input_onblur_obj;
|
|
|
|
hres = IHTMLElement2_put_onblur(elem2, v);
|
|
|
|
ok(hres == S_OK, "put_onblur failed: %08x\n", hres);
|
|
|
|
|
2016-04-04 13:22:46 +02:00
|
|
|
V_VT(&v) = VT_DISPATCH;
|
|
|
|
V_DISPATCH(&v) = (IDispatch*)&div_onfocusout_obj;
|
|
|
|
hres = IHTMLElement4_put_onfocusout(div, v);
|
|
|
|
ok(hres == S_OK, "put_onfocusout failed: %08x\n", hres);
|
|
|
|
|
|
|
|
SET_EXPECT(div_onfocusout);
|
2012-04-10 12:53:24 +02:00
|
|
|
SET_EXPECT(input_onblur);
|
|
|
|
hres = IHTMLElement2_blur(elem2);
|
|
|
|
pump_msgs(NULL);
|
|
|
|
CHECK_CALLED(input_onblur);
|
2016-04-04 13:22:46 +02:00
|
|
|
CHECK_CALLED(div_onfocusout);
|
2012-04-10 12:53:24 +02:00
|
|
|
ok(hres == S_OK, "blur failed: %08x\n", hres);
|
|
|
|
|
2011-02-06 22:16:14 +01:00
|
|
|
if(!winetest_interactive)
|
|
|
|
ShowWindow(container_hwnd, SW_HIDE);
|
|
|
|
|
|
|
|
IHTMLElement2_Release(elem2);
|
2016-04-04 13:22:46 +02:00
|
|
|
IHTMLElement4_Release(div);
|
2011-02-06 22:16:14 +01:00
|
|
|
}
|
|
|
|
|
2011-02-28 13:14:32 +01:00
|
|
|
static void test_submit(IHTMLDocument2 *doc)
|
|
|
|
{
|
|
|
|
IHTMLElement *elem, *submit;
|
|
|
|
IHTMLFormElement *form;
|
|
|
|
VARIANT v;
|
|
|
|
DWORD cp_cookie;
|
|
|
|
HRESULT hres;
|
|
|
|
|
2017-09-29 19:57:30 +02:00
|
|
|
set_body_html(doc,
|
2020-02-12 00:32:46 +01:00
|
|
|
L"<form id=\"formid\" method=\"post\" action=\"about:blank\">"
|
2017-09-29 19:57:30 +02:00
|
|
|
"<input type=\"text\" value=\"test\" name=\"i\"/>"
|
|
|
|
"<input type=\"submit\" id=\"submitid\" />"
|
|
|
|
"</form>");
|
|
|
|
|
2020-02-12 00:32:46 +01:00
|
|
|
elem = get_elem_id(doc, L"formid");
|
2011-02-28 13:14:32 +01:00
|
|
|
|
|
|
|
V_VT(&v) = VT_DISPATCH;
|
|
|
|
V_DISPATCH(&v) = (IDispatch*)&form_onclick_obj;
|
|
|
|
hres = IHTMLElement_put_onclick(elem, v);
|
|
|
|
ok(hres == S_OK, "put_onclick failed: %08x\n", hres);
|
|
|
|
|
|
|
|
hres = IHTMLElement_QueryInterface(elem, &IID_IHTMLFormElement, (void**)&form);
|
|
|
|
IHTMLElement_Release(elem);
|
|
|
|
ok(hres == S_OK, "Could not get IHTMLFormElement iface: %08x\n", hres);
|
|
|
|
|
|
|
|
V_VT(&v) = VT_DISPATCH;
|
|
|
|
V_DISPATCH(&v) = (IDispatch*)&form_onsubmit_obj;
|
|
|
|
hres = IHTMLFormElement_put_onsubmit(form, v);
|
|
|
|
ok(hres == S_OK, "put_onsubmit failed: %08x\n", hres);
|
|
|
|
|
|
|
|
IHTMLFormElement_Release(form);
|
|
|
|
|
2020-02-12 00:32:46 +01:00
|
|
|
submit = get_elem_id(doc, L"submitid");
|
2011-02-28 13:14:32 +01:00
|
|
|
|
|
|
|
SET_EXPECT(form_onclick);
|
|
|
|
SET_EXPECT(form_onsubmit);
|
|
|
|
hres = IHTMLElement_click(submit);
|
|
|
|
ok(hres == S_OK, "click failed: %08x\n", hres);
|
|
|
|
CHECK_CALLED(form_onclick);
|
|
|
|
CHECK_CALLED(form_onsubmit);
|
|
|
|
|
|
|
|
V_VT(&v) = VT_DISPATCH;
|
|
|
|
V_DISPATCH(&v) = (IDispatch*)&submit_onclick_obj;
|
|
|
|
hres = IHTMLElement_put_onclick(submit, v);
|
|
|
|
ok(hres == S_OK, "put_onclick failed: %08x\n", hres);
|
|
|
|
|
|
|
|
SET_EXPECT(form_onclick);
|
|
|
|
SET_EXPECT(submit_onclick);
|
|
|
|
hres = IHTMLElement_click(submit);
|
|
|
|
ok(hres == S_OK, "click failed: %08x\n", hres);
|
|
|
|
CHECK_CALLED(form_onclick);
|
|
|
|
CHECK_CALLED(submit_onclick);
|
|
|
|
|
2020-02-12 00:32:46 +01:00
|
|
|
elem_attach_event((IUnknown*)submit, L"onclick", (IDispatch*)&submit_onclick_attached_obj);
|
2011-02-28 13:14:32 +01:00
|
|
|
|
|
|
|
SET_EXPECT(form_onclick);
|
|
|
|
SET_EXPECT(submit_onclick);
|
|
|
|
SET_EXPECT(submit_onclick_attached);
|
|
|
|
hres = IHTMLElement_click(submit);
|
|
|
|
ok(hres == S_OK, "click failed: %08x\n", hres);
|
|
|
|
CHECK_CALLED(form_onclick);
|
|
|
|
CHECK_CALLED(submit_onclick);
|
|
|
|
CHECK_CALLED(submit_onclick_attached);
|
|
|
|
|
|
|
|
V_VT(&v) = VT_NULL;
|
|
|
|
hres = IHTMLElement_put_onclick(submit, v);
|
|
|
|
ok(hres == S_OK, "put_onclick failed: %08x\n", hres);
|
|
|
|
|
|
|
|
SET_EXPECT(form_onclick);
|
|
|
|
SET_EXPECT(submit_onclick_attached);
|
|
|
|
hres = IHTMLElement_click(submit);
|
|
|
|
ok(hres == S_OK, "click failed: %08x\n", hres);
|
|
|
|
CHECK_CALLED(form_onclick);
|
|
|
|
CHECK_CALLED(submit_onclick_attached);
|
|
|
|
|
2020-02-12 00:32:46 +01:00
|
|
|
elem_detach_event((IUnknown*)submit, L"onclick", (IDispatch*)&submit_onclick_attached_obj);
|
2011-02-28 13:14:32 +01:00
|
|
|
|
|
|
|
cp_cookie = register_cp((IUnknown*)doc, &DIID_HTMLDocumentEvents, (IUnknown*)&doccp_onclick_cancel_obj);
|
|
|
|
|
|
|
|
SET_EXPECT(form_onclick);
|
|
|
|
SET_EXPECT(doccp_onclick_cancel);
|
|
|
|
hres = IHTMLElement_click(submit);
|
|
|
|
ok(hres == S_OK, "click failed: %08x\n", hres);
|
|
|
|
CHECK_CALLED(form_onclick);
|
|
|
|
CHECK_CALLED(doccp_onclick_cancel);
|
|
|
|
|
|
|
|
unregister_cp((IUnknown*)doc, &DIID_HTMLDocumentEvents, cp_cookie);
|
|
|
|
|
2011-07-27 16:45:49 +02:00
|
|
|
V_VT(&v) = VT_DISPATCH;
|
|
|
|
V_DISPATCH(&v) = (IDispatch*)&submit_onclick_setret_obj;
|
|
|
|
hres = IHTMLElement_put_onclick(submit, v);
|
|
|
|
ok(hres == S_OK, "put_onclick failed: %08x\n", hres);
|
|
|
|
|
|
|
|
V_VT(&onclick_retval) = VT_BOOL;
|
|
|
|
V_BOOL(&onclick_retval) = VARIANT_TRUE;
|
|
|
|
V_VT(&onclick_event_retval) = VT_BOOL;
|
|
|
|
V_BOOL(&onclick_event_retval) = VARIANT_TRUE;
|
|
|
|
|
|
|
|
SET_EXPECT(submit_onclick_setret);
|
|
|
|
SET_EXPECT(form_onclick);
|
|
|
|
SET_EXPECT(form_onsubmit);
|
|
|
|
hres = IHTMLElement_click(submit);
|
|
|
|
ok(hres == S_OK, "click failed: %08x\n", hres);
|
|
|
|
CHECK_CALLED(submit_onclick_setret);
|
|
|
|
CHECK_CALLED(form_onclick);
|
|
|
|
CHECK_CALLED(form_onsubmit);
|
|
|
|
|
|
|
|
V_VT(&onclick_event_retval) = VT_BOOL;
|
|
|
|
V_BOOL(&onclick_event_retval) = VARIANT_FALSE;
|
|
|
|
|
|
|
|
SET_EXPECT(submit_onclick_setret);
|
|
|
|
SET_EXPECT(form_onclick);
|
|
|
|
hres = IHTMLElement_click(submit);
|
|
|
|
ok(hres == S_OK, "click failed: %08x\n", hres);
|
|
|
|
CHECK_CALLED(submit_onclick_setret);
|
|
|
|
CHECK_CALLED(form_onclick);
|
|
|
|
|
|
|
|
V_VT(&onclick_retval) = VT_BOOL;
|
|
|
|
V_BOOL(&onclick_retval) = VARIANT_FALSE;
|
|
|
|
V_VT(&onclick_event_retval) = VT_BOOL;
|
|
|
|
V_BOOL(&onclick_event_retval) = VARIANT_TRUE;
|
|
|
|
|
|
|
|
SET_EXPECT(submit_onclick_setret);
|
|
|
|
SET_EXPECT(form_onclick);
|
|
|
|
hres = IHTMLElement_click(submit);
|
|
|
|
ok(hres == S_OK, "click failed: %08x\n", hres);
|
|
|
|
CHECK_CALLED(submit_onclick_setret);
|
|
|
|
CHECK_CALLED(form_onclick);
|
|
|
|
|
|
|
|
V_VT(&onclick_event_retval) = VT_BOOL;
|
|
|
|
V_BOOL(&onclick_event_retval) = VARIANT_FALSE;
|
|
|
|
|
|
|
|
SET_EXPECT(submit_onclick_setret);
|
|
|
|
SET_EXPECT(form_onclick);
|
|
|
|
hres = IHTMLElement_click(submit);
|
|
|
|
ok(hres == S_OK, "click failed: %08x\n", hres);
|
|
|
|
CHECK_CALLED(submit_onclick_setret);
|
|
|
|
CHECK_CALLED(form_onclick);
|
|
|
|
|
2020-02-12 00:32:46 +01:00
|
|
|
elem_attach_event((IUnknown*)submit, L"onclick", (IDispatch*)&submit_onclick_attached_obj);
|
|
|
|
elem_attach_event((IUnknown*)submit, L"onclick", (IDispatch*)&submit_onclick_attached_check_cancel_obj);
|
2012-04-16 13:48:46 +02:00
|
|
|
|
|
|
|
V_VT(&v) = VT_DISPATCH;
|
|
|
|
V_DISPATCH(&v) = (IDispatch*)&submit_onclick_cancel_obj;
|
|
|
|
hres = IHTMLElement_put_onclick(submit, v);
|
|
|
|
ok(hres == S_OK, "put_onclick failed: %08x\n", hres);
|
|
|
|
|
|
|
|
SET_EXPECT(submit_onclick_cancel);
|
|
|
|
SET_EXPECT(submit_onclick_attached_check_cancel);
|
|
|
|
SET_EXPECT(submit_onclick_attached);
|
|
|
|
hres = IHTMLElement_click(submit);
|
|
|
|
ok(hres == S_OK, "click failed: %08x\n", hres);
|
|
|
|
CHECK_CALLED(submit_onclick_cancel);
|
|
|
|
CHECK_CALLED(submit_onclick_attached_check_cancel);
|
|
|
|
CHECK_CALLED(submit_onclick_attached);
|
|
|
|
|
2014-03-11 19:01:09 +01:00
|
|
|
if(1)pump_msgs(NULL);
|
|
|
|
|
2011-02-28 13:14:32 +01:00
|
|
|
IHTMLElement_Release(submit);
|
|
|
|
}
|
|
|
|
|
2009-09-06 19:06:38 +02:00
|
|
|
static void test_timeout(IHTMLDocument2 *doc)
|
|
|
|
{
|
|
|
|
IHTMLWindow3 *win3;
|
|
|
|
VARIANT expr, var;
|
|
|
|
LONG id;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
hres = IHTMLWindow2_QueryInterface(window, &IID_IHTMLWindow3, (void**)&win3);
|
|
|
|
ok(hres == S_OK, "Could not get IHTMLWindow3 iface: %08x\n", hres);
|
|
|
|
|
2016-05-02 15:39:34 +02:00
|
|
|
V_VT(&expr) = VT_DISPATCH;
|
|
|
|
V_DISPATCH(&expr) = (IDispatch*)&timeoutFunc2;
|
|
|
|
V_VT(&var) = VT_EMPTY;
|
|
|
|
id = 0;
|
|
|
|
hres = IHTMLWindow3_setInterval(win3, &expr, 1, &var, &id);
|
|
|
|
ok(hres == S_OK, "setInterval failed: %08x\n", hres);
|
|
|
|
ok(id, "id = 0\n");
|
|
|
|
|
|
|
|
hres = IHTMLWindow2_clearTimeout(window, id);
|
|
|
|
ok(hres == S_OK, "clearTimeout failer: %08x\n", hres);
|
|
|
|
|
2009-09-06 19:06:38 +02:00
|
|
|
V_VT(&expr) = VT_DISPATCH;
|
|
|
|
V_DISPATCH(&expr) = (IDispatch*)&timeoutFunc;
|
|
|
|
V_VT(&var) = VT_EMPTY;
|
|
|
|
id = 0;
|
|
|
|
hres = IHTMLWindow3_setTimeout(win3, &expr, 0, &var, &id);
|
|
|
|
ok(hres == S_OK, "setTimeout failed: %08x\n", hres);
|
|
|
|
ok(id, "id = 0\n");
|
|
|
|
|
|
|
|
SET_EXPECT(timeout);
|
|
|
|
pump_msgs(&called_timeout);
|
|
|
|
CHECK_CALLED(timeout);
|
|
|
|
|
|
|
|
V_VT(&expr) = VT_DISPATCH;
|
|
|
|
V_DISPATCH(&expr) = (IDispatch*)&timeoutFunc;
|
|
|
|
V_VT(&var) = VT_EMPTY;
|
|
|
|
id = 0;
|
|
|
|
hres = IHTMLWindow3_setTimeout(win3, &expr, 0, &var, &id);
|
|
|
|
ok(hres == S_OK, "setTimeout failed: %08x\n", hres);
|
|
|
|
ok(id, "id = 0\n");
|
|
|
|
|
|
|
|
hres = IHTMLWindow2_clearTimeout(window, id);
|
|
|
|
ok(hres == S_OK, "clearTimeout failed: %08x\n", hres);
|
|
|
|
|
2016-05-02 15:39:28 +02:00
|
|
|
V_VT(&expr) = VT_DISPATCH;
|
|
|
|
V_DISPATCH(&expr) = (IDispatch*)&timeoutFunc;
|
|
|
|
V_VT(&var) = VT_EMPTY;
|
|
|
|
id = 0;
|
|
|
|
hres = IHTMLWindow3_setInterval(win3, &expr, 1, &var, &id);
|
|
|
|
ok(hres == S_OK, "setInterval failed: %08x\n", hres);
|
|
|
|
ok(id, "id = 0\n");
|
|
|
|
|
|
|
|
SET_EXPECT(timeout);
|
|
|
|
pump_msgs(&called_timeout);
|
|
|
|
CHECK_CALLED(timeout);
|
|
|
|
|
|
|
|
SET_EXPECT(timeout);
|
|
|
|
pump_msgs(&called_timeout);
|
|
|
|
CHECK_CALLED(timeout);
|
|
|
|
|
|
|
|
hres = IHTMLWindow2_clearInterval(window, id);
|
|
|
|
ok(hres == S_OK, "clearTimeout failer: %08x\n", hres);
|
|
|
|
|
2009-09-06 19:06:38 +02:00
|
|
|
IHTMLWindow3_Release(win3);
|
|
|
|
}
|
|
|
|
|
2016-04-04 18:02:04 +02:00
|
|
|
static IHTMLWindow2 *get_iframe_window(IHTMLIFrameElement *iframe)
|
2011-02-27 05:14:59 +01:00
|
|
|
{
|
2016-04-04 18:02:04 +02:00
|
|
|
IHTMLWindow2 *window;
|
|
|
|
IHTMLFrameBase2 *base;
|
2011-02-27 05:14:59 +01:00
|
|
|
HRESULT hres;
|
|
|
|
|
2016-04-04 18:02:04 +02:00
|
|
|
hres = IHTMLIFrameElement_QueryInterface(iframe, &IID_IHTMLFrameBase2, (void**)&base);
|
|
|
|
ok(hres == S_OK, "QueryInterface(IID_IHTMLFrameBase2) failed: %08x\n", hres);
|
2011-02-27 05:14:59 +01:00
|
|
|
|
2016-04-04 18:02:04 +02:00
|
|
|
hres = IHTMLFrameBase2_get_contentWindow(base, &window);
|
|
|
|
ok(hres == S_OK, "get_contentWindow failed: %08x\n", hres);
|
|
|
|
ok(window != NULL, "window == NULL\n");
|
2011-02-27 05:14:59 +01:00
|
|
|
|
2018-01-05 12:38:57 +01:00
|
|
|
IHTMLFrameBase2_Release(base);
|
2016-04-04 18:02:04 +02:00
|
|
|
return window;
|
2011-02-27 05:14:59 +01:00
|
|
|
}
|
|
|
|
|
2016-04-04 18:02:04 +02:00
|
|
|
static IHTMLDocument2 *get_iframe_doc(IHTMLIFrameElement *iframe)
|
2011-02-27 05:14:59 +01:00
|
|
|
{
|
|
|
|
IHTMLDocument2 *result = NULL;
|
2016-04-04 18:02:04 +02:00
|
|
|
IHTMLWindow2 *window;
|
|
|
|
HRESULT hres;
|
2011-02-27 05:14:59 +01:00
|
|
|
|
2016-04-04 18:02:04 +02:00
|
|
|
window = get_iframe_window(iframe);
|
|
|
|
|
|
|
|
hres = IHTMLWindow2_get_document(window, &result);
|
|
|
|
ok(hres == S_OK, "get_document failed: %08x\n", hres);
|
|
|
|
ok(result != NULL, "result == NULL\n");
|
2011-02-27 05:14:59 +01:00
|
|
|
|
2016-04-04 18:02:04 +02:00
|
|
|
IHTMLWindow2_Release(window);
|
2011-02-27 05:14:59 +01:00
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void test_iframe_connections(IHTMLDocument2 *doc)
|
|
|
|
{
|
|
|
|
IHTMLIFrameElement *iframe;
|
|
|
|
IHTMLDocument2 *iframes_doc;
|
|
|
|
DWORD cookie;
|
|
|
|
IConnectionPoint *cp;
|
2014-03-11 19:01:09 +01:00
|
|
|
IHTMLElement *element;
|
|
|
|
BSTR str;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
trace("iframe tests...\n");
|
2011-02-27 05:14:59 +01:00
|
|
|
|
2020-02-12 00:32:46 +01:00
|
|
|
element = get_elem_id(doc, L"ifr");
|
2014-03-11 19:01:09 +01:00
|
|
|
iframe = get_iframe_iface((IUnknown*)element);
|
2011-02-27 05:14:59 +01:00
|
|
|
IHTMLElement_Release(element);
|
|
|
|
|
|
|
|
iframes_doc = get_iframe_doc(iframe);
|
|
|
|
IHTMLIFrameElement_Release(iframe);
|
|
|
|
|
|
|
|
cookie = register_cp((IUnknown*)iframes_doc, &IID_IDispatch, (IUnknown*)&div_onclick_disp);
|
|
|
|
|
|
|
|
cp = get_cp((IUnknown*)doc, &IID_IDispatch);
|
|
|
|
hres = IConnectionPoint_Unadvise(cp, cookie);
|
|
|
|
IConnectionPoint_Release(cp);
|
|
|
|
ok(hres == CONNECT_E_NOCONNECTION, "Unadvise returned %08x, expected CONNECT_E_NOCONNECTION\n", hres);
|
|
|
|
|
2014-03-11 19:01:09 +01:00
|
|
|
unregister_cp((IUnknown*)iframes_doc, &IID_IDispatch, cookie);
|
|
|
|
|
2014-03-13 14:13:30 +01:00
|
|
|
if(is_ie9plus) {
|
|
|
|
IHTMLFrameBase2 *frame_base2;
|
|
|
|
VARIANT v;
|
2014-03-11 19:01:09 +01:00
|
|
|
|
2014-03-13 14:13:30 +01:00
|
|
|
hres = IHTMLIFrameElement_QueryInterface(iframe, &IID_IHTMLFrameBase2, (void**)&frame_base2);
|
|
|
|
ok(hres == S_OK, "Could not get IHTMLFrameBase2 iface: %08x\n", hres);
|
2014-03-11 19:01:09 +01:00
|
|
|
|
2014-03-13 14:13:30 +01:00
|
|
|
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);
|
2014-03-11 19:01:09 +01:00
|
|
|
|
2014-03-13 14:13:30 +01:00
|
|
|
IHTMLFrameBase2_Release(frame_base2);
|
2014-03-11 19:01:09 +01:00
|
|
|
|
2020-02-12 00:32:46 +01:00
|
|
|
str = SysAllocString(L"about:blank");
|
2014-03-13 14:13:30 +01:00
|
|
|
hres = IHTMLDocument2_put_URL(iframes_doc, str);
|
|
|
|
ok(hres == S_OK, "put_URL failed: %08x\n", hres);
|
|
|
|
SysFreeString(str);
|
2014-03-11 19:01:09 +01:00
|
|
|
|
2014-03-13 14:13:30 +01:00
|
|
|
SET_EXPECT(iframe_onload);
|
|
|
|
pump_msgs(&called_iframe_onload);
|
|
|
|
CHECK_CALLED(iframe_onload);
|
2014-03-11 19:01:09 +01:00
|
|
|
|
2020-02-12 00:32:46 +01:00
|
|
|
str = SysAllocString(L"about:test");
|
2014-03-13 14:13:30 +01:00
|
|
|
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);
|
|
|
|
}else {
|
|
|
|
win_skip("Skipping iframe onload tests on IE older than 9.\n");
|
|
|
|
}
|
2014-03-11 19:01:09 +01:00
|
|
|
|
2011-02-27 05:14:59 +01:00
|
|
|
IHTMLDocument2_Release(iframes_doc);
|
|
|
|
}
|
|
|
|
|
2017-10-11 15:16:20 +02:00
|
|
|
static void test_create_event(IHTMLDocument2 *doc)
|
|
|
|
{
|
2018-02-06 00:09:48 +01:00
|
|
|
IDOMKeyboardEvent *keyboard_event;
|
2019-01-24 13:49:51 +01:00
|
|
|
IDOMCustomEvent *custom_event;
|
2018-02-05 17:29:36 +01:00
|
|
|
IDOMMouseEvent *mouse_event;
|
2017-10-11 15:16:20 +02:00
|
|
|
IDocumentEvent *doc_event;
|
2017-12-04 18:02:01 +01:00
|
|
|
IEventTarget *event_target;
|
2018-02-06 00:08:46 +01:00
|
|
|
IDOMUIEvent *ui_event;
|
2017-12-04 18:02:01 +01:00
|
|
|
IHTMLElement *elem;
|
2017-10-19 17:02:08 +02:00
|
|
|
IDOMEvent *event;
|
2017-12-01 17:02:22 +01:00
|
|
|
VARIANT_BOOL b;
|
2017-10-24 19:39:11 +02:00
|
|
|
USHORT phase;
|
2017-10-19 17:02:08 +02:00
|
|
|
BSTR str;
|
2017-10-11 15:16:20 +02:00
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
trace("createEvent tests...\n");
|
|
|
|
|
|
|
|
hres = IHTMLDocument2_QueryInterface(doc, &IID_IDocumentEvent, (void**)&doc_event);
|
|
|
|
ok(hres == S_OK, "Could not get IDocumentEvent iface: %08x\n", hres);
|
|
|
|
|
2020-02-12 00:32:46 +01:00
|
|
|
str = SysAllocString(L"Event");
|
2017-10-19 17:02:08 +02:00
|
|
|
hres = IDocumentEvent_createEvent(doc_event, str, &event);
|
|
|
|
SysFreeString(str);
|
|
|
|
ok(hres == S_OK, "createEvent failed: %08x\n", hres);
|
|
|
|
|
2017-10-24 19:39:11 +02:00
|
|
|
phase = 0xdead;
|
|
|
|
hres = IDOMEvent_get_eventPhase(event, &phase);
|
|
|
|
ok(hres == S_OK, "get_eventPhase failed: %08x\n", hres);
|
|
|
|
ok(!phase, "phase = %u\n", phase);
|
|
|
|
|
2017-10-20 15:08:59 +02:00
|
|
|
hres = IDOMEvent_preventDefault(event);
|
|
|
|
ok(hres == S_OK, "preventDefault failed: %08x\n", hres);
|
|
|
|
|
2017-10-20 15:09:05 +02:00
|
|
|
hres = IDOMEvent_stopPropagation(event);
|
|
|
|
ok(hres == S_OK, "stopPropagation failed: %08x\n", hres);
|
|
|
|
|
2017-12-01 17:02:06 +01:00
|
|
|
str = (void*)0xdeadbeef;
|
|
|
|
hres = IDOMEvent_get_type(event, &str);
|
|
|
|
ok(hres == S_OK, "get_type failed: %08x\n", hres);
|
|
|
|
ok(!str, "type = %s\n", wine_dbgstr_w(str));
|
|
|
|
|
2017-12-01 17:02:22 +01:00
|
|
|
b = 0xdead;
|
|
|
|
hres = IDOMEvent_get_bubbles(event, &b);
|
|
|
|
ok(hres == S_OK, "get_bubbles failed: %08x\n", hres);
|
|
|
|
ok(!b, "bubbles = %x\n", b);
|
|
|
|
|
2017-12-01 17:02:31 +01:00
|
|
|
b = 0xdead;
|
|
|
|
hres = IDOMEvent_get_cancelable(event, &b);
|
|
|
|
ok(hres == S_OK, "get_cancelable failed: %08x\n", hres);
|
|
|
|
ok(!b, "cancelable = %x\n", b);
|
|
|
|
|
2017-12-04 18:02:01 +01:00
|
|
|
elem = doc_get_body(doc);
|
|
|
|
hres = IHTMLElement_QueryInterface(elem, &IID_IEventTarget, (void**)&event_target);
|
|
|
|
IHTMLElement_Release(elem);
|
|
|
|
|
|
|
|
hres = IEventTarget_dispatchEvent(event_target, NULL, &b);
|
|
|
|
ok(hres == E_INVALIDARG, "dispatchEvent failed: %08x\n", hres);
|
|
|
|
|
|
|
|
IEventTarget_Release(event_target);
|
|
|
|
|
2018-02-06 00:08:46 +01:00
|
|
|
hres = IDOMEvent_QueryInterface(event, &IID_IDOMUIEvent, (void**)&ui_event);
|
|
|
|
ok(hres == E_NOINTERFACE, "QueryInterface(IID_IDOMUIEvent returned %08x\n", hres);
|
2018-02-05 17:29:36 +01:00
|
|
|
hres = IDOMEvent_QueryInterface(event, &IID_IDOMMouseEvent, (void**)&mouse_event);
|
|
|
|
ok(hres == E_NOINTERFACE, "QueryInterface(IID_IDOMMouseEvent returned %08x\n", hres);
|
|
|
|
|
|
|
|
IDOMEvent_Release(event);
|
|
|
|
|
2020-02-12 00:32:46 +01:00
|
|
|
str = SysAllocString(L"MouseEvent");
|
2018-02-05 17:29:36 +01:00
|
|
|
hres = IDocumentEvent_createEvent(doc_event, str, &event);
|
|
|
|
SysFreeString(str);
|
|
|
|
ok(hres == S_OK, "createEvent failed: %08x\n", hres);
|
|
|
|
|
2018-02-06 00:08:46 +01:00
|
|
|
hres = IDOMEvent_QueryInterface(event, &IID_IDOMUIEvent, (void**)&ui_event);
|
|
|
|
ok(hres == S_OK, "QueryInterface(IID_IDOMUIEvent returned %08x\n", hres);
|
|
|
|
IDOMUIEvent_Release(ui_event);
|
2018-02-05 17:29:36 +01:00
|
|
|
hres = IDOMEvent_QueryInterface(event, &IID_IDOMMouseEvent, (void**)&mouse_event);
|
|
|
|
ok(hres == S_OK, "QueryInterface(IID_IDOMMouseEvent returned %08x\n", hres);
|
|
|
|
IDOMMouseEvent_Release(mouse_event);
|
|
|
|
|
2017-10-19 17:02:08 +02:00
|
|
|
IDOMEvent_Release(event);
|
|
|
|
|
2020-02-12 00:32:46 +01:00
|
|
|
str = SysAllocString(L"UIEvent");
|
2018-02-06 00:08:46 +01:00
|
|
|
hres = IDocumentEvent_createEvent(doc_event, str, &event);
|
|
|
|
SysFreeString(str);
|
|
|
|
ok(hres == S_OK, "createEvent failed: %08x\n", hres);
|
|
|
|
|
|
|
|
hres = IDOMEvent_QueryInterface(event, &IID_IDOMUIEvent, (void**)&ui_event);
|
|
|
|
ok(hres == S_OK, "QueryInterface(IID_IDOMUIEvent returned %08x\n", hres);
|
|
|
|
IDOMUIEvent_Release(ui_event);
|
|
|
|
hres = IDOMEvent_QueryInterface(event, &IID_IDOMMouseEvent, (void**)&mouse_event);
|
|
|
|
ok(hres == E_NOINTERFACE, "QueryInterface(IID_IDOMMouseEvent returned %08x\n", hres);
|
|
|
|
|
|
|
|
IDOMEvent_Release(event);
|
|
|
|
|
2020-02-12 00:32:46 +01:00
|
|
|
str = SysAllocString(L"KeyboardEvent");
|
2018-02-06 00:09:48 +01:00
|
|
|
hres = IDocumentEvent_createEvent(doc_event, str, &event);
|
|
|
|
SysFreeString(str);
|
|
|
|
ok(hres == S_OK, "createEvent failed: %08x\n", hres);
|
|
|
|
|
|
|
|
hres = IDOMEvent_QueryInterface(event, &IID_IDOMUIEvent, (void**)&ui_event);
|
|
|
|
ok(hres == S_OK, "QueryInterface(IID_IDOMUIEvent returned %08x\n", hres);
|
|
|
|
IDOMUIEvent_Release(ui_event);
|
|
|
|
hres = IDOMEvent_QueryInterface(event, &IID_IDOMKeyboardEvent, (void**)&keyboard_event);
|
|
|
|
ok(hres == S_OK, "QueryInterface(IID_IDOMKeyboardEvent returned %08x\n", hres);
|
|
|
|
IDOMKeyboardEvent_Release(keyboard_event);
|
|
|
|
|
|
|
|
IDOMEvent_Release(event);
|
|
|
|
|
2020-02-12 00:32:46 +01:00
|
|
|
str = SysAllocString(L"CustomEvent");
|
2019-01-24 13:49:51 +01:00
|
|
|
hres = IDocumentEvent_createEvent(doc_event, str, &event);
|
|
|
|
SysFreeString(str);
|
|
|
|
ok(hres == S_OK, "createEvent failed: %08x\n", hres);
|
|
|
|
|
|
|
|
hres = IDOMEvent_QueryInterface(event, &IID_IDOMCustomEvent, (void**)&custom_event);
|
|
|
|
ok(hres == S_OK, "QueryInterface(IID_IDOMCustomEvent returned %08x\n", hres);
|
|
|
|
IDOMCustomEvent_Release(custom_event);
|
|
|
|
|
|
|
|
IDOMEvent_Release(event);
|
|
|
|
|
2017-10-11 15:16:20 +02:00
|
|
|
IDocumentEvent_Release(doc_event);
|
|
|
|
}
|
|
|
|
|
2009-09-06 19:06:38 +02:00
|
|
|
static HRESULT QueryInterface(REFIID,void**);
|
|
|
|
|
|
|
|
static HRESULT WINAPI InPlaceFrame_QueryInterface(IOleInPlaceFrame *iface, REFIID riid, void **ppv)
|
|
|
|
{
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI InPlaceFrame_AddRef(IOleInPlaceFrame *iface)
|
|
|
|
{
|
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI InPlaceFrame_Release(IOleInPlaceFrame *iface)
|
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI InPlaceFrame_GetWindow(IOleInPlaceFrame *iface, HWND *phwnd)
|
|
|
|
{
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI InPlaceFrame_ContextSensitiveHelp(IOleInPlaceFrame *iface, BOOL fEnterMode)
|
|
|
|
{
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI InPlaceFrame_GetBorder(IOleInPlaceFrame *iface, LPRECT lprectBorder)
|
|
|
|
{
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI InPlaceFrame_RequestBorderSpace(IOleInPlaceFrame *iface,
|
|
|
|
LPCBORDERWIDTHS pborderwidths)
|
|
|
|
{
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI InPlaceFrame_SetBorderSpace(IOleInPlaceFrame *iface,
|
|
|
|
LPCBORDERWIDTHS pborderwidths)
|
|
|
|
{
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI InPlaceUIWindow_SetActiveObject(IOleInPlaceFrame *iface,
|
|
|
|
IOleInPlaceActiveObject *pActiveObject, LPCOLESTR pszObjName)
|
|
|
|
{
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI InPlaceFrame_SetActiveObject(IOleInPlaceFrame *iface,
|
|
|
|
IOleInPlaceActiveObject *pActiveObject, LPCOLESTR pszObjName)
|
|
|
|
{
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI InPlaceFrame_InsertMenus(IOleInPlaceFrame *iface, HMENU hmenuShared,
|
|
|
|
LPOLEMENUGROUPWIDTHS lpMenuWidths)
|
|
|
|
{
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI InPlaceFrame_SetMenu(IOleInPlaceFrame *iface, HMENU hmenuShared,
|
|
|
|
HOLEMENU holemenu, HWND hwndActiveObject)
|
|
|
|
{
|
|
|
|
ok(0, "unexpected call\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI InPlaceFrame_RemoveMenus(IOleInPlaceFrame *iface, HMENU hmenuShared)
|
|
|
|
{
|
|
|
|
ok(0, "unexpected call\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI InPlaceFrame_SetStatusText(IOleInPlaceFrame *iface, LPCOLESTR pszStatusText)
|
|
|
|
{
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI InPlaceFrame_EnableModeless(IOleInPlaceFrame *iface, BOOL fEnable)
|
|
|
|
{
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI InPlaceFrame_TranslateAccelerator(IOleInPlaceFrame *iface, LPMSG lpmsg, WORD wID)
|
|
|
|
{
|
|
|
|
ok(0, "unexpected call\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const IOleInPlaceFrameVtbl InPlaceFrameVtbl = {
|
|
|
|
InPlaceFrame_QueryInterface,
|
|
|
|
InPlaceFrame_AddRef,
|
|
|
|
InPlaceFrame_Release,
|
|
|
|
InPlaceFrame_GetWindow,
|
|
|
|
InPlaceFrame_ContextSensitiveHelp,
|
|
|
|
InPlaceFrame_GetBorder,
|
|
|
|
InPlaceFrame_RequestBorderSpace,
|
|
|
|
InPlaceFrame_SetBorderSpace,
|
|
|
|
InPlaceFrame_SetActiveObject,
|
|
|
|
InPlaceFrame_InsertMenus,
|
|
|
|
InPlaceFrame_SetMenu,
|
|
|
|
InPlaceFrame_RemoveMenus,
|
|
|
|
InPlaceFrame_SetStatusText,
|
|
|
|
InPlaceFrame_EnableModeless,
|
|
|
|
InPlaceFrame_TranslateAccelerator
|
|
|
|
};
|
|
|
|
|
|
|
|
static IOleInPlaceFrame InPlaceFrame = { &InPlaceFrameVtbl };
|
|
|
|
|
|
|
|
static const IOleInPlaceFrameVtbl InPlaceUIWindowVtbl = {
|
|
|
|
InPlaceFrame_QueryInterface,
|
|
|
|
InPlaceFrame_AddRef,
|
|
|
|
InPlaceFrame_Release,
|
|
|
|
InPlaceFrame_GetWindow,
|
|
|
|
InPlaceFrame_ContextSensitiveHelp,
|
|
|
|
InPlaceFrame_GetBorder,
|
|
|
|
InPlaceFrame_RequestBorderSpace,
|
|
|
|
InPlaceFrame_SetBorderSpace,
|
|
|
|
InPlaceUIWindow_SetActiveObject,
|
|
|
|
};
|
|
|
|
|
|
|
|
static IOleInPlaceFrame InPlaceUIWindow = { &InPlaceUIWindowVtbl };
|
|
|
|
|
|
|
|
static HRESULT WINAPI InPlaceSite_QueryInterface(IOleInPlaceSite *iface, REFIID riid, void **ppv)
|
|
|
|
{
|
|
|
|
return QueryInterface(riid, ppv);
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI InPlaceSite_AddRef(IOleInPlaceSite *iface)
|
|
|
|
{
|
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI InPlaceSite_Release(IOleInPlaceSite *iface)
|
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI InPlaceSite_GetWindow(IOleInPlaceSite *iface, HWND *phwnd)
|
|
|
|
{
|
|
|
|
*phwnd = container_hwnd;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI InPlaceSite_ContextSensitiveHelp(IOleInPlaceSite *iface, BOOL fEnterMode)
|
|
|
|
{
|
|
|
|
ok(0, "unexpected call\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI InPlaceSite_CanInPlaceActivate(IOleInPlaceSite *iface)
|
|
|
|
{
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI InPlaceSite_OnInPlaceActivate(IOleInPlaceSite *iface)
|
|
|
|
{
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI InPlaceSite_OnUIActivate(IOleInPlaceSite *iface)
|
|
|
|
{
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI InPlaceSite_GetWindowContext(IOleInPlaceSite *iface,
|
|
|
|
IOleInPlaceFrame **ppFrame, IOleInPlaceUIWindow **ppDoc, LPRECT lprcPosRect,
|
|
|
|
LPRECT lprcClipRect, LPOLEINPLACEFRAMEINFO lpFrameInfo)
|
|
|
|
{
|
|
|
|
static const RECT rect = {0,0,300,300};
|
|
|
|
|
|
|
|
*ppFrame = &InPlaceFrame;
|
|
|
|
*ppDoc = (IOleInPlaceUIWindow*)&InPlaceUIWindow;
|
|
|
|
*lprcPosRect = rect;
|
|
|
|
*lprcClipRect = rect;
|
|
|
|
|
2011-03-16 15:14:19 +01:00
|
|
|
ok(lpFrameInfo->cb == sizeof(*lpFrameInfo), "lpFrameInfo->cb = %u, expected %u\n", lpFrameInfo->cb, (unsigned)sizeof(*lpFrameInfo));
|
2009-09-06 19:06:38 +02:00
|
|
|
lpFrameInfo->fMDIApp = FALSE;
|
|
|
|
lpFrameInfo->hwndFrame = container_hwnd;
|
|
|
|
lpFrameInfo->haccel = NULL;
|
|
|
|
lpFrameInfo->cAccelEntries = 0;
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI InPlaceSite_Scroll(IOleInPlaceSite *iface, SIZE scrollExtant)
|
|
|
|
{
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI InPlaceSite_OnUIDeactivate(IOleInPlaceSite *iface, BOOL fUndoable)
|
|
|
|
{
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI InPlaceSite_OnInPlaceDeactivate(IOleInPlaceSite *iface)
|
|
|
|
{
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI InPlaceSite_DiscardUndoState(IOleInPlaceSite *iface)
|
|
|
|
{
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI InPlaceSite_DeactivateAndUndo(IOleInPlaceSite *iface)
|
|
|
|
{
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI InPlaceSite_OnPosRectChange(IOleInPlaceSite *iface, LPCRECT lprcPosRect)
|
|
|
|
{
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const IOleInPlaceSiteVtbl InPlaceSiteVtbl = {
|
|
|
|
InPlaceSite_QueryInterface,
|
|
|
|
InPlaceSite_AddRef,
|
|
|
|
InPlaceSite_Release,
|
|
|
|
InPlaceSite_GetWindow,
|
|
|
|
InPlaceSite_ContextSensitiveHelp,
|
|
|
|
InPlaceSite_CanInPlaceActivate,
|
|
|
|
InPlaceSite_OnInPlaceActivate,
|
|
|
|
InPlaceSite_OnUIActivate,
|
|
|
|
InPlaceSite_GetWindowContext,
|
|
|
|
InPlaceSite_Scroll,
|
|
|
|
InPlaceSite_OnUIDeactivate,
|
|
|
|
InPlaceSite_OnInPlaceDeactivate,
|
|
|
|
InPlaceSite_DiscardUndoState,
|
|
|
|
InPlaceSite_DeactivateAndUndo,
|
|
|
|
InPlaceSite_OnPosRectChange,
|
|
|
|
};
|
|
|
|
|
|
|
|
static IOleInPlaceSite InPlaceSite = { &InPlaceSiteVtbl };
|
|
|
|
|
|
|
|
static HRESULT WINAPI ClientSite_QueryInterface(IOleClientSite *iface, REFIID riid, void **ppv)
|
|
|
|
{
|
|
|
|
return QueryInterface(riid, ppv);
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI ClientSite_AddRef(IOleClientSite *iface)
|
|
|
|
{
|
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI ClientSite_Release(IOleClientSite *iface)
|
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI ClientSite_SaveObject(IOleClientSite *iface)
|
|
|
|
{
|
|
|
|
ok(0, "unexpected call\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI ClientSite_GetMoniker(IOleClientSite *iface, DWORD dwAssign, DWORD dwWhichMoniker,
|
|
|
|
IMoniker **ppmon)
|
|
|
|
{
|
|
|
|
ok(0, "unexpected call\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI ClientSite_GetContainer(IOleClientSite *iface, IOleContainer **ppContainer)
|
|
|
|
{
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI ClientSite_ShowObject(IOleClientSite *iface)
|
|
|
|
{
|
|
|
|
ok(0, "unexpected call\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI ClientSite_OnShowWindow(IOleClientSite *iface, BOOL fShow)
|
|
|
|
{
|
|
|
|
ok(0, "unexpected call\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI ClientSite_RequestNewObjectLayout(IOleClientSite *iface)
|
|
|
|
{
|
|
|
|
ok(0, "unexpected call\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const IOleClientSiteVtbl ClientSiteVtbl = {
|
|
|
|
ClientSite_QueryInterface,
|
|
|
|
ClientSite_AddRef,
|
|
|
|
ClientSite_Release,
|
|
|
|
ClientSite_SaveObject,
|
|
|
|
ClientSite_GetMoniker,
|
|
|
|
ClientSite_GetContainer,
|
|
|
|
ClientSite_ShowObject,
|
|
|
|
ClientSite_OnShowWindow,
|
|
|
|
ClientSite_RequestNewObjectLayout
|
|
|
|
};
|
|
|
|
|
|
|
|
static IOleClientSite ClientSite = { &ClientSiteVtbl };
|
|
|
|
|
|
|
|
static HRESULT WINAPI DocumentSite_QueryInterface(IOleDocumentSite *iface, REFIID riid, void **ppv)
|
|
|
|
{
|
|
|
|
return QueryInterface(riid, ppv);
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI DocumentSite_AddRef(IOleDocumentSite *iface)
|
|
|
|
{
|
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI DocumentSite_Release(IOleDocumentSite *iface)
|
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI DocumentSite_ActivateMe(IOleDocumentSite *iface, IOleDocumentView *pViewToActivate)
|
|
|
|
{
|
|
|
|
RECT rect = {0,0,300,300};
|
|
|
|
IOleDocument *document;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
hres = IOleDocumentView_QueryInterface(pViewToActivate, &IID_IOleDocument, (void**)&document);
|
|
|
|
ok(hres == S_OK, "could not get IOleDocument: %08x\n", hres);
|
|
|
|
|
|
|
|
hres = IOleDocument_CreateView(document, &InPlaceSite, NULL, 0, &view);
|
|
|
|
IOleDocument_Release(document);
|
|
|
|
ok(hres == S_OK, "CreateView failed: %08x\n", hres);
|
|
|
|
|
|
|
|
hres = IOleDocumentView_SetInPlaceSite(view, &InPlaceSite);
|
|
|
|
ok(hres == S_OK, "SetInPlaceSite failed: %08x\n", hres);
|
|
|
|
|
|
|
|
hres = IOleDocumentView_UIActivate(view, TRUE);
|
|
|
|
ok(hres == S_OK, "UIActivate failed: %08x\n", hres);
|
|
|
|
|
|
|
|
hres = IOleDocumentView_SetRect(view, &rect);
|
|
|
|
ok(hres == S_OK, "SetRect failed: %08x\n", hres);
|
|
|
|
|
|
|
|
hres = IOleDocumentView_Show(view, TRUE);
|
|
|
|
ok(hres == S_OK, "Show failed: %08x\n", hres);
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const IOleDocumentSiteVtbl DocumentSiteVtbl = {
|
|
|
|
DocumentSite_QueryInterface,
|
|
|
|
DocumentSite_AddRef,
|
|
|
|
DocumentSite_Release,
|
|
|
|
DocumentSite_ActivateMe
|
|
|
|
};
|
|
|
|
|
|
|
|
static IOleDocumentSite DocumentSite = { &DocumentSiteVtbl };
|
|
|
|
|
|
|
|
static HRESULT QueryInterface(REFIID riid, void **ppv)
|
|
|
|
{
|
|
|
|
*ppv = NULL;
|
|
|
|
|
|
|
|
if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IOleClientSite, riid))
|
|
|
|
*ppv = &ClientSite;
|
|
|
|
else if(IsEqualGUID(&IID_IOleDocumentSite, riid))
|
|
|
|
*ppv = &DocumentSite;
|
|
|
|
else if(IsEqualGUID(&IID_IOleWindow, riid) || IsEqualGUID(&IID_IOleInPlaceSite, riid))
|
|
|
|
*ppv = &InPlaceSite;
|
|
|
|
|
|
|
|
return *ppv ? S_OK : E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static IHTMLDocument2 *notif_doc;
|
|
|
|
static BOOL doc_complete;
|
|
|
|
|
|
|
|
static HRESULT WINAPI PropertyNotifySink_QueryInterface(IPropertyNotifySink *iface,
|
|
|
|
REFIID riid, void**ppv)
|
|
|
|
{
|
|
|
|
if(IsEqualGUID(&IID_IPropertyNotifySink, riid)) {
|
|
|
|
*ppv = iface;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
ok(0, "unexpected call\n");
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI PropertyNotifySink_AddRef(IPropertyNotifySink *iface)
|
|
|
|
{
|
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI PropertyNotifySink_Release(IPropertyNotifySink *iface)
|
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI PropertyNotifySink_OnChanged(IPropertyNotifySink *iface, DISPID dispID)
|
|
|
|
{
|
|
|
|
if(dispID == DISPID_READYSTATE){
|
|
|
|
BSTR state;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
hres = IHTMLDocument2_get_readyState(notif_doc, &state);
|
|
|
|
ok(hres == S_OK, "get_readyState failed: %08x\n", hres);
|
|
|
|
|
2020-02-12 00:32:47 +01:00
|
|
|
if(!lstrcmpW(state, L"complete"))
|
2009-09-06 19:06:38 +02:00
|
|
|
doc_complete = TRUE;
|
|
|
|
|
|
|
|
SysFreeString(state);
|
|
|
|
}
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI PropertyNotifySink_OnRequestEdit(IPropertyNotifySink *iface, DISPID dispID)
|
|
|
|
{
|
|
|
|
ok(0, "unexpected call\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2011-03-09 05:27:16 +01:00
|
|
|
static const IPropertyNotifySinkVtbl PropertyNotifySinkVtbl = {
|
2009-09-06 19:06:38 +02:00
|
|
|
PropertyNotifySink_QueryInterface,
|
|
|
|
PropertyNotifySink_AddRef,
|
|
|
|
PropertyNotifySink_Release,
|
|
|
|
PropertyNotifySink_OnChanged,
|
|
|
|
PropertyNotifySink_OnRequestEdit
|
|
|
|
};
|
|
|
|
|
|
|
|
static IPropertyNotifySink PropertyNotifySink = { &PropertyNotifySinkVtbl };
|
|
|
|
|
|
|
|
static void doc_load_string(IHTMLDocument2 *doc, const char *str)
|
|
|
|
{
|
|
|
|
IPersistStreamInit *init;
|
|
|
|
IStream *stream;
|
2017-11-28 12:18:15 +01:00
|
|
|
HRESULT hres;
|
2009-09-06 19:06:38 +02:00
|
|
|
HGLOBAL mem;
|
|
|
|
SIZE_T len;
|
|
|
|
|
|
|
|
notif_doc = doc;
|
|
|
|
|
|
|
|
doc_complete = FALSE;
|
|
|
|
len = strlen(str);
|
|
|
|
mem = GlobalAlloc(0, len);
|
|
|
|
memcpy(mem, str, len);
|
2017-11-28 12:18:15 +01:00
|
|
|
hres = CreateStreamOnHGlobal(mem, TRUE, &stream);
|
|
|
|
ok(hres == S_OK, "Failed to create a stream, hr %#x.\n", hres);
|
2009-09-06 19:06:38 +02:00
|
|
|
|
2017-11-28 12:18:15 +01:00
|
|
|
hres = IHTMLDocument2_QueryInterface(doc, &IID_IPersistStreamInit, (void**)&init);
|
|
|
|
ok(hres == S_OK, "Failed to get IPersistStreamInit, hr %#x.\n", hres);
|
2009-09-06 19:06:38 +02:00
|
|
|
|
|
|
|
IPersistStreamInit_Load(init, stream);
|
|
|
|
IPersistStreamInit_Release(init);
|
|
|
|
IStream_Release(stream);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void do_advise(IUnknown *unk, REFIID riid, IUnknown *unk_advise)
|
|
|
|
{
|
|
|
|
IConnectionPointContainer *container;
|
|
|
|
IConnectionPoint *cp;
|
|
|
|
DWORD cookie;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
hres = IUnknown_QueryInterface(unk, &IID_IConnectionPointContainer, (void**)&container);
|
|
|
|
ok(hres == S_OK, "QueryInterface(IID_IConnectionPointContainer) failed: %08x\n", hres);
|
|
|
|
|
|
|
|
hres = IConnectionPointContainer_FindConnectionPoint(container, riid, &cp);
|
|
|
|
IConnectionPointContainer_Release(container);
|
|
|
|
ok(hres == S_OK, "FindConnectionPoint failed: %08x\n", hres);
|
|
|
|
|
|
|
|
hres = IConnectionPoint_Advise(cp, unk_advise, &cookie);
|
|
|
|
IConnectionPoint_Release(cp);
|
|
|
|
ok(hres == S_OK, "Advise failed: %08x\n", hres);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void set_client_site(IHTMLDocument2 *doc, BOOL set)
|
|
|
|
{
|
|
|
|
IOleObject *oleobj;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
if(!set && view) {
|
|
|
|
IOleDocumentView_Show(view, FALSE);
|
|
|
|
IOleDocumentView_CloseView(view, 0);
|
|
|
|
IOleDocumentView_SetInPlaceSite(view, NULL);
|
|
|
|
IOleDocumentView_Release(view);
|
|
|
|
view = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
hres = IHTMLDocument2_QueryInterface(doc, &IID_IOleObject, (void**)&oleobj);
|
|
|
|
ok(hres == S_OK, "Could not et IOleObject: %08x\n", hres);
|
|
|
|
|
|
|
|
hres = IOleObject_SetClientSite(oleobj, set ? &ClientSite : NULL);
|
|
|
|
ok(hres == S_OK, "SetClientSite failed: %08x\n", hres);
|
|
|
|
|
|
|
|
if(set) {
|
|
|
|
IHlinkTarget *hlink;
|
|
|
|
|
|
|
|
hres = IOleObject_QueryInterface(oleobj, &IID_IHlinkTarget, (void**)&hlink);
|
|
|
|
ok(hres == S_OK, "Could not get IHlinkTarget iface: %08x\n", hres);
|
|
|
|
|
|
|
|
hres = IHlinkTarget_Navigate(hlink, 0, NULL);
|
|
|
|
ok(hres == S_OK, "Navgate failed: %08x\n", hres);
|
|
|
|
|
|
|
|
IHlinkTarget_Release(hlink);
|
|
|
|
}
|
|
|
|
|
|
|
|
IOleObject_Release(oleobj);
|
|
|
|
}
|
|
|
|
static IHTMLDocument2 *create_document(void)
|
|
|
|
{
|
|
|
|
IHTMLDocument2 *doc;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
hres = CoCreateInstance(&CLSID_HTMLDocument, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
|
|
|
|
&IID_IHTMLDocument2, (void**)&doc);
|
2020-05-13 10:33:54 +02:00
|
|
|
#if !defined(__i386__) && !defined(__x86_64__)
|
|
|
|
todo_wine
|
|
|
|
#endif
|
2009-09-06 19:06:38 +02:00
|
|
|
ok(hres == S_OK, "CoCreateInstance failed: %08x\n", hres);
|
2014-03-13 14:13:30 +01:00
|
|
|
return SUCCEEDED(hres) ? doc : NULL;
|
2009-09-06 19:06:38 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
typedef void (*testfunc_t)(IHTMLDocument2*);
|
|
|
|
|
|
|
|
static void run_test(const char *str, testfunc_t test)
|
|
|
|
{
|
|
|
|
IHTMLDocument2 *doc;
|
|
|
|
IHTMLElement *body = NULL;
|
|
|
|
MSG msg;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
doc = create_document();
|
2009-12-07 16:43:47 +01:00
|
|
|
if (!doc)
|
|
|
|
return;
|
2009-09-06 19:06:38 +02:00
|
|
|
set_client_site(doc, TRUE);
|
|
|
|
doc_load_string(doc, str);
|
|
|
|
do_advise((IUnknown*)doc, &IID_IPropertyNotifySink, (IUnknown*)&PropertyNotifySink);
|
|
|
|
|
2013-10-10 12:53:34 +02:00
|
|
|
while(!doc_complete && GetMessageA(&msg, NULL, 0, 0)) {
|
2009-09-06 19:06:38 +02:00
|
|
|
TranslateMessage(&msg);
|
2013-10-10 12:53:34 +02:00
|
|
|
DispatchMessageA(&msg);
|
2009-09-06 19:06:38 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
hres = IHTMLDocument2_get_body(doc, &body);
|
|
|
|
ok(hres == S_OK, "get_body failed: %08x\n", hres);
|
|
|
|
|
|
|
|
if(body) {
|
2017-09-29 19:57:30 +02:00
|
|
|
IHTMLDocument6 *doc6;
|
|
|
|
|
2009-09-06 19:06:38 +02:00
|
|
|
IHTMLElement_Release(body);
|
|
|
|
|
2017-09-29 19:57:30 +02:00
|
|
|
hres = IHTMLDocument2_QueryInterface(doc, &IID_IHTMLDocument6, (void**)&doc6);
|
|
|
|
if(SUCCEEDED(hres)) {
|
|
|
|
VARIANT v;
|
|
|
|
hres = IHTMLDocument6_get_documentMode(doc6, &v);
|
|
|
|
ok(hres == S_OK, "get_documentMode failed: %08x\n", hres);
|
|
|
|
ok(V_VT(&v) == VT_R4, "V_VT(documentMode) = %u\n", V_VT(&v));
|
|
|
|
document_mode = V_R4(&v);
|
|
|
|
IHTMLDocument6_Release(doc6);
|
|
|
|
}else {
|
|
|
|
document_mode = 0;
|
|
|
|
}
|
|
|
|
|
2009-09-06 19:06:38 +02:00
|
|
|
hres = IHTMLDocument2_get_parentWindow(doc, &window);
|
|
|
|
ok(hres == S_OK, "get_parentWindow failed: %08x\n", hres);
|
|
|
|
ok(window != NULL, "window == NULL\n");
|
|
|
|
|
|
|
|
test(doc);
|
|
|
|
|
|
|
|
IHTMLWindow2_Release(window);
|
|
|
|
window = NULL;
|
|
|
|
}else {
|
|
|
|
skip("Could not get document body. Assuming no Gecko installed.\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
set_client_site(doc, FALSE);
|
2009-12-10 01:10:20 +01:00
|
|
|
IHTMLDocument2_Release(doc);
|
2009-09-06 19:06:38 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static LRESULT WINAPI wnd_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
2013-10-10 12:53:34 +02:00
|
|
|
return DefWindowProcA(hwnd, msg, wParam, lParam);
|
2009-09-06 19:06:38 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HWND create_container_window(void)
|
|
|
|
{
|
2009-09-10 08:00:14 +02:00
|
|
|
static const CHAR szHTMLDocumentTest[] = "HTMLDocumentTest";
|
|
|
|
static WNDCLASSEXA wndclass = {
|
|
|
|
sizeof(WNDCLASSEXA),
|
2009-09-06 19:06:38 +02:00
|
|
|
0,
|
|
|
|
wnd_proc,
|
|
|
|
0, 0, NULL, NULL, NULL, NULL, NULL,
|
2009-09-10 08:00:14 +02:00
|
|
|
szHTMLDocumentTest,
|
2009-09-06 19:06:38 +02:00
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
2009-09-10 08:00:14 +02:00
|
|
|
RegisterClassExA(&wndclass);
|
|
|
|
return CreateWindowA(szHTMLDocumentTest, szHTMLDocumentTest,
|
2009-09-06 19:06:38 +02:00
|
|
|
WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT,
|
|
|
|
300, 300, NULL, NULL, NULL, NULL);
|
|
|
|
}
|
|
|
|
|
2011-02-27 05:14:59 +01:00
|
|
|
static void test_empty_document(void)
|
|
|
|
{
|
|
|
|
HRESULT hres;
|
|
|
|
IHTMLWindow2 *window;
|
|
|
|
IHTMLDocument2 *windows_doc, *doc;
|
|
|
|
IConnectionPoint *cp;
|
|
|
|
DWORD cookie;
|
|
|
|
|
|
|
|
doc = create_document();
|
|
|
|
if(!doc)
|
|
|
|
return;
|
|
|
|
|
|
|
|
hres = IHTMLDocument2_get_parentWindow(doc, &window);
|
|
|
|
ok(hres == S_OK, "get_parentWindow failed: %08x\n", hres);
|
|
|
|
|
|
|
|
hres = IHTMLWindow2_get_document(window, &windows_doc);
|
|
|
|
IHTMLWindow2_Release(window);
|
|
|
|
ok(hres == S_OK, "get_document failed: %08x\n", hres);
|
|
|
|
|
|
|
|
cookie = register_cp((IUnknown*)windows_doc, &IID_IDispatch, (IUnknown*)&div_onclick_disp);
|
|
|
|
|
|
|
|
cp = get_cp((IUnknown*)doc, &IID_IDispatch);
|
|
|
|
hres = IConnectionPoint_Unadvise(cp, cookie);
|
|
|
|
IConnectionPoint_Release(cp);
|
2011-02-27 05:55:16 +01:00
|
|
|
ok(hres == S_OK, "Unadvise failed: %08x\n", hres);
|
2011-02-27 05:14:59 +01:00
|
|
|
|
|
|
|
IHTMLDocument2_Release(windows_doc);
|
2011-03-09 05:27:16 +01:00
|
|
|
IHTMLDocument2_Release(doc);
|
2011-02-27 05:14:59 +01:00
|
|
|
}
|
|
|
|
|
2014-03-13 14:13:30 +01:00
|
|
|
static BOOL check_ie(void)
|
|
|
|
{
|
|
|
|
IHTMLDocument2 *doc;
|
|
|
|
IHTMLDocument5 *doc5;
|
|
|
|
IHTMLDocument7 *doc7;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
doc = create_document();
|
|
|
|
if(!doc)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
hres = IHTMLDocument2_QueryInterface(doc, &IID_IHTMLDocument7, (void**)&doc7);
|
|
|
|
if(SUCCEEDED(hres)) {
|
|
|
|
is_ie9plus = TRUE;
|
|
|
|
IHTMLDocument7_Release(doc7);
|
|
|
|
}
|
|
|
|
|
|
|
|
trace("is_ie9plus %x\n", is_ie9plus);
|
|
|
|
|
|
|
|
hres = IHTMLDocument2_QueryInterface(doc, &IID_IHTMLDocument5, (void**)&doc5);
|
|
|
|
if(SUCCEEDED(hres))
|
|
|
|
IHTMLDocument5_Release(doc5);
|
|
|
|
|
|
|
|
IHTMLDocument2_Release(doc);
|
|
|
|
return SUCCEEDED(hres);
|
|
|
|
}
|
|
|
|
|
2009-09-06 19:06:38 +02:00
|
|
|
START_TEST(events)
|
|
|
|
{
|
|
|
|
CoInitialize(NULL);
|
|
|
|
|
2014-03-13 14:13:30 +01:00
|
|
|
if(check_ie()) {
|
|
|
|
container_hwnd = create_container_window();
|
2009-09-06 19:06:38 +02:00
|
|
|
|
2014-03-13 14:13:30 +01:00
|
|
|
if(winetest_interactive)
|
|
|
|
ShowWindow(container_hwnd, SW_SHOW);
|
2011-02-27 05:14:59 +01:00
|
|
|
|
2014-03-13 14:13:30 +01:00
|
|
|
run_test(empty_doc_str, test_timeout);
|
2017-09-29 19:57:30 +02:00
|
|
|
run_test(empty_doc_str, test_onclick);
|
|
|
|
run_test(empty_doc_ie9_str, test_onclick);
|
2014-03-13 14:13:30 +01:00
|
|
|
run_test(readystate_doc_str, test_onreadystatechange);
|
2017-09-29 19:57:30 +02:00
|
|
|
run_test(readystate_doc_ie9_str, test_onreadystatechange);
|
2014-03-13 14:13:30 +01:00
|
|
|
run_test(img_doc_str, test_imgload);
|
2016-06-23 15:32:56 +02:00
|
|
|
run_test(link_doc_str, test_link_load);
|
2014-03-13 14:13:30 +01:00
|
|
|
run_test(input_doc_str, test_focus);
|
2017-09-29 19:57:30 +02:00
|
|
|
run_test(empty_doc_str, test_submit);
|
|
|
|
run_test(empty_doc_ie9_str, test_submit);
|
2014-03-13 14:13:30 +01:00
|
|
|
run_test(iframe_doc_str, test_iframe_connections);
|
2017-10-11 15:16:20 +02:00
|
|
|
if(is_ie9plus)
|
|
|
|
run_test(empty_doc_ie9_str, test_create_event);
|
2014-03-13 14:13:30 +01:00
|
|
|
|
|
|
|
test_empty_document();
|
|
|
|
|
|
|
|
DestroyWindow(container_hwnd);
|
|
|
|
}else {
|
2020-05-13 10:33:54 +02:00
|
|
|
#if !defined(__i386__) && !defined(__x86_64__)
|
|
|
|
todo_wine
|
|
|
|
#endif
|
2014-03-13 14:13:30 +01:00
|
|
|
win_skip("Too old IE\n");
|
|
|
|
}
|
2009-09-06 19:06:38 +02:00
|
|
|
|
|
|
|
CoUninitialize();
|
|
|
|
}
|