From: Jacek Caban jacek@codeweavers.com
--- dlls/mshtml/dispex.c | 6 ++++-- dlls/mshtml/htmldoc.c | 26 +++++++++++++++++--------- dlls/mshtml/mshtml_private.h | 2 ++ dlls/mshtml/tests/documentmode.js | 5 +++++ dlls/mshtml/tests/events.c | 1 - 5 files changed, 28 insertions(+), 12 deletions(-)
diff --git a/dlls/mshtml/dispex.c b/dlls/mshtml/dispex.c index ff3ed946284..e4e678a7efd 100644 --- a/dlls/mshtml/dispex.c +++ b/dlls/mshtml/dispex.c @@ -1812,6 +1812,7 @@ static void init_host_object(DispatchEx *dispex, HTMLInnerWindow *script_global,
static BOOL ensure_real_info(DispatchEx *dispex) { + compat_mode_t compat_mode; HTMLInnerWindow *script_global; DispatchEx *prototype = NULL;
@@ -1819,8 +1820,9 @@ static BOOL ensure_real_info(DispatchEx *dispex) return TRUE;
script_global = dispex->info->vtbl->get_script_global(dispex); + compat_mode = script_global->doc->document_mode;
- if(dispex->info->compat_mode >= COMPAT_MODE_IE9 && dispex->info->desc->id) { + if(compat_mode >= COMPAT_MODE_IE9 && dispex->info->desc->id) { HRESULT hres = get_prototype(script_global, dispex->info->desc->id, &prototype); if(FAILED(hres)) { ERR("could not get prototype: %08lx\n", hres); @@ -1828,7 +1830,7 @@ static BOOL ensure_real_info(DispatchEx *dispex) } }
- if (!(dispex->info = ensure_dispex_info(dispex->info->desc, script_global->doc->document_mode))) + if (!(dispex->info = ensure_dispex_info(dispex->info->desc, compat_mode))) return FALSE; init_host_object(dispex, script_global, prototype); return TRUE; diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c index 31d879de837..13731e62474 100644 --- a/dlls/mshtml/htmldoc.c +++ b/dlls/mshtml/htmldoc.c @@ -5625,7 +5625,7 @@ static HRESULT HTMLDocumentNode_handle_event(DispatchEx* dispex, DOMEvent *event return S_OK; }
-static const event_target_vtbl_t HTMLDocumentNode_event_target_vtbl = { +static const event_target_vtbl_t HTMLDocument_event_target_vtbl = { { .query_interface = HTMLDocumentNode_query_interface, .destructor = HTMLDocumentNode_destructor, @@ -5707,12 +5707,20 @@ static void HTMLDocumentNode_init_dispex_info(dispex_data_t *info, compat_mode_t dispex_info_add_interface(info, IHTMLDocument2_tid, mode >= COMPAT_MODE_IE11 ? document2_ie11_hooks : document2_hooks); }
-static dispex_static_data_t HTMLDocumentNode_dispex = { - "HTMLDocument", - &HTMLDocumentNode_event_target_vtbl.dispex_vtbl, - DispHTMLDocument_tid, - HTMLDocumentNode_iface_tids, - HTMLDocumentNode_init_dispex_info +dispex_static_data_t Document_dispex = { + .name = "Document", + .id = PROT_Document, + .prototype_id = PROT_Node, +}; + +dispex_static_data_t HTMLDocument_dispex = { + .name = "HTMLDocument", + .id = PROT_HTMLDocument, + .prototype_id = PROT_Document, + .vtbl = &HTMLDocument_event_target_vtbl.dispex_vtbl, + .disp_tid = DispHTMLDocument_tid, + .iface_tids = HTMLDocumentNode_iface_tids, + .init_info = HTMLDocumentNode_init_dispex_info, };
static HTMLDocumentNode *alloc_doc_node(HTMLDocumentObj *doc_obj, HTMLInnerWindow *window, HTMLInnerWindow *script_global) @@ -5791,7 +5799,7 @@ HRESULT create_document_node(nsIDOMDocument *nsdoc, GeckoBrowser *browser, HTMLI doc->html_document = NULL; }
- HTMLDOMNode_Init(doc, &doc->node, (nsIDOMNode*)doc->dom_document, &HTMLDocumentNode_dispex); + HTMLDOMNode_Init(doc, &doc->node, (nsIDOMNode*)doc->dom_document, &HTMLDocument_dispex);
init_document_mutation(doc); doc_init_events(doc); @@ -5824,7 +5832,7 @@ static HRESULT create_document_fragment(nsIDOMNode *nsnode, HTMLDocumentNode *do if(!doc_frag) return E_OUTOFMEMORY;
- HTMLDOMNode_Init(doc_node, &doc_frag->node, nsnode, &HTMLDocumentNode_dispex); + HTMLDOMNode_Init(doc_node, &doc_frag->node, nsnode, &HTMLDocument_dispex); doc_frag->node.vtbl = &HTMLDocumentFragmentImplVtbl; doc_frag->document_mode = lock_document_mode(doc_node);
diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index 958a7eef8a6..c30a2355605 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -408,8 +408,10 @@ typedef struct {
#define ALL_PROTOTYPES \ X(DOMImplementation) \ + X(Document) \ X(Element) \ X(HTMLBodyElement) \ + X(HTMLDocument) \ X(HTMLElement) \ X(Navigator) \ X(Node) \ diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index bbee5155946..85a063a564e 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -3129,4 +3129,9 @@ sync_test("prototypes", function() { check(Node.prototype, Object.prototype, "node prototype"); check(sessionStorage, Storage.prototype, "storage"); check(Storage.prototype, Object.prototype, "storage prototype"); + if(v >= 11) { + check(document, HTMLDocument.prototype, "html document"); + check(HTMLDocument.prototype, Document.prototype, "html document prototype"); + check(Document.prototype, Node.prototype, "document prototype"); + } }); diff --git a/dlls/mshtml/tests/events.c b/dlls/mshtml/tests/events.c index 6b48fcda226..2cf63f06dd3 100644 --- a/dlls/mshtml/tests/events.c +++ b/dlls/mshtml/tests/events.c @@ -4250,7 +4250,6 @@ static void test_doc_obj(IHTMLDocument2 *doc) hres = IHTMLDocument2_Invoke(doc, has_own_prop_id, &IID_NULL, 0, DISPATCH_METHOD, &dp, &res, NULL, NULL); ok(hres == S_OK, "Invoke(hasOwnProperty("createElement")) failed: %08lx\n", hres); ok(V_VT(&res) == VT_BOOL, "VT = %d\n", V_VT(&res)); - todo_wine ok(V_BOOL(&res) == VARIANT_FALSE, "hasOwnProperty("createElement") = %d\n", V_BOOL(&res));
hres = IHTMLDocument2_GetIDsOfNames(doc, &IID_NULL, &V_BSTR(&arg), 1, 0, &dispid);