mshtml: Improved error handling in element constructors.

This commit is contained in:
Jacek Caban 2010-12-01 22:43:14 +01:00 committed by Alexandre Julliard
parent a8b94a0377
commit ecc551b911
18 changed files with 218 additions and 112 deletions

View File

@ -534,19 +534,27 @@ static dispex_static_data_t HTMLAnchorElement_dispex = {
HTMLAnchorElement_iface_tids HTMLAnchorElement_iface_tids
}; };
HTMLElement *HTMLAnchorElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem) HRESULT HTMLAnchorElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLElement **elem)
{ {
HTMLAnchorElement *ret = heap_alloc_zero(sizeof(HTMLAnchorElement)); HTMLAnchorElement *ret;
nsresult nsres; nsresult nsres;
ret = heap_alloc_zero(sizeof(HTMLAnchorElement));
if(!ret)
return E_OUTOFMEMORY;
ret->lpHTMLAnchorElementVtbl = &HTMLAnchorElementVtbl; ret->lpHTMLAnchorElementVtbl = &HTMLAnchorElementVtbl;
ret->element.node.vtbl = &HTMLAnchorElementImplVtbl; ret->element.node.vtbl = &HTMLAnchorElementImplVtbl;
nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLAnchorElement, (void**)&ret->nsanchor);
if(NS_FAILED(nsres)) {
ERR("Could not get nsIDOMHTMLAnchorElement iface: %08x\n", nsres);
heap_free(ret);
return E_FAIL;
}
HTMLElement_Init(&ret->element, doc, nselem, &HTMLAnchorElement_dispex); HTMLElement_Init(&ret->element, doc, nselem, &HTMLAnchorElement_dispex);
nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLAnchorElement, (void**)&ret->nsanchor); *elem = &ret->element;
if(NS_FAILED(nsres)) return S_OK;
ERR("Could not get nsIDOMHTMLAnchorElement iface: %08x\n", nsres);
return &ret->element;
} }

View File

@ -812,24 +812,29 @@ static dispex_static_data_t HTMLBodyElement_dispex = {
HTMLBodyElement_iface_tids HTMLBodyElement_iface_tids
}; };
HTMLElement *HTMLBodyElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem) HRESULT HTMLBodyElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLElement **elem)
{ {
HTMLBodyElement *ret = heap_alloc_zero(sizeof(HTMLBodyElement)); HTMLBodyElement *ret;
nsresult nsres; nsresult nsres;
TRACE("(%p)->(%p)\n", ret, nselem); ret = heap_alloc_zero(sizeof(HTMLBodyElement));
if(!ret)
return E_OUTOFMEMORY;
ret->lpHTMLBodyElementVtbl = &HTMLBodyElementVtbl; ret->lpHTMLBodyElementVtbl = &HTMLBodyElementVtbl;
ret->textcont.element.node.vtbl = &HTMLBodyElementImplVtbl; ret->textcont.element.node.vtbl = &HTMLBodyElementImplVtbl;
nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLBodyElement, (void**)&ret->nsbody);
if(NS_FAILED(nsres)) {
ERR("Could not get nsDOMHTMLBodyElement: %08x\n", nsres);
heap_free(ret);
return E_OUTOFMEMORY;
}
HTMLTextContainer_Init(&ret->textcont, doc, nselem, &HTMLBodyElement_dispex); HTMLTextContainer_Init(&ret->textcont, doc, nselem, &HTMLBodyElement_dispex);
ConnectionPoint_Init(&ret->cp_propnotif, &ret->textcont.element.cp_container, &IID_IPropertyNotifySink, NULL); ConnectionPoint_Init(&ret->cp_propnotif, &ret->textcont.element.cp_container, &IID_IPropertyNotifySink, NULL);
nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLBodyElement, *elem = &ret->textcont.element;
(void**)&ret->nsbody); return S_OK;
if(NS_FAILED(nsres))
ERR("Could not get nsDOMHTMLBodyElement: %08x\n", nsres);
return &ret->textcont.element;
} }

View File

@ -53,7 +53,7 @@ static const WCHAR trW[] = {'T','R',0};
typedef struct { typedef struct {
const WCHAR *name; const WCHAR *name;
HTMLElement *(*constructor)(HTMLDocumentNode*,nsIDOMHTMLElement*); HRESULT (*constructor)(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**);
} tag_desc_t; } tag_desc_t;
static const tag_desc_t tag_descs[] = { static const tag_desc_t tag_descs[] = {
@ -1742,8 +1742,7 @@ HRESULT HTMLElement_Create(HTMLDocumentNode *doc, nsIDOMNode *nsnode, BOOL use_g
tag = get_tag_desc(class_name); tag = get_tag_desc(class_name);
if(tag) { if(tag) {
elem = tag->constructor(doc, nselem); hres = tag->constructor(doc, nselem, &elem);
hres = elem ? S_OK : E_OUTOFMEMORY;
}else if(use_generic) { }else if(use_generic) {
hres = HTMLGenericElement_Create(doc, nselem, &elem); hres = HTMLGenericElement_Create(doc, nselem, &elem);
}else { }else {

View File

@ -267,13 +267,18 @@ static dispex_static_data_t HTMLEmbedElement_dispex = {
HTMLEmbedElement_iface_tids HTMLEmbedElement_iface_tids
}; };
HTMLElement *HTMLEmbedElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem) HRESULT HTMLEmbedElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLElement **elem)
{ {
HTMLEmbedElement *ret = heap_alloc_zero(sizeof(*ret)); HTMLEmbedElement *ret;
ret = heap_alloc_zero(sizeof(*ret));
if(!ret)
return E_OUTOFMEMORY;
ret->lpIHTMLEmbedElementVtbl = &HTMLEmbedElementVtbl; ret->lpIHTMLEmbedElementVtbl = &HTMLEmbedElementVtbl;
ret->element.node.vtbl = &HTMLEmbedElementImplVtbl; ret->element.node.vtbl = &HTMLEmbedElementImplVtbl;
HTMLElement_Init(&ret->element, doc, nselem, &HTMLEmbedElement_dispex); HTMLElement_Init(&ret->element, doc, nselem, &HTMLEmbedElement_dispex);
return &ret->element; *elem = &ret->element;
return S_OK;
} }

View File

@ -663,19 +663,27 @@ static dispex_static_data_t HTMLFormElement_dispex = {
HTMLFormElement_iface_tids HTMLFormElement_iface_tids
}; };
HTMLElement *HTMLFormElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem) HRESULT HTMLFormElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLElement **elem)
{ {
HTMLFormElement *ret = heap_alloc_zero(sizeof(HTMLFormElement)); HTMLFormElement *ret;
nsresult nsres; nsresult nsres;
ret = heap_alloc_zero(sizeof(HTMLFormElement));
if(!ret)
return E_OUTOFMEMORY;
ret->lpHTMLFormElementVtbl = &HTMLFormElementVtbl; ret->lpHTMLFormElementVtbl = &HTMLFormElementVtbl;
ret->element.node.vtbl = &HTMLFormElementImplVtbl; ret->element.node.vtbl = &HTMLFormElementImplVtbl;
nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLFormElement, (void**)&ret->nsform);
if(NS_FAILED(nsres)) {
ERR("Could not get nsIDOMHTMLFormElement interface: %08x\n", nsres);
heap_free(ret);
return E_FAIL;
}
HTMLElement_Init(&ret->element, doc, nselem, &HTMLFormElement_dispex); HTMLElement_Init(&ret->element, doc, nselem, &HTMLFormElement_dispex);
nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLFormElement, (void**)&ret->nsform); *elem = &ret->element;
if(NS_FAILED(nsres)) return S_OK;
ERR("Could not get nsIDOMHTMLFormElement interface: %08x\n", nsres);
return &ret->element;
} }

View File

@ -292,16 +292,19 @@ static dispex_static_data_t HTMLFrameElement_dispex = {
HTMLFrameElement_iface_tids HTMLFrameElement_iface_tids
}; };
HTMLElement *HTMLFrameElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem) HRESULT HTMLFrameElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLElement **elem)
{ {
HTMLFrameElement *ret; HTMLFrameElement *ret;
ret = heap_alloc_zero(sizeof(HTMLFrameElement)); ret = heap_alloc_zero(sizeof(HTMLFrameElement));
if(!ret)
return E_OUTOFMEMORY;
ret->framebase.element.node.vtbl = &HTMLFrameElementImplVtbl; ret->framebase.element.node.vtbl = &HTMLFrameElementImplVtbl;
ret->lpIHTMLFrameElement3Vtbl = &HTMLFrameElement3Vtbl; ret->lpIHTMLFrameElement3Vtbl = &HTMLFrameElement3Vtbl;
HTMLFrameBase_Init(&ret->framebase, doc, nselem, &HTMLFrameElement_dispex); HTMLFrameBase_Init(&ret->framebase, doc, nselem, &HTMLFrameElement_dispex);
return &ret->framebase.element; *elem = &ret->framebase.element;
return S_OK;
} }

