Jacek Caban : mshtml: Added support for _self target in IHTMLWindow2:: open.

Alexandre Julliard julliard at wine.codeweavers.com
Wed Jan 28 15:45:34 CST 2015


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Wed Jan 28 15:30:10 2015 +0100

mshtml: Added support for _self target in IHTMLWindow2::open.

---

 dlls/mshtml/htmlwindow.c        | 19 +++++++++++++++++++
 dlls/mshtml/tests/nav_test.html | 24 +++++++++++++++++++++---
 2 files changed, 40 insertions(+), 3 deletions(-)

diff --git a/dlls/mshtml/htmlwindow.c b/dlls/mshtml/htmlwindow.c
index a18fc6d..6f3cbd4 100644
--- a/dlls/mshtml/htmlwindow.c
+++ b/dlls/mshtml/htmlwindow.c
@@ -932,6 +932,8 @@ static HRESULT WINAPI HTMLWindow2_open(IHTMLWindow2 *iface, BSTR url, BSTR name,
     IUri *uri;
     HRESULT hres;
 
+    static const WCHAR _selfW[] = {'_','s','e','l','f',0};
+
     TRACE("(%p)->(%s %s %s %x %p)\n", This, debugstr_w(url), debugstr_w(name),
           debugstr_w(features), replace, pomWindowResult);
 
@@ -939,6 +941,23 @@ static HRESULT WINAPI HTMLWindow2_open(IHTMLWindow2 *iface, BSTR url, BSTR name,
         return E_UNEXPECTED;
 
     if(name && *name == '_') {
+        if(!strcmpW(name, _selfW)) {
+            if((features && *features) || replace)
+                FIXME("Unsupported arguments for _self target\n");
+
+            hres = IHTMLWindow2_navigate(&This->IHTMLWindow2_iface, url);
+            if(FAILED(hres))
+                return hres;
+
+            if(pomWindowResult) {
+                FIXME("Returning this window for _self target\n");
+                *pomWindowResult = &This->IHTMLWindow2_iface;
+                IHTMLWindow2_AddRef(*pomWindowResult);
+            }
+
+            return S_OK;
+        }
+
         FIXME("Unsupported name %s\n", debugstr_w(name));
         return E_NOTIMPL;
     }
diff --git a/dlls/mshtml/tests/nav_test.html b/dlls/mshtml/tests/nav_test.html
index 11c4c0c..1021444 100644
--- a/dlls/mshtml/tests/nav_test.html
+++ b/dlls/mshtml/tests/nav_test.html
@@ -5,7 +5,7 @@ function ok(b,m) {
     return external.ok(b, m);
 }
 
-function nav_back_test() {
+function nav_parent_test() {
     external.trace("Running _parent navigation tests...");
 
     var iframe = document.getElementById("testframe");
@@ -29,7 +29,7 @@ function nav_back_test() {
 }
 
 function window_navigate_test() {
-    external.trace("Runnint window.navigate() tests...");
+    external.trace("Running window.navigate() tests...");
 
     var iframe = document.getElementById("testframe");
 
@@ -43,6 +43,23 @@ function window_navigate_test() {
     iframe.contentWindow.navigate("about:blank");
 }
 
+function window_open_self_test() {
+    external.trace("Running window.open(_self) tests...");
+
+    var iframe = document.getElementById("testframe");
+    var iframe_window = iframe.contentWindow;
+
+    iframe.onload = function() {
+        iframe.onload = null;
+        var href = iframe.contentWindow.location.href;
+        ok(/.*blank.html\?window_open_self/.test(href), "Unexpected href " + href);
+        ok(iframe.contentWindow === iframe_window, "iframe.contentWindow !== iframe_window");
+	next_test();
+    }
+
+    iframe_window.open("blank.html?window_open_self", "_self");
+}
+
 function detached_src_test() {
     var iframe = document.createElement("iframe");
     var onload_called = false;
@@ -58,8 +75,9 @@ function detached_src_test() {
 }
 
 var tests = [
-    nav_back_test,
+    nav_parent_test,
     window_navigate_test,
+    window_open_self_test,
     detached_src_test,
     function() { external.reportSuccess(); }
 ];




More information about the wine-cvs mailing list