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
718a415a
Commit
718a415a
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: Moved parsing external script to OnStopBinding callback.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
2dd15b59
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
19 deletions
+32
-19
script.c
dlls/mshtml/script.c
+32
-19
No files found.
dlls/mshtml/script.c
View file @
718a415a
...
...
@@ -92,6 +92,8 @@ struct ScriptHost {
struct
list
entry
;
};
static
ScriptHost
*
get_elem_script_host
(
HTMLInnerWindow
*
,
HTMLScriptElement
*
);
static
void
set_script_prop
(
ScriptHost
*
script_host
,
DWORD
property
,
VARIANT
*
val
)
{
IActiveScriptProperty
*
script_prop
;
...
...
@@ -807,7 +809,6 @@ typedef struct {
DWORD
size
;
char
*
buf
;
HRESULT
hres
;
}
ScriptBSC
;
static
HRESULT
get_binding_text
(
ScriptBSC
*
bsc
,
WCHAR
**
ret
)
...
...
@@ -841,8 +842,7 @@ static HRESULT get_binding_text(ScriptBSC *bsc, WCHAR **ret)
default:
/* FIXME: Try to use charset from HTTP headers first */
if
(
bsc
->
script_elem
)
cp
=
get_document_charset
(
bsc
->
script_elem
->
element
.
node
.
doc
);
cp
=
get_document_charset
(
bsc
->
script_elem
->
element
.
node
.
doc
);
/* fall through */
case
BOM_UTF8
:
{
DWORD
len
;
...
...
@@ -861,6 +861,29 @@ static HRESULT get_binding_text(ScriptBSC *bsc, WCHAR **ret)
return
S_OK
;
}
static
void
script_file_available
(
ScriptBSC
*
bsc
)
{
HTMLScriptElement
*
script_elem
=
bsc
->
script_elem
;
HTMLInnerWindow
*
window
=
bsc
->
bsc
.
window
;
ScriptHost
*
script_host
;
WCHAR
*
text
;
HRESULT
hres
;
hres
=
get_binding_text
(
bsc
,
&
text
);
if
(
FAILED
(
hres
))
return
;
script_host
=
get_elem_script_host
(
window
,
script_elem
);
if
(
!
script_host
)
{
heap_free
(
text
);
return
;
}
script_elem
->
parsed
=
TRUE
;
parse_elem_text
(
script_host
,
script_elem
,
text
);
heap_free
(
text
);
}
static
inline
ScriptBSC
*
impl_from_BSCallback
(
BSCallback
*
iface
)
{
return
CONTAINING_RECORD
(
iface
,
ScriptBSC
,
bsc
);
...
...
@@ -899,11 +922,14 @@ static HRESULT ScriptBSC_stop_binding(BSCallback *bsc, HRESULT result)
{
ScriptBSC
*
This
=
impl_from_BSCallback
(
bsc
);
This
->
hres
=
result
;
if
(
SUCCEEDED
(
result
)
&&
!
This
->
script_elem
)
result
=
E_UNEXPECTED
;
if
(
SUCCEEDED
(
result
))
{
if
(
This
->
script_elem
->
readystate
==
READYSTATE_LOADING
)
set_script_elem_readystate
(
This
->
script_elem
,
READYSTATE_LOADED
);
script_file_available
(
This
);
}
else
{
FIXME
(
"binding failed %08x
\n
"
,
result
);
heap_free
(
This
->
buf
);
...
...
@@ -973,7 +999,7 @@ static const BSCallbackVtbl ScriptBSCVtbl = {
};
static
HRESULT
bind_script
_to_text
(
HTMLInnerWindow
*
window
,
IUri
*
uri
,
HTMLScriptElement
*
script_elem
,
WCHAR
**
ret
)
static
HRESULT
bind_script
(
HTMLInnerWindow
*
window
,
IUri
*
uri
,
HTMLScriptElement
*
script_elem
)
{
ScriptBSC
*
bsc
;
IMoniker
*
mon
;
...
...
@@ -991,7 +1017,6 @@ static HRESULT bind_script_to_text(HTMLInnerWindow *window, IUri *uri, HTMLScrip
init_bscallback
(
&
bsc
->
bsc
,
&
ScriptBSCVtbl
,
mon
,
0
);
IMoniker_Release
(
mon
);
bsc
->
hres
=
E_FAIL
;
hres
=
IUri_GetScheme
(
uri
,
&
bsc
->
scheme
);
if
(
FAILED
(
hres
))
...
...
@@ -1001,10 +1026,6 @@ static HRESULT bind_script_to_text(HTMLInnerWindow *window, IUri *uri, HTMLScrip
bsc
->
script_elem
=
script_elem
;
hres
=
start_binding
(
window
,
&
bsc
->
bsc
,
NULL
);
if
(
SUCCEEDED
(
hres
))
hres
=
bsc
->
hres
;
if
(
SUCCEEDED
(
hres
))
hres
=
get_binding_text
(
bsc
,
ret
);
IBindStatusCallback_Release
(
&
bsc
->
bsc
.
IBindStatusCallback_iface
);
return
hres
;
...
...
@@ -1012,7 +1033,6 @@ static HRESULT bind_script_to_text(HTMLInnerWindow *window, IUri *uri, HTMLScrip
static
void
parse_extern_script
(
ScriptHost
*
script_host
,
HTMLScriptElement
*
script_elem
,
LPCWSTR
src
)
{
WCHAR
*
text
;
IUri
*
uri
;
HRESULT
hres
;
...
...
@@ -1025,14 +1045,8 @@ static void parse_extern_script(ScriptHost *script_host, HTMLScriptElement *scri
if
(
FAILED
(
hres
))
return
;
hres
=
bind_script
_to_text
(
script_host
->
window
,
uri
,
script_elem
,
&
text
);
hres
=
bind_script
(
script_host
->
window
,
uri
,
script_elem
);
IUri_Release
(
uri
);
if
(
FAILED
(
hres
)
||
!
text
)
return
;
parse_elem_text
(
script_host
,
script_elem
,
text
);
heap_free
(
text
);
}
static
void
parse_inline_script
(
ScriptHost
*
script_host
,
HTMLScriptElement
*
script_elem
)
...
...
@@ -1083,7 +1097,6 @@ static void parse_script_elem(ScriptHost *script_host, HTMLScriptElement *script
if
(
NS_FAILED
(
nsres
))
{
ERR
(
"GetSrc failed: %08x
\n
"
,
nsres
);
}
else
if
(
*
src
)
{
script_elem
->
parsed
=
TRUE
;
parse_extern_script
(
script_host
,
script_elem
,
src
);
}
else
{
parse_inline_script
(
script_host
,
script_elem
);
...
...
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