View File

@ -270,16 +270,19 @@ static dispex_static_data_t HTMLIFrame_dispex = {
HTMLIFrame_iface_tids HTMLIFrame_iface_tids
}; };
HTMLElement *HTMLIFrame_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem) HRESULT HTMLIFrame_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLElement **elem)
{ {
HTMLIFrame *ret; HTMLIFrame *ret;
ret = heap_alloc_zero(sizeof(HTMLIFrame)); ret = heap_alloc_zero(sizeof(HTMLIFrame));
if(!ret)
return E_OUTOFMEMORY;
ret->lpIHTMLIFrameElementVtbl = &HTMLIFrameElementVtbl; ret->lpIHTMLIFrameElementVtbl = &HTMLIFrameElementVtbl;
ret->framebase.element.node.vtbl = &HTMLIFrameImplVtbl; ret->framebase.element.node.vtbl = &HTMLIFrameImplVtbl;
HTMLFrameBase_Init(&ret->framebase, doc, nselem, &HTMLIFrame_dispex); HTMLFrameBase_Init(&ret->framebase, doc, nselem, &HTMLIFrame_dispex);
return &ret->framebase.element; *elem = &ret->framebase.element;
return S_OK;
} }

View File

@ -666,21 +666,29 @@ static dispex_static_data_t HTMLImgElement_dispex = {
HTMLImgElement_iface_tids HTMLImgElement_iface_tids
}; };
HTMLElement *HTMLImgElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem) HRESULT HTMLImgElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLElement **elem)
{ {
HTMLImgElement *ret = heap_alloc_zero(sizeof(HTMLImgElement)); HTMLImgElement *ret;
nsresult nsres; nsresult nsres;
ret = heap_alloc_zero(sizeof(HTMLImgElement));
if(!ret)
return E_OUTOFMEMORY;
ret->lpHTMLImgElementVtbl = &HTMLImgElementVtbl; ret->lpHTMLImgElementVtbl = &HTMLImgElementVtbl;
ret->element.node.vtbl = &HTMLImgElementImplVtbl; ret->element.node.vtbl = &HTMLImgElementImplVtbl;
nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLImageElement, (void**)&ret->nsimg); nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLImageElement, (void**)&ret->nsimg);
if(NS_FAILED(nsres)) if(NS_FAILED(nsres)) {
ERR("Could not get nsIDOMHTMLImageElement: %08x\n", nsres); ERR("Could not get nsIDOMHTMLImageElement: %08x\n", nsres);
heap_free(ret);
return E_FAIL;
}
HTMLElement_Init(&ret->element, doc, nselem, &HTMLImgElement_dispex); HTMLElement_Init(&ret->element, doc, nselem, &HTMLImgElement_dispex);
return &ret->element; *elem = &ret->element;
return S_OK;
} }
#define HTMLIMGFACTORY_THIS(iface) DEFINE_THIS(HTMLImageElementFactory, HTMLImageElementFactory, iface) #define HTMLIMGFACTORY_THIS(iface) DEFINE_THIS(HTMLImageElementFactory, HTMLImageElementFactory, iface)

View File

@ -1212,21 +1212,28 @@ static dispex_static_data_t HTMLInputElement_dispex = {
HTMLInputElement_iface_tids HTMLInputElement_iface_tids
}; };
HTMLElement *HTMLInputElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem) HRESULT HTMLInputElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLElement **elem)
{ {
HTMLInputElement *ret = heap_alloc_zero(sizeof(HTMLInputElement)); HTMLInputElement *ret;
nsresult nsres; nsresult nsres;
ret = heap_alloc_zero(sizeof(HTMLInputElement));
if(!ret)
return E_OUTOFMEMORY;
ret->lpHTMLInputElementVtbl = &HTMLInputElementVtbl; ret->lpHTMLInputElementVtbl = &HTMLInputElementVtbl;
ret->lpHTMLInputTextElementVtbl = &HTMLInputTextElementVtbl; ret->lpHTMLInputTextElementVtbl = &HTMLInputTextElementVtbl;
ret->element.node.vtbl = &HTMLInputElementImplVtbl; ret->element.node.vtbl = &HTMLInputElementImplVtbl;
nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLInputElement, (void**)&ret->nsinput);
if(NS_FAILED(nsres)) {
ERR("Could not get nsIDOMHTMLInputElement interface: %08x\n", nsres);
heap_free(ret);
return E_FAIL;
}
HTMLElement_Init(&ret->element, doc, nselem, &HTMLInputElement_dispex); HTMLElement_Init(&ret->element, doc, nselem, &HTMLInputElement_dispex);
nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLInputElement, *elem = &ret->element;
(void**)&ret->nsinput); return S_OK;
if(NS_FAILED(nsres))
ERR("Could not get nsIDOMHTMLInputElement interface: %08x\n", nsres);
return &ret->element;
} }

View File

@ -457,19 +457,27 @@ static dispex_static_data_t HTMLObjectElement_dispex = {
HTMLObjectElement_iface_tids HTMLObjectElement_iface_tids
}; };
HTMLElement *HTMLObjectElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem) HRESULT HTMLObjectElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLElement **elem)
{ {
HTMLObjectElement *ret = heap_alloc_zero(sizeof(*ret)); HTMLObjectElement *ret;
nsresult nsres; nsresult nsres;
ret = heap_alloc_zero(sizeof(*ret));
if(!ret)
return E_OUTOFMEMORY;
ret->lpIHTMLObjectElementVtbl = &HTMLObjectElementVtbl; ret->lpIHTMLObjectElementVtbl = &HTMLObjectElementVtbl;
ret->element.node.vtbl = &HTMLObjectElementImplVtbl; ret->element.node.vtbl = &HTMLObjectElementImplVtbl;
nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLObjectElement, (void**)&ret->nsobject);
if(NS_FAILED(nsres)) {
ERR("Could not get nsIDOMHTMLObjectElement iface: %08x\n", nsres);
heap_free(ret);
return E_FAIL;
}
HTMLElement_Init(&ret->element, doc, nselem, &HTMLObjectElement_dispex); HTMLElement_Init(&ret->element, doc, nselem, &HTMLObjectElement_dispex);
nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLObjectElement, (void**)&ret->nsobject); *elem = &ret->element;
if(NS_FAILED(nsres)) return S_OK;
ERR("Could not get nsIDOMHTMLObjectElement iface: %08x\n", nsres);
return &ret->element;
} }

View File

@ -356,21 +356,29 @@ static dispex_static_data_t HTMLOptionElement_dispex = {
HTMLOptionElement_iface_tids HTMLOptionElement_iface_tids
}; };
HTMLElement *HTMLOptionElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem) HRESULT HTMLOptionElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLElement **elem)
{ {
HTMLOptionElement *ret = heap_alloc_zero(sizeof(HTMLOptionElement)); HTMLOptionElement *ret;
nsresult nsres; nsresult nsres;
ret = heap_alloc_zero(sizeof(HTMLOptionElement));
if(!ret)
return E_OUTOFMEMORY;
ret->lpHTMLOptionElementVtbl = &HTMLOptionElementVtbl; ret->lpHTMLOptionElementVtbl = &HTMLOptionElementVtbl;
ret->element.node.vtbl = &HTMLOptionElementImplVtbl; ret->element.node.vtbl = &HTMLOptionElementImplVtbl;
nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLOptionElement, (void**)&ret->nsoption);
if(NS_FAILED(nsres)) {
ERR("Could not get nsIDOMHTMLOptionElement interface: %08x\n", nsres);
heap_free(ret);
return E_FAIL;
}
HTMLElement_Init(&ret->element, doc, nselem, &HTMLOptionElement_dispex); HTMLElement_Init(&ret->element, doc, nselem, &HTMLOptionElement_dispex);
nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLOptionElement, (void**)&ret->nsoption); *elem = &ret->element;
if(NS_FAILED(nsres)) return S_OK;
ERR("Could not get nsIDOMHTMLOptionElement interface: %08x\n", nsres);
return &ret->element;
} }
#define HTMLOPTFACTORY_THIS(iface) DEFINE_THIS(HTMLOptionElementFactory, HTMLOptionElementFactory, iface) #define HTMLOPTFACTORY_THIS(iface) DEFINE_THIS(HTMLOptionElementFactory, HTMLOptionElementFactory, iface)

