Commit 9944c4bd authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Propagate nsIDOMCSSStyleDeclaration errors.

parent 78a05ca6
......@@ -921,16 +921,13 @@ static HRESULT set_nsstyle_property(nsIDOMCSSStyleDeclaration *nsstyle, styleid_
nsAString_InitDepend(&str_name, style_tbl[sid].name);
nsAString_InitDepend(&str_value, value);
nsAString_InitDepend(&str_empty, emptyW);
nsres = nsIDOMCSSStyleDeclaration_SetProperty(nsstyle, &str_name, &str_value, &str_empty);
if(NS_FAILED(nsres))
ERR("SetProperty failed: %08x\n", nsres);
nsAString_Finish(&str_name);
nsAString_Finish(&str_value);
nsAString_Finish(&str_empty);
return S_OK;
if(NS_FAILED(nsres))
WARN("SetProperty failed: %08x\n", nsres);
return map_nsresult(nsres);
}
static HRESULT var_to_styleval(CSSStyle *style, const VARIANT *v, const style_tbl_entry_t *entry, WCHAR *buf, const WCHAR **ret)
......@@ -1023,12 +1020,9 @@ static HRESULT get_nsstyle_attr_nsval(nsIDOMCSSStyleDeclaration *nsstyle, stylei
nsAString_InitDepend(&str_name, style_tbl[sid].name);
nsres = nsIDOMCSSStyleDeclaration_GetPropertyValue(nsstyle, &str_name, value);
nsAString_Finish(&str_name);
if(NS_FAILED(nsres)) {
ERR("SetProperty failed: %08x\n", nsres);
return E_FAIL;
}
return S_OK;
if(NS_FAILED(nsres))
WARN("GetPropertyValue failed: %08x\n", nsres);
return map_nsresult(nsres);
}
static HRESULT nsstyle_to_bstr(const WCHAR *val, DWORD flags, BSTR *p)
......@@ -3179,11 +3173,11 @@ static HRESULT WINAPI HTMLStyle_removeAttribute(IHTMLStyle *iface, BSTR strAttri
nsAString_GetData(&ret_str, &ret);
*pfSuccess = variant_bool(*ret);
}else {
ERR("RemoveProperty failed: %08x\n", nsres);
WARN("RemoveProperty failed: %08x\n", nsres);
}
nsAString_Finish(&name_str);
nsAString_Finish(&ret_str);
return NS_SUCCEEDED(nsres) ? S_OK : E_FAIL;
return map_nsresult(nsres);
}
static HRESULT WINAPI HTMLStyle_toString(IHTMLStyle *iface, BSTR *String)
......@@ -5063,12 +5057,9 @@ static HRESULT WINAPI HTMLCSSStyleDeclaration_setProperty(IHTMLCSSStyleDeclarati
nsAString_Finish(&name_str);
nsAString_Finish(&value_str);
nsAString_Finish(&priority_str);
if(NS_FAILED(nsres)) {
FIXME("SetProperty failed: %08x\n", nsres);
return E_FAIL;
}
return S_OK;
if(NS_FAILED(nsres))
WARN("SetProperty failed: %08x\n", nsres);
return map_nsresult(nsres);
}
static HRESULT WINAPI HTMLCSSStyleDeclaration_item(IHTMLCSSStyleDeclaration *iface, LONG index, BSTR *pbstrPropertyName)
......
......@@ -56,6 +56,7 @@
#define NS_ERROR_NOT_AVAILABLE ((nsresult)0x80040111L)
#define NS_ERROR_INVALID_ARG ((nsresult)0x80070057L)
#define NS_ERROR_UNEXPECTED ((nsresult)0x8000ffffL)
#define NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR ((nsresult)0x80530007)
#define NS_ERROR_MODULE_NETWORK 6
......@@ -958,6 +959,7 @@ void nsAString_InitDepend(nsAString*,const PRUnichar*) DECLSPEC_HIDDEN;
UINT32 nsAString_GetData(const nsAString*,const PRUnichar**) DECLSPEC_HIDDEN;
void nsAString_Finish(nsAString*) DECLSPEC_HIDDEN;
HRESULT map_nsresult(nsresult) DECLSPEC_HIDDEN;
HRESULT return_nsstr(nsresult,nsAString*,BSTR*) DECLSPEC_HIDDEN;
HRESULT return_nsstr_variant(nsresult nsres, nsAString *nsstr, VARIANT *p) DECLSPEC_HIDDEN;
HRESULT return_nsform(nsresult,nsIDOMHTMLFormElement*,IHTMLFormElement**) DECLSPEC_HIDDEN;
......
......@@ -848,7 +848,7 @@ void nsAString_Finish(nsAString *str)
NS_StringContainerFinish(str);
}
static HRESULT map_nsresult(nsresult nsres)
HRESULT map_nsresult(nsresult nsres)
{
switch(nsres) {
case NS_OK:
......@@ -865,6 +865,8 @@ static HRESULT map_nsresult(nsresult nsres)
return E_INVALIDARG;
case NS_ERROR_UNEXPECTED:
return E_UNEXPECTED;
case NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR:
return 0x80700007; /* according to tests */
}
return E_FAIL;
}
......
......@@ -6750,6 +6750,27 @@ static void test_xmlhttprequest(IHTMLWindow5 *window)
VariantClear(&var);
}
static void test_read_only_style(IHTMLCSSStyleDeclaration *style)
{
BSTR none = a2bstr("none"), display = a2bstr("display"), str;
VARIANT v;
HRESULT hres;
hres = IHTMLCSSStyleDeclaration_put_display(style, none);
ok(hres == 0x80700007, "put_display failed: %08x\n", hres);
hres = IHTMLCSSStyleDeclaration_removeProperty(style, display, &str);
ok(hres == 0x80700007, "removeProperty failed: %08x\n", hres);
V_VT(&v) = VT_BSTR;
V_BSTR(&v) = none;
hres = IHTMLCSSStyleDeclaration_setProperty(style, display, &v, NULL);
ok(hres == 0x80700007, "setProperty returned: %08x\n", hres);
SysFreeString(none);
SysFreeString(display);
}
static void test_window(IHTMLDocument2 *doc)
{
IHTMLWindow2 *window, *window2, *self, *parent;
......@@ -7099,10 +7120,19 @@ static void test_defaults(IHTMLDocument2 *doc)
test_ifaces((IUnknown*)cstyle, cstyle_iids);
hres = IHTMLCurrentStyle_QueryInterface(cstyle, &IID_IHTMLCurrentStyle4, (void**)&unk);
if(SUCCEEDED(hres))
if(SUCCEEDED(hres)) {
IHTMLCSSStyleDeclaration *css_style;
hres = IHTMLCurrentStyle_QueryInterface(cstyle, &IID_IHTMLCSSStyleDeclaration, (void**)&css_style);
if(SUCCEEDED(hres)) {
test_read_only_style(css_style);
IHTMLCSSStyleDeclaration_Release(css_style);
}else {
win_skip("IHTMLCSSStyleDeclaration not supported\n");
}
IUnknown_Release(unk);
else
{
}else {
/*IE6 doesn't have interface */
win_skip("IID_IHTMLCurrentStyle4 not supported\n");
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment