Jacek Caban : mshtml: Moved HTMLLocation reference to inner window.

Alexandre Julliard julliard at winehq.org
Tue Aug 14 12:59:52 CDT 2012


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Tue Aug 14 11:29:17 2012 +0200

mshtml: Moved HTMLLocation reference to inner window.

---

 dlls/mshtml/htmllocation.c   |   18 +++++++++---------
 dlls/mshtml/htmlwindow.c     |   19 +++++++++----------
 dlls/mshtml/mshtml_private.h |    8 ++++----
 3 files changed, 22 insertions(+), 23 deletions(-)

diff --git a/dlls/mshtml/htmllocation.c b/dlls/mshtml/htmllocation.c
index 1bcd048..cde1fee 100644
--- a/dlls/mshtml/htmllocation.c
+++ b/dlls/mshtml/htmllocation.c
@@ -37,20 +37,20 @@ WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
 
 static HRESULT get_url(HTMLLocation *This, const WCHAR **ret)
 {
-    if(!This->window || !This->window->url) {
+    if(!This->window || !This->window->base.outer_window || !This->window->base.outer_window->url) {
         FIXME("No current URL\n");
         return E_NOTIMPL;
     }
 
-    *ret = This->window->url;
+    *ret = This->window->base.outer_window->url;
     return S_OK;
 }
 
 static IUri *get_uri(HTMLLocation *This)
 {
-    if(!This->window)
+    if(!This->window || !This->window->base.outer_window)
         return NULL;
-    return This->window->uri;
+    return This->window->base.outer_window->uri;
 }
 
 static HRESULT get_url_components(HTMLLocation *This, URL_COMPONENTSW *url)
@@ -165,12 +165,12 @@ static HRESULT WINAPI HTMLLocation_put_href(IHTMLLocation *iface, BSTR v)
 
     TRACE("(%p)->(%s)\n", This, debugstr_w(v));
 
-    if(!This->window) {
+    if(!This->window || !This->window->base.outer_window) {
         FIXME("No window available\n");
         return E_FAIL;
     }
 
-    return navigate_url(This->window, v, This->window->url);
+    return navigate_url(This->window->base.outer_window, v, This->window->base.outer_window->url);
 }
 
 static HRESULT WINAPI HTMLLocation_get_href(IHTMLLocation *iface, BSTR *p)
@@ -565,12 +565,12 @@ static HRESULT WINAPI HTMLLocation_replace(IHTMLLocation *iface, BSTR bstr)
 
     TRACE("(%p)->(%s)\n", This, debugstr_w(bstr));
 
-    if(!This->window) {
+    if(!This->window || !This->window->base.outer_window) {
         FIXME("No window available\n");
         return E_FAIL;
     }
 
-    return navigate_url(This->window, bstr, This->window->url);
+    return navigate_url(This->window->base.outer_window, bstr, This->window->base.outer_window->url);
 }
 
 static HRESULT WINAPI HTMLLocation_assign(IHTMLLocation *iface, BSTR bstr)
@@ -629,7 +629,7 @@ static dispex_static_data_t HTMLLocation_dispex = {
 };
 
 
-HRESULT HTMLLocation_Create(HTMLOuterWindow *window, HTMLLocation **ret)
+HRESULT HTMLLocation_Create(HTMLInnerWindow *window, HTMLLocation **ret)
 {
     HTMLLocation *location;
 
diff --git a/dlls/mshtml/htmlwindow.c b/dlls/mshtml/htmlwindow.c
index 3884bf8..e9a0625 100644
--- a/dlls/mshtml/htmlwindow.c
+++ b/dlls/mshtml/htmlwindow.c
@@ -61,7 +61,7 @@ static void release_children(HTMLOuterWindow *This)
     }
 }
 
