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
339ebdb1
Commit
339ebdb1
authored
Jul 19, 2016
by
Jacek Caban
Committed by
Alexandre Julliard
Jul 20, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mshtml: Use bind_to_tree callback to parse dynamically added scripts.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
acef7258
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
14 deletions
+26
-14
htmlscript.c
dlls/mshtml/htmlscript.c
+20
-1
mutation.c
dlls/mshtml/mutation.c
+1
-11
exectest.html
dlls/mshtml/tests/exectest.html
+5
-2
No files found.
dlls/mshtml/htmlscript.c
View file @
339ebdb1
...
...
@@ -398,6 +398,25 @@ static HRESULT HTMLScriptElement_get_readystate(HTMLDOMNode *iface, BSTR *p)
return
IHTMLScriptElement_get_readyState
(
&
This
->
IHTMLScriptElement_iface
,
p
);
}
static
HRESULT
HTMLScriptElement_bind_to_tree
(
HTMLDOMNode
*
iface
)
{
HTMLScriptElement
*
This
=
impl_from_HTMLDOMNode
(
iface
);
TRACE
(
"(%p)
\n
"
,
This
);
if
(
!
This
->
parse_on_bind
)
return
S_OK
;
if
(
!
This
->
element
.
node
.
doc
||
!
This
->
element
.
node
.
doc
->
window
)
{
ERR
(
"No window
\n
"
);
return
E_UNEXPECTED
;
}
This
->
parse_on_bind
=
FALSE
;
doc_insert_script
(
This
->
element
.
node
.
doc
->
window
,
This
);
return
S_OK
;
}
static
void
HTMLScriptElement_traverse
(
HTMLDOMNode
*
iface
,
nsCycleCollectionTraversalCallback
*
cb
)
{
HTMLScriptElement
*
This
=
impl_from_HTMLDOMNode
(
iface
);
...
...
@@ -433,7 +452,7 @@ static const NodeImplVtbl HTMLScriptElementImplVtbl = {
HTMLScriptElement_get_readystate
,
NULL
,
NULL
,
NULL
,
HTMLScriptElement_bind_to_tree
,
HTMLScriptElement_traverse
,
HTMLScriptElement_unlink
};
...
...
dlls/mshtml/mutation.c
View file @
339ebdb1
...
...
@@ -767,20 +767,10 @@ static void NSAPI nsDocumentObserver_BindToDocument(nsIDocumentObserver *iface,
nsres
=
nsIContent_QueryInterface
(
aContent
,
&
IID_nsIDOMHTMLScriptElement
,
(
void
**
)
&
nsscript
);
if
(
NS_SUCCEEDED
(
nsres
))
{
HTMLScriptElement
*
script_elem
;
HRESULT
hres
;
TRACE
(
"script element
\n
"
);
hres
=
script_elem_from_nsscript
(
This
,
nsscript
,
&
script_elem
);
add_script_runner
(
This
,
run_bind_to_tree
,
(
nsISupports
*
)
nsscript
,
NULL
);
nsIDOMHTMLScriptElement_Release
(
nsscript
);
if
(
FAILED
(
hres
))
return
;
if
(
script_elem
->
parse_on_bind
)
add_script_runner
(
This
,
run_insert_script
,
(
nsISupports
*
)
nsscript
,
NULL
);
IHTMLScriptElement_Release
(
&
script_elem
->
IHTMLScriptElement_iface
);
return
;
}
...
...
dlls/mshtml/tests/exectest.html
View file @
339ebdb1
...
...
@@ -104,17 +104,20 @@ function testPutText2() {
elem
.
text
=
"exec_cnt++;"
;
/* forces evaluation, but src will be executed */
ok
(
exec_cnt
===
0
,
"script exec_cnt "
+
exec_cnt
);
ok
(
extern_cnt
===
6
,
"< extern_cnt = "
+
extern_cnt
+
" expected 6"
);
elem
.
text
=
"exec_cnt++;"
;
/* forces evaluation, but src will be executed */
ok
(
exec_cnt
===
0
,
"script exec_cnt "
+
exec_cnt
);
ok
(
extern_cnt
===
7
,
"< extern_cnt = "
+
extern_cnt
+
" expected 6"
);
elem
=
document
.
createElement
(
"script"
);
exec_cnt
=
0
;
elem
.
text
=
"exec_cnt++;"
;
ok
(
exec_cnt
===
0
,
"script exec_cnt "
+
exec_cnt
);
elem
.
src
=
"externscr.js"
;
ok
(
extern_cnt
===
6
,
"extern_cnt = "
+
extern_cnt
+
" expected 6
"
);
ok
(
extern_cnt
===
7
,
"extern_cnt = "
+
extern_cnt
+
" expected 7
"
);
document
.
body
.
appendChild
(
elem
);
ok
(
exec_cnt
===
0
,
"script exec_cnt "
+
exec_cnt
);
ok
(
extern_cnt
===
7
,
"extern_cnt = "
+
extern_cnt
+
" expected 7
"
);
ok
(
extern_cnt
===
8
,
"extern_cnt = "
+
extern_cnt
+
" expected 8
"
);
}
document
.
body
.
onload
=
function
()
{
...
...
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