From: Jacek Caban jacek@codeweavers.com
--- dlls/mshtml/htmlscript.h | 2 +- dlls/mshtml/htmlwindow.c | 10 +++++----- dlls/mshtml/mshtml_private.h | 4 ++-- dlls/mshtml/script.c | 10 ++++++++-- 4 files changed, 16 insertions(+), 10 deletions(-)
diff --git a/dlls/mshtml/htmlscript.h b/dlls/mshtml/htmlscript.h index 37a7b8d1f50..6d608d525a1 100644 --- a/dlls/mshtml/htmlscript.h +++ b/dlls/mshtml/htmlscript.h @@ -47,7 +47,7 @@ void doc_insert_script(HTMLInnerWindow*,HTMLScriptElement*,BOOL); IDispatch *script_parse_event(HTMLInnerWindow*,LPCWSTR); HRESULT exec_script(HTMLInnerWindow*,const WCHAR*,const WCHAR*,VARIANT*); void update_browser_script_mode(GeckoBrowser*,IUri*); -BOOL find_global_prop(HTMLInnerWindow*,BSTR,DWORD,ScriptHost**,DISPID*); +BOOL find_global_prop(HTMLInnerWindow*,const WCHAR*,DWORD,ScriptHost**,DISPID*); IDispatch *get_script_disp(ScriptHost*); IActiveScriptSite *get_first_script_site(HTMLInnerWindow*); void initialize_script_global(HTMLInnerWindow*); diff --git a/dlls/mshtml/htmlwindow.c b/dlls/mshtml/htmlwindow.c index e53d9cacd42..b936a9a844a 100644 --- a/dlls/mshtml/htmlwindow.c +++ b/dlls/mshtml/htmlwindow.c @@ -3341,7 +3341,7 @@ static inline DWORD prop_to_dispid(HTMLInnerWindow *This, global_prop_t *prop) return MSHTML_DISPID_CUSTOM_MIN + (prop-This->global_props); }
-HRESULT search_window_props(HTMLInnerWindow *This, BSTR bstrName, DWORD grfdex, DISPID *pid) +HRESULT search_window_props(HTMLInnerWindow *This, const WCHAR *name, DWORD grfdex, DISPID *pid) { DWORD i; ScriptHost *script_host; @@ -3349,16 +3349,16 @@ HRESULT search_window_props(HTMLInnerWindow *This, BSTR bstrName, DWORD grfdex,
for(i=0; i < This->global_prop_cnt; i++) { /* FIXME: case sensitivity */ - if(!wcscmp(This->global_props[i].name, bstrName)) { + if(!wcscmp(This->global_props[i].name, name)) { *pid = MSHTML_DISPID_CUSTOM_MIN+i; return S_OK; } }
- if(find_global_prop(This->base.inner_window, bstrName, grfdex, &script_host, &id)) { + if(find_global_prop(This->base.inner_window, name, grfdex, &script_host, &id)) { global_prop_t *prop;
- prop = alloc_global_prop(This, GLOBAL_SCRIPTVAR, bstrName); + prop = alloc_global_prop(This, GLOBAL_SCRIPTVAR, name); if(!prop) return E_OUTOFMEMORY;
@@ -3774,7 +3774,7 @@ static HRESULT HTMLWindow_get_name(DispatchEx *dispex, DISPID id, BSTR *name) return (*name = SysAllocString(This->global_props[idx].name)) ? S_OK : E_OUTOFMEMORY; }
-static HRESULT HTMLWindow_lookup_dispid(DispatchEx *dispex, BSTR name, DWORD grfdex, DISPID *dispid) +static HRESULT HTMLWindow_lookup_dispid(DispatchEx *dispex, const WCHAR *name, DWORD grfdex, DISPID *dispid) { HTMLInnerWindow *This = impl_from_DispatchEx(dispex);
diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index d79c8b6a24e..620b4986dc6 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -385,7 +385,7 @@ typedef struct { HRESULT (*find_dispid)(DispatchEx*,const WCHAR*,DWORD,DISPID*);
/* Similar to get_dispid, but called before any other lookup */ - HRESULT (*lookup_dispid)(DispatchEx*,BSTR,DWORD,DISPID*); + HRESULT (*lookup_dispid)(DispatchEx*,const WCHAR*,DWORD,DISPID*);
/* These are called when the object implements GetMemberName, InvokeEx, DeleteMemberByDispID and GetNextDispID for custom props */ HRESULT (*get_name)(DispatchEx*,DISPID,BSTR*); @@ -1277,7 +1277,7 @@ HRESULT get_document_node(nsIDOMDocument*,HTMLDocumentNode**);
HTMLElement *unsafe_impl_from_IHTMLElement(IHTMLElement*);
-HRESULT search_window_props(HTMLInnerWindow*,BSTR,DWORD,DISPID*); +HRESULT search_window_props(HTMLInnerWindow*,const WCHAR*,DWORD,DISPID*); HRESULT get_frame_by_name(HTMLOuterWindow*,const WCHAR*,BOOL,HTMLOuterWindow**); HRESULT get_doc_elem_by_id(HTMLDocumentNode*,const WCHAR*,HTMLElement**); HTMLOuterWindow *get_target_window(HTMLOuterWindow*,nsAString*,BOOL*); diff --git a/dlls/mshtml/script.c b/dlls/mshtml/script.c index 6a542defa8c..295c8a0dc15 100644 --- a/dlls/mshtml/script.c +++ b/dlls/mshtml/script.c @@ -1770,13 +1770,17 @@ void bind_event_scripts(HTMLDocumentNode *doc) nsIDOMNodeList_Release(node_list); }
-BOOL find_global_prop(HTMLInnerWindow *window, BSTR name, DWORD flags, ScriptHost **ret_host, DISPID *ret_id) +BOOL find_global_prop(HTMLInnerWindow *window, const WCHAR *name, DWORD flags, ScriptHost **ret_host, DISPID *ret_id) { IDispatchEx *dispex; IDispatch *disp; ScriptHost *iter; + BSTR str; HRESULT hres;
+ if(!(str = SysAllocString(name))) + return E_OUTOFMEMORY; + LIST_FOR_EACH_ENTRY(iter, &window->script_hosts, ScriptHost, entry) { disp = get_script_disp(iter); if(!disp) @@ -1784,7 +1788,7 @@ BOOL find_global_prop(HTMLInnerWindow *window, BSTR name, DWORD flags, ScriptHos
hres = IDispatch_QueryInterface(disp, &IID_IDispatchEx, (void**)&dispex); if(SUCCEEDED(hres)) { - hres = IDispatchEx_GetDispID(dispex, name, flags & (~fdexNameEnsure), ret_id); + hres = IDispatchEx_GetDispID(dispex, str, flags & (~fdexNameEnsure), ret_id); IDispatchEx_Release(dispex); }else { FIXME("No IDispatchEx\n"); @@ -1793,11 +1797,13 @@ BOOL find_global_prop(HTMLInnerWindow *window, BSTR name, DWORD flags, ScriptHos
IDispatch_Release(disp); if(SUCCEEDED(hres)) { + SysFreeString(str); *ret_host = iter; return TRUE; } }
+ SysFreeString(str); return FALSE; }