-static HRESULT get_location(HTMLOuterWindow *This, HTMLLocation **ret)
+static HRESULT get_location(HTMLInnerWindow *This, HTMLLocation **ret)
 {
     if(This->location) {
         IHTMLLocation_AddRef(&This->location->IHTMLLocation_iface);
@@ -214,11 +214,6 @@ static void release_outer_window(HTMLOuterWindow *This)
     if(This->frame_element)
         This->frame_element->content_window = NULL;
 
-    if(This->location) {
-        This->location->window = NULL;
-        IHTMLLocation_Release(&This->location->IHTMLLocation_iface);
-    }
-
     This->window_ref->window = NULL;
     windowref_release(This->window_ref);
 
@@ -250,6 +245,11 @@ static void release_inner_window(HTMLInnerWindow *This)
         heap_free(This->global_props[i].name);
     heap_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);
@@ -707,7 +707,7 @@ static HRESULT WINAPI HTMLWindow2_get_location(IHTMLWindow2 *iface, IHTMLLocatio
 
     TRACE("(%p)->(%p)\n", This, p);
 
-    hres = get_location(This->outer_window, &location);
+    hres = get_location(This->inner_window, &location);
     if(FAILED(hres))
         return hres;
 
@@ -2335,7 +2335,7 @@ static HRESULT WINAPI WindowDispEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID
         VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
 {
     HTMLWindow *This = impl_from_IDispatchEx(iface);
-    HTMLOuterWindow *window = This->outer_window;
+    HTMLInnerWindow *window = This->inner_window;
 
     TRACE("(%p)->(%x %x %x %p %p %p %p)\n", This, id, lcid, wFlags, pdp, pvarRes, pei, pspCaller);
 
@@ -2355,8 +2355,7 @@ static HRESULT WINAPI WindowDispEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID
         return hres;
     }
 
-    return IDispatchEx_InvokeEx(&window->base.inner_window->dispex.IDispatchEx_iface, id, lcid, wFlags, pdp, pvarRes,
-            pei, pspCaller);
+    return IDispatchEx_InvokeEx(&window->dispex.IDispatchEx_iface, id, lcid, wFlags, pdp, pvarRes, pei, pspCaller);
 }
 
 static HRESULT WINAPI WindowDispEx_DeleteMemberByName(IDispatchEx *iface, BSTR bstrName, DWORD grfdex)
diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h
index f76ebaf..dee8f90 100644
--- a/dlls/mshtml/mshtml_private.h
+++ b/dlls/mshtml/mshtml_private.h
@@ -323,7 +323,7 @@ struct HTMLLocation {
 
     LONG ref;
 
-    HTMLOuterWindow *window;
+    HTMLInnerWindow *window;
 };
 
 typedef struct {
@@ -371,8 +371,6 @@ struct HTMLOuterWindow {
 
     IInternetSecurityManager *secmgr;
 
-    HTMLLocation *location;
-
     struct list children;
     struct list sibling_entry;
     struct list entry;
@@ -400,6 +398,8 @@ struct HTMLInnerWindow {
 
     LONG task_magic;
 
+    HTMLLocation *location;
+
     IMoniker *mon;
     nsChannelBSC *bscallback;
     struct list bindings;
@@ -713,7 +713,7 @@ HTMLOuterWindow *nswindow_to_window(const nsIDOMWindow*) DECLSPEC_HIDDEN;
 void get_top_window(HTMLOuterWindow*,HTMLOuterWindow**) DECLSPEC_HIDDEN;
 HRESULT HTMLOptionElementFactory_Create(HTMLInnerWindow*,HTMLOptionElementFactory**) DECLSPEC_HIDDEN;
 HRESULT HTMLImageElementFactory_Create(HTMLInnerWindow*,HTMLImageElementFactory**) DECLSPEC_HIDDEN;
-HRESULT HTMLLocation_Create(HTMLOuterWindow*,HTMLLocation**) DECLSPEC_HIDDEN;
+HRESULT HTMLLocation_Create(HTMLInnerWindow*,HTMLLocation**) DECLSPEC_HIDDEN;
 IOmNavigator *OmNavigator_Create(void) DECLSPEC_HIDDEN;
 HRESULT HTMLScreen_Create(IHTMLScreen**) DECLSPEC_HIDDEN;
 HRESULT create_history(IOmHistory**) DECLSPEC_HIDDEN;




More information about the wine-cvs mailing list