From eeb075dd0e38615f2e1ac9e62adf11f3b3105a82 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Tue, 19 Jul 2016 18:40:04 +0200 Subject: [PATCH] mshtml: Merge parse_extern_script and bind_script. Signed-off-by: Jacek Caban Signed-off-by: Alexandre Julliard --- dlls/mshtml/script.c | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/dlls/mshtml/script.c b/dlls/mshtml/script.c index 3503e6971a2..ab9be3b4419 100644 --- a/dlls/mshtml/script.c +++ b/dlls/mshtml/script.c @@ -997,12 +997,30 @@ static const BSCallbackVtbl ScriptBSCVtbl = { }; -static HRESULT bind_script(HTMLInnerWindow *window, IUri *uri, HTMLScriptElement *script_elem) +static HRESULT load_script(HTMLScriptElement *script_elem, const WCHAR *src) { + HTMLInnerWindow *window; ScriptBSC *bsc; IMoniker *mon; + IUri *uri; HRESULT hres; + static const WCHAR wine_schemaW[] = {'w','i','n','e',':'}; + + if(strlenW(src) > sizeof(wine_schemaW)/sizeof(WCHAR) && !memcmp(src, wine_schemaW, sizeof(wine_schemaW))) + src += sizeof(wine_schemaW)/sizeof(WCHAR); + + TRACE("(%p %s)\n", script_elem, debugstr_w(src)); + + if(!script_elem->element.node.doc || !(window = script_elem->element.node.doc->window)) { + ERR("no window\n"); + return E_UNEXPECTED; + } + + hres = create_uri(src, 0, &uri); + if(FAILED(hres)) + return hres; + hres = CreateURLMonikerEx2(NULL, uri, &mon, URL_MK_UNIFORM); if(FAILED(hres)) return hres; @@ -1029,24 +1047,6 @@ static HRESULT bind_script(HTMLInnerWindow *window, IUri *uri, HTMLScriptElement return hres; } -static void parse_extern_script(ScriptHost *script_host, HTMLScriptElement *script_elem, LPCWSTR src) -{ - IUri *uri; - HRESULT hres; - - static const WCHAR wine_schemaW[] = {'w','i','n','e',':'}; - - if(strlenW(src) > sizeof(wine_schemaW)/sizeof(WCHAR) && !memcmp(src, wine_schemaW, sizeof(wine_schemaW))) - src += sizeof(wine_schemaW)/sizeof(WCHAR); - - hres = create_uri(src, 0, &uri); - if(FAILED(hres)) - return; - - hres = bind_script(script_host->window, uri, script_elem); - IUri_Release(uri); -} - static void parse_inline_script(ScriptHost *script_host, HTMLScriptElement *script_elem) { const PRUnichar *text; @@ -1095,7 +1095,7 @@ static void parse_script_elem(ScriptHost *script_host, HTMLScriptElement *script if(NS_FAILED(nsres)) { ERR("GetSrc failed: %08x\n", nsres); }else if(*src) { - parse_extern_script(script_host, script_elem, src); + load_script(script_elem, src); }else { parse_inline_script(script_host, script_elem); }