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
f6980025
Commit
f6980025
authored
Apr 23, 2012
by
Jacek Caban
Committed by
Alexandre Julliard
Apr 23, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mshtml: Accept different VARIANT types in document_write.
parent
6c2235cf
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
60 additions
and
13 deletions
+60
-13
htmldoc.c
dlls/mshtml/htmldoc.c
+23
-12
dom.c
dlls/mshtml/tests/dom.c
+37
-1
No files found.
dlls/mshtml/htmldoc.c
View file @
f6980025
...
@@ -799,8 +799,8 @@ static HRESULT WINAPI HTMLDocument_get_nameProp(IHTMLDocument2 *iface, BSTR *p)
...
@@ -799,8 +799,8 @@ static HRESULT WINAPI HTMLDocument_get_nameProp(IHTMLDocument2 *iface, BSTR *p)
static
HRESULT
document_write
(
HTMLDocument
*
This
,
SAFEARRAY
*
psarray
,
BOOL
ln
)
static
HRESULT
document_write
(
HTMLDocument
*
This
,
SAFEARRAY
*
psarray
,
BOOL
ln
)
{
{
VARIANT
*
var
,
tmp
;
nsAString
nsstr
;
nsAString
nsstr
;
VARIANT
*
var
;
ULONG
i
,
argc
;
ULONG
i
,
argc
;
nsresult
nsres
;
nsresult
nsres
;
HRESULT
hres
;
HRESULT
hres
;
...
@@ -824,27 +824,38 @@ static HRESULT document_write(HTMLDocument *This, SAFEARRAY *psarray, BOOL ln)
...
@@ -824,27 +824,38 @@ static HRESULT document_write(HTMLDocument *This, SAFEARRAY *psarray, BOOL ln)
return
hres
;
return
hres
;
}
}
nsAString_Init
(
&
nsstr
,
NULL
)
;
V_VT
(
&
tmp
)
=
VT_EMPTY
;
argc
=
psarray
->
rgsabound
[
0
].
cElements
;
argc
=
psarray
->
rgsabound
[
0
].
cElements
;
for
(
i
=
0
;
i
<
argc
;
i
++
)
{
for
(
i
=
0
;
i
<
argc
;
i
++
)
{
if
(
V_VT
(
var
+
i
)
==
VT_BSTR
)
{
if
(
V_VT
(
var
+
i
)
==
VT_BSTR
)
{
nsAString_SetData
(
&
nsstr
,
V_BSTR
(
var
+
i
));
nsAString_InitDepend
(
&
nsstr
,
V_BSTR
(
var
+
i
));
if
(
!
ln
||
i
!=
argc
-
1
)
nsres
=
nsIDOMHTMLDocument_Write
(
This
->
doc_node
->
nsdoc
,
&
nsstr
,
NULL
/* FIXME! */
);
else
nsres
=
nsIDOMHTMLDocument_Writeln
(
This
->
doc_node
->
nsdoc
,
&
nsstr
,
NULL
/* FIXME! */
);
if
(
NS_FAILED
(
nsres
))
ERR
(
"Write failed: %08x
\n
"
,
nsres
);
}
else
{
}
else
{
FIXME
(
"unsupported arg[%d] = %s
\n
"
,
i
,
debugstr_variant
(
var
+
i
));
hres
=
VariantChangeType
(
&
tmp
,
var
+
i
,
0
,
VT_BSTR
);
if
(
FAILED
(
hres
))
{
WARN
(
"Could not convert %s to string
\n
"
,
debugstr_variant
(
var
+
i
));
break
;
}
nsAString_InitDepend
(
&
nsstr
,
V_BSTR
(
&
tmp
));
}
if
(
!
ln
||
i
!=
argc
-
1
)
nsres
=
nsIDOMHTMLDocument_Write
(
This
->
doc_node
->
nsdoc
,
&
nsstr
,
NULL
/* FIXME! */
);
else
nsres
=
nsIDOMHTMLDocument_Writeln
(
This
->
doc_node
->
nsdoc
,
&
nsstr
,
NULL
/* FIXME! */
);
nsAString_Finish
(
&
nsstr
);
if
(
V_VT
(
var
+
i
)
!=
VT_BSTR
)
VariantClear
(
&
tmp
);
if
(
NS_FAILED
(
nsres
))
{
ERR
(
"Write failed: %08x
\n
"
,
nsres
);
hres
=
E_FAIL
;
break
;
}
}
}
}
nsAString_Finish
(
&
nsstr
);
SafeArrayUnaccessData
(
psarray
);
SafeArrayUnaccessData
(
psarray
);
return
S_OK
;
return
hres
;
}
}
static
HRESULT
WINAPI
HTMLDocument_write
(
IHTMLDocument2
*
iface
,
SAFEARRAY
*
psarray
)
static
HRESULT
WINAPI
HTMLDocument_write
(
IHTMLDocument2
*
iface
,
SAFEARRAY
*
psarray
)
...
...
dlls/mshtml/tests/dom.c
View file @
f6980025
...
@@ -4783,6 +4783,34 @@ static void doc_write(IHTMLDocument2 *doc, BOOL ln, const char *text)
...
@@ -4783,6 +4783,34 @@ static void doc_write(IHTMLDocument2 *doc, BOOL ln, const char *text)
SafeArrayDestroy
(
sa
);
SafeArrayDestroy
(
sa
);
}
}
static
void
doc_complex_write
(
IHTMLDocument2
*
doc
)
{
SAFEARRAYBOUND
dim
=
{
5
,
0
};
SAFEARRAY
*
sa
;
VARIANT
*
args
;
HRESULT
hres
;
sa
=
SafeArrayCreate
(
VT_VARIANT
,
1
,
&
dim
);
SafeArrayAccessData
(
sa
,
(
void
**
)
&
args
);
V_VT
(
args
)
=
VT_BSTR
;
V_BSTR
(
args
)
=
a2bstr
(
"<body i4val=
\"
"
);
V_VT
(
args
+
1
)
=
VT_I4
;
V_I4
(
args
+
1
)
=
4
;
V_VT
(
args
+
2
)
=
VT_BSTR
;
V_BSTR
(
args
+
2
)
=
a2bstr
(
"
\"
r8val=
\"
"
);
V_VT
(
args
+
3
)
=
VT_R8
;
V_R8
(
args
+
3
)
=
3
.
14
;
V_VT
(
args
+
4
)
=
VT_BSTR
;
V_BSTR
(
args
+
4
)
=
a2bstr
(
"
\"
>"
);
SafeArrayUnaccessData
(
sa
);
hres
=
IHTMLDocument2_write
(
doc
,
sa
);
ok
(
hres
==
S_OK
,
"write failed: %08x
\n
"
,
hres
);
SafeArrayDestroy
(
sa
);
}
static
void
test_frame_doc
(
IUnknown
*
frame_elem
,
BOOL
iframe
)
static
void
test_frame_doc
(
IUnknown
*
frame_elem
,
BOOL
iframe
)
{
{
IHTMLDocument2
*
window_doc
,
*
elem_doc
;
IHTMLDocument2
*
window_doc
,
*
elem_doc
;
...
@@ -4823,6 +4851,7 @@ static void test_iframe_elem(IHTMLElement *elem)
...
@@ -4823,6 +4851,7 @@ static void test_iframe_elem(IHTMLElement *elem)
IHTMLDocument2
*
content_doc
,
*
owner_doc
;
IHTMLDocument2
*
content_doc
,
*
owner_doc
;
IHTMLElementCollection
*
col
;
IHTMLElementCollection
*
col
;
IHTMLWindow2
*
content_window
;
IHTMLWindow2
*
content_window
;
IHTMLElement
*
body
;
IDispatch
*
disp
;
IDispatch
*
disp
;
VARIANT
errv
;
VARIANT
errv
;
BSTR
str
;
BSTR
str
;
...
@@ -4854,7 +4883,9 @@ static void test_iframe_elem(IHTMLElement *elem)
...
@@ -4854,7 +4883,9 @@ static void test_iframe_elem(IHTMLElement *elem)
ok
(
iface_cmp
((
IUnknown
*
)
disp
,
(
IUnknown
*
)
content_window
),
"disp != content_window
\n
"
);
ok
(
iface_cmp
((
IUnknown
*
)
disp
,
(
IUnknown
*
)
content_window
),
"disp != content_window
\n
"
);
IDispatch_Release
(
disp
);
IDispatch_Release
(
disp
);
doc_write
(
content_doc
,
FALSE
,
"<html><head><title>test</title></head><body><br /></body>"
);
doc_write
(
content_doc
,
FALSE
,
"<html><head><title>test</title></head>"
);
doc_complex_write
(
content_doc
);
doc_write
(
content_doc
,
TRUE
,
"<br />"
);
doc_write
(
content_doc
,
TRUE
,
"</html>"
);
doc_write
(
content_doc
,
TRUE
,
"</html>"
);
hres
=
IHTMLDocument2_get_all
(
content_doc
,
&
col
);
hres
=
IHTMLDocument2_get_all
(
content_doc
,
&
col
);
...
@@ -4862,6 +4893,11 @@ static void test_iframe_elem(IHTMLElement *elem)
...
@@ -4862,6 +4893,11 @@ static void test_iframe_elem(IHTMLElement *elem)
test_elem_collection
((
IUnknown
*
)
col
,
all_types
,
sizeof
(
all_types
)
/
sizeof
(
all_types
[
0
]));
test_elem_collection
((
IUnknown
*
)
col
,
all_types
,
sizeof
(
all_types
)
/
sizeof
(
all_types
[
0
]));
IHTMLElementCollection_Release
(
col
);
IHTMLElementCollection_Release
(
col
);
body
=
doc_get_body
(
content_doc
);
test_elem_attr
(
body
,
"i4val"
,
"4"
);
test_elem_attr
(
body
,
"r8val"
,
"3.14"
);
IHTMLElement_Release
(
body
);
hres
=
IHTMLDocument2_close
(
content_doc
);
hres
=
IHTMLDocument2_close
(
content_doc
);
ok
(
hres
==
S_OK
,
"close failed: %08x
\n
"
,
hres
);
ok
(
hres
==
S_OK
,
"close failed: %08x
\n
"
,
hres
);
...
...
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