Jacek Caban : mshtml: Properly handle conditional comments in IE9+ modes.

Alexandre Julliard julliard at winehq.org
Thu Feb 22 15:07:48 CST 2018


Module: wine
Branch: master
Commit: 67de587f60a6baf643a001c030739043a5ec2fb0
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=67de587f60a6baf643a001c030739043a5ec2fb0

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Thu Feb 22 19:48:03 2018 +0100

mshtml: Properly handle conditional comments in IE9+ modes.

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

---

 dlls/mshtml/mutation.c            | 22 ++++++++--------------
 dlls/mshtml/tests/documentmode.js |  8 ++------
 2 files changed, 10 insertions(+), 20 deletions(-)

diff --git a/dlls/mshtml/mutation.c b/dlls/mshtml/mutation.c
index 189bf84..95a0694 100644
--- a/dlls/mshtml/mutation.c
+++ b/dlls/mshtml/mutation.c
@@ -138,14 +138,6 @@ static PRUnichar *handle_insert_comment(HTMLDocumentNode *doc, const PRUnichar *
         return NULL;
 
     compat_version = compat_mode_info[doc->document_mode].ie_version;
-    if(compat_version > 8) {
-        /*
-         * Ideally we should handle higher versions, but right now it would cause more problems than it's worth.
-         * We should revisit that once more IE9 features are implemented, most notably new events APIs.
-         */
-        WARN("Using compat version 8\n");
-        compat_version = 8;
-    }
 
     switch(cmpt) {
     case CMP_EQ:
@@ -748,13 +740,15 @@ static void NSAPI nsDocumentObserver_BindToDocument(nsIDocumentObserver *iface,
 
     TRACE("(%p)->(%p %p)\n", This, aDocument, aContent);
 
-    nsres = nsIContent_QueryInterface(aContent, &IID_nsIDOMComment, (void**)&nscomment);
-    if(NS_SUCCEEDED(nsres)) {
-        TRACE("comment node\n");
+    if(This->document_mode < COMPAT_MODE_IE10) {
+        nsres = nsIContent_QueryInterface(aContent, &IID_nsIDOMComment, (void**)&nscomment);
+        if(NS_SUCCEEDED(nsres)) {
+            TRACE("comment node\n");
 
-        add_script_runner(This, run_insert_comment, (nsISupports*)nscomment, NULL);
-        nsIDOMComment_Release(nscomment);
-        return;
+            add_script_runner(This, run_insert_comment, (nsISupports*)nscomment, NULL);
+            nsIDOMComment_Release(nscomment);
+            return;
+        }
     }
 
     if(This->document_mode == COMPAT_MODE_QUIRKS) {
diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js
index 498dfed..1a16c56 100644
--- a/dlls/mshtml/tests/documentmode.js
+++ b/dlls/mshtml/tests/documentmode.js
@@ -165,10 +165,6 @@ function test_conditional_comments() {
     function test_version(v) {
         var version = compat_version ? compat_version : 7;
 
-        /* Uncomment and fix tests below once we support that. */
-        if(version >= 9)
-            return;
-
         div.innerHTML = "<!--[if lte IE " + v + "]>true<![endif]-->";
         ok(div.innerText === (version <= v ? "true" : ""),
            "div.innerText = " + div.innerText + " for version (<=) " + v);
@@ -178,11 +174,11 @@ function test_conditional_comments() {
            "div.innerText = " + div.innerText + " for version (<) " + v);
 
         div.innerHTML = "<!--[if gte IE " + v + "]>true<![endif]-->";
-        ok(div.innerText === (version >= v ? "true" : ""),
+        ok(div.innerText === (version >= v && version < 10 ? "true" : ""),
            "div.innerText = " + div.innerText + " for version (>=) " + v);
 
         div.innerHTML = "<!--[if gt IE " + v + "]>true<![endif]-->";
-        ok(div.innerText === (version > v ? "true" : ""),
+        ok(div.innerText === (version > v && version < 10 ? "true" : ""),
            "div.innerText = " + div.innerText + " for version (>) " + v);
     }
 




More information about the wine-cvs mailing list