Commit de2192bb authored by Gabriel Ivăncescu's avatar Gabriel Ivăncescu Committed by Alexandre Julliard

mshtml: Allow null or undefined func in addEventListener.

parent a3dbd506
......@@ -4105,6 +4105,9 @@ static HRESULT WINAPI EventTarget_addEventListener(IEventTarget *iface, BSTR typ
TRACE("(%p)->(%s %p %x)\n", This, debugstr_w(type), function, capture);
if(!function)
return S_OK;
container = get_listener_container(This, type, TRUE);
if(!container)
return E_OUTOFMEMORY;
......
......@@ -1898,6 +1898,7 @@ static void test_onclick(IHTMLDocument2 *doc)
VariantClear(&v);
if(document_mode >= 9) {
add_event_listener((IUnknown*)div, L"click", NULL, VARIANT_FALSE);
add_event_listener((IUnknown*)div, L"click", (IDispatch*)&div_onclick_capture_obj, VARIANT_TRUE);
add_event_listener((IUnknown*)div, L"click", (IDispatch*)&div_onclick_bubble_obj, VARIANT_FALSE);
}
......@@ -2052,6 +2053,7 @@ static void test_onclick(IHTMLDocument2 *doc)
doc_detach_event(doc, L"onclick", (IDispatch*)&doc_onclick_attached_obj);
if(document_mode >= 9) {
remove_event_listener((IUnknown*)div, L"click", NULL, VARIANT_FALSE);
remove_event_listener((IUnknown*)div, L"click", (IDispatch*)&div_onclick_capture_obj, VARIANT_TRUE);
remove_event_listener((IUnknown*)div, L"click", (IDispatch*)&div_onclick_bubble_obj, VARIANT_FALSE);
}
......
......@@ -198,6 +198,21 @@ sync_test("add_remove_listener", function() {
calls = "";
div.click();
ok(calls === "", "calls = " + calls);
/* test undefined function argument */
div.addEventListener("click", undefined, false);
calls = "";
div.click();
ok(calls === "", "calls = " + calls);
div.addEventListener("click", listener, false);
div.removeEventListener("click", undefined);
calls = "";
div.click();
ok(calls === "listener,", "calls = " + calls);
div.removeEventListener("click", listener);
});
sync_test("event_phase", function() {
......
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