mshtml: Implement IHTMLScriptElement get/put Defer.

This commit is contained in:
Alistair Leslie-Hughes 2008-12-12 20:14:17 +11:00 committed by Alexandre Julliard
parent 8e984bcc61
commit de5bbbc2ff
2 changed files with 49 additions and 8 deletions

View File

@ -154,15 +154,40 @@ static HRESULT WINAPI HTMLScriptElement_get_text(IHTMLScriptElement *iface, BSTR
static HRESULT WINAPI HTMLScriptElement_put_defer(IHTMLScriptElement *iface, VARIANT_BOOL v)
{
HTMLScriptElement *This = HTMLSCRIPT_THIS(iface);
FIXME("(%p)->(%x)\n", This, v);
return E_NOTIMPL;
HRESULT hr = S_OK;
nsresult nsres;
TRACE("(%p)->(%x)\n", This, v);
nsres = nsIDOMHTMLScriptElement_SetDefer(This->nsscript, v != VARIANT_FALSE);
if(NS_FAILED(nsres))
{
hr = E_FAIL;
}
return hr;
}
static HRESULT WINAPI HTMLScriptElement_get_defer(IHTMLScriptElement *iface, VARIANT_BOOL *p)
{
HTMLScriptElement *This = HTMLSCRIPT_THIS(iface);
FIXME("(%p)->(%p)\n", This, p);
return E_NOTIMPL;
PRBool defer = FALSE;
nsresult nsres;
TRACE("(%p)->(%p)\n", This, p);
if(!p)
return E_INVALIDARG;
nsres = nsIDOMHTMLScriptElement_GetDefer(This->nsscript, &defer);
if(NS_FAILED(nsres)) {
ERR("GetSrc failed: %08x\n", nsres);
}
*p = defer ? VARIANT_TRUE : VARIANT_FALSE;
TRACE("*p = %d\n", *p);
return S_OK;
}
static HRESULT WINAPI HTMLScriptElement_get_readyState(IHTMLScriptElement *iface, BSTR *p)

View File

@ -3433,10 +3433,26 @@ static void test_elems(IHTMLDocument2 *doc)
hres = IHTMLElement_QueryInterface(elem, &IID_IHTMLScriptElement, (void**)&script);
ok(hres == S_OK, "Could not get IHTMLScriptElement interface: %08x\n", hres);
hres = IHTMLScriptElement_get_type(script, &type);
ok(hres == S_OK, "get_type failed: %08x\n", hres);
ok(!lstrcmpW(type, text_javascriptW), "Unexpected type %s\n", dbgstr_w(type));
SysFreeString(type);
if(hres == S_OK)
{
VARIANT_BOOL vb;
hres = IHTMLScriptElement_get_type(script, &type);
ok(hres == S_OK, "get_type failed: %08x\n", hres);
ok(!lstrcmpW(type, text_javascriptW), "Unexpected type %s\n", dbgstr_w(type));
SysFreeString(type);
/* test defer */
hres = IHTMLScriptElement_put_defer(script, VARIANT_TRUE);
ok(hres == S_OK, "get_type failed: %08x\n", hres);
hres = IHTMLScriptElement_get_defer(script, &vb);
ok(hres == S_OK, "get_type failed: %08x\n", hres);
ok(vb == VARIANT_TRUE, "get_type failed: %08x\n", hres);
hres = IHTMLScriptElement_put_defer(script, VARIANT_FALSE);
ok(hres == S_OK, "get_type failed: %08x\n", hres);
}
IHTMLScriptElement_Release(script);
}