Commit fc66d0ec authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Get rid of no longer needed windowref_t.

parent 406d66f8
...@@ -138,7 +138,7 @@ HRESULT create_redirect_nschannel(const WCHAR*,nsChannel*,nsChannel**) DECLSPEC_ ...@@ -138,7 +138,7 @@ HRESULT create_redirect_nschannel(const WCHAR*,nsChannel*,nsChannel**) DECLSPEC_
nsresult on_start_uri_open(NSContainer*,nsIURI*,cpp_bool*) DECLSPEC_HIDDEN; nsresult on_start_uri_open(NSContainer*,nsIURI*,cpp_bool*) DECLSPEC_HIDDEN;
HRESULT hlink_frame_navigate(HTMLDocument*,LPCWSTR,nsChannel*,DWORD,BOOL*) DECLSPEC_HIDDEN; HRESULT hlink_frame_navigate(HTMLDocument*,LPCWSTR,nsChannel*,DWORD,BOOL*) DECLSPEC_HIDDEN;
HRESULT create_doc_uri(HTMLOuterWindow*,IUri*,nsWineURI**) DECLSPEC_HIDDEN; HRESULT create_doc_uri(IUri*,nsWineURI**) DECLSPEC_HIDDEN;
HRESULT load_nsuri(HTMLOuterWindow*,nsWineURI*,nsIInputStream*,nsChannelBSC*,DWORD) DECLSPEC_HIDDEN; HRESULT load_nsuri(HTMLOuterWindow*,nsWineURI*,nsIInputStream*,nsChannelBSC*,DWORD) DECLSPEC_HIDDEN;
HRESULT set_moniker(HTMLOuterWindow*,IMoniker*,IUri*,IBindCtx*,nsChannelBSC*,BOOL) DECLSPEC_HIDDEN; HRESULT set_moniker(HTMLOuterWindow*,IMoniker*,IUri*,IBindCtx*,nsChannelBSC*,BOOL) DECLSPEC_HIDDEN;
void prepare_for_binding(HTMLDocument*,IMoniker*,DWORD) DECLSPEC_HIDDEN; void prepare_for_binding(HTMLDocument*,IMoniker*,DWORD) DECLSPEC_HIDDEN;
......
...@@ -238,9 +238,6 @@ static void release_outer_window(HTMLOuterWindow *This) ...@@ -238,9 +238,6 @@ static void release_outer_window(HTMLOuterWindow *This)
if(This->frame_element) if(This->frame_element)
This->frame_element->content_window = NULL; This->frame_element->content_window = NULL;
This->window_ref->window = NULL;
windowref_release(This->window_ref);
if(This->nswindow) if(This->nswindow)
nsIDOMWindow_Release(This->nswindow); nsIDOMWindow_Release(This->nswindow);
if(This->window_proxy) if(This->window_proxy)
...@@ -3554,17 +3551,8 @@ HRESULT HTMLOuterWindow_Create(HTMLDocumentObj *doc_obj, nsIDOMWindow *nswindow, ...@@ -3554,17 +3551,8 @@ HRESULT HTMLOuterWindow_Create(HTMLDocumentObj *doc_obj, nsIDOMWindow *nswindow,
window->base.outer_window = window; window->base.outer_window = window;
window->base.inner_window = NULL; window->base.inner_window = NULL;
window->window_ref = heap_alloc(sizeof(windowref_t));
if(!window->window_ref) {
heap_free(window);
return E_OUTOFMEMORY;
}
window->doc_obj = doc_obj; window->doc_obj = doc_obj;
window->window_ref->window = window;
window->window_ref->ref = 1;
if(nswindow) { if(nswindow) {
nsresult nsres; nsresult nsres;
......
...@@ -453,11 +453,6 @@ typedef struct { ...@@ -453,11 +453,6 @@ typedef struct {
HTMLInnerWindow *window; HTMLInnerWindow *window;
} OmHistory; } OmHistory;
typedef struct {
HTMLOuterWindow *window;
LONG ref;
} windowref_t;
typedef struct nsChannelBSC nsChannelBSC; typedef struct nsChannelBSC nsChannelBSC;
struct HTMLWindow { struct HTMLWindow {
...@@ -483,7 +478,6 @@ struct HTMLWindow { ...@@ -483,7 +478,6 @@ struct HTMLWindow {
struct HTMLOuterWindow { struct HTMLOuterWindow {
HTMLWindow base; HTMLWindow base;
windowref_t *window_ref;
LONG task_magic; LONG task_magic;
HTMLDocumentObj *doc_obj; HTMLDocumentObj *doc_obj;
...@@ -1321,17 +1315,6 @@ static inline char *heap_strndupWtoU(LPCWSTR str, unsigned len) ...@@ -1321,17 +1315,6 @@ static inline char *heap_strndupWtoU(LPCWSTR str, unsigned len)
return ret; return ret;
} }
static inline void windowref_addref(windowref_t *ref)
{
InterlockedIncrement(&ref->ref);
}
static inline void windowref_release(windowref_t *ref)
{
if(!InterlockedDecrement(&ref->ref))
heap_free(ref);
}
static inline VARIANT_BOOL variant_bool(BOOL b) static inline VARIANT_BOOL variant_bool(BOOL b)
{ {
return b ? VARIANT_TRUE : VARIANT_FALSE; return b ? VARIANT_TRUE : VARIANT_FALSE;
......
...@@ -2442,7 +2442,7 @@ static HRESULT navigate_uri(HTMLOuterWindow *window, IUri *uri, const WCHAR *dis ...@@ -2442,7 +2442,7 @@ static HRESULT navigate_uri(HTMLOuterWindow *window, IUri *uri, const WCHAR *dis
} }
} }
hres = create_doc_uri(window, uri, &nsuri); hres = create_doc_uri(uri, &nsuri);
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
......
...@@ -57,7 +57,6 @@ struct nsWineURI { ...@@ -57,7 +57,6 @@ struct nsWineURI {
LONG ref; LONG ref;
windowref_t *window_ref;
nsChannelBSC *channel_bsc; nsChannelBSC *channel_bsc;
IUri *uri; IUri *uri;
IUriBuilder *uri_builder; IUriBuilder *uri_builder;
...@@ -156,7 +155,7 @@ static HRESULT combine_url(IUri *base_uri, const WCHAR *rel_url, IUri **ret) ...@@ -156,7 +155,7 @@ static HRESULT combine_url(IUri *base_uri, const WCHAR *rel_url, IUri **ret)
return hres; return hres;
} }
static nsresult create_nsuri(IUri*,HTMLOuterWindow*,const char*,nsWineURI**); static nsresult create_nsuri(IUri*,const char*,nsWineURI**);
static const char *debugstr_nsacstr(const nsACString *nsstr) static const char *debugstr_nsacstr(const nsACString *nsstr)
{ {
...@@ -304,7 +303,7 @@ HRESULT load_nsuri(HTMLOuterWindow *window, nsWineURI *uri, nsIInputStream *post ...@@ -304,7 +303,7 @@ HRESULT load_nsuri(HTMLOuterWindow *window, nsWineURI *uri, nsIInputStream *post
if(window->uri_nofrag) { if(window->uri_nofrag) {
nsWineURI *referrer_uri; nsWineURI *referrer_uri;
nsres = create_nsuri(window->uri_nofrag, window, NULL, &referrer_uri); nsres = create_nsuri(window->uri_nofrag, NULL, &referrer_uri);
if(NS_SUCCEEDED(nsres)) { if(NS_SUCCEEDED(nsres)) {
nsres = nsIDocShellLoadInfo_SetReferrer(load_info, (nsIURI*)&referrer_uri->nsIFileURL_iface); nsres = nsIDocShellLoadInfo_SetReferrer(load_info, (nsIURI*)&referrer_uri->nsIFileURL_iface);
assert(nsres == NS_OK); assert(nsres == NS_OK);
...@@ -329,23 +328,6 @@ HRESULT load_nsuri(HTMLOuterWindow *window, nsWineURI *uri, nsIInputStream *post ...@@ -329,23 +328,6 @@ HRESULT load_nsuri(HTMLOuterWindow *window, nsWineURI *uri, nsIInputStream *post
return S_OK; return S_OK;
} }
static void set_uri_window(nsWineURI *This, HTMLOuterWindow *window)
{
if(This->window_ref) {
if(This->window_ref->window == window)
return;
TRACE("Changing %p -> %p\n", This->window_ref->window, window);
windowref_release(This->window_ref);
}
if(window) {
windowref_addref(window->window_ref);
This->window_ref = window->window_ref;
}else {
This->window_ref = NULL;
}
}
static inline BOOL is_http_channel(nsChannel *This) static inline BOOL is_http_channel(nsChannel *This)
{ {
return This->uri->scheme == URL_SCHEME_HTTP || This->uri->scheme == URL_SCHEME_HTTPS; return This->uri->scheme == URL_SCHEME_HTTP || This->uri->scheme == URL_SCHEME_HTTPS;
...@@ -1062,8 +1044,6 @@ static nsresult NSAPI nsChannel_AsyncOpen(nsIHttpChannel *iface, nsIStreamListen ...@@ -1062,8 +1044,6 @@ static nsresult NSAPI nsChannel_AsyncOpen(nsIHttpChannel *iface, nsIStreamListen
} }
is_document_channel = !!(This->load_flags & LOAD_DOCUMENT_URI); is_document_channel = !!(This->load_flags & LOAD_DOCUMENT_URI);
if(is_document_channel)
set_uri_window(This->uri, window);
if(is_document_channel && window == window->doc_obj->basedoc.window) { if(is_document_channel && window == window->doc_obj->basedoc.window) {
if(This->uri->channel_bsc) { if(This->uri->channel_bsc) {
...@@ -2266,8 +2246,6 @@ static nsrefcnt NSAPI nsURI_Release(nsIFileURL *iface) ...@@ -2266,8 +2246,6 @@ static nsrefcnt NSAPI nsURI_Release(nsIFileURL *iface)
TRACE("(%p) ref=%d\n", This, ref); TRACE("(%p) ref=%d\n", This, ref);
if(!ref) { if(!ref) {
if(This->window_ref)
windowref_release(This->window_ref);
if(This->uri) if(This->uri)
IUri_Release(This->uri); IUri_Release(This->uri);
if(This->uri_builder) if(This->uri_builder)
...@@ -2769,8 +2747,7 @@ static nsresult NSAPI nsURI_Clone(nsIFileURL *iface, nsIURI **_retval) ...@@ -2769,8 +2747,7 @@ static nsresult NSAPI nsURI_Clone(nsIFileURL *iface, nsIURI **_retval)
if(!ensure_uri(This)) if(!ensure_uri(This))
return NS_ERROR_UNEXPECTED; return NS_ERROR_UNEXPECTED;
nsres = create_nsuri(This->uri, This->window_ref ? This->window_ref->window : NULL, nsres = create_nsuri(This->uri, This->origin_charset, &wine_uri);
This->origin_charset, &wine_uri);
if(NS_FAILED(nsres)) { if(NS_FAILED(nsres)) {
WARN("create_nsuri failed: %08x\n", nsres); WARN("create_nsuri failed: %08x\n", nsres);
return nsres; return nsres;
...@@ -2952,8 +2929,7 @@ static nsresult NSAPI nsURI_CloneIgnoreRef(nsIFileURL *iface, nsIURI **_retval) ...@@ -2952,8 +2929,7 @@ static nsresult NSAPI nsURI_CloneIgnoreRef(nsIFileURL *iface, nsIURI **_retval)
if(!uri) if(!uri)
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
nsres = create_nsuri(uri, This->window_ref ? This->window_ref->window : NULL, nsres = create_nsuri(uri, This->origin_charset, &wine_uri);
This->origin_charset, &wine_uri);
IUri_Release(uri); IUri_Release(uri);
if(NS_FAILED(nsres)) { if(NS_FAILED(nsres)) {
WARN("create_nsuri failed: %08x\n", nsres); WARN("create_nsuri failed: %08x\n", nsres);
...@@ -3348,8 +3324,7 @@ static const nsIStandardURLVtbl nsStandardURLVtbl = { ...@@ -3348,8 +3324,7 @@ static const nsIStandardURLVtbl nsStandardURLVtbl = {
nsStandardURL_SetDefaultPort nsStandardURL_SetDefaultPort
}; };
static nsresult create_nsuri(IUri *iuri, HTMLOuterWindow *window, static nsresult create_nsuri(IUri *iuri, const char *origin_charset, nsWineURI **_retval)
const char *origin_charset, nsWineURI **_retval)
{ {
nsWineURI *ret; nsWineURI *ret;
HRESULT hres; HRESULT hres;
...@@ -3363,8 +3338,6 @@ static nsresult create_nsuri(IUri *iuri, HTMLOuterWindow *window, ...@@ -3363,8 +3338,6 @@ static nsresult create_nsuri(IUri *iuri, HTMLOuterWindow *window,
ret->ref = 1; ret->ref = 1;
ret->is_mutable = TRUE; ret->is_mutable = TRUE;
set_uri_window(ret, window);
IUri_AddRef(iuri); IUri_AddRef(iuri);
ret->uri = iuri; ret->uri = iuri;
...@@ -3385,12 +3358,12 @@ static nsresult create_nsuri(IUri *iuri, HTMLOuterWindow *window, ...@@ -3385,12 +3358,12 @@ static nsresult create_nsuri(IUri *iuri, HTMLOuterWindow *window,
return NS_OK; return NS_OK;
} }
HRESULT create_doc_uri(HTMLOuterWindow *window, IUri *iuri, nsWineURI **ret) HRESULT create_doc_uri(IUri *iuri, nsWineURI **ret)
{ {
nsWineURI *uri; nsWineURI *uri;
nsresult nsres; nsresult nsres;
nsres = create_nsuri(iuri, window, NULL, &uri); nsres = create_nsuri(iuri, NULL, &uri);
if(NS_FAILED(nsres)) if(NS_FAILED(nsres))
return E_FAIL; return E_FAIL;
...@@ -3428,7 +3401,6 @@ static nsresult create_nschannel(nsWineURI *uri, nsChannel **ret) ...@@ -3428,7 +3401,6 @@ static nsresult create_nschannel(nsWineURI *uri, nsChannel **ret)
HRESULT create_redirect_nschannel(const WCHAR *url, nsChannel *orig_channel, nsChannel **ret) HRESULT create_redirect_nschannel(const WCHAR *url, nsChannel *orig_channel, nsChannel **ret)
{ {
HTMLOuterWindow *window = NULL;
nsChannel *channel; nsChannel *channel;
nsWineURI *uri; nsWineURI *uri;
IUri *iuri; IUri *iuri;
...@@ -3439,9 +3411,7 @@ HRESULT create_redirect_nschannel(const WCHAR *url, nsChannel *orig_channel, nsC ...@@ -3439,9 +3411,7 @@ HRESULT create_redirect_nschannel(const WCHAR *url, nsChannel *orig_channel, nsC
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
if(orig_channel->uri->window_ref) nsres = create_nsuri(iuri, NULL, &uri);
window = orig_channel->uri->window_ref->window;
nsres = create_nsuri(iuri, window, NULL, &uri);
IUri_Release(iuri); IUri_Release(iuri);
if(NS_FAILED(nsres)) if(NS_FAILED(nsres))
return E_FAIL; return E_FAIL;
...@@ -3760,7 +3730,6 @@ static nsresult NSAPI nsIOServiceHook_NewURI(nsIIOServiceHook *iface, const nsAC ...@@ -3760,7 +3730,6 @@ static nsresult NSAPI nsIOServiceHook_NewURI(nsIIOServiceHook *iface, const nsAC
{ {
nsWineURI *wine_uri, *base_wine_uri = NULL; nsWineURI *wine_uri, *base_wine_uri = NULL;
WCHAR new_spec[INTERNET_MAX_URL_LENGTH]; WCHAR new_spec[INTERNET_MAX_URL_LENGTH];
HTMLOuterWindow *window = NULL;
const char *spec = NULL; const char *spec = NULL;
UINT cp = CP_UTF8; UINT cp = CP_UTF8;
IUri *urlmon_uri; IUri *urlmon_uri;
...@@ -3782,8 +3751,6 @@ static nsresult NSAPI nsIOServiceHook_NewURI(nsIIOServiceHook *iface, const nsAC ...@@ -3782,8 +3751,6 @@ static nsresult NSAPI nsIOServiceHook_NewURI(nsIIOServiceHook *iface, const nsAC
if(NS_SUCCEEDED(nsres)) { if(NS_SUCCEEDED(nsres)) {
if(!ensure_uri(base_wine_uri)) if(!ensure_uri(base_wine_uri))
return NS_ERROR_UNEXPECTED; return NS_ERROR_UNEXPECTED;
if(base_wine_uri->window_ref)
window = base_wine_uri->window_ref->window;
}else { }else {
WARN("Could not get base nsWineURI: %08x\n", nsres); WARN("Could not get base nsWineURI: %08x\n", nsres);
} }
...@@ -3817,7 +3784,7 @@ static nsresult NSAPI nsIOServiceHook_NewURI(nsIIOServiceHook *iface, const nsAC ...@@ -3817,7 +3784,7 @@ static nsresult NSAPI nsIOServiceHook_NewURI(nsIIOServiceHook *iface, const nsAC
if(FAILED(hres)) if(FAILED(hres))
return NS_SUCCESS_DEFAULT_ACTION; return NS_SUCCESS_DEFAULT_ACTION;
nsres = create_nsuri(urlmon_uri, window, NULL, &wine_uri); nsres = create_nsuri(urlmon_uri, NULL, &wine_uri);
IUri_Release(urlmon_uri); IUri_Release(urlmon_uri);
if(base_wine_uri) if(base_wine_uri)
nsIFileURL_Release(&base_wine_uri->nsIFileURL_iface); nsIFileURL_Release(&base_wine_uri->nsIFileURL_iface);
......
...@@ -387,7 +387,7 @@ HRESULT set_moniker(HTMLOuterWindow *window, IMoniker *mon, IUri *nav_uri, IBind ...@@ -387,7 +387,7 @@ HRESULT set_moniker(HTMLOuterWindow *window, IMoniker *mon, IUri *nav_uri, IBind
set_ready_state(window, READYSTATE_LOADING); set_ready_state(window, READYSTATE_LOADING);
hres = create_doc_uri(window, uri, &nsuri); hres = create_doc_uri(uri, &nsuri);
if(!nav_uri) if(!nav_uri)
IUri_Release(uri); IUri_Release(uri);
if(SUCCEEDED(hres)) { if(SUCCEEDED(hres)) {
......
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