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

mshtml: Don't lock document mode when querying IEventTarget.

parent 2e4721ac
...@@ -3380,7 +3380,7 @@ static HRESULT WINAPI HTMLDocumentObj_QueryInterface(IUnknown *iface, REFIID rii ...@@ -3380,7 +3380,7 @@ static HRESULT WINAPI HTMLDocumentObj_QueryInterface(IUnknown *iface, REFIID rii
}else if(IsEqualGUID(&IID_IEventTarget, riid)) { }else if(IsEqualGUID(&IID_IEventTarget, riid)) {
/* IEventTarget is conditionally exposed. This breaks COM rules when /* IEventTarget is conditionally exposed. This breaks COM rules when
it changes its compat mode, but it is how native works (see tests). */ it changes its compat mode, but it is how native works (see tests). */
if(!This->doc_node || dispex_compat_mode(&This->doc_node->node.event_target.dispex) < COMPAT_MODE_IE9) { if(!This->doc_node || This->doc_node->document_mode < COMPAT_MODE_IE9) {
*ppv = NULL; *ppv = NULL;
return E_NOINTERFACE; return E_NOINTERFACE;
} }
......
...@@ -11731,6 +11731,56 @@ static void test_quirks_mode(void) ...@@ -11731,6 +11731,56 @@ static void test_quirks_mode(void)
"</html>", test_document_mode); "</html>", test_document_mode);
} }
static void test_document_mode_lock(void)
{
IEventTarget *event_target;
IPersistStreamInit *init;
IHTMLDocument2 *doc;
IStream *stream;
HRESULT hres;
HGLOBAL mem;
SIZE_T len;
MSG msg;
notif_doc = doc = create_document();
if(!doc)
return;
doc_complete = FALSE;
hres = IHTMLDocument2_QueryInterface(doc, &IID_IEventTarget, (void**)&event_target);
ok(hres == E_NOINTERFACE, "QueryInterface(IID_IEventTarget) returned %08lx.\n", hres);
ok(event_target == NULL, "event_target != NULL\n");
len = strlen(doc_blank_ie9);
mem = GlobalAlloc(0, len);
memcpy(mem, doc_blank_ie9, len);
hres = CreateStreamOnHGlobal(mem, TRUE, &stream);
ok(hres == S_OK, "Failed to create stream: %08lx.\n", hres);
hres = IHTMLDocument2_QueryInterface(doc, &IID_IPersistStreamInit, (void**)&init);
ok(hres == S_OK, "QueryInterface(IID_IPersistStreamInit) failed: %08lx.\n", hres);
IPersistStreamInit_Load(init, stream);
IPersistStreamInit_Release(init);
IStream_Release(stream);
set_client_site(doc, TRUE);
do_advise((IUnknown*)doc, &IID_IPropertyNotifySink, (IUnknown*)&PropertyNotifySink);
while(!doc_complete && GetMessageW(&msg, NULL, 0, 0)) {
TranslateMessage(&msg);
DispatchMessageW(&msg);
}
hres = IHTMLDocument2_QueryInterface(doc, &IID_IEventTarget, (void**)&event_target);
ok(hres == S_OK, "QueryInterface(IID_IEventTarget) returned %08lx.\n", hres);
ok(event_target != NULL, "event_target == NULL\n");
IEventTarget_Release(event_target);
set_client_site(doc, FALSE);
IHTMLDocument2_Release(doc);
}
static void test_custom_user_agent(IHTMLDocument2 *doc) static void test_custom_user_agent(IHTMLDocument2 *doc)
{ {
static const WCHAR ua[] = L"1234567890xxxABC"; static const WCHAR ua[] = L"1234567890xxxABC";
...@@ -11830,6 +11880,7 @@ START_TEST(dom) ...@@ -11830,6 +11880,7 @@ START_TEST(dom)
run_domtest(doctype_str, test_doctype); run_domtest(doctype_str, test_doctype);
test_quirks_mode(); test_quirks_mode();
test_document_mode_lock();
/* Run this last since it messes with the process-wide user agent */ /* Run this last since it messes with the process-wide user agent */
if (winetest_interactive || ! is_ie_hardened()) { if (winetest_interactive || ! is_ie_hardened()) {
......
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