From 739ff1208e63ef46dcb11ec0205fc76fc80f5eb6 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Tue, 29 Mar 2011 12:51:04 +0200 Subject: [PATCH] mshtml: Store security manager in HTMLWindow instead of HTMLDocumentNode. --- dlls/mshtml/htmldoc.c | 9 --------- dlls/mshtml/htmlwindow.c | 10 ++++++++++ dlls/mshtml/mshtml_private.h | 3 ++- dlls/mshtml/secmgr.c | 6 +++--- 4 files changed, 15 insertions(+), 13 deletions(-) diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c index f9bc469a7eb..f7a70ca22ea 100644 --- a/dlls/mshtml/htmldoc.c +++ b/dlls/mshtml/htmldoc.c @@ -1912,8 +1912,6 @@ static void HTMLDocumentNode_destructor(HTMLDOMNode *iface) release_nsevents(This); if(This->catmgr) ICatInformation_Release(This->catmgr); - if(This->secmgr) - IInternetSecurityManager_Release(This->secmgr); detach_selection(This); detach_ranges(This); @@ -2013,7 +2011,6 @@ static HTMLDocumentNode *alloc_doc_node(HTMLDocumentObj *doc_obj, HTMLWindow *wi HRESULT create_doc_from_nsdoc(nsIDOMHTMLDocument *nsdoc, HTMLDocumentObj *doc_obj, HTMLWindow *window, HTMLDocumentNode **ret) { HTMLDocumentNode *doc; - HRESULT hres; doc = alloc_doc_node(doc_obj, window); if(!doc) @@ -2030,12 +2027,6 @@ HRESULT create_doc_from_nsdoc(nsIDOMHTMLDocument *nsdoc, HTMLDocumentObj *doc_ob doc->node.vtbl = &HTMLDocumentNodeImplVtbl; doc->node.cp_container = &doc->basedoc.cp_container; - hres = CoInternetCreateSecurityManager(NULL, &doc->secmgr, 0); - if(FAILED(hres)) { - htmldoc_release(&doc->basedoc); - return hres; - } - *ret = doc; return S_OK; } diff --git a/dlls/mshtml/htmlwindow.c b/dlls/mshtml/htmlwindow.c index 695b829a537..e0d542be228 100644 --- a/dlls/mshtml/htmlwindow.c +++ b/dlls/mshtml/htmlwindow.c @@ -236,6 +236,9 @@ static ULONG WINAPI HTMLWindow2_Release(IHTMLWindow2 *iface) window_set_docnode(This, NULL); release_children(This); + if(This->secmgr) + IInternetSecurityManager_Release(This->secmgr); + if(This->frame_element) This->frame_element->content_window = NULL; @@ -2217,6 +2220,7 @@ static dispex_static_data_t HTMLWindow_dispex = { HRESULT HTMLWindow_Create(HTMLDocumentObj *doc_obj, nsIDOMWindow *nswindow, HTMLWindow *parent, HTMLWindow **ret) { HTMLWindow *window; + HRESULT hres; window = heap_alloc_zero(sizeof(HTMLWindow)); if(!window) @@ -2251,6 +2255,12 @@ HRESULT HTMLWindow_Create(HTMLDocumentObj *doc_obj, nsIDOMWindow *nswindow, HTML window->readystate = READYSTATE_UNINITIALIZED; list_init(&window->script_hosts); + hres = CoInternetCreateSecurityManager(NULL, &window->secmgr, 0); + if(FAILED(hres)) { + IHTMLWindow2_Release(&window->IHTMLWindow2_iface); + return hres; + } + window->task_magic = get_task_target_magic(); update_window_doc(window); diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index 83a76b9767c..a449b18652e 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -295,6 +295,8 @@ struct HTMLWindow { SCRIPTMODE scriptmode; struct list script_hosts; + IInternetSecurityManager *secmgr; + HTMLOptionElementFactory *option_factory; HTMLImageElementFactory *image_factory; HTMLLocation *location; @@ -611,7 +613,6 @@ struct HTMLDocumentNode { BOOL content_ready; event_target_t *body_event_target; - IInternetSecurityManager *secmgr; ICatInformation *catmgr; nsDocumentEventListener *nsevent_listener; BOOL *event_vector; diff --git a/dlls/mshtml/secmgr.c b/dlls/mshtml/secmgr.c index 8225d59e3df..3d21475b95a 100644 --- a/dlls/mshtml/secmgr.c +++ b/dlls/mshtml/secmgr.c @@ -83,7 +83,7 @@ static HRESULT WINAPI InternetHostSecurityManager_ProcessUrlAction(IInternetHost url = This->basedoc.window->url ? This->basedoc.window->url : about_blankW; - return IInternetSecurityManager_ProcessUrlAction(This->secmgr, url, dwAction, pPolicy, cbPolicy, + return IInternetSecurityManager_ProcessUrlAction(This->basedoc.window->secmgr, url, dwAction, pPolicy, cbPolicy, pContext, cbContext, dwFlags, dwReserved); } @@ -121,7 +121,7 @@ static HRESULT confirm_safety(HTMLDocumentNode *This, const WCHAR *url, struct C /* FIXME: Check URLACTION_ACTIVEX_OVERRIDE_SCRIPT_SAFETY */ - hres = IInternetSecurityManager_ProcessUrlAction(This->secmgr, url, URLACTION_SCRIPT_SAFE_ACTIVEX, + hres = IInternetSecurityManager_ProcessUrlAction(This->basedoc.window->secmgr, url, URLACTION_SCRIPT_SAFE_ACTIVEX, (BYTE*)&policy, sizeof(policy), NULL, 0, 0, 0); if(FAILED(hres) || policy != URLPOLICY_ALLOW) { *ret = URLPOLICY_DISALLOW; @@ -187,7 +187,7 @@ static HRESULT WINAPI InternetHostSecurityManager_QueryCustomPolicy(IInternetHos url = This->basedoc.window->url ? This->basedoc.window->url : about_blankW; - hres = IInternetSecurityManager_QueryCustomPolicy(This->secmgr, url, guidKey, ppPolicy, pcbPolicy, + hres = IInternetSecurityManager_QueryCustomPolicy(This->basedoc.window->secmgr, url, guidKey, ppPolicy, pcbPolicy, pContext, cbContext, dwReserved); if(hres != HRESULT_FROM_WIN32(ERROR_NOT_FOUND)) return hres;