mshtml: Store external script text in HTMLScriptElement object.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
oldstable
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);
}
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)
{
HTMLScriptElement *This = impl_from_HTMLDOMNode(iface);
@ -439,7 +446,7 @@ static void HTMLScriptElement_unlink(HTMLDOMNode *iface)
static const NodeImplVtbl HTMLScriptElementImplVtbl = {
HTMLScriptElement_QI,
HTMLElement_destructor,
HTMLScriptElement_destructor,
HTMLElement_cpc,
HTMLElement_clone,
HTMLElement_handle_event,

View File

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

View File

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