mshtml: Clear the string dprop associated with the builtin attribute when removing it.

Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Gabriel Ivăncescu 2021-11-16 19:58:16 +02:00 committed by Alexandre Julliard
parent 8afb89436f
commit 6b2c20c6a1
2 changed files with 65 additions and 4 deletions

View File

@ -1463,13 +1463,18 @@ HRESULT remove_attribute(DispatchEx *This, DISPID id, VARIANT_BOOL *success)
*success = VARIANT_TRUE; *success = VARIANT_TRUE;
return S_OK; return S_OK;
} }
*success = VARIANT_TRUE;
V_VT(&var) = VT_EMPTY; V_VT(&var) = VT_EMPTY;
hres = builtin_propput(This, func, &dp, NULL); hres = builtin_propput(This, func, &dp, NULL);
if(FAILED(hres)) if(FAILED(hres)) {
return hres; VARIANT *ref;
hres = dispex_get_dprop_ref(This, func->name, FALSE, &ref);
*success = VARIANT_TRUE; if(FAILED(hres) || V_VT(ref) != VT_BSTR)
*success = VARIANT_FALSE;
else
VariantClear(ref);
}
return S_OK; return S_OK;
} }
default: default:

View File

@ -1087,6 +1087,62 @@ sync_test("elem_attr", function() {
ok(r === "cls2", "class attr = " + r); ok(r === "cls2", "class attr = " + r);
r = elem.getAttribute("className"); r = elem.getAttribute("className");
ok(r === "cls3", "className attr = " + r); ok(r === "cls3", "className attr = " + r);
var func = function() { };
elem.onclick = func;
ok(elem.onclick === func, "onclick = " + elem.onclick);
r = elem.getAttribute("onclick");
ok(r === (v < 8 ? func : null), "onclick attr = " + r);
r = elem.removeAttribute("onclick");
todo_wine_if(v === 8).
ok(r === (v < 9 ? false : undefined), "removeAttribute returned " + r);
todo_wine_if(v === 8).
ok(elem.onclick === (v != 8 ? func : null), "removed onclick = " + elem.onclick);
elem.onclick_test = func;
ok(elem.onclick_test === func, "onclick_test = " + elem.onclick_test);
r = elem.getAttribute("onclick_test");
todo_wine_if(v === 8).
ok(r === (v < 8 ? func : (v < 9 ? func.toString() : null)), "onclick_test attr = " + r);
elem.setAttribute("onclick", "test");
r = elem.getAttribute("onclick");
ok(r === "test", "onclick attr after setAttribute = " + r);
r = elem.removeAttribute("onclick");
ok(r === (v < 9 ? true : undefined), "removeAttribute after setAttribute returned " + r);
/* IE11 returns an empty function, which we can't check directly */
todo_wine_if(v >= 8).
ok((v < 11) ? (elem.onclick === null) : (elem.onclick !== func), "removed onclick after setAttribute = " + elem.onclick);
r = Object.prototype.toString.call(elem.onclick);
todo_wine_if(v >= 8 && v < 11).
ok(r === (v < 9 ? "[object Object]" : (v < 11 ? "[object Null]" : "[object Function]")),
"removed onclick after setAttribute Object.toString returned " + r);
elem.setAttribute("onclick", "string");
r = elem.getAttribute("onclick");
ok(r === "string", "onclick attr after setAttribute = " + r);
elem.onclick = func;
ok(elem.onclick === func, "onclick = " + elem.onclick);
r = elem.getAttribute("onclick");
todo_wine_if(v === 8).
ok(r === (v < 8 ? func : (v < 9 ? null : "string")), "onclick attr = " + r);
elem.onclick = "test";
r = elem.getAttribute("onclick");
todo_wine_if(v === 8).
ok(r === (v < 9 ? "test" : "string"), "onclick attr = " + r);
r = elem.removeAttribute("onclick");
ok(r === (v < 9 ? true : undefined), "removeAttribute returned " + r);
todo_wine_if(v >= 8).
ok(elem.onclick === null, "removed onclick = " + elem.onclick);
elem.setAttribute("ondblclick", "string");
r = elem.getAttribute("ondblclick");
ok(r === "string", "ondblclick string = " + r);
r = elem.removeAttribute("ondblclick");
ok(r === (v < 9 ? true : undefined), "ondblclick string removeAttribute returned " + r);
ok(elem.ondblclick === null, "removed ondblclick string = " + elem.ondblclick);
}); });
sync_test("__proto__", function() { sync_test("__proto__", function() {