View File

@ -343,19 +343,27 @@ static dispex_static_data_t HTMLScriptElement_dispex = {
HTMLScriptElement_iface_tids HTMLScriptElement_iface_tids
}; };
HTMLElement *HTMLScriptElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem) HRESULT HTMLScriptElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLElement **elem)
{ {
HTMLScriptElement *ret = heap_alloc_zero(sizeof(HTMLScriptElement)); HTMLScriptElement *ret;
nsresult nsres; nsresult nsres;
ret = heap_alloc_zero(sizeof(HTMLScriptElement));
if(!ret)
return E_OUTOFMEMORY;
ret->lpHTMLScriptElementVtbl = &HTMLScriptElementVtbl; ret->lpHTMLScriptElementVtbl = &HTMLScriptElementVtbl;
ret->element.node.vtbl = &HTMLScriptElementImplVtbl; ret->element.node.vtbl = &HTMLScriptElementImplVtbl;
nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLScriptElement, (void**)&ret->nsscript);
if(NS_FAILED(nsres)) {
ERR("Could not get nsIDOMHTMLScriptElement: %08x\n", nsres);
heap_free(ret);
return E_FAIL;
}
HTMLElement_Init(&ret->element, doc, nselem, &HTMLScriptElement_dispex); HTMLElement_Init(&ret->element, doc, nselem, &HTMLScriptElement_dispex);
nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLScriptElement, (void**)&ret->nsscript); *elem = &ret->element;
if(NS_FAILED(nsres)) return S_OK;
ERR("Could not get nsIDOMHTMLScriptElement: %08x\n", nsres);
return &ret->element;
} }

View File

@ -636,20 +636,28 @@ static dispex_static_data_t HTMLSelectElement_dispex = {
HTMLSelectElement_tids HTMLSelectElement_tids
}; };
HTMLElement *HTMLSelectElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem) HRESULT HTMLSelectElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLElement **elem)
{ {
HTMLSelectElement *ret = heap_alloc_zero(sizeof(HTMLSelectElement)); HTMLSelectElement *ret;
nsresult nsres; nsresult nsres;
ret = heap_alloc_zero(sizeof(HTMLSelectElement));
if(!ret)
return E_OUTOFMEMORY;
ret->lpHTMLSelectElementVtbl = &HTMLSelectElementVtbl; ret->lpHTMLSelectElementVtbl = &HTMLSelectElementVtbl;
ret->element.node.vtbl = &HTMLSelectElementImplVtbl; ret->element.node.vtbl = &HTMLSelectElementImplVtbl;
HTMLElement_Init(&ret->element, doc, nselem, &HTMLSelectElement_dispex);
nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLSelectElement, nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLSelectElement,
(void**)&ret->nsselect); (void**)&ret->nsselect);
if(NS_FAILED(nsres)) if(NS_FAILED(nsres)) {
ERR("Could not get nsIDOMHTMLSelectElement interfce: %08x\n", nsres); ERR("Could not get nsIDOMHTMLSelectElement interfce: %08x\n", nsres);
heap_free(ret);
return &ret->element; return E_FAIL;
}
HTMLElement_Init(&ret->element, doc, nselem, &HTMLSelectElement_dispex);
*elem = &ret->element;
return S_OK;
} }

View File

