Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
4503edd6
Commit
4503edd6
authored
Oct 02, 2012
by
Jacek Caban
Committed by
Alexandre Julliard
Oct 02, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mshtml: Store information if script was already parsed in script element object.
parent
a420b5da
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
54 additions
and
28 deletions
+54
-28
htmlscript.c
dlls/mshtml/htmlscript.c
+14
-8
mshtml_private.h
dlls/mshtml/mshtml_private.h
+12
-1
mutation.c
dlls/mshtml/mutation.c
+9
-2
script.c
dlls/mshtml/script.c
+19
-17
No files found.
dlls/mshtml/htmlscript.c
View file @
4503edd6
...
...
@@ -32,14 +32,6 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
mshtml
);
typedef
struct
{
HTMLElement
element
;
IHTMLScriptElement
IHTMLScriptElement_iface
;
nsIDOMHTMLScriptElement
*
nsscript
;
}
HTMLScriptElement
;
static
inline
HTMLScriptElement
*
impl_from_IHTMLScriptElement
(
IHTMLScriptElement
*
iface
)
{
return
CONTAINING_RECORD
(
iface
,
HTMLScriptElement
,
IHTMLScriptElement_iface
);
...
...
@@ -327,6 +319,20 @@ static const NodeImplVtbl HTMLScriptElementImplVtbl = {
HTMLScriptElement_get_readystate
};
HRESULT
script_elem_from_nsscript
(
HTMLDocumentNode
*
doc
,
nsIDOMHTMLScriptElement
*
nsscript
,
HTMLScriptElement
**
ret
)
{
HTMLDOMNode
*
node
;
HRESULT
hres
;
hres
=
get_node
(
doc
,
(
nsIDOMNode
*
)
nsscript
,
TRUE
,
&
node
);
if
(
FAILED
(
hres
))
return
hres
;
assert
(
node
->
vtbl
==
&
HTMLScriptElementImplVtbl
);
*
ret
=
impl_from_HTMLDOMNode
(
node
);
return
S_OK
;
}
static
const
tid_t
HTMLScriptElement_iface_tids
[]
=
{
HTMLELEMENT_TIDS
,
IHTMLScriptElement_tid
,
...
...
dlls/mshtml/mshtml_private.h
View file @
4503edd6
...
...
@@ -741,6 +741,17 @@ void init_binding_ui(HTMLDocumentObj*) DECLSPEC_HIDDEN;
void
HTMLDocumentNode_SecMgr_Init
(
HTMLDocumentNode
*
)
DECLSPEC_HIDDEN
;
typedef
struct
{
HTMLElement
element
;
IHTMLScriptElement
IHTMLScriptElement_iface
;
nsIDOMHTMLScriptElement
*
nsscript
;
BOOL
parsed
;
}
HTMLScriptElement
;
HRESULT
script_elem_from_nsscript
(
HTMLDocumentNode
*
,
nsIDOMHTMLScriptElement
*
,
HTMLScriptElement
**
)
DECLSPEC_HIDDEN
;
HRESULT
HTMLCurrentStyle_Create
(
HTMLElement
*
,
IHTMLCurrentStyle
**
)
DECLSPEC_HIDDEN
;
void
ConnectionPoint_Init
(
ConnectionPoint
*
,
ConnectionPointContainer
*
,
REFIID
,
cp_static_data_t
*
)
DECLSPEC_HIDDEN
;
...
...
@@ -904,7 +915,7 @@ HTMLElement *unsafe_impl_from_IHTMLElement(IHTMLElement*) DECLSPEC_HIDDEN;
void
release_script_hosts
(
HTMLInnerWindow
*
)
DECLSPEC_HIDDEN
;
void
connect_scripts
(
HTMLInnerWindow
*
)
DECLSPEC_HIDDEN
;
void
doc_insert_script
(
HTMLInnerWindow
*
,
nsIDOM
HTMLScriptElement
*
)
DECLSPEC_HIDDEN
;
void
doc_insert_script
(
HTMLInnerWindow
*
,
HTMLScriptElement
*
)
DECLSPEC_HIDDEN
;
IDispatch
*
script_parse_event
(
HTMLInnerWindow
*
,
LPCWSTR
)
DECLSPEC_HIDDEN
;
HRESULT
exec_script
(
HTMLInnerWindow
*
,
const
WCHAR
*
,
const
WCHAR
*
,
VARIANT
*
)
DECLSPEC_HIDDEN
;
void
set_script_mode
(
HTMLOuterWindow
*
,
SCRIPTMODE
)
DECLSPEC_HIDDEN
;
...
...
dlls/mshtml/mutation.c
View file @
4503edd6
...
...
@@ -294,8 +294,10 @@ static nsresult run_end_load(HTMLDocumentNode *This, nsISupports *arg1, nsISuppo
static
nsresult
run_insert_script
(
HTMLDocumentNode
*
doc
,
nsISupports
*
script_iface
,
nsISupports
*
parser_iface
)
{
nsIDOMHTMLScriptElement
*
nsscript
;
HTMLScriptElement
*
script_elem
;
nsIParser
*
nsparser
=
NULL
;
nsresult
nsres
;
HRESULT
hres
;
TRACE
(
"(%p)->(%p)
\n
"
,
doc
,
script_iface
);
...
...
@@ -313,17 +315,22 @@ static nsresult run_insert_script(HTMLDocumentNode *doc, nsISupports *script_ifa
}
}
hres
=
script_elem_from_nsscript
(
doc
,
nsscript
,
&
script_elem
);
nsIDOMHTMLScriptElement_Release
(
nsscript
);
if
(
FAILED
(
hres
))
return
NS_ERROR_FAILURE
;
if
(
nsparser
)
nsIParser_BeginEvaluatingParserInsertedScript
(
nsparser
);
doc_insert_script
(
doc
->
window
,
nsscript
);
doc_insert_script
(
doc
->
window
,
script_elem
);
if
(
nsparser
)
{
nsIParser_EndEvaluatingParserInsertedScript
(
nsparser
);
nsIParser_Release
(
nsparser
);
}
nsIDOMHTMLScriptElement_Release
(
nsscript
);
IHTMLScriptElement_Release
(
&
script_elem
->
IHTMLScriptElement_iface
);
return
NS_OK
;
}
...
...
dlls/mshtml/script.c
View file @
4503edd6
...
...
@@ -731,34 +731,34 @@ static void parse_extern_script(ScriptHost *script_host, LPCWSTR src)
heap_free
(
text
);
}
static
void
parse_inline_script
(
ScriptHost
*
script_host
,
nsIDOMHTMLScriptElement
*
nsscript
)
static
void
parse_inline_script
(
ScriptHost
*
script_host
,
HTMLScriptElement
*
script_elem
)
{
const
PRUnichar
*
text
;
nsAString
text_str
;
nsresult
nsres
;
nsAString_Init
(
&
text_str
,
NULL
);
nsres
=
nsIDOMHTMLScriptElement_GetText
(
script_elem
->
nsscript
,
&
text_str
);
nsAString_GetData
(
&
text_str
,
&
text
);
nsres
=
nsIDOMHTMLScriptElement_GetText
(
nsscript
,
&
text_str
);
if
(
NS_SUCCEEDED
(
nsres
))
{
nsAString_GetData
(
&
text_str
,
&
text
);
parse_text
(
script_host
,
text
);
}
else
{
if
(
NS_FAILED
(
nsres
))
{
ERR
(
"GetText failed: %08x
\n
"
,
nsres
);
}
else
if
(
*
text
)
{
script_elem
->
parsed
=
TRUE
;
parse_text
(
script_host
,
text
);
}
nsAString_Finish
(
&
text_str
);
}
static
void
parse_script_elem
(
ScriptHost
*
script_host
,
nsIDOMHTMLScriptElement
*
nsscript
)
static
void
parse_script_elem
(
ScriptHost
*
script_host
,
HTMLScriptElement
*
script_elem
)
{
nsAString
src_str
,
event_str
;
const
PRUnichar
*
src
;
nsresult
nsres
;
nsAString_Init
(
&
event_str
,
NULL
);
nsres
=
nsIDOMHTMLScriptElement_GetEvent
(
nsscript
,
&
event_str
);
nsres
=
nsIDOMHTMLScriptElement_GetEvent
(
script_elem
->
nsscript
,
&
event_str
);
if
(
NS_SUCCEEDED
(
nsres
))
{
const
PRUnichar
*
event
;
...
...
@@ -774,15 +774,17 @@ static void parse_script_elem(ScriptHost *script_host, nsIDOMHTMLScriptElement *
nsAString_Finish
(
&
event_str
);
nsAString_Init
(
&
src_str
,
NULL
);
nsres
=
nsIDOMHTMLScriptElement_GetSrc
(
nsscript
,
&
src_str
);
nsres
=
nsIDOMHTMLScriptElement_GetSrc
(
script_elem
->
nsscript
,
&
src_str
);
nsAString_GetData
(
&
src_str
,
&
src
);
if
(
NS_FAILED
(
nsres
))
if
(
NS_FAILED
(
nsres
))
{
ERR
(
"GetSrc failed: %08x
\n
"
,
nsres
);
else
if
(
*
src
)
}
else
if
(
*
src
)
{
script_elem
->
parsed
=
TRUE
;
parse_extern_script
(
script_host
,
src
);
else
parse_inline_script
(
script_host
,
nsscript
);
}
else
{
parse_inline_script
(
script_host
,
script_elem
);
}
nsAString_Finish
(
&
src_str
);
}
...
...
@@ -887,12 +889,12 @@ static ScriptHost *get_script_host(HTMLInnerWindow *window, const GUID *guid)
return
create_script_host
(
window
,
guid
);
}
void
doc_insert_script
(
HTMLInnerWindow
*
window
,
nsIDOMHTMLScriptElement
*
nsscript
)
void
doc_insert_script
(
HTMLInnerWindow
*
window
,
HTMLScriptElement
*
script_elem
)
{
ScriptHost
*
script_host
;
GUID
guid
;
if
(
!
get_script_guid
(
window
,
nsscript
,
&
guid
))
{
if
(
!
get_script_guid
(
window
,
script_elem
->
nsscript
,
&
guid
))
{
WARN
(
"Could not find script GUID
\n
"
);
return
;
}
...
...
@@ -908,7 +910,7 @@ void doc_insert_script(HTMLInnerWindow *window, nsIDOMHTMLScriptElement *nsscrip
return
;
if
(
script_host
->
parse
)
parse_script_elem
(
script_host
,
nsscript
);
parse_script_elem
(
script_host
,
script_elem
);
}
IDispatch
*
script_parse_event
(
HTMLInnerWindow
*
window
,
LPCWSTR
text
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment