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
0ef8f70e
Commit
0ef8f70e
authored
Mar 14, 2011
by
Jacek Caban
Committed by
Alexandre Julliard
Mar 14, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mshtml: Properly handle BLOCKED:: URLs in IHTMLImgElement::get_src.
parent
cdb7bc45
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
12 deletions
+48
-12
htmlimg.c
dlls/mshtml/htmlimg.c
+16
-6
dom.c
dlls/mshtml/tests/dom.c
+32
-6
No files found.
dlls/mshtml/htmlimg.c
View file @
0ef8f70e
...
...
@@ -287,21 +287,31 @@ static HRESULT WINAPI HTMLImgElement_get_src(IHTMLImgElement *iface, BSTR *p)
const
PRUnichar
*
src
;
nsAString
src_str
;
nsresult
nsres
;
HRESULT
hres
;
HRESULT
hres
=
S_OK
;
static
const
WCHAR
blockedW
[]
=
{
'B'
,
'L'
,
'O'
,
'C'
,
'K'
,
'E'
,
'D'
,
':'
,
':'
,
0
};
TRACE
(
"(%p)->(%p)
\n
"
,
This
,
p
);
nsAString_Init
(
&
src_str
,
NULL
);
nsres
=
nsIDOMHTMLImageElement_GetSrc
(
This
->
nsimg
,
&
src_str
);
if
(
NS_FAILED
(
nsres
))
{
if
(
NS_SUCCEEDED
(
nsres
))
{
nsAString_GetData
(
&
src_str
,
&
src
);
if
(
!
strncmpiW
(
src
,
blockedW
,
sizeof
(
blockedW
)
/
sizeof
(
WCHAR
)
-
1
))
{
TRACE
(
"returning BLOCKED::
\n
"
);
*
p
=
SysAllocString
(
blockedW
);
if
(
!*
p
)
hres
=
E_OUTOFMEMORY
;
}
else
{
hres
=
nsuri_to_url
(
src
,
TRUE
,
p
);
}
}
else
{
ERR
(
"GetSrc failed: %08x
\n
"
,
nsres
);
return
E_FAIL
;
hres
=
E_FAIL
;
}
nsAString_GetData
(
&
src_str
,
&
src
);
hres
=
nsuri_to_url
(
src
,
TRUE
,
p
);
nsAString_Finish
(
&
src_str
);
return
hres
;
}
...
...
dlls/mshtml/tests/dom.c
View file @
0ef8f70e
...
...
@@ -2161,8 +2161,8 @@ static void _elem_get_scroll_left(unsigned line, IUnknown *unk)
ok
(
l
==
l2
,
"unexpected left %d, expected %d
\n
"
,
l2
,
l
);
}
#define test_img_src(
i,s) _test_img_src(__LINE__,i,s
)
static
void
_test_img_src
(
unsigned
line
,
IUnknown
*
unk
,
const
char
*
exsrc
)
#define test_img_src(
a,b,c) _test_img_src(__LINE__,a,b,c
)
static
void
_test_img_src
(
unsigned
line
,
IUnknown
*
unk
,
const
char
*
exsrc
,
const
char
*
broken_src
)
{
IHTMLImgElement
*
img
=
_get_img_iface
(
line
,
unk
);
BSTR
src
;
...
...
@@ -2171,7 +2171,8 @@ static void _test_img_src(unsigned line, IUnknown *unk, const char *exsrc)
hres
=
IHTMLImgElement_get_src
(
img
,
&
src
);
IHTMLImgElement_Release
(
img
);
ok_
(
__FILE__
,
line
)
(
hres
==
S_OK
,
"get_src failed: %08x
\n
"
,
hres
);
ok_
(
__FILE__
,
line
)
(
!
strcmp_wa
(
src
,
exsrc
),
"get_src returned %s expected %s
\n
"
,
wine_dbgstr_w
(
src
),
exsrc
);
ok_
(
__FILE__
,
line
)
(
!
strcmp_wa
(
src
,
exsrc
)
||
(
broken_src
&&
broken
(
!
strcmp_wa
(
src
,
broken_src
))),
"get_src returned %s expected %s
\n
"
,
wine_dbgstr_w
(
src
),
exsrc
);
SysFreeString
(
src
);
}
...
...
@@ -2187,8 +2188,6 @@ static void _test_img_set_src(unsigned line, IUnknown *unk, const char *src)
IHTMLImgElement_Release
(
img
);
SysFreeString
(
tmp
);
ok_
(
__FILE__
,
line
)
(
hres
==
S_OK
,
"put_src failed: %08x
\n
"
,
hres
);
_test_img_src
(
line
,
unk
,
src
);
}
#define test_img_alt(u,a) _test_img_alt(__LINE__,u,a)
...
...
@@ -6574,8 +6573,9 @@ static void test_elems(IHTMLDocument2 *doc)
elem
=
get_elem_by_id
(
doc
,
"imgid"
,
TRUE
);
if
(
elem
)
{
test_img_src
((
IUnknown
*
)
elem
,
""
);
test_img_src
((
IUnknown
*
)
elem
,
""
,
NULL
);
test_img_set_src
((
IUnknown
*
)
elem
,
"about:blank"
);
test_img_src
((
IUnknown
*
)
elem
,
"about:blank"
,
NULL
);
test_img_alt
((
IUnknown
*
)
elem
,
NULL
);
test_img_set_alt
((
IUnknown
*
)
elem
,
"alt test"
);
test_img_name
((
IUnknown
*
)
elem
,
"WineImg"
);
...
...
@@ -6852,6 +6852,31 @@ static void test_attr(IHTMLElement *elem)
IHTMLDOMAttribute_Release
(
attr
);
}
static
void
test_blocked
(
IHTMLDocument2
*
doc
,
IHTMLElement
*
outer_elem
)
{
IHTMLElement
*
elem
;
test_elem_set_innerhtml
((
IUnknown
*
)
outer_elem
,
"<img id=
\"
imgid
\"
src=
\"
BLOCKED::http://www.winehq.org/img.png
\"
/>"
);
elem
=
get_elem_by_id
(
doc
,
"imgid"
,
TRUE
);
if
(
elem
)
{
test_img_src
((
IUnknown
*
)
elem
,
"BLOCKED::"
,
"blocked::http://www.winehq.org/img.png"
);
IHTMLElement_Release
(
elem
);
}
test_elem_set_innerhtml
((
IUnknown
*
)
outer_elem
,
"<img id=
\"
imgid
\"
src=
\"
BLOCKE::http://www.winehq.org/img.png
\"
/>"
);
elem
=
get_elem_by_id
(
doc
,
"imgid"
,
TRUE
);
if
(
elem
)
{
test_img_src
((
IUnknown
*
)
elem
,
"blocke::http://www.winehq.org/img.png"
,
NULL
);
test_img_set_src
((
IUnknown
*
)
elem
,
"BLOCKED:http://www.winehq.org/img.png"
);
test_img_src
((
IUnknown
*
)
elem
,
"blocked:http://www.winehq.org/img.png"
,
NULL
);
test_img_set_src
((
IUnknown
*
)
elem
,
"blocked::http://www.winehq.org/img.png"
);
test_img_src
((
IUnknown
*
)
elem
,
"BLOCKED::"
,
"blocked::http://www.winehq.org/img.png"
);
IHTMLElement_Release
(
elem
);
}
}
static
void
test_elems2
(
IHTMLDocument2
*
doc
)
{
IHTMLElement
*
elem
,
*
elem2
,
*
div
;
...
...
@@ -6913,6 +6938,7 @@ static void test_elems2(IHTMLDocument2 *doc)
test_attr
(
div
);
test_style_filters
(
div
);
test_blocked
(
doc
,
div
);
IHTMLElement_Release
(
div
);
}
...
...
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