@ -267,13 +267,18 @@ static dispex_static_data_t HTMLStyleElement_dispex = {
HTMLStyleElement_iface_tids HTMLStyleElement_iface_tids
}; };
HTMLElement *HTMLStyleElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem) HRESULT HTMLStyleElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLElement **elem)
{ {
HTMLStyleElement *ret = heap_alloc_zero(sizeof(*ret)); HTMLStyleElement *ret;
ret = heap_alloc_zero(sizeof(*ret));
if(!ret)
return E_OUTOFMEMORY;
ret->lpIHTMLStyleElementVtbl = &HTMLStyleElementVtbl; ret->lpIHTMLStyleElementVtbl = &HTMLStyleElementVtbl;
ret->element.node.vtbl = &HTMLStyleElementImplVtbl; ret->element.node.vtbl = &HTMLStyleElementImplVtbl;
HTMLElement_Init(&ret->element, doc, nselem, &HTMLStyleElement_dispex); HTMLElement_Init(&ret->element, doc, nselem, &HTMLStyleElement_dispex);
return &ret->element; *elem = &ret->element;
return S_OK;
} }

View File

@ -571,21 +571,28 @@ static dispex_static_data_t HTMLTable_dispex = {
HTMLTable_iface_tids HTMLTable_iface_tids
}; };
HTMLElement *HTMLTable_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem) HRESULT HTMLTable_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLElement **elem)
{ {
HTMLTable *ret = heap_alloc_zero(sizeof(HTMLTable)); HTMLTable *ret;
nsresult nsres; nsresult nsres;
ret = heap_alloc_zero(sizeof(HTMLTable));
if(!ret)
return E_OUTOFMEMORY;
ret->element.node.vtbl = &HTMLTableImplVtbl; ret->element.node.vtbl = &HTMLTableImplVtbl;
ret->lpHTMLTableVtbl = &HTMLTableVtbl; ret->lpHTMLTableVtbl = &HTMLTableVtbl;
HTMLElement_Init(&ret->element, doc, nselem, &HTMLTable_dispex); nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLTableElement, (void**)&ret->nstable);
if(NS_FAILED(nsres)) {
ERR("Could not get nsIDOMHTMLTableElement iface: %08x\n", nsres);
heap_free(ret);
return E_FAIL;
}
HTMLElement_Init(&ret->element, doc, nselem, &HTMLTable_dispex);
ConnectionPoint_Init(&ret->cp, &ret->element.cp_container, &DIID_HTMLTableEvents, NULL); ConnectionPoint_Init(&ret->cp, &ret->element.cp_container, &DIID_HTMLTableEvents, NULL);
nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLTableElement, (void**)&ret->nstable); *elem = &ret->element;
if(NS_FAILED(nsres)) return S_OK;
ERR("Could not get nsIDOMHTMLTableElement iface: %08x\n", nsres);
return &ret->element;
} }

View File

@ -314,19 +314,27 @@ static dispex_static_data_t HTMLTableRow_dispex = {
HTMLTableRow_iface_tids HTMLTableRow_iface_tids
}; };
HTMLElement *HTMLTableRow_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem) HRESULT HTMLTableRow_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLElement **elem)
{ {
HTMLTableRow *ret = heap_alloc_zero(sizeof(HTMLTableRow)); HTMLTableRow *ret;
nsresult nsres; nsresult nsres;
ret = heap_alloc_zero(sizeof(HTMLTableRow));
if(!ret)
return E_OUTOFMEMORY;
ret->lpHTMLTableRowVtbl = &HTMLTableRowVtbl; ret->lpHTMLTableRowVtbl = &HTMLTableRowVtbl;
ret->element.node.vtbl = &HTMLTableRowImplVtbl; ret->element.node.vtbl = &HTMLTableRowImplVtbl;
nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLTableRowElement, (void**)&ret->nsrow);
if(NS_FAILED(nsres)) {
ERR("Could not get nsIDOMHTMLTableRowElement iface: %08x\n", nsres);
heap_free(ret);
return E_OUTOFMEMORY;
}
HTMLElement_Init(&ret->element, doc, nselem, &HTMLTableRow_dispex); HTMLElement_Init(&ret->element, doc, nselem, &HTMLTableRow_dispex);
nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLTableRowElement, (void**)&ret->nsrow); *elem = &ret->element;
if(NS_FAILED(nsres)) return S_OK;
ERR("Could not get nsIDOMHTMLTableRowElement iface: %08x\n", nsres);
return &ret->element;
} }

View File

