mshtml: Added IHTMLFormElement::action property implementation.
This commit is contained in:
parent
5bb9172af2
commit
d9427e3922
|
@ -133,15 +133,43 @@ static HRESULT WINAPI HTMLFormElement_Invoke(IHTMLFormElement *iface, DISPID dis
|
|||
static HRESULT WINAPI HTMLFormElement_put_action(IHTMLFormElement *iface, BSTR v)
|
||||
{
|
||||
HTMLFormElement *This = HTMLFORM_THIS(iface);
|
||||
FIXME("(%p)->(%s)\n", This, wine_dbgstr_w(v));
|
||||
return E_NOTIMPL;
|
||||
nsAString action_str;
|
||||
nsresult nsres;
|
||||
|
||||
TRACE("(%p)->(%s)\n", This, wine_dbgstr_w(v));
|
||||
|
||||
nsAString_InitDepend(&action_str, v);
|
||||
nsres = nsIDOMHTMLFormElement_SetAction(This->nsform, &action_str);
|
||||
nsAString_Finish(&action_str);
|
||||
if(NS_FAILED(nsres)) {
|
||||
ERR("SetAction failed: %08x\n", nsres);
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLFormElement_get_action(IHTMLFormElement *iface, BSTR *p)
|
||||
{
|
||||
HTMLFormElement *This = HTMLFORM_THIS(iface);
|
||||
FIXME("(%p)->(%p)\n", This, p);
|
||||
return E_NOTIMPL;
|
||||
nsAString action_str;
|
||||
nsresult nsres;
|
||||
HRESULT hres;
|
||||
|
||||
TRACE("(%p)->(%p)\n", This, p);
|
||||
|
||||
nsAString_Init(&action_str, NULL);
|
||||
nsres = nsIDOMHTMLFormElement_GetAction(This->nsform, &action_str);
|
||||
if(NS_SUCCEEDED(nsres)) {
|
||||
const PRUnichar *action;
|
||||
nsAString_GetData(&action_str, &action);
|
||||
hres = nsuri_to_url(action, FALSE, p);
|
||||
}else {
|
||||
ERR("GetAction failed: %08x\n", nsres);
|
||||
hres = E_FAIL;
|
||||
}
|
||||
|
||||
return hres;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLFormElement_put_dir(IHTMLFormElement *iface, BSTR v)
|
||||
|
|
|
@ -2519,6 +2519,38 @@ static void _test_form_length(unsigned line, IUnknown *unk, LONG 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)
|
||||
static IHTMLDocument2 *_get_elem_doc(unsigned line, IUnknown *unk)
|
||||
{
|
||||
|
@ -6160,6 +6192,8 @@ static void test_elems2(IHTMLDocument2 *doc)
|
|||
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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue