Author: cwittich
Date: Sat May 29 20:04:05 2010
New Revision: 47422
URL:
http://svn.reactos.org/svn/reactos?rev=47422&view=rev
Log:
[MSHTML_WINETEST]
sync to wine 1.2 RC2
Modified:
trunk/rostests/winetests/mshtml/dom.c
trunk/rostests/winetests/mshtml/htmldoc.c
trunk/rostests/winetests/mshtml/jstest.html
trunk/rostests/winetests/mshtml/script.c
Modified: trunk/rostests/winetests/mshtml/dom.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/mshtml/dom.c?re…
==============================================================================
--- trunk/rostests/winetests/mshtml/dom.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/mshtml/dom.c [iso-8859-1] Sat May 29 20:04:05 2010
@@ -508,7 +508,7 @@
}
}
-#define test_get_dispid(u,id) _test_disp(__LINE__,u,id)
+#define test_get_dispid(u,id) _test_get_dispid(__LINE__,u,id)
static BOOL _test_get_dispid(unsigned line, IUnknown *unk, IID *iid)
{
IDispatchEx *dispex;
@@ -671,6 +671,39 @@
hres = IUnknown_QueryInterface(unk, &IID_IHTMLAnchorElement,
(void**)&anchor);
ok_(__FILE__,line) (hres == S_OK, "Could not get IHTMLAnchorElement:
%08x\n", hres);
return anchor;
+}
+
+#define get_textarea_iface(u) _get_textarea_iface(__LINE__,u)
+static IHTMLTextAreaElement *_get_textarea_iface(unsigned line, IUnknown *unk)
+{
+ IHTMLTextAreaElement *textarea;
+ HRESULT hres;
+
+ hres = IUnknown_QueryInterface(unk, &IID_IHTMLTextAreaElement,
(void**)&textarea);
+ ok_(__FILE__,line) (hres == S_OK, "Could not get IHTMLTextAreaElement:
%08x\n", hres);
+ return textarea;
+}
+
+#define get_select_iface(u) _get_select_iface(__LINE__,u)
+static IHTMLSelectElement *_get_select_iface(unsigned line, IUnknown *unk)
+{
+ IHTMLSelectElement *select;
+ HRESULT hres;
+
+ hres = IUnknown_QueryInterface(unk, &IID_IHTMLSelectElement,
(void**)&select);
+ ok_(__FILE__,line) (hres == S_OK, "Could not get IHTMLSelectElement:
%08x\n", hres);
+ return select;
+}
+
+#define get_form_iface(u) _get_form_iface(__LINE__,u)
+static IHTMLFormElement *_get_form_iface(unsigned line, IUnknown *unk)
+{
+ IHTMLFormElement *form;
+ HRESULT hres;
+
+ hres = IUnknown_QueryInterface(unk, &IID_IHTMLFormElement, (void**)&form);
+ ok_(__FILE__,line) (hres == S_OK, "Could not get IHTMLFormElement: %08x\n",
hres);
+ return form;
}
#define get_text_iface(u) _get_text_iface(__LINE__,u)
@@ -1113,6 +1146,85 @@
_test_option_value(line, option, value);
}
+#define test_option_selected(o,s) _test_option_selected(__LINE__,o,s)
+static void _test_option_selected(unsigned line, IHTMLOptionElement *option, VARIANT_BOOL
ex)
+{
+ VARIANT_BOOL b = 0x100;
+ HRESULT hres;
+
+ hres = IHTMLOptionElement_get_selected(option, &b);
+ ok_(__FILE__,line)(hres == S_OK, "get_selected failed: %08x\n", hres);
+ ok_(__FILE__,line)(b == ex, "selected = %x, expected %x\n", b, ex);
+}
+
+#define test_option_put_selected(o,s) _test_option_put_selected(__LINE__,o,s)
+static void _test_option_put_selected(unsigned line, IHTMLOptionElement *option,
VARIANT_BOOL b)
+{
+ HRESULT hres;
+
+ hres = IHTMLOptionElement_put_selected(option, b);
+ ok_(__FILE__,line)(hres == S_OK, "put_selected failed: %08x\n", hres);
+ _test_option_selected(line, option, b);
+}
+
+#define test_textarea_value(t,v) _test_textarea_value(__LINE__,t,v)
+static void _test_textarea_value(unsigned line, IUnknown *unk, const char *exval)
+{
+ IHTMLTextAreaElement *textarea = _get_textarea_iface(line, unk);
+ BSTR value = (void*)0xdeadbeef;
+ HRESULT hres;
+
+ hres = IHTMLTextAreaElement_get_value(textarea, &value);
+ IHTMLTextAreaElement_Release(textarea);
+ ok_(__FILE__,line)(hres == S_OK, "get_value failed: %08x\n", hres);
+ if(exval)
+ ok_(__FILE__,line)(!strcmp_wa(value, exval), "value = %s, expected
%s\n", wine_dbgstr_w(value), exval);
+ else
+ ok_(__FILE__,line)(!value, "value = %p\n", value);
+ SysFreeString(value);
+}
+
+#define test_textarea_put_value(t,v) _test_textarea_put_value(__LINE__,t,v)
+static void _test_textarea_put_value(unsigned line, IUnknown *unk, const char *value)
+{
+ IHTMLTextAreaElement *textarea = _get_textarea_iface(line, unk);
+ BSTR tmp = a2bstr(value);
+ HRESULT hres;
+
+ hres = IHTMLTextAreaElement_put_value(textarea, tmp);
+ IHTMLTextAreaElement_Release(textarea);
+ ok_(__FILE__,line)(hres == S_OK, "put_value failed: %08x\n", hres);
+ SysFreeString(tmp);
+
+ _test_textarea_value(line, unk, value);
+}
+
+#define test_textarea_readonly(t,v) _test_textarea_readonly(__LINE__,t,v)
+static void _test_textarea_readonly(unsigned line, IUnknown *unk, VARIANT_BOOL ex)
+{
+ IHTMLTextAreaElement *textarea = _get_textarea_iface(line, unk);
+ VARIANT_BOOL b = 0x100;
+ HRESULT hres;
+
+ hres = IHTMLTextAreaElement_get_readOnly(textarea, &b);
+ IHTMLTextAreaElement_Release(textarea);
+ ok_(__FILE__,line)(hres == S_OK, "get_readOnly failed: %08x\n", hres);
+ ok_(__FILE__,line)(b == ex, "readOnly = %x, expected %x\n", b, ex);
+}
+
+#define test_textarea_put_readonly(t,v) _test_textarea_put_readonly(__LINE__,t,v)
+static void _test_textarea_put_readonly(unsigned line, IUnknown *unk, VARIANT_BOOL b)
+{
+ IHTMLTextAreaElement *textarea = _get_textarea_iface(line, unk);
+ HRESULT hres;
+
+ hres = IHTMLTextAreaElement_put_readOnly(textarea, b);
+ IHTMLTextAreaElement_Release(textarea);
+ ok_(__FILE__,line)(hres == S_OK, "put_readOnly failed: %08x\n", hres);
+
+ _test_textarea_readonly(line, unk, b);
+}
+
#define test_comment_text(c,t) _test_comment_text(__LINE__,c,t)
static void _test_comment_text(unsigned line, IUnknown *unk, const char *extext)
{
@@ -1161,12 +1273,13 @@
_test_option_text(line, option, txt);
_test_option_value(line, option, val);
+ _test_option_selected(line, option, VARIANT_FALSE);
return option;
}
#define test_img_width(o,w) _test_img_width(__LINE__,o,w)
-static void _test_img_width(unsigned line, IHTMLImgElement *img, const long exp)
+static void _test_img_width(unsigned line, IHTMLImgElement *img, const LONG exp)
{
LONG found = -1;
HRESULT hres;
@@ -1177,7 +1290,7 @@
}
#define test_img_put_width(o,w) _test_img_put_width(__LINE__,o,w)
-static void _test_img_put_width(unsigned line, IHTMLImgElement *img, const long width)
+static void _test_img_put_width(unsigned line, IHTMLImgElement *img, const LONG width)
{
HRESULT hres;
@@ -1188,7 +1301,7 @@
}
#define test_img_height(o,h) _test_img_height(__LINE__,o,h)
-static void _test_img_height(unsigned line, IHTMLImgElement *img, const long exp)
+static void _test_img_height(unsigned line, IHTMLImgElement *img, const LONG exp)
{
LONG found = -1;
HRESULT hres;
@@ -1199,7 +1312,7 @@
}
#define test_img_put_height(o,w) _test_img_put_height(__LINE__,o,w)
-static void _test_img_put_height(unsigned line, IHTMLImgElement *img, const long height)
+static void _test_img_put_height(unsigned line, IHTMLImgElement *img, const LONG height)
{
HRESULT hres;
@@ -1273,6 +1386,18 @@
hres = IHTMLSelectElement_get_length(select, &len);
ok_(__FILE__,line) (hres == S_OK, "get_length failed: %08x\n", hres);
ok_(__FILE__,line) (len == length, "len=%d, expected %d\n", len, length);
+}
+
+#define test_select_put_length(s,l) _test_select_put_length(__LINE__,s,l)
+static void _test_select_put_length(unsigned line, IUnknown *unk, LONG length)
+{
+ IHTMLSelectElement *select = _get_select_iface(line, unk);
+ HRESULT hres;
+
+ hres = IHTMLSelectElement_put_length(select, length);
+ ok_(__FILE__,line) (hres == S_OK, "put_length failed: %08x\n", hres);
+ _test_select_length(line, select, length);
+ IHTMLSelectElement_Release(select);
}
#define test_select_selidx(s,i) _test_select_selidx(__LINE__,s,i)
@@ -1995,9 +2120,49 @@
hres = IHTMLImgElement_get_name(img, &sName);
ok_(__FILE__,line) (hres == S_OK, "get_Name failed: %08x\n", hres);
ok_(__FILE__,line) (!strcmp_wa (sName, pValue), "expected '%s' got
'%s'\n", pValue, wine_dbgstr_w(sName));
+ IHTMLImgElement_Release(img);
SysFreeString(sName);
}
+#define test_input_type(i,t) _test_input_type(__LINE__,i,t)
+static void _test_input_type(unsigned line, IHTMLInputElement *input, const char
*extype)
+{
+ BSTR type;
+ HRESULT hres;
+
+ hres = IHTMLInputElement_get_type(input, &type);
+ ok_(__FILE__,line) (hres == S_OK, "get_type failed: %08x\n", hres);
+ ok_(__FILE__,line) (!strcmp_wa(type, extype), "type=%s, expected %s\n",
wine_dbgstr_w(type), extype);
+ SysFreeString(type);
+}
+
+#define test_input_name(u, c) _test_input_name(__LINE__,u, c)
+static void _test_input_name(unsigned line, IHTMLInputElement *input, const char
*exname)
+{
+ BSTR name = (BSTR)0xdeadbeef;
+ HRESULT hres;
+
+ hres = IHTMLInputElement_get_name(input, &name);
+ ok_(__FILE__,line) (hres == S_OK, "get_name failed: %08x\n", hres);
+ if(exname)
+ ok_(__FILE__,line) (!strcmp_wa (name, exname), "name=%s, expected
%s\n", wine_dbgstr_w(name), exname);
+ else
+ ok_(__FILE__,line) (!name, "name=%p, expected NULL\n", name);
+ SysFreeString(name);
+}
+
+#define test_input_set_name(u, c) _test_input_set_name(__LINE__,u, c)
+static void _test_input_set_name(unsigned line, IHTMLInputElement *input, const char
*name)
+{
+ BSTR tmp = a2bstr(name);
+ HRESULT hres;
+
+ hres = IHTMLInputElement_put_name(input, tmp);
+ ok_(__FILE__,line) (hres == S_OK, "put_name failed: %08x\n", hres);
+ SysFreeString(tmp);
+
+ _test_input_name(line, input, name);
+}
#define test_input_get_disabled(i,b) _test_input_get_disabled(__LINE__,i,b)
static void _test_input_get_disabled(unsigned line, IHTMLInputElement *input,
VARIANT_BOOL exb)
@@ -2364,6 +2529,52 @@
ok_(__FILE__,line) (!l, "clientTop = %d\n", l);
IHTMLElement2_Release(elem);
+}
+
+#define test_form_length(e,l) _test_form_length(__LINE__,e,l)
+static void _test_form_length(unsigned line, IUnknown *unk, LONG exlen)
+{
+ IHTMLFormElement *form = _get_form_iface(line, unk);
+ LONG len = 0xdeadbeef;
+ HRESULT hres;
+
+ hres = IHTMLFormElement_get_length(form, &len);
+ ok_(__FILE__,line)(hres == S_OK, "get_length failed: %08x\n", hres);
+ ok_(__FILE__,line)(len == exlen, "length=%d, expected %d\n", len, exlen);
+
+ IHTMLFormElement_Release(form);
+}
+
+#define test_form_action(f,a) _test_form_action(__LINE__,f,a)
+static void _test_form_action(unsigned line, IUnknown *unk, const char *ex)
+{
+ IHTMLFormElement *form = _get_form_iface(line, unk);
+ BSTR action = (void*)0xdeadbeef;
+ HRESULT hres;
+
+ hres = IHTMLFormElement_get_action(form, &action);
+ ok_(__FILE__,line)(hres == S_OK, "get_action failed: %08x\n", hres);
+ if(ex)
+ ok_(__FILE__,line)(!strcmp_wa(action, ex), "action=%s, expected %s\n",
wine_dbgstr_w(action), ex);
+ else
+ ok_(__FILE__,line)(!action, "action=%p\n", action);
+
+ IHTMLFormElement_Release(form);
+}
+
+#define test_form_put_action(f,a) _test_form_put_action(__LINE__,f,a)
+static void _test_form_put_action(unsigned line, IUnknown *unk, const char *action)
+{
+ IHTMLFormElement *form = _get_form_iface(line, unk);
+ BSTR tmp = a2bstr(action);
+ HRESULT hres;
+
+ hres = IHTMLFormElement_put_action(form, tmp);
+ ok_(__FILE__,line)(hres == S_OK, "put_action failed: %08x\n", hres);
+ SysFreeString(tmp);
+ IHTMLFormElement_Release(form);
+
+ _test_form_action(line, unk, action);
}
#define get_elem_doc(e) _get_elem_doc(__LINE__,e)
@@ -2753,6 +2964,10 @@
static void test_select_elem(IHTMLSelectElement *select)
{
+ IDispatch *disp, *disp2;
+ VARIANT name, index;
+ HRESULT hres;
+
test_select_type(select, "select-one");
test_select_length(select, 2);
test_select_selidx(select, 0);
@@ -2764,6 +2979,89 @@
test_select_get_disabled(select, VARIANT_FALSE);
test_select_set_disabled(select, VARIANT_TRUE);
test_select_set_disabled(select, VARIANT_FALSE);
+
+ disp = NULL;
+ hres = IHTMLSelectElement_get_options(select, &disp);
+ ok(hres == S_OK, "get_options failed: %08x\n", hres);
+ ok(disp != NULL, "options == NULL\n");
+ ok(iface_cmp((IUnknown*)disp, (IUnknown*)select), "disp != select\n");
+ IDispatch_Release(disp);
+
+ V_VT(&index) = VT_EMPTY;
+ V_VT(&name) = VT_I4;
+ V_I4(&name) = -1;
+ disp = (void*)0xdeadbeef;
+ hres = IHTMLSelectElement_item(select, name, index, &disp);
+ ok(hres == E_INVALIDARG, "item failed: %08x, expected E_INVALIDARG\n",
hres);
+ ok(!disp, "disp = %p\n", disp);
+
+ V_I4(&name) = 2;
+ disp = (void*)0xdeadbeef;
+ hres = IHTMLSelectElement_item(select, name, index, &disp);
+ ok(hres == S_OK, "item failed: %08x\n", hres);
+ ok(!disp, "disp = %p\n", disp);
+
+ V_I4(&name) = 1;
+ hres = IHTMLSelectElement_item(select, name, index, NULL);
+ ok(hres == E_POINTER || broken(hres == E_INVALIDARG), "item failed: %08x,
expected E_POINTER\n", hres);
+
+ disp = NULL;
+ hres = IHTMLSelectElement_item(select, name, index, &disp);
+ ok(hres == S_OK, "item failed: %08x\n", hres);
+ ok(disp != NULL, "disp = NULL\n");
+ test_disp((IUnknown*)disp, &DIID_DispHTMLOptionElement, NULL);
+
+ V_VT(&index) = VT_I4;
+ V_I4(&index) = 1;
+ disp2 = NULL;
+ hres = IHTMLSelectElement_item(select, name, index, &disp2);
+ ok(hres == S_OK, "item failed: %08x\n", hres);
+ ok(disp2 != NULL, "disp = NULL\n");
+ ok(iface_cmp((IUnknown*)disp, (IUnknown*)disp2), "disp != disp2\n");
+ IDispatch_Release(disp2);
+ IDispatch_Release(disp);
+}
+
+static void test_form_item(IHTMLElement *elem)
+{
+ IHTMLFormElement *form = get_form_iface((IUnknown*)elem);
+ IDispatch *disp, *disp2;
+ VARIANT name, index;
+ HRESULT hres;
+
+ V_VT(&index) = VT_EMPTY;
+ V_VT(&name) = VT_I4;
+ V_I4(&name) = -1;
+ disp = (void*)0xdeadbeef;
+ hres = IHTMLFormElement_item(form, name, index, &disp);
+ ok(hres == E_INVALIDARG, "item failed: %08x, expected E_INVALIDARG\n",
hres);
+ ok(!disp, "disp = %p\n", disp);
+
+ V_I4(&name) = 2;
+ disp = (void*)0xdeadbeef;
+ hres = IHTMLFormElement_item(form, name, index, &disp);
+ ok(hres == S_OK, "item failed: %08x\n", hres);
+ ok(!disp, "disp = %p\n", disp);
+
+ V_I4(&name) = 1;
+ hres = IHTMLFormElement_item(form, name, index, NULL);
+ ok(hres == E_INVALIDARG, "item failed: %08x, expected E_INVALIDARG\n",
hres);
+
+ disp = NULL;
+ hres = IHTMLFormElement_item(form, name, index, &disp);
+ ok(hres == S_OK, "item failed: %08x\n", hres);
+ ok(disp != NULL, "disp = NULL\n");
+ test_disp((IUnknown*)disp, &DIID_DispHTMLInputElement, NULL);
+
+ V_VT(&index) = VT_I4;
+ V_I4(&index) = 1;
+ disp2 = NULL;
+ hres = IHTMLFormElement_item(form, name, index, &disp2);
+ ok(hres == S_OK, "item failed: %08x\n", hres);
+ ok(disp2 != NULL, "disp = NULL\n");
+ ok(iface_cmp((IUnknown*)disp, (IUnknown*)disp2), "disp != disp2\n");
+ IDispatch_Release(disp2);
+ IDispatch_Release(disp);
}
static void test_create_option_elem(IHTMLDocument2 *doc)
@@ -2774,6 +3072,8 @@
test_option_put_text(option, "new text");
test_option_put_value(option, "new value");
+ test_option_put_selected(option, VARIANT_TRUE);
+ test_option_put_selected(option, VARIANT_FALSE);
IHTMLOptionElement_Release(option);
}
@@ -3142,7 +3442,7 @@
hres = IOmNavigator_get_platform(navigator, &bstr);
ok(hres == S_OK, "get_platform failed: %08x\n", hres);
#ifdef _WIN64
- ok(!strcmp_wa(bstr, "Win64"), "unexpected platform %s\n",
wine_dbgstr_w(bstr));
+ ok(!strcmp_wa(bstr, "Win64") || broken(!strcmp_wa(bstr, "Win32")
/* IE6 */), "unexpected platform %s\n", wine_dbgstr_w(bstr));
#else
ok(!strcmp_wa(bstr, "Win32"), "unexpected platform %s\n",
wine_dbgstr_w(bstr));
#endif
@@ -5553,11 +5853,8 @@
elem = get_elem_by_id(doc, "s", TRUE);
if(elem) {
- IHTMLSelectElement *select;
+ IHTMLSelectElement *select = get_select_iface((IUnknown*)elem);
IHTMLDocument2 *doc_node, *elem_doc;
-
- hres = IHTMLElement_QueryInterface(elem, &IID_IHTMLSelectElement,
(void**)&select);
- ok(hres == S_OK, "Could not get IHTMLSelectElement interface: %08x\n",
hres);
test_select_elem(select);
@@ -5646,6 +5943,7 @@
test_elem3_set_disabled((IUnknown*)input, VARIANT_FALSE);
test_input_get_disabled(input, VARIANT_FALSE);
test_elem_client_size((IUnknown*)elem);
+ test_input_type(input, "text");
test_node_get_value_str((IUnknown*)elem, NULL);
test_node_put_value_str((IUnknown*)elem, "test");
@@ -5666,6 +5964,9 @@
test_input_set_checked(input, VARIANT_TRUE);
test_input_set_checked(input, VARIANT_FALSE);
+ test_input_name(input, NULL);
+ test_input_set_name(input, "test");
+
test_input_src(input, NULL);
test_input_set_src(input, "about:blank");
@@ -5787,6 +6088,13 @@
test_elem3_set_disabled((IUnknown*)elem, VARIANT_FALSE);
IHTMLElement_Release(elem);
+
+ elem = get_doc_elem_by_id(doc, "frm");
+ ok(elem != NULL, "elem == NULL\n");
+ if(elem) {
+ test_form_length((IUnknown*)elem, 0);
+ IHTMLElement_Release(elem);
+ }
test_stylesheets(doc);
test_create_option_elem(doc);
@@ -5854,6 +6162,17 @@
IHTMLDocument3_Release(doc3);
+ elem = get_elem_by_id(doc, "s", TRUE);
+ if(elem) {
+ static const elem_type_t select_types[] = { ET_OPTION, ET_OPTION, ET_OPTION };
+
+ test_select_put_length((IUnknown*)elem, 3);
+ test_elem_all((IUnknown*)elem, select_types,
sizeof(select_types)/sizeof(*select_types));
+ test_select_put_length((IUnknown*)elem, 1);
+ test_elem_all((IUnknown*)elem, select_types, 1);
+ IHTMLElement_Release(elem);
+ }
+
window = get_doc_window(doc);
test_window_name(window, NULL);
set_window_name(window, "test name");
@@ -5863,29 +6182,51 @@
static void test_elems2(IHTMLDocument2 *doc)
{
- IHTMLElement *elem, *elem2;
+ IHTMLElement *elem, *elem2, *div;
static const elem_type_t outer_types[] = {
ET_BR,
ET_A
};
- elem = get_doc_elem_by_id(doc, "divid");
-
- test_elem_set_innerhtml((IUnknown*)elem, "<div
id=\"innerid\"></div>");
+ div = get_doc_elem_by_id(doc, "divid");
+
+ test_elem_set_innerhtml((IUnknown*)div, "<div
id=\"innerid\"></div>");
elem2 = get_doc_elem_by_id(doc, "innerid");
ok(elem2 != NULL, "elem2 == NULL\n");
test_elem_set_outerhtml((IUnknown*)elem2, "<br><a
href=\"about:blank\" id=\"aid\">a</a>");
- test_elem_all((IUnknown*)elem, outer_types,
sizeof(outer_types)/sizeof(*outer_types));
+ test_elem_all((IUnknown*)div, outer_types,
sizeof(outer_types)/sizeof(*outer_types));
IHTMLElement_Release(elem2);
elem2 = get_doc_elem_by_id(doc, "aid");
ok(elem2 != NULL, "elem2 == NULL\n");
test_elem_set_outerhtml((IUnknown*)elem2, "");
- test_elem_all((IUnknown*)elem, outer_types, 1);
+ test_elem_all((IUnknown*)div, outer_types, 1);
IHTMLElement_Release(elem2);
- IHTMLElement_Release(elem);
+ test_elem_set_innerhtml((IUnknown*)div, "<textarea
id=\"ta\"></textarea>");
+ elem = get_elem_by_id(doc, "ta", TRUE);
+ if(elem) {
+ test_textarea_value((IUnknown*)elem, NULL);
+ test_textarea_put_value((IUnknown*)elem, "test");
+ test_textarea_readonly((IUnknown*)elem, VARIANT_FALSE);
+ test_textarea_put_readonly((IUnknown*)elem, VARIANT_TRUE);
+ test_textarea_put_readonly((IUnknown*)elem, VARIANT_FALSE);
+ IHTMLElement_Release(elem);
+ }
+
+ test_elem_set_innerhtml((IUnknown*)div,
+ "<form id=\"form\"><input
type=\"button\"></input><input
type=\"text\"></input></textarea>");
+ elem = get_elem_by_id(doc, "form", TRUE);
+ if(elem) {
+ test_form_length((IUnknown*)elem, 2);
+ test_form_item(elem);
+ test_form_action((IUnknown*)elem, NULL);
+ test_form_put_action((IUnknown*)elem, "about:blank");
+ IHTMLElement_Release(elem);
+ }
+
+ IHTMLElement_Release(div);
}
static void test_create_elems(IHTMLDocument2 *doc)
Modified: trunk/rostests/winetests/mshtml/htmldoc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/mshtml/htmldoc.…
==============================================================================
--- trunk/rostests/winetests/mshtml/htmldoc.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/mshtml/htmldoc.c [iso-8859-1] Sat May 29 20:04:05 2010
@@ -3405,6 +3405,14 @@
test_download(DWL_VERBDONE);
}
+static void test_clear(IHTMLDocument2 *doc)
+{
+ HRESULT hres;
+
+ hres = IHTMLDocument2_clear(doc);
+ ok(hres == S_OK, "clear failed: %08x\n", hres);
+}
+
static const OLECMDF expect_cmds[OLECMDID_GETPRINTTEMPLATE+1] = {
0,
OLECMDF_SUPPORTED, /* OLECMDID_OPEN */
@@ -4566,6 +4574,8 @@
test_Close(doc, FALSE);
test_IsDirty(doc, S_FALSE);
test_GetCurMoniker((IUnknown*)doc, &Moniker, NULL);
+ test_clear(doc);
+ test_GetCurMoniker((IUnknown*)doc, &Moniker, NULL);
if(view)
IOleDocumentView_Release(view);
Modified: trunk/rostests/winetests/mshtml/jstest.html
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/mshtml/jstest.h…
==============================================================================
--- trunk/rostests/winetests/mshtml/jstest.html [iso-8859-1] (original)
+++ trunk/rostests/winetests/mshtml/jstest.html [iso-8859-1] Sat May 29 20:04:05 2010
@@ -20,6 +20,17 @@
}
+function test_select_index() {
+ var s = document.getElementById("sel");
+
+ ok("0" in s, "'0' is not in s");
+ ok(s[0].text === "opt1", "s[0].text = " + s[0].text);
+ ok("1" in s, "'1 is not in s");
+ ok(s[1].text === "opt2", "s[1].text = " + s[1].text);
+ ok("2" in s, "'2' is in s");
+ ok(s[2] === null, "s[2] = " + s[2]);
+}
+
function runTest() {
obj = new Object();
ok(obj === window.obj, "obj !== window.obj");
@@ -28,11 +39,16 @@
test_removeAttribute(document.getElementById("divid"));
test_removeAttribute(document.body);
+ test_select_index();
external.reportSuccess();
}
</script>
<body onload="runTest();">
<div id="divid"></div>
+<select id="sel">
+<option>opt1</option>
+<option>opt2</option>
+</select>
</body>
</html>
Modified: trunk/rostests/winetests/mshtml/script.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/mshtml/script.c…
==============================================================================
--- trunk/rostests/winetests/mshtml/script.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/mshtml/script.c [iso-8859-1] Sat May 29 20:04:05 2010
@@ -123,7 +123,8 @@
DEFINE_EXPECT(AXQueryInterface_IActiveScript);
DEFINE_EXPECT(AXQueryInterface_IObjectSafety);
DEFINE_EXPECT(AXGetInterfaceSafetyOptions);
-DEFINE_EXPECT(AXSetInterfaceSafetyOptions);
+DEFINE_EXPECT(AXSetInterfaceSafetyOptions_IDispatch);
+DEFINE_EXPECT(AXSetInterfaceSafetyOptions_IDispatchEx);
DEFINE_EXPECT(external_success);
#define TESTSCRIPT_CLSID "{178fc163-f585-4e24-9c13-4bb7faf80746}"
@@ -148,6 +149,8 @@
static IDispatch *script_disp;
static BOOL ax_objsafe;
static HWND container_hwnd;
+static HRESULT ax_getopt_hres = S_OK, ax_setopt_dispex_hres = S_OK, ax_setopt_disp_hres =
S_OK;
+static DWORD ax_setopt;
static const char *debugstr_guid(REFIID riid)
{
@@ -1265,25 +1268,35 @@
ok(pdwSupportedOptions != NULL, "pdwSupportedOptions == NULL\n");
ok(pdwEnabledOptions != NULL, "pdwEnabledOptions == NULL\n");
- *pdwSupportedOptions =
INTERFACESAFE_FOR_UNTRUSTED_DATA|INTERFACE_USES_DISPEX|INTERFACE_USES_SECURITY_MANAGER;
- *pdwEnabledOptions = INTERFACE_USES_DISPEX;
-
- return S_OK;
+ if(SUCCEEDED(ax_getopt_hres)) {
+ *pdwSupportedOptions =
INTERFACESAFE_FOR_UNTRUSTED_DATA|INTERFACE_USES_DISPEX|INTERFACE_USES_SECURITY_MANAGER;
+ *pdwEnabledOptions = INTERFACE_USES_DISPEX;
+ }
+
+ return ax_getopt_hres;
}
static HRESULT WINAPI AXObjectSafety_SetInterfaceSafetyOptions(IObjectSafety *iface,
REFIID riid,
DWORD dwOptionSetMask, DWORD dwEnabledOptions)
{
- CHECK_EXPECT(AXSetInterfaceSafetyOptions);
-
- ok(IsEqualGUID(&IID_IDispatchEx, riid), "unexpected riid %s\n",
debugstr_guid(riid));
-
- ok(dwOptionSetMask ==
(INTERFACESAFE_FOR_UNTRUSTED_CALLER|INTERFACE_USES_SECURITY_MANAGER),
- "dwOptionSetMask=%x\n", dwOptionSetMask);
- ok(dwEnabledOptions ==
(INTERFACESAFE_FOR_UNTRUSTED_CALLER|INTERFACE_USES_SECURITY_MANAGER),
- "dwEnabledOptions=%x\n", dwOptionSetMask);
-
- return S_OK;
+ if(IsEqualGUID(&IID_IDispatchEx, riid)) {
+ CHECK_EXPECT(AXSetInterfaceSafetyOptions_IDispatchEx);
+ ok(dwOptionSetMask == ax_setopt, "dwOptionSetMask=%x, expected %x\n",
dwOptionSetMask, ax_setopt);
+ ok(dwEnabledOptions == ax_setopt, "dwEnabledOptions=%x, expected %x\n",
dwOptionSetMask, ax_setopt);
+ return ax_setopt_dispex_hres;
+ }
+
+ if(IsEqualGUID(&IID_IDispatch, riid)) {
+ DWORD exopt = ax_setopt & ~INTERFACE_USES_SECURITY_MANAGER;
+
+ CHECK_EXPECT(AXSetInterfaceSafetyOptions_IDispatch);
+ ok(dwOptionSetMask == exopt, "dwOptionSetMask=%x, expected %x\n",
dwOptionSetMask, exopt);
+ ok(dwEnabledOptions == exopt, "dwEnabledOptions=%x, expected %x\n",
dwOptionSetMask, exopt);
+ return ax_setopt_disp_hres;
+ }
+
+ ok(0, "unexpected riid %s\n", debugstr_guid(riid));
+ return E_NOINTERFACE;
}
static const IObjectSafetyVtbl AXObjectSafetyVtbl = {
@@ -1311,6 +1324,8 @@
BYTE *ppolicy;
HRESULT hres;
+ ax_setopt = INTERFACESAFE_FOR_UNTRUSTED_CALLER|INTERFACE_USES_SECURITY_MANAGER;
+
hres = IActiveScriptSite_QueryInterface(site, &IID_IServiceProvider,
(void**)&sp);
ok(hres == S_OK, "Could not get IServiceProvider iface: %08x\n", hres);
@@ -1332,13 +1347,13 @@
SET_EXPECT(AXQueryInterface_IActiveScript);
SET_EXPECT(AXQueryInterface_IObjectSafety);
SET_EXPECT(AXGetInterfaceSafetyOptions);
- SET_EXPECT(AXSetInterfaceSafetyOptions);
+ SET_EXPECT(AXSetInterfaceSafetyOptions_IDispatchEx);
hres = IInternetHostSecurityManager_QueryCustomPolicy(sec_mgr,
&GUID_CUSTOM_CONFIRMOBJECTSAFETY,
&ppolicy, &policy_size, (BYTE*)&cs, sizeof(cs), 0);
CHECK_CALLED(AXQueryInterface_IActiveScript);
CHECK_CALLED(AXQueryInterface_IObjectSafety);
CHECK_CALLED(AXGetInterfaceSafetyOptions);
- CHECK_CALLED(AXSetInterfaceSafetyOptions);
+ CHECK_CALLED(AXSetInterfaceSafetyOptions_IDispatchEx);
ok(hres == S_OK, "QueryCusromPolicy failed: %08x\n", hres);
ok(policy_size == sizeof(DWORD), "policy_size = %d\n", policy_size);
@@ -1376,13 +1391,13 @@
SET_EXPECT(AXQueryInterface_IActiveScript);
SET_EXPECT(AXQueryInterface_IObjectSafety);
SET_EXPECT(AXGetInterfaceSafetyOptions);
- SET_EXPECT(AXSetInterfaceSafetyOptions);
+ SET_EXPECT(AXSetInterfaceSafetyOptions_IDispatchEx);
hres = IInternetHostSecurityManager_QueryCustomPolicy(sec_mgr,
&GUID_CUSTOM_CONFIRMOBJECTSAFETY,
&ppolicy, &policy_size, (BYTE*)&cs, sizeof(cs), 0);
CHECK_CALLED(AXQueryInterface_IActiveScript);
CHECK_CALLED(AXQueryInterface_IObjectSafety);
CHECK_CALLED(AXGetInterfaceSafetyOptions);
- CHECK_CALLED(AXSetInterfaceSafetyOptions);
+ CHECK_CALLED(AXSetInterfaceSafetyOptions_IDispatchEx);
ok(hres == S_OK, "QueryCusromPolicy failed: %08x\n", hres);
ok(policy_size == sizeof(DWORD), "policy_size = %d\n", policy_size);
@@ -1393,6 +1408,69 @@
}else {
skip("Could not set safety registry\n");
}
+
+ ax_objsafe = TRUE;
+
+ ax_setopt_dispex_hres = E_NOINTERFACE;
+ SET_EXPECT(AXQueryInterface_IActiveScript);
+ SET_EXPECT(AXQueryInterface_IObjectSafety);
+ SET_EXPECT(AXGetInterfaceSafetyOptions);
+ SET_EXPECT(AXSetInterfaceSafetyOptions_IDispatchEx);
+ SET_EXPECT(AXSetInterfaceSafetyOptions_IDispatch);
+ hres = IInternetHostSecurityManager_QueryCustomPolicy(sec_mgr,
&GUID_CUSTOM_CONFIRMOBJECTSAFETY,
+ &ppolicy, &policy_size, (BYTE*)&cs, sizeof(cs), 0);
+ CHECK_CALLED(AXQueryInterface_IActiveScript);
+ CHECK_CALLED(AXQueryInterface_IObjectSafety);
+ CHECK_CALLED(AXGetInterfaceSafetyOptions);
+ CHECK_CALLED(AXSetInterfaceSafetyOptions_IDispatchEx);
+ CHECK_CALLED(AXSetInterfaceSafetyOptions_IDispatch);
+
+ ok(hres == S_OK, "QueryCusromPolicy failed: %08x\n", hres);
+ ok(policy_size == sizeof(DWORD), "policy_size = %d\n", policy_size);
+ ok(*(DWORD*)ppolicy == URLPOLICY_ALLOW, "policy = %x\n",
*(DWORD*)ppolicy);
+ CoTaskMemFree(ppolicy);
+
+ ax_setopt_dispex_hres = E_FAIL;
+ ax_setopt_disp_hres = E_NOINTERFACE;
+ SET_EXPECT(AXQueryInterface_IActiveScript);
+ SET_EXPECT(AXQueryInterface_IObjectSafety);
+ SET_EXPECT(AXGetInterfaceSafetyOptions);
+ SET_EXPECT(AXSetInterfaceSafetyOptions_IDispatchEx);
+ SET_EXPECT(AXSetInterfaceSafetyOptions_IDispatch);
+ hres = IInternetHostSecurityManager_QueryCustomPolicy(sec_mgr,
&GUID_CUSTOM_CONFIRMOBJECTSAFETY,
+ &ppolicy, &policy_size, (BYTE*)&cs, sizeof(cs), 0);
+ CHECK_CALLED(AXQueryInterface_IActiveScript);
+ CHECK_CALLED(AXQueryInterface_IObjectSafety);
+ CHECK_CALLED(AXGetInterfaceSafetyOptions);
+ CHECK_CALLED(AXSetInterfaceSafetyOptions_IDispatchEx);
+ CHECK_CALLED(AXSetInterfaceSafetyOptions_IDispatch);
+
+ ok(hres == S_OK, "QueryCusromPolicy failed: %08x\n", hres);
+ ok(policy_size == sizeof(DWORD), "policy_size = %d\n", policy_size);
+ ok(*(DWORD*)ppolicy == URLPOLICY_DISALLOW, "policy = %x\n",
*(DWORD*)ppolicy);
+ CoTaskMemFree(ppolicy);
+
+ ax_setopt_dispex_hres = E_FAIL;
+ ax_setopt_disp_hres = S_OK;
+ ax_getopt_hres = E_NOINTERFACE;
+ ax_setopt = INTERFACESAFE_FOR_UNTRUSTED_CALLER;
+ SET_EXPECT(AXQueryInterface_IActiveScript);
+ SET_EXPECT(AXQueryInterface_IObjectSafety);
+ SET_EXPECT(AXGetInterfaceSafetyOptions);
+ SET_EXPECT(AXSetInterfaceSafetyOptions_IDispatchEx);
+ SET_EXPECT(AXSetInterfaceSafetyOptions_IDispatch);
+ hres = IInternetHostSecurityManager_QueryCustomPolicy(sec_mgr,
&GUID_CUSTOM_CONFIRMOBJECTSAFETY,
+ &ppolicy, &policy_size, (BYTE*)&cs, sizeof(cs), 0);
+ CHECK_CALLED(AXQueryInterface_IActiveScript);
+ CHECK_CALLED(AXQueryInterface_IObjectSafety);
+ CHECK_CALLED(AXGetInterfaceSafetyOptions);
+ CHECK_CALLED(AXSetInterfaceSafetyOptions_IDispatchEx);
+ CHECK_CALLED(AXSetInterfaceSafetyOptions_IDispatch);
+
+ ok(hres == S_OK, "QueryCusromPolicy failed: %08x\n", hres);
+ ok(policy_size == sizeof(DWORD), "policy_size = %d\n", policy_size);
+ ok(*(DWORD*)ppolicy == URLPOLICY_ALLOW, "policy = %x\n",
*(DWORD*)ppolicy);
+ CoTaskMemFree(ppolicy);
IInternetHostSecurityManager_Release(sec_mgr);
}
@@ -1995,6 +2073,8 @@
}
hres = IActiveScriptSite_OnStateChange(site, (state = ss));
+ ok(hres == S_OK, "OnStateChange failed: %08x\n", hres);
+
return S_OK;
}