Jacek Caban : mshtml: Properly expose IHTMLDocument6 interface to scripts.

Alexandre Julliard julliard at winehq.org
Thu Aug 24 14:18:25 CDT 2017


Module: wine
Branch: master
Commit: d631268fa1ae03ce124fec9934043d98a24cd940
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=d631268fa1ae03ce124fec9934043d98a24cd940

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Thu Aug 24 12:29:17 2017 +0200

mshtml: Properly expose IHTMLDocument6 interface to scripts.

Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/mshtml/htmldoc.c             | 19 ++++++++++++++++---
 dlls/mshtml/tests/documentmode.js | 16 ++++++++++++++++
 2 files changed, 32 insertions(+), 3 deletions(-)

diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c
index 8d48e18..ed3075b 100644
--- a/dlls/mshtml/htmldoc.c
+++ b/dlls/mshtml/htmldoc.c
@@ -4887,19 +4887,32 @@ static const tid_t HTMLDocumentNode_iface_tids[] = {
     IHTMLDOMNode_tid,
     IHTMLDOMNode2_tid,
     IHTMLDocument2_tid,
-    IHTMLDocument3_tid,
     IHTMLDocument4_tid,
     IHTMLDocument5_tid,
-    IHTMLDocument6_tid,
     IDocumentSelector_tid,
     0
 };
 
+void HTMLDocumentNode_init_dispex_info(dispex_data_t *info, compat_mode_t mode)
+{
+    HTMLDOMNode_init_dispex_info(info, mode);
+
+    /* Depending on compatibility version, we add interfaces in different order
+     * so that the right getElementById implementation is used. */
+    if(mode < COMPAT_MODE_IE8) {
+        dispex_info_add_interface(info, IHTMLDocument3_tid, NULL);
+        dispex_info_add_interface(info, IHTMLDocument6_tid, NULL);
+    }else {
+        dispex_info_add_interface(info, IHTMLDocument6_tid, NULL);
+        dispex_info_add_interface(info, IHTMLDocument3_tid, NULL);
+    }
+}
+
 static dispex_static_data_t HTMLDocumentNode_dispex = {
     &HTMLDocumentNode_dispex_vtbl,
     DispHTMLDocument_tid,
     HTMLDocumentNode_iface_tids,
-    HTMLDOMNode_init_dispex_info
+    HTMLDocumentNode_init_dispex_info
 };
 
 static HTMLDocumentNode *alloc_doc_node(HTMLDocumentObj *doc_obj, HTMLInnerWindow *window)
diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js
index 4224dfe..9453bdc 100644
--- a/dlls/mshtml/tests/documentmode.js
+++ b/dlls/mshtml/tests/documentmode.js
@@ -55,6 +55,21 @@ function test_doc_props() {
     next_test();
 }
 
+function test_elem_by_id() {
+    document.body.innerHTML = '<form id="testid" name="testname"></form>';
+
+    var id_elem = document.getElementById("testid");
+    ok(id_elem.tagName === "FORM", "id_elem.tagName = " + id_elem.tagName);
+
+    var name_elem = document.getElementById("testname");
+    if(document.documentMode < 8)
+        ok(id_elem === name_elem, "id_elem != id_elem");
+    else
+        ok(name_elem === null, "name_elem != null");
+
+    next_test();
+}
+
 function test_doc_mode() {
     compat_version = parseInt(document.location.search.substring(1));
 
@@ -116,5 +131,6 @@ var tests = [
     test_doc_mode,
     test_elem_props,
     test_doc_props,
+    test_elem_by_id,
     test_conditional_comments
 ];




More information about the wine-cvs mailing list