mshtml: Added IHTMLFormElement_{get/put}_method implementation.
This commit is contained in:
parent
02277b4853
commit
bd94cc3b86
|
@ -202,16 +202,50 @@ static HRESULT WINAPI HTMLFormElement_get_encoding(IHTMLFormElement *iface, BSTR
|
|||
|
||||
static HRESULT WINAPI HTMLFormElement_put_method(IHTMLFormElement *iface, BSTR v)
|
||||
{
|
||||
static const WCHAR postW[] = {'P','O','S','T',0};
|
||||
static const WCHAR getW[] = {'G','E','T',0};
|
||||
|
||||
HTMLFormElement *This = HTMLFORM_THIS(iface);
|
||||
FIXME("(%p)->(%s)\n", This, wine_dbgstr_w(v));
|
||||
return E_NOTIMPL;
|
||||
nsAString method_str;
|
||||
nsresult nsres;
|
||||
|
||||
TRACE("(%p)->(%s)\n", This, wine_dbgstr_w(v));
|
||||
|
||||
if(lstrcmpiW(v, postW) && lstrcmpiW(v, getW)) {
|
||||
WARN("unrecognized method\n");
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
nsAString_InitDepend(&method_str, v);
|
||||
nsres = nsIDOMHTMLFormElement_SetMethod(This->nsform, &method_str);
|
||||
nsAString_Finish(&method_str);
|
||||
if(NS_FAILED(nsres))
|
||||
return E_FAIL;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLFormElement_get_method(IHTMLFormElement *iface, BSTR *p)
|
||||
{
|
||||
HTMLFormElement *This = HTMLFORM_THIS(iface);
|
||||
FIXME("(%p)->(%p)\n", This, p);
|
||||
return E_NOTIMPL;
|
||||
nsAString method_str;
|
||||
nsresult nsres;
|
||||
|
||||
TRACE("(%p)->(%p)\n", This, p);
|
||||
|
||||
nsAString_Init(&method_str, NULL);
|
||||
nsres = nsIDOMHTMLFormElement_GetMethod(This->nsform, &method_str);
|
||||
if(NS_SUCCEEDED(nsres)) {
|
||||
const PRUnichar *method;
|
||||
nsAString_GetData(&method_str, &method);
|
||||
|
||||
*p = SysAllocString(method);
|
||||
if(!*p)
|
||||
return E_OUTOFMEMORY;
|
||||
}else
|
||||
return E_FAIL;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLFormElement_get_elements(IHTMLFormElement *iface, IDispatch **p)
|
||||
|
|
|
@ -2595,6 +2595,40 @@ static void _test_form_put_action(unsigned line, IUnknown *unk, const char *acti
|
|||
_test_form_action(line, unk, action);
|
||||
}
|
||||
|
||||
#define test_form_method(f,a) _test_form_method(__LINE__,f,a)
|
||||
static void _test_form_method(unsigned line, IUnknown *unk, const char *ex)
|
||||
{
|
||||
IHTMLFormElement *form = _get_form_iface(line, unk);
|
||||
BSTR method = (void*)0xdeadbeef;
|
||||
HRESULT hres;
|
||||
|
||||
hres = IHTMLFormElement_get_method(form, &method);
|
||||
ok_(__FILE__,line)(hres == S_OK, "get_method failed: %08x\n", hres);
|
||||
if(ex)
|
||||
ok_(__FILE__,line)(!strcmp_wa(method, ex), "method=%s, expected %s\n", wine_dbgstr_w(method), ex);
|
||||
else
|
||||
ok_(__FILE__,line)(!method, "method=%p\n", method);
|
||||
|
||||
SysFreeString(method);
|
||||
IHTMLFormElement_Release(form);
|
||||
}
|
||||
|
||||
#define test_form_put_method(f,r,a) _test_form_put_method(__LINE__,f,r,a)
|
||||
static void _test_form_put_method(unsigned line, IUnknown *unk, HRESULT exp_hres, const char *method)
|
||||
{
|
||||
IHTMLFormElement *form = _get_form_iface(line, unk);
|
||||
BSTR tmp = a2bstr(method);
|
||||
HRESULT hres;
|
||||
|
||||
hres = IHTMLFormElement_put_method(form, tmp);
|
||||
ok_(__FILE__,line)(hres == exp_hres, "put_method returned: %08x, expected %08x\n", hres, exp_hres);
|
||||
SysFreeString(tmp);
|
||||
IHTMLFormElement_Release(form);
|
||||
|
||||
if(exp_hres == S_OK)
|
||||
_test_form_method(line, unk, method);
|
||||
}
|
||||
|
||||
#define get_elem_doc(e) _get_elem_doc(__LINE__,e)
|
||||
static IHTMLDocument2 *_get_elem_doc(unsigned line, IUnknown *unk)
|
||||
{
|
||||
|
@ -6290,6 +6324,10 @@ static void test_elems2(IHTMLDocument2 *doc)
|
|||
test_form_item(elem);
|
||||
test_form_action((IUnknown*)elem, NULL);
|
||||
test_form_put_action((IUnknown*)elem, "about:blank");
|
||||
test_form_method((IUnknown*)elem, "get");
|
||||
test_form_put_method((IUnknown*)elem, S_OK, "post");
|
||||
test_form_put_method((IUnknown*)elem, E_INVALIDARG, "put");
|
||||
test_form_method((IUnknown*)elem, "post");
|
||||
IHTMLElement_Release(elem);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue