Jacek Caban : mshtml: Added beginning IHTMLScriptElement:: put_src implementation.
Alexandre Julliard
julliard at winehq.org
Tue Oct 16 15:27:47 CDT 2012
Module: wine
Branch: master
Commit: 680aca56efab0610ab5b4c698da481a82acaf5c6
URL: http://source.winehq.org/git/wine.git/?a=commit;h=680aca56efab0610ab5b4c698da481a82acaf5c6
Author: Jacek Caban <jacek at codeweavers.com>
Date: Tue Oct 16 17:07:48 2012 +0200
mshtml: Added beginning IHTMLScriptElement::put_src implementation.
---
dlls/mshtml/htmlscript.c | 41 ++++++++++++++++++++++++++++++++++++++++-
dlls/mshtml/mshtml_private.h | 2 ++
dlls/mshtml/mutation.c | 12 ++++++++++--
3 files changed, 52 insertions(+), 3 deletions(-)
diff --git a/dlls/mshtml/htmlscript.c b/dlls/mshtml/htmlscript.c
index d5ae39d..a256663 100644
--- a/dlls/mshtml/htmlscript.c
+++ b/dlls/mshtml/htmlscript.c
@@ -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)
diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h
index d78e6ab..d5f4ce3 100644
--- a/dlls/mshtml/mshtml_private.h
+++ b/dlls/mshtml/mshtml_private.h
@@ -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;
diff --git a/dlls/mshtml/mutation.c b/dlls/mshtml/mutation.c
index 8c45621..da691de 100644
--- a/dlls/mshtml/mutation.c
+++ b/dlls/mshtml/mutation.c
@@ -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);
}
More information about the wine-cvs
mailing list