@ -464,20 +464,28 @@ static dispex_static_data_t HTMLTextAreaElement_dispex = {
HTMLTextAreaElement_iface_tids HTMLTextAreaElement_iface_tids
}; };
HTMLElement *HTMLTextAreaElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem) HRESULT HTMLTextAreaElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, HTMLElement **elem)
{ {
HTMLTextAreaElement *ret = heap_alloc_zero(sizeof(HTMLTextAreaElement)); HTMLTextAreaElement *ret;
nsresult nsres; nsresult nsres;
ret = heap_alloc_zero(sizeof(HTMLTextAreaElement));
if(!ret)
return E_OUTOFMEMORY;
ret->lpHTMLTextAreaElementVtbl = &HTMLTextAreaElementVtbl; ret->lpHTMLTextAreaElementVtbl = &HTMLTextAreaElementVtbl;
ret->element.node.vtbl = &HTMLTextAreaElementImplVtbl; ret->element.node.vtbl = &HTMLTextAreaElementImplVtbl;
HTMLElement_Init(&ret->element, doc, nselem, &HTMLTextAreaElement_dispex);
nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLTextAreaElement, nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLTextAreaElement,
(void**)&ret->nstextarea); (void**)&ret->nstextarea);
if(NS_FAILED(nsres)) if(NS_FAILED(nsres)) {
ERR("Could not get nsDOMHTMLInputElement: %08x\n", nsres); ERR("Could not get nsDOMHTMLInputElement: %08x\n", nsres);
heap_free(ret);
return &ret->element; return E_FAIL;
}
HTMLElement_Init(&ret->element, doc, nselem, &HTMLTextAreaElement_dispex);
*elem = &ret->element;
return S_OK;
} }

View File

@ -822,22 +822,22 @@ HRESULT HTMLDOMTextNode_Create(HTMLDocumentNode*,nsIDOMNode*,HTMLDOMNode**);
HRESULT HTMLElement_Create(HTMLDocumentNode*,nsIDOMNode*,BOOL,HTMLElement**); HRESULT HTMLElement_Create(HTMLDocumentNode*,nsIDOMNode*,BOOL,HTMLElement**);
HRESULT HTMLCommentElement_Create(HTMLDocumentNode*,nsIDOMNode*,HTMLElement**); HRESULT HTMLCommentElement_Create(HTMLDocumentNode*,nsIDOMNode*,HTMLElement**);
HTMLElement *HTMLAnchorElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*); HRESULT HTMLAnchorElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**);
HTMLElement *HTMLBodyElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*); HRESULT HTMLBodyElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**);
HTMLElement *HTMLEmbedElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*); HRESULT HTMLEmbedElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**);
HTMLElement *HTMLFormElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*); HRESULT HTMLFormElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**);
HTMLElement *HTMLFrameElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*); HRESULT HTMLFrameElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**);
HTMLElement *HTMLIFrame_Create(HTMLDocumentNode*,nsIDOMHTMLElement*); HRESULT HTMLIFrame_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**);
HTMLElement *HTMLStyleElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*); HRESULT HTMLStyleElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**);
HTMLElement *HTMLImgElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*); HRESULT HTMLImgElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**);
HTMLElement *HTMLInputElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*); HRESULT HTMLInputElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**);
HTMLElement *HTMLObjectElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*); HRESULT HTMLObjectElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**);
HTMLElement *HTMLOptionElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*); HRESULT HTMLOptionElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**);
HTMLElement *HTMLScriptElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*); HRESULT HTMLScriptElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**);
HTMLElement *HTMLSelectElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*); HRESULT HTMLSelectElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**);
HTMLElement *HTMLTable_Create(HTMLDocumentNode*,nsIDOMHTMLElement*); HRESULT HTMLTable_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**);
HTMLElement *HTMLTableRow_Create(HTMLDocumentNode*,nsIDOMHTMLElement*); HRESULT HTMLTableRow_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**);
HTMLElement *HTMLTextAreaElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*); HRESULT HTMLTextAreaElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**);
HRESULT HTMLGenericElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**); HRESULT HTMLGenericElement_Create(HTMLDocumentNode*,nsIDOMHTMLElement*,HTMLElement**);
void HTMLDOMNode_Init(HTMLDocumentNode*,HTMLDOMNode*,nsIDOMNode*); void HTMLDOMNode_Init(HTMLDocumentNode*,HTMLDOMNode*,nsIDOMNode*);