mshtml: Added beginning IHTMLScriptElement::put_src implementation.
This commit is contained in:
parent
51b701c3ad
commit
680aca56ef
|
@ -95,8 +95,47 @@ static HRESULT WINAPI HTMLScriptElement_Invoke(IHTMLScriptElement *iface, DISPID
|
||||||
static HRESULT WINAPI HTMLScriptElement_put_src(IHTMLScriptElement *iface, BSTR v)
|
static HRESULT WINAPI HTMLScriptElement_put_src(IHTMLScriptElement *iface, BSTR v)
|
||||||
{
|
{
|
||||||
HTMLScriptElement *This = impl_from_IHTMLScriptElement(iface);
|
HTMLScriptElement *This = impl_from_IHTMLScriptElement(iface);
|
||||||
|
HTMLInnerWindow *window;
|
||||||
|
nsIDOMNode *parent;
|
||||||
|
nsAString src_str;
|
||||||
|
nsresult nsres;
|
||||||
|
|
||||||
FIXME("(%p)->(%s)\n", This, debugstr_w(v));
|
FIXME("(%p)->(%s)\n", This, debugstr_w(v));
|
||||||
|
|
||||||
|
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;
|
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)
|
static HRESULT WINAPI HTMLScriptElement_get_src(IHTMLScriptElement *iface, BSTR *p)
|
||||||
|
|
|
@ -399,6 +399,8 @@ struct HTMLInnerWindow {
|
||||||
IOmHistory *history;
|
IOmHistory *history;
|
||||||
IHTMLStorage *session_storage;
|
IHTMLStorage *session_storage;
|
||||||
|
|
||||||
|
unsigned parser_callback_cnt;
|
||||||
|
|
||||||
global_prop_t *global_props;
|
global_prop_t *global_props;
|
||||||
DWORD global_prop_cnt;
|
DWORD global_prop_cnt;
|
||||||
DWORD global_prop_size;
|
DWORD global_prop_size;
|
||||||
|
|
|
@ -298,11 +298,16 @@ static nsresult run_insert_script(HTMLDocumentNode *doc, nsISupports *script_ifa
|
||||||
nsIDOMHTMLScriptElement *nsscript;
|
nsIDOMHTMLScriptElement *nsscript;
|
||||||
HTMLScriptElement *script_elem;
|
HTMLScriptElement *script_elem;
|
||||||
nsIParser *nsparser = NULL;
|
nsIParser *nsparser = NULL;
|
||||||
|
HTMLInnerWindow *window;
|
||||||
nsresult nsres;
|
nsresult nsres;
|
||||||
HRESULT hres;
|
HRESULT hres;
|
||||||
|
|
||||||
TRACE("(%p)->(%p)\n", doc, script_iface);
|
TRACE("(%p)->(%p)\n", doc, script_iface);
|
||||||
|
|
||||||
|
window = doc->window;
|
||||||
|
if(!window)
|
||||||
|
return NS_OK;
|
||||||
|
|
||||||
nsres = nsISupports_QueryInterface(script_iface, &IID_nsIDOMHTMLScriptElement, (void**)&nsscript);
|
nsres = nsISupports_QueryInterface(script_iface, &IID_nsIDOMHTMLScriptElement, (void**)&nsscript);
|
||||||
if(NS_FAILED(nsres)) {
|
if(NS_FAILED(nsres)) {
|
||||||
ERR("Could not get nsIDOMHTMLScriptElement: %08x\n", 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))
|
if(FAILED(hres))
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
if(nsparser)
|
if(nsparser) {
|
||||||
nsIParser_BeginEvaluatingParserInsertedScript(nsparser);
|
nsIParser_BeginEvaluatingParserInsertedScript(nsparser);
|
||||||
|
window->parser_callback_cnt++;
|
||||||
|
}
|
||||||
|
|
||||||
doc_insert_script(doc->window, script_elem);
|
doc_insert_script(window, script_elem);
|
||||||
|
|
||||||
if(nsparser) {
|
if(nsparser) {
|
||||||
|
window->parser_callback_cnt--;
|
||||||
nsIParser_EndEvaluatingParserInsertedScript(nsparser);
|
nsIParser_EndEvaluatingParserInsertedScript(nsparser);
|
||||||
nsIParser_Release(nsparser);
|
nsIParser_Release(nsparser);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue