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
a8b94a03
Commit
a8b94a03
authored
Dec 01, 2010
by
Jacek Caban
Committed by
Alexandre Julliard
Dec 02, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mshtml: Improved error handling in HTMLElement_Create calls.
parent
0835749a
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
46 additions
and
25 deletions
+46
-25
htmldoc.c
dlls/mshtml/htmldoc.c
+3
-1
htmlelem.c
dlls/mshtml/htmlelem.c
+25
-13
htmlgeneric.c
dlls/mshtml/htmlgeneric.c
+5
-2
htmlimg.c
dlls/mshtml/htmlimg.c
+4
-5
htmlnode.c
dlls/mshtml/htmlnode.c
+7
-2
mshtml_private.h
dlls/mshtml/mshtml_private.h
+2
-2
No files found.
dlls/mshtml/htmldoc.c
View file @
a8b94a03
...
...
@@ -996,8 +996,10 @@ static HRESULT WINAPI HTMLDocument_createElement(IHTMLDocument2 *iface, BSTR eTa
if
(
FAILED
(
hres
))
return
hres
;
elem
=
HTMLElement_Create
(
This
->
doc_node
,
(
nsIDOMNode
*
)
nselem
,
TRUE
);
hres
=
HTMLElement_Create
(
This
->
doc_node
,
(
nsIDOMNode
*
)
nselem
,
TRUE
,
&
elem
);
nsIDOMHTMLElement_Release
(
nselem
);
if
(
FAILED
(
hres
))
return
hres
;
*
newElem
=
HTMLELEM
(
elem
);
IHTMLElement_AddRef
(
HTMLELEM
(
elem
));
...
...
dlls/mshtml/htmlelem.c
View file @
a8b94a03
...
...
@@ -1666,10 +1666,13 @@ HRESULT HTMLElement_clone(HTMLDOMNode *iface, nsIDOMNode *nsnode, HTMLDOMNode **
{
HTMLElement
*
This
=
HTMLELEM_NODE_THIS
(
iface
);
HTMLElement
*
new_elem
;
HRESULT
hres
;
new_elem
=
HTMLElement_Create
(
This
->
node
.
doc
,
nsnode
,
FALSE
);
IHTMLElement_AddRef
(
HTMLELEM
(
new_elem
));
hres
=
HTMLElement_Create
(
This
->
node
.
doc
,
nsnode
,
FALSE
,
&
new_elem
);
if
(
FAILED
(
hres
))
return
hres
;
IHTMLElement_AddRef
(
HTMLELEM
(
new_elem
));
*
ret
=
&
new_elem
->
node
;
return
S_OK
;
}
...
...
@@ -1718,19 +1721,19 @@ void HTMLElement_Init(HTMLElement *This, HTMLDocumentNode *doc, nsIDOMHTMLElemen
ConnectionPointContainer_Init
(
&
This
->
cp_container
,
(
IUnknown
*
)
HTMLELEM
(
This
));
}
H
TMLElement
*
HTMLElement_Create
(
HTMLDocumentNode
*
doc
,
nsIDOMNode
*
nsnode
,
BOOL
use_generic
)
H
RESULT
HTMLElement_Create
(
HTMLDocumentNode
*
doc
,
nsIDOMNode
*
nsnode
,
BOOL
use_generic
,
HTMLElement
**
ret
)
{
nsIDOMHTMLElement
*
nselem
;
HTMLElement
*
ret
=
NULL
;
nsAString
class_name_str
;
const
PRUnichar
*
class_name
;
const
tag_desc_t
*
tag
;
HTMLElement
*
elem
;
nsresult
nsres
;
HRESULT
hres
;
nsres
=
nsIDOMNode_QueryInterface
(
nsnode
,
&
IID_nsIDOMHTMLElement
,
(
void
**
)
&
nselem
);
if
(
NS_FAILED
(
nsres
))
return
NUL
L
;
return
E_FAI
L
;
nsAString_Init
(
&
class_name_str
,
NULL
);
nsIDOMHTMLElement_GetTagName
(
nselem
,
&
class_name_str
);
...
...
@@ -1739,21 +1742,30 @@ HTMLElement *HTMLElement_Create(HTMLDocumentNode *doc, nsIDOMNode *nsnode, BOOL
tag
=
get_tag_desc
(
class_name
);
if
(
tag
)
{
ret
=
tag
->
constructor
(
doc
,
nselem
);
elem
=
tag
->
constructor
(
doc
,
nselem
);
hres
=
elem
?
S_OK
:
E_OUTOFMEMORY
;
}
else
if
(
use_generic
)
{
ret
=
HTMLGenericElement_Create
(
doc
,
ns
elem
);
hres
=
HTMLGenericElement_Create
(
doc
,
nselem
,
&
elem
);
}
else
{
ret
=
heap_alloc_zero
(
sizeof
(
HTMLElement
));
HTMLElement_Init
(
ret
,
doc
,
nselem
,
&
HTMLElement_dispex
);
ret
->
node
.
vtbl
=
&
HTMLElementImplVtbl
;
elem
=
heap_alloc_zero
(
sizeof
(
HTMLElement
));
if
(
elem
)
{
HTMLElement_Init
(
elem
,
doc
,
nselem
,
&
HTMLElement_dispex
);
elem
->
node
.
vtbl
=
&
HTMLElementImplVtbl
;
hres
=
S_OK
;
}
else
{
hres
=
E_OUTOFMEMORY
;
}
}
TRACE
(
"%s ret %p
\n
"
,
debugstr_w
(
class_name
),
ret
);
TRACE
(
"%s ret %p
\n
"
,
debugstr_w
(
class_name
),
elem
);
nsIDOMElement_Release
(
nselem
);
nsAString_Finish
(
&
class_name_str
);
if
(
FAILED
(
hres
))
return
hres
;
return
ret
;
*
ret
=
elem
;
return
S_OK
;
}
/* interface IHTMLFiltersCollection */
...
...
dlls/mshtml/htmlgeneric.c
View file @
a8b94a03
...
...
@@ -166,16 +166,19 @@ static dispex_static_data_t HTMLGenericElement_dispex = {
HTMLGenericElement_iface_tids
};
H
TMLElement
*
HTMLGenericElement_Create
(
HTMLDocumentNode
*
doc
,
nsIDOMHTMLElement
*
ns
elem
)
H
RESULT
HTMLGenericElement_Create
(
HTMLDocumentNode
*
doc
,
nsIDOMHTMLElement
*
nselem
,
HTMLElement
**
elem
)
{
HTMLGenericElement
*
ret
;
ret
=
heap_alloc_zero
(
sizeof
(
HTMLGenericElement
));
if
(
!
ret
)
return
E_OUTOFMEMORY
;
ret
->
lpHTMLGenericElementVtbl
=
&
HTMLGenericElementVtbl
;
ret
->
element
.
node
.
vtbl
=
&
HTMLGenericElementImplVtbl
;
HTMLElement_Init
(
&
ret
->
element
,
doc
,
nselem
,
&
HTMLGenericElement_dispex
);
return
&
ret
->
element
;
*
elem
=
&
ret
->
element
;
return
S_OK
;
}
dlls/mshtml/htmlimg.c
View file @
a8b94a03
...
...
@@ -820,10 +820,11 @@ static HRESULT WINAPI HTMLImageElementFactory_create(IHTMLImageElementFactory *i
if
(
FAILED
(
hres
))
return
hres
;
elem
=
HTMLElement_Create
(
This
->
window
->
doc
,
(
nsIDOMNode
*
)
nselem
,
FALSE
);
if
(
!
elem
)
{
hres
=
HTMLElement_Create
(
This
->
window
->
doc
,
(
nsIDOMNode
*
)
nselem
,
FALSE
,
&
elem
);
nsIDOMHTMLElement_Release
(
nselem
);
if
(
FAILED
(
hres
))
{
ERR
(
"HTMLElement_Create failed
\n
"
);
return
E_FAIL
;
return
hres
;
}
hres
=
IHTMLElement_QueryInterface
(
HTMLELEM
(
elem
),
&
IID_IHTMLImgElement
,
(
void
**
)
&
img
);
...
...
@@ -832,8 +833,6 @@ static HRESULT WINAPI HTMLImageElementFactory_create(IHTMLImageElementFactory *i
return
hres
;
}
nsIDOMHTMLElement_Release
(
nselem
);
l
=
var_to_size
(
&
width
);
if
(
l
)
IHTMLImgElement_put_width
(
img
,
l
);
...
...
dlls/mshtml/htmlnode.c
View file @
a8b94a03
...
...
@@ -1001,9 +1001,14 @@ static HRESULT create_node(HTMLDocumentNode *doc, nsIDOMNode *nsnode, HTMLDOMNod
nsIDOMNode_GetNodeType
(
nsnode
,
&
node_type
);
switch
(
node_type
)
{
case
ELEMENT_NODE
:
*
ret
=
&
HTMLElement_Create
(
doc
,
nsnode
,
FALSE
)
->
node
;
case
ELEMENT_NODE
:
{
HTMLElement
*
elem
;
hres
=
HTMLElement_Create
(
doc
,
nsnode
,
FALSE
,
&
elem
);
if
(
FAILED
(
hres
))
return
hres
;
*
ret
=
&
elem
->
node
;
break
;
}
case
TEXT_NODE
:
hres
=
HTMLDOMTextNode_Create
(
doc
,
nsnode
,
ret
);
if
(
FAILED
(
hres
))
...
...
dlls/mshtml/mshtml_private.h
View file @
a8b94a03
...
...
@@ -820,7 +820,7 @@ HRESULT create_nselem(HTMLDocumentNode*,const WCHAR*,nsIDOMHTMLElement**);
HRESULT
HTMLDOMTextNode_Create
(
HTMLDocumentNode
*
,
nsIDOMNode
*
,
HTMLDOMNode
**
);
H
TMLElement
*
HTMLElement_Create
(
HTMLDocumentNode
*
,
nsIDOMNode
*
,
BOOL
);
H
RESULT
HTMLElement_Create
(
HTMLDocumentNode
*
,
nsIDOMNode
*
,
BOOL
,
HTMLElement
**
);
HRESULT
HTMLCommentElement_Create
(
HTMLDocumentNode
*
,
nsIDOMNode
*
,
HTMLElement
**
);
HTMLElement
*
HTMLAnchorElement_Create
(
HTMLDocumentNode
*
,
nsIDOMHTMLElement
*
);
HTMLElement
*
HTMLBodyElement_Create
(
HTMLDocumentNode
*
,
nsIDOMHTMLElement
*
);
...
...
@@ -838,7 +838,7 @@ HTMLElement *HTMLSelectElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*);
HTMLElement
*
HTMLTable_Create
(
HTMLDocumentNode
*
,
nsIDOMHTMLElement
*
);
HTMLElement
*
HTMLTableRow_Create
(
HTMLDocumentNode
*
,
nsIDOMHTMLElement
*
);
HTMLElement
*
HTMLTextAreaElement_Create
(
HTMLDocumentNode
*
,
nsIDOMHTMLElement
*
);
H
TMLElement
*
HTMLGenericElement_Create
(
HTMLDocumentNode
*
,
nsIDOMHTMLElement
*
);
H
RESULT
HTMLGenericElement_Create
(
HTMLDocumentNode
*
,
nsIDOMHTMLElement
*
,
HTMLElement
*
*
);
void
HTMLDOMNode_Init
(
HTMLDocumentNode
*
,
HTMLDOMNode
*
,
nsIDOMNode
*
);
void
HTMLElement_Init
(
HTMLElement
*
,
HTMLDocumentNode
*
,
nsIDOMHTMLElement
*
,
dispex_static_data_t
*
);
...
...
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