Robert Shearman wrote:
I suspect that you'll get different results when you do the same test on a loaded HTML document, even though this violates COM rules.
No, load state doesn't change anything. I've attached a test.
Jacek
diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c index 09f905a..44c98c2 100644 --- a/dlls/mshtml/tests/dom.c +++ b/dlls/mshtml/tests/dom.c @@ -74,6 +74,27 @@ static void test_node_name(IUnknown *unk, const char *exname) SysFreeString(name); }
+static void test_QueryInterface(IUnknown *unk) +{ + IUnknown *qi; + HRESULT hres; + + qi = (void*)0xdeadbeef; + hres = IUnknown_QueryInterface(unk, &IID_IRunnableObject, (void**)&qi); + ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres); + ok(qi == NULL, "runnable=%p, ezpected NULL\n", qi); + + qi = (void*)0xdeadbeef; + hres = IUnknown_QueryInterface(unk, &IID_IHTMLDOMNode, (void**)&qi); + ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres); + ok(qi == NULL, "runnable=%p, ezpected NULL\n", qi); + + qi = (void*)0xdeadbeef; + hres = IUnknown_QueryInterface(unk, &IID_IHTMLDOMNode2, (void**)&qi); + ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres); + ok(qi == NULL, "runnable=%p, ezpected NULL\n", qi); +} + static void test_doc_elem(IHTMLDocument2 *doc) { IHTMLElement *elem; @@ -90,6 +111,8 @@ static void test_doc_elem(IHTMLDocument2 *doc) test_node_name((IUnknown*)elem, "HTML");
IHTMLElement_Release(elem); + + test_QueryInterface((IUnknown*)doc); }
static IHTMLDocument2 *notif_doc;