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

mshtml: Return E_ABORT from postMessage called without a caller ServiceProvider.

parent b9e4680d
......@@ -2473,18 +2473,14 @@ static HRESULT post_message(HTMLInnerWindow *window, VARIANT msg, BSTR targetOri
static HRESULT WINAPI HTMLWindow6_postMessage(IHTMLWindow6 *iface, BSTR msg, VARIANT targetOrigin)
{
HTMLWindow *This = impl_from_IHTMLWindow6(iface);
VARIANT var, transfer;
TRACE("(%p)->(%s %s)\n", This, debugstr_w(msg), debugstr_variant(&targetOrigin));
if(V_VT(&targetOrigin) != VT_BSTR)
return E_INVALIDARG;
V_VT(&var) = VT_BSTR;
V_BSTR(&var) = msg;
V_VT(&transfer) = VT_EMPTY;
return post_message(This->inner_window, var, V_BSTR(&targetOrigin), transfer, NULL,
dispex_compat_mode(&This->inner_window->event_target.dispex));
/* This can't obtain the source, and never works even in IE9+ modes... */
return E_ABORT;
}
static HRESULT WINAPI HTMLWindow6_toStaticHTML(IHTMLWindow6 *iface, BSTR bstrHTML, BSTR *pbstrStaticHTML)
......
......@@ -3218,7 +3218,6 @@ static void test_message_event(IHTMLDocument2 *doc)
ok(hres == S_OK, "get_onmessage failed: %08lx\n", hres);
ok(V_VT(&v[0]) == VT_DISPATCH, "V_VT(onmessage) = %d\n", V_VT(&v[0]));
ok(V_DISPATCH(&v[0]) == (IDispatch*)&onmessage_obj, "V_DISPATCH(onmessage) = %p\n", V_DISPATCH(&v[0]));
IHTMLWindow6_Release(window6);
if(document_mode >= 9)
add_event_listener((IUnknown*)doc, L"message", (IDispatch*)&onmessage_obj, VARIANT_TRUE);
......@@ -3227,6 +3226,10 @@ static void test_message_event(IHTMLDocument2 *doc)
V_BSTR(&v[1]) = SysAllocString(L"foobar");
V_VT(&v[0]) = VT_BSTR;
V_BSTR(&v[0]) = SysAllocString(L"*");
bstr = SysAllocString(L"foobar");
hres = IHTMLWindow6_postMessage(window6, V_BSTR(&v[1]), v[0]);
ok(hres == E_ABORT, "postMessage returned: %08lx\n", hres);
IHTMLWindow6_Release(window6);
hres = IHTMLWindow2_QueryInterface(window, &IID_IDispatchEx, (void**)&dispex);
ok(hres == S_OK, "Could not get IDispatchEx iface: %08lx\n", hres);
......
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