mshtml: Store external script text in HTMLScriptElement object.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2016-07-19 18:39:47 +02:00 committed by Alexandre Julliard
parent 718a415aa1
commit f73f884884
3 changed files with 14 additions and 8 deletions

View File

@ -391,6 +391,13 @@ static HRESULT HTMLScriptElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
return HTMLElement_QI(&This->element.node, riid, ppv); return HTMLElement_QI(&This->element.node, riid, ppv);
} }
static void HTMLScriptElement_destructor(HTMLDOMNode *iface)
{
HTMLScriptElement *This = impl_from_HTMLDOMNode(iface);
heap_free(This->src_text);
HTMLElement_destructor(&This->element.node);
}
static HRESULT HTMLScriptElement_get_readystate(HTMLDOMNode *iface, BSTR *p) static HRESULT HTMLScriptElement_get_readystate(HTMLDOMNode *iface, BSTR *p)
{ {
HTMLScriptElement *This = impl_from_HTMLDOMNode(iface); HTMLScriptElement *This = impl_from_HTMLDOMNode(iface);
@ -439,7 +446,7 @@ static void HTMLScriptElement_unlink(HTMLDOMNode *iface)
static const NodeImplVtbl HTMLScriptElementImplVtbl = { static const NodeImplVtbl HTMLScriptElementImplVtbl = {
HTMLScriptElement_QI, HTMLScriptElement_QI,
HTMLElement_destructor, HTMLScriptElement_destructor,
HTMLElement_cpc, HTMLElement_cpc,
HTMLElement_clone, HTMLElement_clone,
HTMLElement_handle_event, HTMLElement_handle_event,

View File

@ -26,6 +26,7 @@ typedef struct {
BOOL parse_on_bind; BOOL parse_on_bind;
BOOL pending_readystatechange_event; BOOL pending_readystatechange_event;
READYSTATE readystate; READYSTATE readystate;
WCHAR *src_text; /* sctipt text downloaded from src */
} HTMLScriptElement; } HTMLScriptElement;
typedef struct { typedef struct {

View File

@ -866,22 +866,20 @@ static void script_file_available(ScriptBSC *bsc)
HTMLScriptElement *script_elem = bsc->script_elem; HTMLScriptElement *script_elem = bsc->script_elem;
HTMLInnerWindow *window = bsc->bsc.window; HTMLInnerWindow *window = bsc->bsc.window;
ScriptHost *script_host; ScriptHost *script_host;
WCHAR *text;
HRESULT hres; HRESULT hres;
hres = get_binding_text(bsc, &text); assert(window != NULL);
hres = get_binding_text(bsc, &script_elem->src_text);
if(FAILED(hres)) if(FAILED(hres))
return; return;
script_host = get_elem_script_host(window, script_elem); script_host = get_elem_script_host(window, script_elem);
if(!script_host) { if(!script_host)
heap_free(text);
return; return;
}
script_elem->parsed = TRUE; script_elem->parsed = TRUE;
parse_elem_text(script_host, script_elem, text); parse_elem_text(script_host, script_elem, script_elem->src_text);
heap_free(text);
} }
static inline ScriptBSC *impl_from_BSCallback(BSCallback *iface) static inline ScriptBSC *impl_from_BSCallback(BSCallback *iface)