Commit 680aca56 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Added beginning IHTMLScriptElement::put_src implementation.

parent 51b701c3
......@@ -95,8 +95,47 @@ static HRESULT WINAPI HTMLScriptElement_Invoke(IHTMLScriptElement *iface, DISPID
static HRESULT WINAPI HTMLScriptElement_put_src(IHTMLScriptElement *iface, BSTR v)
{
HTMLScriptElement *This = impl_from_IHTMLScriptElement(iface);
HTMLInnerWindow *window;
nsIDOMNode *parent;
nsAString src_str;
nsresult nsres;
FIXME("(%p)->(%s)\n", This, debugstr_w(v));
return E_NOTIMPL;
if(!This->element.node.doc || !This->element.node.doc->window) {
WARN("no windoow\n");
return E_UNEXPECTED;
}
window = This->element.node.doc->window;
nsAString_InitDepend(&src_str, v);
nsres = nsIDOMHTMLScriptElement_SetSrc(This->nsscript, &src_str);
nsAString_Finish(&src_str);
if(NS_FAILED(nsres)) {
ERR("SetSrc failed: %08x\n", nsres);
return E_FAIL;
}
if(This->parsed) {
WARN("already parsed\n");
return S_OK;
}
if(window->parser_callback_cnt) {
FIXME("execution inside parser not supported\n");
return E_NOTIMPL;
}
nsres = nsIDOMHTMLScriptElement_GetParentNode(This->nsscript, &parent);
if(NS_FAILED(nsres) || !parent) {
FIXME("No parent, not supported detached elements\n");
return E_NOTIMPL;
}
nsIDOMNode_Release(parent);
doc_insert_script(window, This);
return S_OK;
}
static HRESULT WINAPI HTMLScriptElement_get_src(IHTMLScriptElement *iface, BSTR *p)
......
......@@ -399,6 +399,8 @@ struct HTMLInnerWindow {
IOmHistory *history;
IHTMLStorage *session_storage;
unsigned parser_callback_cnt;
global_prop_t *global_props;
DWORD global_prop_cnt;
DWORD global_prop_size;
......
......@@ -298,11 +298,16 @@ static nsresult run_insert_script(HTMLDocumentNode *doc, nsISupports *script_ifa
nsIDOMHTMLScriptElement *nsscript;
HTMLScriptElement *script_elem;
nsIParser *nsparser = NULL;
HTMLInnerWindow *window;
nsresult nsres;
HRESULT hres;
TRACE("(%p)->(%p)\n", doc, script_iface);
window = doc->window;
if(!window)
return NS_OK;
nsres = nsISupports_QueryInterface(script_iface, &IID_nsIDOMHTMLScriptElement, (void**)&nsscript);
if(NS_FAILED(nsres)) {
ERR("Could not get nsIDOMHTMLScriptElement: %08x\n", nsres);
......@@ -322,12 +327,15 @@ static nsresult run_insert_script(HTMLDocumentNode *doc, nsISupports *script_ifa
if(FAILED(hres))
return NS_ERROR_FAILURE;
if(nsparser)
if(nsparser) {
nsIParser_BeginEvaluatingParserInsertedScript(nsparser);
window->parser_callback_cnt++;
}
doc_insert_script(doc->window, script_elem);
doc_insert_script(window, script_elem);
if(nsparser) {
window->parser_callback_cnt--;
nsIParser_EndEvaluatingParserInsertedScript(nsparser);
nsIParser_Release(nsparser);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment