Jacek Caban : mshtml: Store security manager in HTMLWindow instead of HTMLDocumentNode.
Alexandre Julliard
julliard at winehq.org
Tue Mar 29 11:43:06 CDT 2011
Module: wine
Branch: master
Commit: 739ff1208e63ef46dcb11ec0205fc76fc80f5eb6
URL: http://source.winehq.org/git/wine.git/?a=commit;h=739ff1208e63ef46dcb11ec0205fc76fc80f5eb6
Author: Jacek Caban <jacek at codeweavers.com>
Date: Tue Mar 29 12:51:04 2011 +0200
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 f9bc469..f7a70ca 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 695b829..e0d542b 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 83a76b9..a449b18 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 8225d59..3d21475 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;
More information about the wine-cvs
mailing list