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

This commit is contained in:
Jacek Caban 2015-01-28 15:30:10 +01:00 committed by Alexandre Julliard
parent fdda480df5
commit 679ddf24d4
2 changed files with 40 additions and 3 deletions

View file

@ -932,6 +932,8 @@ static HRESULT WINAPI HTMLWindow2_open(IHTMLWindow2 *iface, BSTR url, BSTR name,
IUri *uri; IUri *uri;
HRESULT hres; 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), TRACE("(%p)->(%s %s %s %x %p)\n", This, debugstr_w(url), debugstr_w(name),
debugstr_w(features), replace, pomWindowResult); debugstr_w(features), replace, pomWindowResult);
@ -939,6 +941,23 @@ static HRESULT WINAPI HTMLWindow2_open(IHTMLWindow2 *iface, BSTR url, BSTR name,
return E_UNEXPECTED; return E_UNEXPECTED;
if(name && *name == '_') { 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)); FIXME("Unsupported name %s\n", debugstr_w(name));
return E_NOTIMPL; return E_NOTIMPL;
} }

View file

@ -5,7 +5,7 @@ function ok(b,m) {
return external.ok(b, m); return external.ok(b, m);
} }
function nav_back_test() { function nav_parent_test() {
external.trace("Running _parent navigation tests..."); external.trace("Running _parent navigation tests...");
var iframe = document.getElementById("testframe"); var iframe = document.getElementById("testframe");
@ -29,7 +29,7 @@ function nav_back_test() {
} }
function window_navigate_test() { function window_navigate_test() {
external.trace("Runnint window.navigate() tests..."); external.trace("Running window.navigate() tests...");
var iframe = document.getElementById("testframe"); var iframe = document.getElementById("testframe");
@ -43,6 +43,23 @@ function window_navigate_test() {
iframe.contentWindow.navigate("about:blank"); 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() { function detached_src_test() {
var iframe = document.createElement("iframe"); var iframe = document.createElement("iframe");
var onload_called = false; var onload_called = false;
@ -58,8 +75,9 @@ function detached_src_test() {
} }
var tests = [ var tests = [
nav_back_test, nav_parent_test,
window_navigate_test, window_navigate_test,
window_open_self_test,
detached_src_test, detached_src_test,
function() { external.reportSuccess(); } function() { external.reportSuccess(); }
]; ];