From: Gabriel Ivăncescu gabrielopcode@gmail.com
Even in IE9+ modes, it's still a non-JS object.
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/mshtml/htmllocation.c | 31 ++++++++++++++----------------- dlls/mshtml/htmlwindow.c | 16 ++++++++-------- dlls/mshtml/mshtml_private.h | 7 +++---- dlls/mshtml/tests/dom.c | 1 - dlls/mshtml/tests/events.c | 1 - 5 files changed, 25 insertions(+), 31 deletions(-)
diff --git a/dlls/mshtml/htmllocation.c b/dlls/mshtml/htmllocation.c index 066ebb4f5e6..5c31ee02e04 100644 --- a/dlls/mshtml/htmllocation.c +++ b/dlls/mshtml/htmllocation.c @@ -38,18 +38,16 @@ WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
static HRESULT get_url(HTMLLocation *This, const WCHAR **ret) { - if(!This->window || !This->window->base.outer_window || !This->window->base.outer_window->url) + if(!This->window || !This->window->url) *ret = L"about:blank"; else - *ret = This->window->base.outer_window->url; + *ret = This->window->url; return S_OK; }
static IUri *get_uri(HTMLLocation *This) { - if(!This->window || !This->window->base.outer_window) - return NULL; - return This->window->base.outer_window->uri; + return This->window ? This->window->uri : NULL; }
static HRESULT get_url_components(HTMLLocation *This, URL_COMPONENTSW *url) @@ -165,12 +163,12 @@ static HRESULT WINAPI HTMLLocation_put_href(IHTMLLocation *iface, BSTR v)
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
- if(!This->window || !This->window->base.outer_window) { + if(!This->window) { FIXME("No window available\n"); return E_FAIL; }
- return navigate_url(This->window->base.outer_window, v, This->window->base.outer_window->uri, BINDING_NAVIGATED); + return navigate_url(This->window, v, This->window->uri, BINDING_NAVIGATED); }
static HRESULT WINAPI HTMLLocation_get_href(IHTMLLocation *iface, BSTR *p) @@ -523,7 +521,7 @@ static HRESULT WINAPI HTMLLocation_put_hash(IHTMLLocation *iface, BSTR v)
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
- if(!This->window || !This->window->base.outer_window) { + if(!This->window) { FIXME("No window available\n"); return E_FAIL; } @@ -536,7 +534,7 @@ static HRESULT WINAPI HTMLLocation_put_hash(IHTMLLocation *iface, BSTR v) memcpy(hash + 1, v, size - sizeof(WCHAR)); }
- hres = navigate_url(This->window->base.outer_window, hash, This->window->base.outer_window->uri, BINDING_NAVIGATED); + hres = navigate_url(This->window, hash, This->window->uri, BINDING_NAVIGATED);
if(hash != v) free(hash); @@ -585,12 +583,12 @@ static HRESULT WINAPI HTMLLocation_reload(IHTMLLocation *iface, VARIANT_BOOL fla }
/* reload is supposed to fail if called from a script with different origin, but IE doesn't care */ - if(!is_main_content_window(This->window->base.outer_window)) { + if(!is_main_content_window(This->window)) { FIXME("Unsupported on iframe\n"); return E_NOTIMPL; }
- return reload_page(This->window->base.outer_window); + return reload_page(This->window); }
static HRESULT WINAPI HTMLLocation_replace(IHTMLLocation *iface, BSTR bstr) @@ -599,13 +597,12 @@ static HRESULT WINAPI HTMLLocation_replace(IHTMLLocation *iface, BSTR bstr)
TRACE("(%p)->(%s)\n", This, debugstr_w(bstr));
- if(!This->window || !This->window->base.outer_window) { + if(!This->window) { FIXME("No window available\n"); return E_FAIL; }
- return navigate_url(This->window->base.outer_window, bstr, This->window->base.outer_window->uri, - BINDING_NAVIGATED|BINDING_REPLACE); + return navigate_url(This->window, bstr, This->window->uri, BINDING_NAVIGATED | BINDING_REPLACE); }
static HRESULT WINAPI HTMLLocation_assign(IHTMLLocation *iface, BSTR bstr) @@ -659,14 +656,14 @@ static const tid_t HTMLLocation_iface_tids[] = { 0 }; static dispex_static_data_t HTMLLocation_dispex = { - L"Object", + L"Location", NULL, DispHTMLLocation_tid, HTMLLocation_iface_tids };
-HRESULT HTMLLocation_Create(HTMLInnerWindow *window, HTMLLocation **ret) +HRESULT HTMLLocation_Create(HTMLOuterWindow *window, HTMLLocation **ret) { HTMLLocation *location;
@@ -679,7 +676,7 @@ HRESULT HTMLLocation_Create(HTMLInnerWindow *window, HTMLLocation **ret) location->window = window;
init_dispatch(&location->dispex, (IUnknown*)&location->IHTMLLocation_iface, &HTMLLocation_dispex, - dispex_compat_mode(&window->event_target.dispex)); + COMPAT_MODE_QUIRKS);
*ret = location; return S_OK; diff --git a/dlls/mshtml/htmlwindow.c b/dlls/mshtml/htmlwindow.c index c4c6a99f5f3..9f623e77f77 100644 --- a/dlls/mshtml/htmlwindow.c +++ b/dlls/mshtml/htmlwindow.c @@ -67,7 +67,7 @@ static inline BOOL is_outer_window(HTMLWindow *window) return &window->outer_window->base == window; }
-static HRESULT get_location(HTMLInnerWindow *This, HTMLLocation **ret) +static HRESULT get_location(HTMLOuterWindow *This, HTMLLocation **ret) { if(!This->location) { HRESULT hres; @@ -237,6 +237,11 @@ static void release_outer_window(HTMLOuterWindow *This) if(This->base.inner_window) detach_inner_window(This->base.inner_window);
+ if(This->location) { + This->location->window = NULL; + IHTMLLocation_Release(&This->location->IHTMLLocation_iface); + } + if(This->frame_element) This->frame_element->content_window = NULL;
@@ -269,11 +274,6 @@ static void release_inner_window(HTMLInnerWindow *This) free(This->global_props[i].name); free(This->global_props);
- if(This->location) { - This->location->window = NULL; - IHTMLLocation_Release(&This->location->IHTMLLocation_iface); - } - if(This->image_factory) { This->image_factory->window = NULL; IHTMLImageElementFactory_Release(&This->image_factory->IHTMLImageElementFactory_iface); @@ -809,7 +809,7 @@ static HRESULT WINAPI HTMLWindow2_get_location(IHTMLWindow2 *iface, IHTMLLocatio
TRACE("(%p)->(%p)\n", This, p);
- hres = get_location(This->inner_window, &location); + hres = get_location(This->outer_window, &location); if(FAILED(hres)) return hres;
@@ -3922,7 +3922,7 @@ static HRESULT IHTMLWindow2_location_hook(DispatchEx *dispex, WORD flags, DISPPA
TRACE("forwarding to location.href\n");
- hres = get_location(This, &location); + hres = get_location(This->base.outer_window, &location); if(FAILED(hres)) return hres;
diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index 870ba14c8b4..1ce25d5c862 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -493,7 +493,7 @@ struct HTMLLocation {
LONG ref;
- HTMLInnerWindow *window; + HTMLOuterWindow *window; };
typedef struct { @@ -576,6 +576,7 @@ struct HTMLOuterWindow { unsigned readystate_pending;
HTMLInnerWindow *pending_window; + HTMLLocation *location; IMoniker *mon; IUri *uri; IUri *uri_nofrag; @@ -619,8 +620,6 @@ struct HTMLInnerWindow {
LONG task_magic;
- HTMLLocation *location; - IMoniker *mon; nsChannelBSC *bscallback; struct list bindings; @@ -994,7 +993,7 @@ void get_top_window(HTMLOuterWindow*,HTMLOuterWindow**) DECLSPEC_HIDDEN; HRESULT HTMLOptionElementFactory_Create(HTMLInnerWindow*,HTMLOptionElementFactory**) DECLSPEC_HIDDEN; HRESULT HTMLImageElementFactory_Create(HTMLInnerWindow*,HTMLImageElementFactory**) DECLSPEC_HIDDEN; HRESULT HTMLXMLHttpRequestFactory_Create(HTMLInnerWindow*,HTMLXMLHttpRequestFactory**) DECLSPEC_HIDDEN; -HRESULT HTMLLocation_Create(HTMLInnerWindow*,HTMLLocation**) DECLSPEC_HIDDEN; +HRESULT HTMLLocation_Create(HTMLOuterWindow*,HTMLLocation**) DECLSPEC_HIDDEN; HRESULT create_navigator(compat_mode_t,IOmNavigator**) DECLSPEC_HIDDEN; HRESULT create_html_screen(compat_mode_t,IHTMLScreen**) DECLSPEC_HIDDEN; HRESULT create_performance(HTMLInnerWindow*,IHTMLPerformance**) DECLSPEC_HIDDEN; diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c index 2efbbbf513c..7643388a94f 100644 --- a/dlls/mshtml/tests/dom.c +++ b/dlls/mshtml/tests/dom.c @@ -11909,7 +11909,6 @@ static void test_document_mode_lock(void)
hres = IHTMLWindow2_get_location(window, &location2); ok(hres == S_OK, "get_location failed: %08lx\n", hres); - todo_wine ok(location == location2, "location != location2\n"); IHTMLLocation_Release(location2); IHTMLLocation_Release(location); diff --git a/dlls/mshtml/tests/events.c b/dlls/mshtml/tests/events.c index 196ab3160a7..2165410e62d 100644 --- a/dlls/mshtml/tests/events.c +++ b/dlls/mshtml/tests/events.c @@ -3356,7 +3356,6 @@ static void test_doc_obj(IHTMLDocument2 *doc)
hres = IHTMLWindow2_get_location(window, &location2); ok(hres == S_OK, "get_location failed: %08lx\n", hres); - todo_wine ok(location == location2, "location != location2\n"); IHTMLLocation_Release(location2); IHTMLLocation_Release(location);