mshtml: Store security manager in HTMLWindow instead of HTMLDocumentNode.

This commit is contained in:
Jacek Caban 2011-03-29 12:51:04 +02:00 committed by Alexandre Julliard
parent 643c66ba75
commit 739ff1208e
4 changed files with 15 additions and 13 deletions

View File

@ -1912,8 +1912,6 @@ static void HTMLDocumentNode_destructor(HTMLDOMNode *iface)
release_nsevents(This); release_nsevents(This);
if(This->catmgr) if(This->catmgr)
ICatInformation_Release(This->catmgr); ICatInformation_Release(This->catmgr);
if(This->secmgr)
IInternetSecurityManager_Release(This->secmgr);
detach_selection(This); detach_selection(This);
detach_ranges(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) HRESULT create_doc_from_nsdoc(nsIDOMHTMLDocument *nsdoc, HTMLDocumentObj *doc_obj, HTMLWindow *window, HTMLDocumentNode **ret)
{ {
HTMLDocumentNode *doc; HTMLDocumentNode *doc;
HRESULT hres;
doc = alloc_doc_node(doc_obj, window); doc = alloc_doc_node(doc_obj, window);
if(!doc) if(!doc)
@ -2030,12 +2027,6 @@ HRESULT create_doc_from_nsdoc(nsIDOMHTMLDocument *nsdoc, HTMLDocumentObj *doc_ob
doc->node.vtbl = &HTMLDocumentNodeImplVtbl; doc->node.vtbl = &HTMLDocumentNodeImplVtbl;
doc->node.cp_container = &doc->basedoc.cp_container; 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; *ret = doc;
return S_OK; return S_OK;
} }

View File

@ -236,6 +236,9 @@ static ULONG WINAPI HTMLWindow2_Release(IHTMLWindow2 *iface)
window_set_docnode(This, NULL); window_set_docnode(This, NULL);
release_children(This); release_children(This);
if(This->secmgr)
IInternetSecurityManager_Release(This->secmgr);
if(This->frame_element) if(This->frame_element)
This->frame_element->content_window = NULL; 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) HRESULT HTMLWindow_Create(HTMLDocumentObj *doc_obj, nsIDOMWindow *nswindow, HTMLWindow *parent, HTMLWindow **ret)
{ {
HTMLWindow *window; HTMLWindow *window;
HRESULT hres;
window = heap_alloc_zero(sizeof(HTMLWindow)); window = heap_alloc_zero(sizeof(HTMLWindow));
if(!window) if(!window)
@ -2251,6 +2255,12 @@ HRESULT HTMLWindow_Create(HTMLDocumentObj *doc_obj, nsIDOMWindow *nswindow, HTML
window->readystate = READYSTATE_UNINITIALIZED; window->readystate = READYSTATE_UNINITIALIZED;
list_init(&window->script_hosts); 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(); window->task_magic = get_task_target_magic();
update_window_doc(window); update_window_doc(window);

View File

@ -295,6 +295,8 @@ struct HTMLWindow {
SCRIPTMODE scriptmode; SCRIPTMODE scriptmode;
struct list script_hosts; struct list script_hosts;
IInternetSecurityManager *secmgr;
HTMLOptionElementFactory *option_factory; HTMLOptionElementFactory *option_factory;
HTMLImageElementFactory *image_factory; HTMLImageElementFactory *image_factory;
HTMLLocation *location; HTMLLocation *location;
@ -611,7 +613,6 @@ struct HTMLDocumentNode {
BOOL content_ready; BOOL content_ready;
event_target_t *body_event_target; event_target_t *body_event_target;
IInternetSecurityManager *secmgr;
ICatInformation *catmgr; ICatInformation *catmgr;
nsDocumentEventListener *nsevent_listener; nsDocumentEventListener *nsevent_listener;
BOOL *event_vector; BOOL *event_vector;

View File

@ -83,7 +83,7 @@ static HRESULT WINAPI InternetHostSecurityManager_ProcessUrlAction(IInternetHost
url = This->basedoc.window->url ? This->basedoc.window->url : about_blankW; 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); 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 */ /* 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); (BYTE*)&policy, sizeof(policy), NULL, 0, 0, 0);
if(FAILED(hres) || policy != URLPOLICY_ALLOW) { if(FAILED(hres) || policy != URLPOLICY_ALLOW) {
*ret = URLPOLICY_DISALLOW; *ret = URLPOLICY_DISALLOW;
@ -187,7 +187,7 @@ static HRESULT WINAPI InternetHostSecurityManager_QueryCustomPolicy(IInternetHos
url = This->basedoc.window->url ? This->basedoc.window->url : about_blankW; 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); pContext, cbContext, dwReserved);
if(hres != HRESULT_FROM_WIN32(ERROR_NOT_FOUND)) if(hres != HRESULT_FROM_WIN32(ERROR_NOT_FOUND))
return hres; return hres;