Commit 96d611cb authored by Gabriel Ivăncescu's avatar Gabriel Ivăncescu Committed by Alexandre Julliard

mshtml: Return outer window to external callers.

UIEvent.view is still todo_wine because it returns NULL for some reason, but it is clear from the existing tests that it must match the outer window. Signed-off-by: 's avatarGabriel Ivăncescu <gabrielopcode@gmail.com>
parent 988884a4
......@@ -1338,7 +1338,7 @@ static HRESULT WINAPI DOMUIEvent_get_view(IDOMUIEvent *iface, IHTMLWindow2 **p)
mozIDOMWindowProxy_Release(moz_window);
}
if(view)
IHTMLWindow2_AddRef((*p = &view->base.inner_window->base.IHTMLWindow2_iface));
IHTMLWindow2_AddRef((*p = &view->base.IHTMLWindow2_iface));
else
*p = NULL;
return S_OK;
......
......@@ -504,11 +504,12 @@ static HRESULT WINAPI HTMLWindow2_get_length(IHTMLWindow2 *iface, LONG *p)
static HRESULT WINAPI HTMLWindow2_get_frames(IHTMLWindow2 *iface, IHTMLFramesCollection2 **p)
{
HTMLWindow *This = impl_from_IHTMLWindow2(iface);
FIXME("(%p)->(%p): semi-stub\n", This, p);
/* FIXME: Should return a separate Window object */
*p = (IHTMLFramesCollection2*)&This->IHTMLWindow2_iface;
IHTMLWindow2_AddRef(iface);
*p = (IHTMLFramesCollection2*)&This->outer_window->base.IHTMLWindow2_iface;
IHTMLWindow2_AddRef(&This->outer_window->base.IHTMLWindow2_iface);
return S_OK;
}
......@@ -993,8 +994,8 @@ static HRESULT WINAPI HTMLWindow2_get_self(IHTMLWindow2 *iface, IHTMLWindow2 **p
TRACE("(%p)->(%p)\n", This, p);
/* FIXME: We should return kind of proxy window here. */
IHTMLWindow2_AddRef(&This->IHTMLWindow2_iface);
*p = &This->IHTMLWindow2_iface;
*p = &This->outer_window->base.IHTMLWindow2_iface;
IHTMLWindow2_AddRef(*p);
return S_OK;
}
......@@ -1019,8 +1020,8 @@ static HRESULT WINAPI HTMLWindow2_get_window(IHTMLWindow2 *iface, IHTMLWindow2 *
TRACE("(%p)->(%p)\n", This, p);
/* FIXME: We should return kind of proxy window here. */
IHTMLWindow2_AddRef(&This->IHTMLWindow2_iface);
*p = &This->IHTMLWindow2_iface;
*p = &This->outer_window->base.IHTMLWindow2_iface;
IHTMLWindow2_AddRef(*p);
return S_OK;
}
......@@ -4132,7 +4133,7 @@ static HRESULT HTMLWindow_invoke(DispatchEx *dispex, DISPID id, LCID lcid, WORD
return DISP_E_MEMBERNOTFOUND;
V_VT(res) = VT_DISPATCH;
V_DISPATCH(res) = (IDispatch*)&frame->base.inner_window->base.IHTMLWindow2_iface;
V_DISPATCH(res) = (IDispatch*)&frame->base.IHTMLWindow2_iface;
IDispatch_AddRef(V_DISPATCH(res));
return S_OK;
}
......
......@@ -374,11 +374,11 @@ static HRESULT WINAPI ActiveScriptSite_GetItemInfo(IActiveScriptSite *iface, LPC
if(wcscmp(pstrName, L"window"))
return DISP_E_MEMBERNOTFOUND;
if(!This->window)
if(!This->window || !This->window->base.outer_window)
return E_FAIL;
/* FIXME: Return proxy object */
*ppiunkItem = (IUnknown*)&This->window->base.IHTMLWindow2_iface;
*ppiunkItem = (IUnknown*)&This->window->base.outer_window->base.IHTMLWindow2_iface;
IUnknown_AddRef(*ppiunkItem);
return S_OK;
......
......@@ -7319,9 +7319,10 @@ static void test_window(IHTMLDocument2 *doc)
hres = IHTMLWindow2_get_self(window, &self);
ok(hres == S_OK, "get_self failed: %08lx\n", hres);
ok(window2 != NULL, "self == NULL\n");
ok(self != NULL, "self == NULL\n");
ok(self == window2, "self != window2\n");
todo_wine ok(window != window2, "window == window2\n");
IHTMLWindow2_Release(window2);
......@@ -10931,7 +10932,7 @@ static void test_frames_collection(IHTMLFramesCollection2 *frames, const WCHAR *
static void test_frameset(IHTMLDocument2 *doc)
{
IHTMLWindow2 *window;
IHTMLWindow2 *window, *window2, *self;
IHTMLFramesCollection2 *frames;
IHTMLDocument6 *doc6;
IHTMLElement *elem;
......@@ -10946,6 +10947,16 @@ static void test_frameset(IHTMLDocument2 *doc)
if(FAILED(hres))
return;
hres = IHTMLFramesCollection2_QueryInterface(frames, &IID_IHTMLWindow2, (void**)&window2);
ok(hres == S_OK, "QueryInterface(IID_IHTMLWindow2) failed: 0x%08lx\n", hres);
todo_wine ok(window != window2, "window == window2\n");
hres = IHTMLWindow2_get_self(window, &self);
ok(hres == S_OK, "get_self failed: %08lx\n", hres);
ok(self == window2, "self != window2\n");
IHTMLWindow2_Release(window2);
IHTMLWindow2_Release(self);
test_frames_collection(frames, L"fr1");
IHTMLFramesCollection2_Release(frames);
......
......@@ -3343,6 +3343,7 @@ static void test_doc_obj(IHTMLDocument2 *doc)
IHTMLPerformance *perf, *perf2;
IOmHistory *history, *history2;
IHTMLScreen *screen, *screen2;
IHTMLWindow2 *self, *window2;
IEventTarget *event_target;
DISPPARAMS dp = { 0 };
IHTMLWindow7 *window7;
......@@ -3504,6 +3505,11 @@ static void test_doc_obj(IHTMLDocument2 *doc)
IHTMLWindow7_Release(window7);
VariantClear(&res);
/* Test "proxy" windows as well, they're actually outer window proxies, but not the same */
hres = IHTMLWindow2_get_self(window, &self);
ok(hres == S_OK, "get_self failed: %08lx\n", hres);
ok(self != NULL, "self == NULL\n");
/* Add props to location, since it gets lost on navigation, despite being same object */
bstr = SysAllocString(L"wineTestProp");
hres = IHTMLLocation_QueryInterface(location, &IID_IDispatchEx, (void**)&dispex);
......@@ -3658,6 +3664,12 @@ static void test_doc_obj(IHTMLDocument2 *doc)
IHTMLPerformance_Release(perf);
IHTMLWindow7_Release(window7);
VariantClear(&res);
hres = IHTMLWindow2_get_self(window, &window2);
ok(hres == S_OK, "get_self failed: %08lx\n", hres);
ok(self == window2, "self != window2\n");
IHTMLWindow2_Release(window2);
IHTMLWindow2_Release(self);
}
static void test_create_event(IHTMLDocument2 *doc)
......
......@@ -76,8 +76,8 @@ function test_document_name_as_index() {
ok("iframeid" in window, "iframeid is not in window");
e = document.getElementById("iframeid");
ok(!!e, "e is null");
ok(iframeid != e, "iframeid == e");
ok(iframeid.frameElement === e, "frameid != e.contentWindow");
ok(iframeid === e.contentWindow.self, "frameid != e.contentWindow.self");
ok(iframeid.frameElement === e, "frameid.frameElement != e");
}
function test_remove_style_attribute() {
......
......@@ -4498,7 +4498,6 @@ static void test_exec_script(IHTMLDocument2 *doc, const WCHAR *codew, const WCHA
hres = IHTMLDocument2_get_parentWindow(doc, &window);
ok(hres == S_OK, "get_parentWindow failed: %08lx\n", hres);
todo_wine
ok(iface_cmp((IUnknown *)window, (IUnknown *)window_dispex), "window != dispex_window\n");
code = SysAllocString(codew);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment