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
6bf247f9
Commit
6bf247f9
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: Better error handling in create_node calls.
parent
8fb6b02d
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
72 additions
and
33 deletions
+72
-33
htmlcomment.c
dlls/mshtml/htmlcomment.c
+8
-3
htmldoc3.c
dlls/mshtml/htmldoc3.c
+4
-1
htmldoc5.c
dlls/mshtml/htmldoc5.c
+7
-4
htmlnode.c
dlls/mshtml/htmlnode.c
+33
-16
htmltextnode.c
dlls/mshtml/htmltextnode.c
+18
-7
mshtml_private.h
dlls/mshtml/mshtml_private.h
+2
-2
No files found.
dlls/mshtml/htmlcomment.c
View file @
6bf247f9
...
...
@@ -185,9 +185,13 @@ static dispex_static_data_t HTMLCommentElement_dispex = {
HTMLCommentElement_iface_tids
};
H
TMLElement
*
HTMLCommentElement_Create
(
HTMLDocumentNode
*
doc
,
nsIDOMNode
*
nsnode
)
H
RESULT
HTMLCommentElement_Create
(
HTMLDocumentNode
*
doc
,
nsIDOMNode
*
nsnode
,
HTMLElement
**
elem
)
{
HTMLCommentElement
*
ret
=
heap_alloc_zero
(
sizeof
(
*
ret
));
HTMLCommentElement
*
ret
;
ret
=
heap_alloc_zero
(
sizeof
(
*
ret
));
if
(
!
ret
)
return
E_OUTOFMEMORY
;
ret
->
element
.
node
.
vtbl
=
&
HTMLCommentElementImplVtbl
;
ret
->
lpIHTMLCommentElementVtbl
=
&
HTMLCommentElementVtbl
;
...
...
@@ -197,5 +201,6 @@ HTMLElement *HTMLCommentElement_Create(HTMLDocumentNode *doc, nsIDOMNode *nsnode
nsIDOMNode_AddRef
(
nsnode
);
ret
->
element
.
node
.
nsnode
=
nsnode
;
return
&
ret
->
element
;
*
elem
=
&
ret
->
element
;
return
S_OK
;
}
dlls/mshtml/htmldoc3.c
View file @
6bf247f9
...
...
@@ -108,6 +108,7 @@ static HRESULT WINAPI HTMLDocument3_createTextNode(IHTMLDocument3 *iface, BSTR t
HTMLDOMNode
*
node
;
nsAString
text_str
;
nsresult
nsres
;
HRESULT
hres
;
TRACE
(
"(%p)->(%s %p)
\n
"
,
This
,
debugstr_w
(
text
),
newTextNode
);
...
...
@@ -124,8 +125,10 @@ static HRESULT WINAPI HTMLDocument3_createTextNode(IHTMLDocument3 *iface, BSTR t
return
E_FAIL
;
}
node
=
HTMLDOMTextNode_Create
(
This
->
doc_node
,
(
nsIDOMNode
*
)
nstext
);
hres
=
HTMLDOMTextNode_Create
(
This
->
doc_node
,
(
nsIDOMNode
*
)
nstext
,
&
node
);
nsIDOMElement_Release
(
nstext
);
if
(
FAILED
(
hres
))
return
hres
;
*
newTextNode
=
HTMLDOMNODE
(
node
);
IHTMLDOMNode_AddRef
(
HTMLDOMNODE
(
node
));
...
...
dlls/mshtml/htmldoc5.c
View file @
6bf247f9
...
...
@@ -125,9 +125,10 @@ static HRESULT WINAPI HTMLDocument5_createComment(IHTMLDocument5 *iface, BSTR bs
{
HTMLDocument
*
This
=
HTMLDOC5_THIS
(
iface
);
nsIDOMComment
*
nscomment
;
HTML
DOMNode
*
node
;
HTML
Element
*
elem
;
nsAString
str
;
nsresult
nsres
;
HRESULT
hres
;
TRACE
(
"(%p)->(%s %p)
\n
"
,
This
,
debugstr_w
(
bstrdata
),
ppRetNode
);
...
...
@@ -144,11 +145,13 @@ static HRESULT WINAPI HTMLDocument5_createComment(IHTMLDocument5 *iface, BSTR bs
return
E_FAIL
;
}
node
=
&
HTMLCommentElement_Create
(
This
->
doc_node
,
(
nsIDOMNode
*
)
nscomment
)
->
node
;
hres
=
HTMLCommentElement_Create
(
This
->
doc_node
,
(
nsIDOMNode
*
)
nscomment
,
&
elem
)
;
nsIDOMElement_Release
(
nscomment
);
if
(
FAILED
(
hres
))
return
hres
;
*
ppRetNode
=
HTMLDOMNODE
(
node
);
IHTMLDOMNode_AddRef
(
HTMLDOMNODE
(
node
));
*
ppRetNode
=
HTMLDOMNODE
(
&
elem
->
node
);
IHTMLDOMNode_AddRef
(
HTMLDOMNODE
(
&
elem
->
node
));
return
S_OK
;
}
...
...
dlls/mshtml/htmlnode.c
View file @
6bf247f9
...
...
@@ -33,7 +33,7 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
mshtml
);
static
HTMLDOMNode
*
get_node_obj
(
HTMLDocumentNode
*
,
IUnknown
*
);
static
H
TMLDOMNode
*
create_node
(
HTMLDocumentNode
*
,
nsIDOMNode
*
);
static
H
RESULT
create_node
(
HTMLDocumentNode
*
,
nsIDOMNode
*
,
HTMLDOMNode
*
*
);
typedef
struct
{
DispatchEx
dispex
;
...
...
@@ -962,7 +962,12 @@ void HTMLDOMNode_destructor(HTMLDOMNode *This)
static
HRESULT
HTMLDOMNode_clone
(
HTMLDOMNode
*
This
,
nsIDOMNode
*
nsnode
,
HTMLDOMNode
**
ret
)
{
*
ret
=
create_node
(
This
->
doc
,
nsnode
);
HRESULT
hres
;
hres
=
create_node
(
This
->
doc
,
nsnode
,
ret
);
if
(
FAILED
(
hres
))
return
hres
;
IHTMLDOMNode_AddRef
(
HTMLDOMNODE
(
*
ret
));
return
S_OK
;
}
...
...
@@ -988,32 +993,45 @@ void HTMLDOMNode_Init(HTMLDocumentNode *doc, HTMLDOMNode *node, nsIDOMNode *nsno
doc
->
nodes
=
node
;
}
static
H
TMLDOMNode
*
create_node
(
HTMLDocumentNode
*
doc
,
nsIDOMNode
*
nsnode
)
static
H
RESULT
create_node
(
HTMLDocumentNode
*
doc
,
nsIDOMNode
*
nsnode
,
HTMLDOMNode
**
ret
)
{
HTMLDOMNode
*
ret
;
PRUint16
node_type
;
HRESULT
hres
;
nsIDOMNode_GetNodeType
(
nsnode
,
&
node_type
);
switch
(
node_type
)
{
case
ELEMENT_NODE
:
ret
=
&
HTMLElement_Create
(
doc
,
nsnode
,
FALSE
)
->
node
;
*
ret
=
&
HTMLElement_Create
(
doc
,
nsnode
,
FALSE
)
->
node
;
break
;
case
TEXT_NODE
:
ret
=
HTMLDOMTextNode_Create
(
doc
,
nsnode
);
hres
=
HTMLDOMTextNode_Create
(
doc
,
nsnode
,
ret
);
if
(
FAILED
(
hres
))
return
hres
;
break
;
case
COMMENT_NODE
:
ret
=
&
HTMLCommentElement_Create
(
doc
,
nsnode
)
->
node
;
case
COMMENT_NODE
:
{
HTMLElement
*
comment
;
hres
=
HTMLCommentElement_Create
(
doc
,
nsnode
,
&
comment
);
if
(
FAILED
(
hres
))
return
hres
;
*
ret
=
&
comment
->
node
;
break
;
default:
ret
=
heap_alloc_zero
(
sizeof
(
HTMLDOMNode
));
ret
->
vtbl
=
&
HTMLDOMNodeImplVtbl
;
HTMLDOMNode_Init
(
doc
,
ret
,
nsnode
);
}
default:
{
HTMLDOMNode
*
node
;
TRACE
(
"type %d ret %p
\n
"
,
node_type
,
ret
);
node
=
heap_alloc_zero
(
sizeof
(
HTMLDOMNode
));
if
(
!
node
)
return
E_OUTOFMEMORY
;
return
ret
;
node
->
vtbl
=
&
HTMLDOMNodeImplVtbl
;
HTMLDOMNode_Init
(
doc
,
node
,
nsnode
);
*
ret
=
node
;
}
}
TRACE
(
"type %d ret %p
\n
"
,
node_type
,
*
ret
);
return
S_OK
;
}
/*
...
...
@@ -1037,8 +1055,7 @@ HRESULT get_node(HTMLDocumentNode *This, nsIDOMNode *nsnode, BOOL create, HTMLDO
return
S_OK
;
}
*
ret
=
create_node
(
This
,
nsnode
);
return
*
ret
?
S_OK
:
E_OUTOFMEMORY
;
return
create_node
(
This
,
nsnode
,
ret
);
}
/*
...
...
dlls/mshtml/htmltextnode.c
View file @
6bf247f9
...
...
@@ -190,8 +190,12 @@ static void HTMLDOMTextNode_destructor(HTMLDOMNode *iface)
static
HRESULT
HTMLDOMTextNode_clone
(
HTMLDOMNode
*
iface
,
nsIDOMNode
*
nsnode
,
HTMLDOMNode
**
ret
)
{
HTMLDOMTextNode
*
This
=
HTMLTEXT_NODE_THIS
(
iface
);
HRESULT
hres
;
hres
=
HTMLDOMTextNode_Create
(
This
->
node
.
doc
,
nsnode
,
ret
);
if
(
FAILED
(
hres
))
return
hres
;
*
ret
=
HTMLDOMTextNode_Create
(
This
->
node
.
doc
,
nsnode
);
IHTMLDOMNode_AddRef
(
HTMLDOMNODE
(
*
ret
));
return
S_OK
;
}
...
...
@@ -217,21 +221,28 @@ static dispex_static_data_t HTMLDOMTextNode_dispex = {
HTMLDOMTextNode_iface_tids
};
H
TMLDOMNode
*
HTMLDOMTextNode_Create
(
HTMLDocumentNode
*
doc
,
nsIDOMNode
*
ns
node
)
H
RESULT
HTMLDOMTextNode_Create
(
HTMLDocumentNode
*
doc
,
nsIDOMNode
*
nsnode
,
HTMLDOMNode
**
node
)
{
HTMLDOMTextNode
*
ret
;
nsresult
nsres
;
ret
=
heap_alloc_zero
(
sizeof
(
*
ret
));
if
(
!
ret
)
return
E_OUTOFMEMORY
;
ret
->
node
.
vtbl
=
&
HTMLDOMTextNodeImplVtbl
;
ret
->
lpIHTMLDOMTextNodeVtbl
=
&
HTMLDOMTextNodeVtbl
;
init_dispex
(
&
ret
->
node
.
dispex
,
(
IUnknown
*
)
HTMLTEXT
(
ret
),
&
HTMLDOMTextNode_dispex
);
HTMLDOMNode_Init
(
doc
,
&
ret
->
node
,
nsnode
);
nsres
=
nsIDOMNode_QueryInterface
(
nsnode
,
&
IID_nsIDOMText
,
(
void
**
)
&
ret
->
nstext
);
if
(
NS_FAILED
(
nsres
))
if
(
NS_FAILED
(
nsres
))
{
ERR
(
"Could not get nsIDOMText iface: %08x
\n
"
,
nsres
);
heap_free
(
ret
);
return
E_FAIL
;
}
return
&
ret
->
node
;
init_dispex
(
&
ret
->
node
.
dispex
,
(
IUnknown
*
)
HTMLTEXT
(
ret
),
&
HTMLDOMTextNode_dispex
);
HTMLDOMNode_Init
(
doc
,
&
ret
->
node
,
nsnode
);
*
node
=
&
ret
->
node
;
return
S_OK
;
}
dlls/mshtml/mshtml_private.h
View file @
6bf247f9
...
...
@@ -818,10 +818,10 @@ HRESULT get_node_text(HTMLDOMNode*,BSTR*);
HRESULT
create_nselem
(
HTMLDocumentNode
*
,
const
WCHAR
*
,
nsIDOMHTMLElement
**
);
H
TMLDOMNode
*
HTMLDOMTextNode_Create
(
HTMLDocumentNode
*
,
nsIDOMNode
*
);
H
RESULT
HTMLDOMTextNode_Create
(
HTMLDocumentNode
*
,
nsIDOMNode
*
,
HTMLDOMNode
*
*
);
HTMLElement
*
HTMLElement_Create
(
HTMLDocumentNode
*
,
nsIDOMNode
*
,
BOOL
);
H
TMLElement
*
HTMLCommentElement_Create
(
HTMLDocumentNode
*
,
nsIDOMNode
*
);
H
RESULT
HTMLCommentElement_Create
(
HTMLDocumentNode
*
,
nsIDOMNode
*
,
HTMLElement
*
*
);
HTMLElement
*
HTMLAnchorElement_Create
(
HTMLDocumentNode
*
,
nsIDOMHTMLElement
*
);
HTMLElement
*
HTMLBodyElement_Create
(
HTMLDocumentNode
*
,
nsIDOMHTMLElement
*
);
HTMLElement
*
HTMLEmbedElement_Create
(
HTMLDocumentNode
*
,
nsIDOMHTMLElement
*
);
...
...
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