Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/mshtml/dispex.c | 10 ++ dlls/mshtml/htmlanchor.c | 3 +- dlls/mshtml/htmlarea.c | 3 +- dlls/mshtml/htmlbody.c | 3 +- dlls/mshtml/htmlcomment.c | 3 +- dlls/mshtml/htmlelem.c | 163 +++++++++++++++++++++++++----- dlls/mshtml/htmlform.c | 3 +- dlls/mshtml/htmlframe.c | 6 +- dlls/mshtml/htmlhead.c | 12 ++- dlls/mshtml/htmlimg.c | 3 +- dlls/mshtml/htmlinput.c | 9 +- dlls/mshtml/htmllink.c | 3 +- dlls/mshtml/htmlobject.c | 6 +- dlls/mshtml/htmlscript.c | 3 +- dlls/mshtml/htmlselect.c | 6 +- dlls/mshtml/htmlstyleelem.c | 3 +- dlls/mshtml/htmltable.c | 9 +- dlls/mshtml/htmltextarea.c | 3 +- dlls/mshtml/mshtml_private.h | 2 + dlls/mshtml/tests/documentmode.js | 142 ++++++++++++++++++++++++++ 20 files changed, 341 insertions(+), 54 deletions(-)
diff --git a/dlls/mshtml/dispex.c b/dlls/mshtml/dispex.c index 64ead8f..797f024 100644 --- a/dlls/mshtml/dispex.c +++ b/dlls/mshtml/dispex.c @@ -1482,6 +1482,16 @@ compat_mode_t dispex_compat_mode(DispatchEx *dispex) : dispex->info->desc->vtbl->get_compat_mode(dispex); }
+const WCHAR *dispex_tostring(DispatchEx *dispex) +{ + const WCHAR *str = dispex->info->desc->tostring_name; + + /* Empty string is special for all modes */ + if((!str || str[0]) && dispex_compat_mode(dispex) < COMPAT_MODE_IE9) + str = L"[object]"; + return str; +} + static dispex_data_t *ensure_dispex_info(dispex_static_data_t *desc, compat_mode_t compat_mode) { if(!desc->info_cache[compat_mode]) { diff --git a/dlls/mshtml/htmlanchor.c b/dlls/mshtml/htmlanchor.c index da48601..5a402ad 100644 --- a/dlls/mshtml/htmlanchor.c +++ b/dlls/mshtml/htmlanchor.c @@ -860,7 +860,8 @@ static dispex_static_data_t HTMLAnchorElement_dispex = { NULL, DispHTMLAnchorElement_tid, HTMLAnchorElement_iface_tids, - HTMLElement_init_dispex_info + HTMLElement_init_dispex_info, + L"" };
HRESULT HTMLAnchorElement_Create(HTMLDocumentNode *doc, nsIDOMElement *nselem, HTMLElement **elem) diff --git a/dlls/mshtml/htmlarea.c b/dlls/mshtml/htmlarea.c index a0708c4..4e4eed3 100644 --- a/dlls/mshtml/htmlarea.c +++ b/dlls/mshtml/htmlarea.c @@ -452,7 +452,8 @@ static dispex_static_data_t HTMLAreaElement_dispex = { NULL, DispHTMLAreaElement_tid, HTMLAreaElement_iface_tids, - HTMLElement_init_dispex_info + HTMLElement_init_dispex_info, + L"" };
HRESULT HTMLAreaElement_Create(HTMLDocumentNode *doc, nsIDOMElement *nselem, HTMLElement **elem) diff --git a/dlls/mshtml/htmlbody.c b/dlls/mshtml/htmlbody.c index 32c49fe..63f92a0 100644 --- a/dlls/mshtml/htmlbody.c +++ b/dlls/mshtml/htmlbody.c @@ -1011,7 +1011,8 @@ static dispex_static_data_t HTMLBodyElement_dispex = { NULL, DispHTMLBody_tid, HTMLBodyElement_iface_tids, - HTMLElement_init_dispex_info + HTMLElement_init_dispex_info, + L"[object HTMLBodyElement]" };
HRESULT HTMLBodyElement_Create(HTMLDocumentNode *doc, nsIDOMElement *nselem, HTMLElement **elem) diff --git a/dlls/mshtml/htmlcomment.c b/dlls/mshtml/htmlcomment.c index 85eceef..b628cf8 100644 --- a/dlls/mshtml/htmlcomment.c +++ b/dlls/mshtml/htmlcomment.c @@ -202,7 +202,8 @@ static dispex_static_data_t HTMLCommentElement_dispex = { NULL, DispHTMLCommentElement_tid, HTMLCommentElement_iface_tids, - HTMLElement_init_dispex_info + HTMLElement_init_dispex_info, + L"[object HTMLCommentElement]" };
HRESULT HTMLCommentElement_Create(HTMLDocumentNode *doc, nsIDOMNode *nsnode, HTMLElement **elem) diff --git a/dlls/mshtml/htmlelem.c b/dlls/mshtml/htmlelem.c index d9554f4..8546c19 100644 --- a/dlls/mshtml/htmlelem.c +++ b/dlls/mshtml/htmlelem.c @@ -47,31 +47,116 @@ typedef struct { } tag_desc_t;
static const tag_desc_t tag_descs[] = { - {L"A", HTMLAnchorElement_Create}, - {L"AREA", HTMLAreaElement_Create}, - {L"BODY", HTMLBodyElement_Create}, - {L"BUTTON", HTMLButtonElement_Create}, - {L"EMBED", HTMLEmbedElement_Create}, - {L"FORM", HTMLFormElement_Create}, - {L"FRAME", HTMLFrameElement_Create}, - {L"HEAD", HTMLHeadElement_Create}, - {L"HTML", HTMLHtmlElement_Create}, - {L"IFRAME", HTMLIFrame_Create}, - {L"IMG", HTMLImgElement_Create}, - {L"INPUT", HTMLInputElement_Create}, - {L"LABEL", HTMLLabelElement_Create}, - {L"LINK", HTMLLinkElement_Create}, - {L"META", HTMLMetaElement_Create}, - {L"OBJECT", HTMLObjectElement_Create}, - {L"OPTION", HTMLOptionElement_Create}, - {L"SCRIPT", HTMLScriptElement_Create}, - {L"SELECT", HTMLSelectElement_Create}, - {L"STYLE", HTMLStyleElement_Create}, - {L"TABLE", HTMLTable_Create}, - {L"TD", HTMLTableCell_Create}, - {L"TEXTAREA", HTMLTextAreaElement_Create}, - {L"TITLE", HTMLTitleElement_Create}, - {L"TR", HTMLTableRow_Create} + {L"A", HTMLAnchorElement_Create}, + {L"ABBR", NULL}, + {L"ACRONYM", NULL}, + {L"ADDRESS", NULL}, + {L"APPLET", NULL}, + {L"AREA", HTMLAreaElement_Create}, + {L"ARTICLE", NULL}, + {L"ASIDE", NULL}, + {L"AUDIO", NULL}, + {L"B", NULL}, + {L"BASE", NULL}, + {L"BASEFONT", NULL}, + {L"BDO", NULL}, + {L"BIG", NULL}, + {L"BLOCKQUOTE", NULL}, + {L"BODY", HTMLBodyElement_Create}, + {L"BR", NULL}, + {L"BUTTON", HTMLButtonElement_Create}, + {L"CANVAS", NULL}, + {L"CAPTION", NULL}, + {L"CENTER", NULL}, + {L"CITE", NULL}, + {L"CODE", NULL}, + {L"COL", NULL}, + {L"COLGROUP", NULL}, + {L"DATALIST", NULL}, + {L"DD", NULL}, + {L"DEL", NULL}, + {L"DFN", NULL}, + {L"DIR", NULL}, + {L"DIV", NULL}, + {L"DL", NULL}, + {L"DT", NULL}, + {L"EM", NULL}, + {L"EMBED", HTMLEmbedElement_Create}, + {L"FIELDSET", NULL}, + {L"FIGCAPTION", NULL}, + {L"FIGURE", NULL}, + {L"FONT", NULL}, + {L"FOOTER", NULL}, + {L"FORM", HTMLFormElement_Create}, + {L"FRAME", HTMLFrameElement_Create}, + {L"FRAMESET", NULL}, + {L"H1", NULL}, + {L"H2", NULL}, + {L"H3", NULL}, + {L"H4", NULL}, + {L"H5", NULL}, + {L"H6", NULL}, + {L"HEAD", HTMLHeadElement_Create}, + {L"HEADER", NULL}, + {L"HR", NULL}, + {L"HTML", HTMLHtmlElement_Create}, + {L"I", NULL}, + {L"IFRAME", HTMLIFrame_Create}, + {L"IMG", HTMLImgElement_Create}, + {L"INPUT", HTMLInputElement_Create}, + {L"INS", NULL}, + {L"KBD", NULL}, + {L"LABEL", HTMLLabelElement_Create}, + {L"LEGEND", NULL}, + {L"LI", NULL}, + {L"LINK", HTMLLinkElement_Create}, + {L"MAP", NULL}, + {L"MARK", NULL}, + {L"META", HTMLMetaElement_Create}, + {L"NAV", NULL}, + {L"NOFRAMES", NULL}, + {L"NOSCRIPT", NULL}, + {L"OBJECT", HTMLObjectElement_Create}, + {L"OL", NULL}, + {L"OPTGROUP", NULL}, + {L"OPTION", HTMLOptionElement_Create}, + {L"P", NULL}, + {L"PARAM", NULL}, + {L"PRE", NULL}, + {L"PROGRESS", NULL}, + {L"Q", NULL}, + {L"RP", NULL}, + {L"RT", NULL}, + {L"RUBY", NULL}, + {L"S", NULL}, + {L"SAMP", NULL}, + {L"SCRIPT", HTMLScriptElement_Create}, + {L"SECTION", NULL}, + {L"SELECT", HTMLSelectElement_Create}, + {L"SMALL", NULL}, + {L"SOURCE", NULL}, + {L"SPAN", NULL}, + {L"STRIKE", NULL}, + {L"STRONG", NULL}, + {L"STYLE", HTMLStyleElement_Create}, + {L"SUB", NULL}, + {L"SUP", NULL}, + {L"TABLE", HTMLTable_Create}, + {L"TBODY", NULL}, + {L"TD", HTMLTableCell_Create}, + {L"TEXTAREA", HTMLTextAreaElement_Create}, + {L"TFOOT", NULL}, + {L"TH", NULL}, + {L"THEAD", NULL}, + {L"TITLE", HTMLTitleElement_Create}, + {L"TR", HTMLTableRow_Create}, + {L"TRACK", NULL}, + {L"TT", NULL}, + {L"U", NULL}, + {L"UL", NULL}, + {L"VAR", NULL}, + {L"VIDEO", NULL}, + {L"WBR", NULL} };
static const tag_desc_t *get_tag_desc(const WCHAR *tag_name) @@ -2112,8 +2197,30 @@ static HRESULT WINAPI HTMLElement_get_ondragstart(IHTMLElement *iface, VARIANT * static HRESULT WINAPI HTMLElement_toString(IHTMLElement *iface, BSTR *String) { HTMLElement *This = impl_from_IHTMLElement(iface); - FIXME("(%p)->(%p)\n", This, String); - return E_NOTIMPL; + const PRUnichar *str; + nsAString tag_str; + nsresult nsres; + + TRACE("(%p)->(%p)\n", This, String); + + if(!String) + return E_INVALIDARG; + + str = dispex_tostring(&This->node.event_target.dispex); + if(!str) { + nsAString_Init(&tag_str, NULL); + nsres = nsIDOMElement_GetTagName(This->dom_element, &tag_str); + if(NS_FAILED(nsres)) { + nsAString_Finish(&tag_str); + return map_nsresult(nsres); + } + nsAString_GetData(&tag_str, &str); + str = get_tag_desc(str) ? L"[object HTMLElement]" : L"[object HTMLUnknownElement]"; + nsAString_Finish(&tag_str); + } + + *String = SysAllocString(str); + return *String ? S_OK : E_OUTOFMEMORY; }
static HRESULT WINAPI HTMLElement_put_onbeforeupdate(IHTMLElement *iface, VARIANT v) @@ -6806,7 +6913,7 @@ HRESULT HTMLElement_Create(HTMLDocumentNode *doc, nsIDOMNode *nsnode, BOOL use_g nsAString_GetData(&tag_name_str, &tag_name);
tag = get_tag_desc(tag_name); - if(tag) { + if(tag && tag->constructor) { hres = tag->constructor(doc, nselem, &elem); }else { nsIDOMSVGElement *svg_element; diff --git a/dlls/mshtml/htmlform.c b/dlls/mshtml/htmlform.c index 5d0928e..5846f46 100644 --- a/dlls/mshtml/htmlform.c +++ b/dlls/mshtml/htmlform.c @@ -830,7 +830,8 @@ static dispex_static_data_t HTMLFormElement_dispex = { NULL, DispHTMLFormElement_tid, HTMLFormElement_iface_tids, - HTMLElement_init_dispex_info + HTMLElement_init_dispex_info, + L"[object HTMLFormElement]" };
HRESULT HTMLFormElement_Create(HTMLDocumentNode *doc, nsIDOMElement *nselem, HTMLElement **elem) diff --git a/dlls/mshtml/htmlframe.c b/dlls/mshtml/htmlframe.c index 7118ea8..5f17b8d 100644 --- a/dlls/mshtml/htmlframe.c +++ b/dlls/mshtml/htmlframe.c @@ -1026,7 +1026,8 @@ static dispex_static_data_t HTMLFrameElement_dispex = { NULL, DispHTMLFrameElement_tid, HTMLFrameElement_iface_tids, - HTMLElement_init_dispex_info + HTMLElement_init_dispex_info, + L"[object HTMLFrameElement]" };
HRESULT HTMLFrameElement_Create(HTMLDocumentNode *doc, nsIDOMElement *nselem, HTMLElement **elem) @@ -1606,7 +1607,8 @@ static dispex_static_data_t HTMLIFrame_dispex = { NULL, DispHTMLIFrame_tid, HTMLIFrame_iface_tids, - HTMLElement_init_dispex_info + HTMLElement_init_dispex_info, + L"[object HTMLIFrameElement]" };
HRESULT HTMLIFrame_Create(HTMLDocumentNode *doc, nsIDOMElement *nselem, HTMLElement **elem) diff --git a/dlls/mshtml/htmlhead.c b/dlls/mshtml/htmlhead.c index 5dbf8d6..85958e1 100644 --- a/dlls/mshtml/htmlhead.c +++ b/dlls/mshtml/htmlhead.c @@ -172,7 +172,8 @@ static dispex_static_data_t HTMLTitleElement_dispex = { NULL, DispHTMLTitleElement_tid, HTMLTitleElement_iface_tids, - HTMLElement_init_dispex_info + HTMLElement_init_dispex_info, + L"[object HTMLTitleElement]" };
HRESULT HTMLTitleElement_Create(HTMLDocumentNode *doc, nsIDOMElement *nselem, HTMLElement **elem) @@ -355,7 +356,8 @@ static dispex_static_data_t HTMLHtmlElement_dispex = { NULL, DispHTMLHtmlElement_tid, HTMLHtmlElement_iface_tids, - HTMLElement_init_dispex_info + HTMLElement_init_dispex_info, + L"[object HTMLHtmlElement]" };
HRESULT HTMLHtmlElement_Create(HTMLDocumentNode *doc, nsIDOMElement *nselem, HTMLElement **elem) @@ -591,7 +593,8 @@ static dispex_static_data_t HTMLMetaElement_dispex = { NULL, DispHTMLMetaElement_tid, HTMLMetaElement_iface_tids, - HTMLElement_init_dispex_info + HTMLElement_init_dispex_info, + L"[object HTMLMetaElement]" };
HRESULT HTMLMetaElement_Create(HTMLDocumentNode *doc, nsIDOMElement *nselem, HTMLElement **elem) @@ -754,7 +757,8 @@ static dispex_static_data_t HTMLHeadElement_dispex = { NULL, DispHTMLHeadElement_tid, HTMLHeadElement_iface_tids, - HTMLElement_init_dispex_info + HTMLElement_init_dispex_info, + L"[object HTMLHeadElement]" };
HRESULT HTMLHeadElement_Create(HTMLDocumentNode *doc, nsIDOMElement *nselem, HTMLElement **elem) diff --git a/dlls/mshtml/htmlimg.c b/dlls/mshtml/htmlimg.c index f89e8e5..6859425 100644 --- a/dlls/mshtml/htmlimg.c +++ b/dlls/mshtml/htmlimg.c @@ -733,7 +733,8 @@ static dispex_static_data_t HTMLImgElement_dispex = { NULL, DispHTMLImg_tid, HTMLImgElement_iface_tids, - HTMLElement_init_dispex_info + HTMLElement_init_dispex_info, + L"[object HTMLImageElement]" };
HRESULT HTMLImgElement_Create(HTMLDocumentNode *doc, nsIDOMElement *nselem, HTMLElement **elem) diff --git a/dlls/mshtml/htmlinput.c b/dlls/mshtml/htmlinput.c index 1a0a739..d92e299 100644 --- a/dlls/mshtml/htmlinput.c +++ b/dlls/mshtml/htmlinput.c @@ -1444,7 +1444,8 @@ static dispex_static_data_t HTMLInputElement_dispex = { NULL, DispHTMLInputElement_tid, HTMLInputElement_iface_tids, - HTMLElement_init_dispex_info + HTMLElement_init_dispex_info, + L"[object HTMLInputElement]" };
HRESULT HTMLInputElement_Create(HTMLDocumentNode *doc, nsIDOMElement *nselem, HTMLElement **elem) @@ -1640,7 +1641,8 @@ static dispex_static_data_t HTMLLabelElement_dispex = { NULL, DispHTMLLabelElement_tid, HTMLLabelElement_iface_tids, - HTMLElement_init_dispex_info + HTMLElement_init_dispex_info, + L"[object HTMLLabelElement]" };
HRESULT HTMLLabelElement_Create(HTMLDocumentNode *doc, nsIDOMElement *nselem, HTMLElement **elem) @@ -1986,7 +1988,8 @@ static dispex_static_data_t HTMLButtonElement_dispex = { NULL, DispHTMLButtonElement_tid, HTMLButtonElement_iface_tids, - HTMLElement_init_dispex_info + HTMLElement_init_dispex_info, + L"[object HTMLButtonElement]" };
HRESULT HTMLButtonElement_Create(HTMLDocumentNode *doc, nsIDOMElement *nselem, HTMLElement **elem) diff --git a/dlls/mshtml/htmllink.c b/dlls/mshtml/htmllink.c index ddf67ca..b11a7ca 100644 --- a/dlls/mshtml/htmllink.c +++ b/dlls/mshtml/htmllink.c @@ -449,7 +449,8 @@ static dispex_static_data_t HTMLLinkElement_dispex = { NULL, DispHTMLLinkElement_tid, HTMLLinkElement_iface_tids, - HTMLElement_init_dispex_info + HTMLElement_init_dispex_info, + L"[object HTMLLinkElement]" };
HRESULT HTMLLinkElement_Create(HTMLDocumentNode *doc, nsIDOMElement *nselem, HTMLElement **elem) diff --git a/dlls/mshtml/htmlobject.c b/dlls/mshtml/htmlobject.c index 6702548..814b70e 100644 --- a/dlls/mshtml/htmlobject.c +++ b/dlls/mshtml/htmlobject.c @@ -769,7 +769,8 @@ static dispex_static_data_t HTMLObjectElement_dispex = { NULL, DispHTMLObjectElement_tid, HTMLObjectElement_iface_tids, - HTMLElement_init_dispex_info + HTMLElement_init_dispex_info, + L"[object HTMLObjectElement]" };
HRESULT HTMLObjectElement_Create(HTMLDocumentNode *doc, nsIDOMElement *nselem, HTMLElement **elem) @@ -1031,7 +1032,8 @@ static dispex_static_data_t HTMLEmbedElement_dispex = { NULL, DispHTMLEmbed_tid, HTMLEmbedElement_iface_tids, - HTMLElement_init_dispex_info + HTMLElement_init_dispex_info, + L"[object HTMLEmbedElement]" };
HRESULT HTMLEmbedElement_Create(HTMLDocumentNode *doc, nsIDOMElement *nselem, HTMLElement **elem) diff --git a/dlls/mshtml/htmlscript.c b/dlls/mshtml/htmlscript.c index 9b7f95e..47987e5 100644 --- a/dlls/mshtml/htmlscript.c +++ b/dlls/mshtml/htmlscript.c @@ -482,7 +482,8 @@ static dispex_static_data_t HTMLScriptElement_dispex = { NULL, DispHTMLScriptElement_tid, HTMLScriptElement_iface_tids, - HTMLElement_init_dispex_info + HTMLElement_init_dispex_info, + L"[object HTMLScriptElement]" };
HRESULT HTMLScriptElement_Create(HTMLDocumentNode *doc, nsIDOMElement *nselem, HTMLElement **elem) diff --git a/dlls/mshtml/htmlselect.c b/dlls/mshtml/htmlselect.c index ad801f8..93a831e 100644 --- a/dlls/mshtml/htmlselect.c +++ b/dlls/mshtml/htmlselect.c @@ -419,7 +419,8 @@ static dispex_static_data_t HTMLOptionElement_dispex = { NULL, DispHTMLOptionElement_tid, HTMLOptionElement_iface_tids, - HTMLElement_init_dispex_info + HTMLElement_init_dispex_info, + L"[object HTMLOptionElement]" };
HRESULT HTMLOptionElement_Create(HTMLDocumentNode *doc, nsIDOMElement *nselem, HTMLElement **elem) @@ -1284,7 +1285,8 @@ static dispex_static_data_t HTMLSelectElement_dispex = { NULL, DispHTMLSelectElement_tid, HTMLSelectElement_tids, - HTMLElement_init_dispex_info + HTMLElement_init_dispex_info, + L"[object HTMLSelectElement]" };
HRESULT HTMLSelectElement_Create(HTMLDocumentNode *doc, nsIDOMElement *nselem, HTMLElement **elem) diff --git a/dlls/mshtml/htmlstyleelem.c b/dlls/mshtml/htmlstyleelem.c index d2a4a75..1b85231 100644 --- a/dlls/mshtml/htmlstyleelem.c +++ b/dlls/mshtml/htmlstyleelem.c @@ -465,7 +465,8 @@ static dispex_static_data_t HTMLStyleElement_dispex = { NULL, DispHTMLStyleElement_tid, HTMLStyleElement_iface_tids, - HTMLStyleElement_init_dispex_info + HTMLStyleElement_init_dispex_info, + L"[object HTMLStyleElement]" };
HRESULT HTMLStyleElement_Create(HTMLDocumentNode *doc, nsIDOMElement *nselem, HTMLElement **elem) diff --git a/dlls/mshtml/htmltable.c b/dlls/mshtml/htmltable.c index 178e9e5..6367999 100644 --- a/dlls/mshtml/htmltable.c +++ b/dlls/mshtml/htmltable.c @@ -523,7 +523,8 @@ static dispex_static_data_t HTMLTableCell_dispex = { NULL, DispHTMLTableCell_tid, HTMLTableCell_iface_tids, - HTMLElement_init_dispex_info + HTMLElement_init_dispex_info, + L"[object HTMLTableDataCellElement]" };
HRESULT HTMLTableCell_Create(HTMLDocumentNode *doc, nsIDOMElement *nselem, HTMLElement **elem) @@ -967,7 +968,8 @@ static dispex_static_data_t HTMLTableRow_dispex = { NULL, DispHTMLTableRow_tid, HTMLTableRow_iface_tids, - HTMLElement_init_dispex_info + HTMLElement_init_dispex_info, + L"[object HTMLTableRowElement]" };
HRESULT HTMLTableRow_Create(HTMLDocumentNode *doc, nsIDOMElement *nselem, HTMLElement **elem) @@ -1999,7 +2001,8 @@ static dispex_static_data_t HTMLTable_dispex = { NULL, DispHTMLTable_tid, HTMLTable_iface_tids, - HTMLElement_init_dispex_info + HTMLElement_init_dispex_info, + L"[object HTMLTableElement]" };
HRESULT HTMLTable_Create(HTMLDocumentNode *doc, nsIDOMElement *nselem, HTMLElement **elem) diff --git a/dlls/mshtml/htmltextarea.c b/dlls/mshtml/htmltextarea.c index 57f3373..71f0e3e 100644 --- a/dlls/mshtml/htmltextarea.c +++ b/dlls/mshtml/htmltextarea.c @@ -482,7 +482,8 @@ static dispex_static_data_t HTMLTextAreaElement_dispex = { NULL, DispHTMLTextAreaElement_tid, HTMLTextAreaElement_iface_tids, - HTMLElement_init_dispex_info + HTMLElement_init_dispex_info, + L"[object HTMLTextAreaElement]" };
HRESULT HTMLTextAreaElement_Create(HTMLDocumentNode *doc, nsIDOMElement *nselem, HTMLElement **elem) diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index c1e7e78..67ea0ad 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -331,6 +331,7 @@ typedef struct { const tid_t disp_tid; const tid_t* const iface_tids; void (*init_info)(dispex_data_t*,compat_mode_t); + const WCHAR *tostring_name; dispex_data_t *info_cache[COMPAT_MODE_CNT]; dispex_data_t *delayed_init_info; } dispex_static_data_t; @@ -393,6 +394,7 @@ HRESULT get_class_typeinfo(const CLSID*,ITypeInfo**) DECLSPEC_HIDDEN; const void *dispex_get_vtbl(DispatchEx*) DECLSPEC_HIDDEN; void dispex_info_add_interface(dispex_data_t*,tid_t,const dispex_hook_t*) DECLSPEC_HIDDEN; compat_mode_t dispex_compat_mode(DispatchEx*) DECLSPEC_HIDDEN; +const WCHAR *dispex_tostring(DispatchEx*) DECLSPEC_HIDDEN;
typedef enum { DISPEXPROP_CUSTOM, diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index c20f6ee..16764a5 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -19,6 +19,148 @@ var compat_version; var tests = [];
+sync_test("builtin_toString", function() { + var tags = [ + [ "a", null ], + [ "abbr", "Phrase" ], + [ "acronym", "Phrase" ], + [ "address", "Block" ], + // [ "applet", "Applet" ], // makes Windows pop up a dialog box + [ "area", null ], + [ "article", "" ], + [ "aside", "" ], + [ "audio", "Audio" ], + [ "b", "Phrase" ], + [ "base", "Base" ], + [ "basefont", "BaseFont" ], + [ "bdi", "Unknown" ], + [ "bdo", "Phrase" ], + [ "big", "Phrase" ], + [ "blockquote", "Block" ], + [ "body", "Body" ], + [ "br", "BR" ], + [ "button", "Button" ], + [ "canvas", "Canvas" ], + [ "caption", "TableCaption" ], + [ "center", "Block" ], + [ "cite", "Phrase" ], + [ "code", "Phrase" ], + [ "col", "TableCol" ], + [ "colgroup", "TableCol" ], + [ "data", "Unknown" ], + [ "datalist", "DataList", 10 ], + [ "dd", "DD" ], + [ "del", "Mod" ], + [ "details", "Unknown" ], + [ "dfn", "Phrase" ], + [ "dialog", "Unknown" ], + [ "dir", "Directory" ], + [ "div", "Div" ], + [ "dl", "DList" ], + [ "dt", "DT" ], + [ "em", "Phrase" ], + [ "embed", "Embed" ], + [ "fieldset", "FieldSet" ], + [ "figcaption", "" ], + [ "figure", "" ], + [ "font", "Font" ], + [ "footer", "" ], + [ "form", "Form" ], + [ "frame", "Frame" ], + [ "frameset", "FrameSet" ], + [ "h1", "Heading" ], + [ "h2", "Heading" ], + [ "h3", "Heading" ], + [ "h4", "Heading" ], + [ "h5", "Heading" ], + [ "h6", "Heading" ], + [ "h7", "Unknown" ], + [ "head", "Head" ], + [ "header", "" ], + [ "hr", "HR" ], + [ "html", "Html" ], + [ "i", "Phrase" ], + [ "iframe", "IFrame" ], + [ "img", "Image" ], + [ "input", "Input" ], + [ "ins", "Mod" ], + [ "kbd", "Phrase" ], + [ "label", "Label" ], + [ "legend", "Legend" ], + [ "li", "LI" ], + [ "link", "Link" ], + [ "main", "Unknown" ], + [ "map", "Map" ], + [ "mark", "" ], + [ "meta", "Meta" ], + [ "meter", "Unknown" ], + [ "nav", "" ], + [ "noframes", "" ], + [ "noscript", "" ], + [ "object", "Object" ], + [ "ol", "OList" ], + [ "optgroup", "OptGroup" ], + [ "option", "Option" ], + [ "output", "Unknown" ], + [ "p", "Paragraph" ], + [ "param", "Param" ], + [ "picture", "Unknown" ], + [ "pre", "Pre" ], + [ "progress", "Progress", 10 ], + [ "q", "Quote" ], + [ "rp", "Phrase" ], + [ "rt", "Phrase" ], + [ "ruby", "Phrase" ], + [ "s", "Phrase" ], + [ "samp", "Phrase" ], + [ "script", "Script" ], + [ "section", "" ], + [ "select", "Select" ], + [ "small", "Phrase" ], + [ "source", "Source" ], + [ "span", "Span" ], + [ "strike", "Phrase" ], + [ "strong", "Phrase" ], + [ "style", "Style" ], + [ "sub", "Phrase" ], + [ "summary", "Unknown" ], + [ "sup", "Phrase" ], + [ "svg", "Unknown" ], + [ "table", "Table" ], + [ "tbody", "TableSection" ], + [ "td", "TableDataCell" ], + [ "template", "Unknown" ], + [ "textarea", "TextArea" ], + [ "tfoot", "TableSection" ], + [ "th", "TableHeaderCell" ], + [ "thead", "TableSection" ], + [ "time", "Unknown" ], + [ "title", "Title" ], + [ "tr", "TableRow" ], + [ "track", "Track", 10 ], + [ "tt", "Phrase" ], + [ "u", "Phrase" ], + [ "ul", "UList" ], + [ "var", "Phrase" ], + [ "video", "Video" ], + [ "wbr", "" ], + [ "winetest", "Unknown" ] + ]; + var v = document.documentMode; + + for(var i = 0; i < tags.length; i++) { + var s = document.createElement(tags[i][0]).toString(); + if(tags[i][1] === null) + ok(s === "", "tag '" + tags[i][0] + "' toString returned " + s); + else if(v < 9) + ok(s === "[object]", "tag '" + tags[i][0] + "' toString returned " + s); + else if(tags[i].length < 3 || v >= tags[i][2]) { + todo_wine_if(tags[i][1] !== "" && s === "[object HTMLElement]"). + ok(s === "[object HTML" + tags[i][1] + "Element]", "tag '" + tags[i][0] + "' toString returned " + s); + } + } +}); + sync_test("elem_props", function() { var elem = document.documentElement;
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/mshtml/htmlwindow.c | 2 +- dlls/mshtml/tests/documentmode.js | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/dlls/mshtml/htmlwindow.c b/dlls/mshtml/htmlwindow.c index 870d7e8..096aa9c 100644 --- a/dlls/mshtml/htmlwindow.c +++ b/dlls/mshtml/htmlwindow.c @@ -1457,7 +1457,7 @@ static HRESULT WINAPI HTMLWindow2_toString(IHTMLWindow2 *iface, BSTR *String) if(!String) return E_INVALIDARG;
- *String = SysAllocString(L"[object]"); + *String = SysAllocString(L"[object Window]"); return *String ? S_OK : E_OUTOFMEMORY; }
diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index 16764a5..546e66e 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -159,6 +159,9 @@ sync_test("builtin_toString", function() { ok(s === "[object HTML" + tags[i][1] + "Element]", "tag '" + tags[i][0] + "' toString returned " + s); } } + + s = window.toString(); + ok(s === "[object Window]", "window.toString returned " + s); });
sync_test("elem_props", function() {
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=98701
Your paranoid android.
=== w8adm (32 bit report) ===
mshtml: htmldoc.c:3084: Test failed: Incorrect error code: -2146697211 htmldoc.c:3089: Test failed: Page address: L"http://test.winehq.org/tests/winehq_snapshot/" htmldoc.c:5861: Test failed: expected OnChanged_1012 htmldoc.c:5862: Test failed: expected Exec_HTTPEQUIV htmldoc.c:5864: Test failed: expected Exec_SETTITLE htmldoc.c:5905: Test failed: expected FireNavigateComplete2
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/mshtml/htmldoc.c | 15 +++++++++++++-- dlls/mshtml/tests/documentmode.js | 2 ++ 2 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c index 9faf987..bc56792 100644 --- a/dlls/mshtml/htmldoc.c +++ b/dlls/mshtml/htmldoc.c @@ -1700,13 +1700,23 @@ static HRESULT WINAPI HTMLDocument_get_onerrorupdate(IHTMLDocument2 *iface, VARI static HRESULT WINAPI HTMLDocument_toString(IHTMLDocument2 *iface, BSTR *String) { HTMLDocument *This = impl_from_IHTMLDocument2(iface); + compat_mode_t compat_mode; + DispatchEx *dispex; + const WCHAR *str;
TRACE("(%p)->(%p)\n", This, String);
if(!String) return E_INVALIDARG;
- *String = SysAllocString(L"[object]"); + dispex = &This->doc_node->node.event_target.dispex; + compat_mode = dispex_compat_mode(dispex); + if(COMPAT_MODE_IE9 <= compat_mode && compat_mode <= COMPAT_MODE_IE10) + str = L"[object Document]"; + else + str = dispex_tostring(dispex); + + *String = SysAllocString(str); return *String ? S_OK : E_OUTOFMEMORY;
} @@ -5657,7 +5667,8 @@ static dispex_static_data_t HTMLDocumentNode_dispex = { &HTMLDocumentNode_event_target_vtbl.dispex_vtbl, DispHTMLDocument_tid, HTMLDocumentNode_iface_tids, - HTMLDocumentNode_init_dispex_info + HTMLDocumentNode_init_dispex_info, + L"[object HTMLDocument]" };
static HTMLDocumentNode *alloc_doc_node(HTMLDocumentObj *doc_obj, HTMLInnerWindow *window) diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index 546e66e..26f2373 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -162,6 +162,8 @@ sync_test("builtin_toString", function() {
s = window.toString(); ok(s === "[object Window]", "window.toString returned " + s); + s = document.toString(); + ok(s === (v < 9 ? "[object]" : (v < 11 ? "[object Document]" : "[object HTMLDocument]")), "document.toString returned " + s); });
sync_test("elem_props", function() {
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/mshtml/omnavigator.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/dlls/mshtml/omnavigator.c b/dlls/mshtml/omnavigator.c index eff9576..2847e34 100644 --- a/dlls/mshtml/omnavigator.c +++ b/dlls/mshtml/omnavigator.c @@ -1313,8 +1313,7 @@ static HRESULT WINAPI OmNavigator_toString(IOmNavigator *iface, BSTR *String) if(!String) return E_INVALIDARG;
- *String = SysAllocString(dispex_compat_mode(&This->dispex) < COMPAT_MODE_IE9 - ? L"[object]" : L"[object Navigator]"); + *String = SysAllocString(dispex_tostring(&This->dispex)); return *String ? S_OK : E_OUTOFMEMORY; }
@@ -1471,7 +1470,9 @@ static const tid_t OmNavigator_iface_tids[] = { static dispex_static_data_t OmNavigator_dispex = { NULL, DispHTMLNavigator_tid, - OmNavigator_iface_tids + OmNavigator_iface_tids, + NULL, + L"[object Navigator]" };
HRESULT create_navigator(compat_mode_t compat_mode, IOmNavigator **navigator)
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/mshtml/htmlstyle.c | 13 ++++++++++--- dlls/mshtml/tests/documentmode.js | 2 ++ 2 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/dlls/mshtml/htmlstyle.c b/dlls/mshtml/htmlstyle.c index 4ee81ba..6c5135e 100644 --- a/dlls/mshtml/htmlstyle.c +++ b/dlls/mshtml/htmlstyle.c @@ -3025,8 +3025,14 @@ static HRESULT WINAPI HTMLStyle_removeAttribute(IHTMLStyle *iface, BSTR strAttri static HRESULT WINAPI HTMLStyle_toString(IHTMLStyle *iface, BSTR *String) { HTMLStyle *This = impl_from_IHTMLStyle(iface); - FIXME("(%p)->(%p)\n", This, String); - return E_NOTIMPL; + + TRACE("(%p)->(%p)\n", This, String); + + if(!String) + return E_INVALIDARG; + + *String = SysAllocString(dispex_tostring(&This->css_style.dispex)); + return *String ? S_OK : E_OUTOFMEMORY; }
static const IHTMLStyleVtbl HTMLStyleVtbl = { @@ -10009,7 +10015,8 @@ static dispex_static_data_t HTMLStyle_dispex = { &CSSStyle_dispex_vtbl, DispHTMLStyle_tid, HTMLStyle_iface_tids, - CSSStyle_init_dispex_info + CSSStyle_init_dispex_info, + L"[object MSStyleCSSProperties]" };
static HRESULT get_style_from_elem(HTMLElement *elem, nsIDOMCSSStyleDeclaration **ret) diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index 26f2373..037631b 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -164,6 +164,8 @@ sync_test("builtin_toString", function() { ok(s === "[object Window]", "window.toString returned " + s); s = document.toString(); ok(s === (v < 9 ? "[object]" : (v < 11 ? "[object Document]" : "[object HTMLDocument]")), "document.toString returned " + s); + s = document.body.style.toString(); + ok(s === (v < 9 ? "[object]" : "[object MSStyleCSSProperties]"), "document.body.style.toString returned " + s); });
sync_test("elem_props", function() {
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=98704
Your paranoid android.
=== w8adm (32 bit report) ===
mshtml: events.c:1089: Test failed: unexpected call img_onerror events: Timeout
=== w8adm (32 bit report) ===
mshtml: htmldoc.c:3084: Test failed: Incorrect error code: -2146697211 htmldoc.c:3089: Test failed: Page address: L"http://test.winehq.org/tests/winehq_snapshot/" htmldoc.c:5861: Test failed: expected OnChanged_1012 htmldoc.c:5862: Test failed: expected Exec_HTTPEQUIV htmldoc.c:5864: Test failed: expected Exec_SETTITLE htmldoc.c:5905: Test failed: expected FireNavigateComplete2
=== w7u_adm (32 bit report) ===
mshtml: script.c:624: Test failed: L"/index.html?es5.js:date_now: unexpected Date.now() result 1632504383650 expected 1632504383713"
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/mshtml/htmltextnode.c | 30 +++++++++++++++++++++++++++--- dlls/mshtml/tests/documentmode.js | 2 ++ 2 files changed, 29 insertions(+), 3 deletions(-)
diff --git a/dlls/mshtml/htmltextnode.c b/dlls/mshtml/htmltextnode.c index 56a0572..be20be5 100644 --- a/dlls/mshtml/htmltextnode.c +++ b/dlls/mshtml/htmltextnode.c @@ -128,8 +128,31 @@ static HRESULT WINAPI HTMLDOMTextNode_get_data(IHTMLDOMTextNode *iface, BSTR *p) static HRESULT WINAPI HTMLDOMTextNode_toString(IHTMLDOMTextNode *iface, BSTR *String) { HTMLDOMTextNode *This = impl_from_IHTMLDOMTextNode(iface); - FIXME("(%p)->(%p)\n", This, String); - return E_NOTIMPL; + const PRUnichar *str; + + TRACE("(%p)->(%p)\n", This, String); + + if(!String) + return E_INVALIDARG; + + str = dispex_tostring(&This->node.event_target.dispex); + if(!wcscmp(str, L"[object]")) { + nsAString nsstr; + nsresult nsres; + + nsAString_Init(&nsstr, NULL); + nsres = nsIDOMText_GetData(This->nstext, &nsstr); + if(NS_FAILED(nsres)) { + nsAString_Finish(&nsstr); + return map_nsresult(nsres); + } + nsAString_GetData(&nsstr, &str); + *String = SysAllocString(str); + nsAString_Finish(&nsstr); + }else { + *String = SysAllocString(str); + } + return *String ? S_OK : E_OUTOFMEMORY; }
static HRESULT WINAPI HTMLDOMTextNode_get_length(IHTMLDOMTextNode *iface, LONG *p) @@ -361,7 +384,8 @@ static dispex_static_data_t HTMLDOMTextNode_dispex = { NULL, DispHTMLDOMTextNode_tid, HTMLDOMTextNode_iface_tids, - HTMLDOMNode_init_dispex_info + HTMLDOMNode_init_dispex_info, + L"[object Text]" };
HRESULT HTMLDOMTextNode_Create(HTMLDocumentNode *doc, nsIDOMNode *nsnode, HTMLDOMNode **node) diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index 037631b..5f78791 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -166,6 +166,8 @@ sync_test("builtin_toString", function() { ok(s === (v < 9 ? "[object]" : (v < 11 ? "[object Document]" : "[object HTMLDocument]")), "document.toString returned " + s); s = document.body.style.toString(); ok(s === (v < 9 ? "[object]" : "[object MSStyleCSSProperties]"), "document.body.style.toString returned " + s); + s = document.createTextNode("testNode").toString(); + ok(s === (v < 9 ? "testNode" : "[object Text]"), "text node 'testNode' toString returned " + s); });
sync_test("elem_props", function() {
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=98705
Your paranoid android.
=== w8adm (32 bit report) ===
mshtml: events.c:1089: Test failed: unexpected call img_onerror events: Timeout
=== w1064_tsign (32 bit report) ===
mshtml: htmldoc.c:2541: Test failed: unexpected call UpdateUI htmldoc.c:2853: Test failed: unexpected call Exec_UPDATECOMMANDS
=== w10pro64_he (64 bit report) ===
mshtml: htmldoc.c:2541: Test failed: unexpected call UpdateUI htmldoc.c:2853: Test failed: unexpected call Exec_UPDATECOMMANDS htmldoc.c:350: Test failed: expected Exec_SETTITLE htmldoc.c:2859: Test failed: unexpected call Exec_SETTITLE
=== w7u_el (32 bit report) ===
mshtml: script.c:624: Test failed: L"/index.html?es5.js:date_now: unexpected Date.now() result 1632508200820 expected 1632508200883"
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/mshtml/htmlelemcol.c | 14 +++++++++++--- dlls/mshtml/tests/documentmode.js | 2 ++ 2 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/dlls/mshtml/htmlelemcol.c b/dlls/mshtml/htmlelemcol.c index e72f21f..a231937 100644 --- a/dlls/mshtml/htmlelemcol.c +++ b/dlls/mshtml/htmlelemcol.c @@ -301,8 +301,14 @@ static HRESULT WINAPI HTMLElementCollection_toString(IHTMLElementCollection *ifa BSTR *String) { HTMLElementCollection *This = impl_from_IHTMLElementCollection(iface); - FIXME("(%p)->(%p)\n", This, String); - return E_NOTIMPL; + + TRACE("(%p)->(%p)\n", This, String); + + if(!String) + return E_INVALIDARG; + + *String = SysAllocString(dispex_tostring(&This->dispex)); + return *String ? S_OK : E_OUTOFMEMORY; }
static HRESULT WINAPI HTMLElementCollection_put_length(IHTMLElementCollection *iface, @@ -620,7 +626,9 @@ static const tid_t HTMLElementCollection_iface_tids[] = { static dispex_static_data_t HTMLElementCollection_dispex = { &HTMLElementColection_dispex_vtbl, DispHTMLElementCollection_tid, - HTMLElementCollection_iface_tids + HTMLElementCollection_iface_tids, + NULL, + L"[object HTMLCollection]" };
static void create_all_list(HTMLDOMNode *elem, elem_vector_t *buf) diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index 5f78791..a99ebe5 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -168,6 +168,8 @@ sync_test("builtin_toString", function() { ok(s === (v < 9 ? "[object]" : "[object MSStyleCSSProperties]"), "document.body.style.toString returned " + s); s = document.createTextNode("testNode").toString(); ok(s === (v < 9 ? "testNode" : "[object Text]"), "text node 'testNode' toString returned " + s); + s = document.getElementsByTagName("body").toString(); + ok(s === (v < 9 ? "[object]" : "[object HTMLCollection]"), "element collection toString returned " + s); });
sync_test("elem_props", function() {
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=98706
Your paranoid android.
=== w8adm (32 bit report) ===
mshtml: htmldoc.c:3084: Test failed: Incorrect error code: -2146697211 htmldoc.c:3089: Test failed: Page address: L"http://test.winehq.org/tests/winehq_snapshot/" htmldoc.c:5861: Test failed: expected OnChanged_1012 htmldoc.c:5862: Test failed: expected Exec_HTTPEQUIV htmldoc.c:5864: Test failed: expected Exec_SETTITLE htmldoc.c:5905: Test failed: expected FireNavigateComplete2
=== w1064_tsign (64 bit report) ===
mshtml: htmldoc.c:2541: Test failed: unexpected call UpdateUI htmldoc.c:2853: Test failed: unexpected call Exec_UPDATECOMMANDS htmldoc.c:350: Test failed: expected Exec_SETTITLE htmldoc.c:2859: Test failed: unexpected call Exec_SETTITLE
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/mshtml/range.c | 10 ++++++++-- dlls/mshtml/tests/dom.c | 6 ++++++ 2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/dlls/mshtml/range.c b/dlls/mshtml/range.c index 89f6804..6c3d346 100644 --- a/dlls/mshtml/range.c +++ b/dlls/mshtml/range.c @@ -1993,8 +1993,14 @@ static HRESULT WINAPI HTMLDOMRange_cloneRange(IHTMLDOMRange *iface, IHTMLDOMRang static HRESULT WINAPI HTMLDOMRange_toString(IHTMLDOMRange *iface, BSTR *p) { HTMLDOMRange *This = impl_from_IHTMLDOMRange(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; + + TRACE("(%p)->(%p)\n", This, p); + + if(!p) + return E_INVALIDARG; + + *p = NULL; + return S_OK; }
static HRESULT WINAPI HTMLDOMRange_detach(IHTMLDOMRange *iface) diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c index 67d7978..4af16b9 100644 --- a/dlls/mshtml/tests/dom.c +++ b/dlls/mshtml/tests/dom.c @@ -5913,6 +5913,7 @@ static void test_range(IHTMLDocument2 *doc) IDocumentRange *doc_range; IHTMLDOMRange *range; HRESULT hres; + BSTR str;
hres = IHTMLDocument2_QueryInterface(doc, &IID_IDocumentRange, (void **)&doc_range); ok(hres == S_OK, "Failed to get IDocumentRange: %08x\n", hres); @@ -5922,6 +5923,11 @@ static void test_range(IHTMLDocument2 *doc) hres = IDocumentRange_createRange(doc_range, &range); ok(hres == S_OK, "Failed to create range, %08x\n", hres);
+ hres = IHTMLDOMRange_toString(range, &str); + ok(hres == S_OK, "toString failed: %08x\n", hres); + ok(!str, "toString returned: %s\n", wine_dbgstr_w(str)); + SysFreeString(str); + test_disp((IUnknown *)range, &DIID_DispHTMLDOMRange, NULL, NULL);
IHTMLDOMRange_Release(range);
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=98700
Your paranoid android.
=== w8adm (32 bit report) ===
mshtml: events.c:1089: Test failed: unexpected call img_onerror events: Timeout
=== w1064_tsign (32 bit report) ===
mshtml: htmldoc.c:2541: Test failed: unexpected call UpdateUI htmldoc.c:2853: Test failed: unexpected call Exec_UPDATECOMMANDS
Hi Gabriel,
On 9/24/21 3:45 PM, Gabriel Ivăncescu wrote:
The special case for an empty string should not be needed.
I was hoping that it could take care of entire implementation. Caller could be about to do just:
return dispex_to_string(&This->dispex, p);
I think that having a separated constructor instead of all those NULLs would avoid the mess that you need in HTMLElement_toString:
(...)
It would be cleaner to no tie it so tightly with toString and store just the type name. "[object ...]" decorations can be a part of toString implementation.
I also think it would be nicer to have it as the first field of dispex_static_data_t.
Thanks,
Jacek
Hi Jacek,
On 27/09/2021 18:42, Jacek Caban wrote:
How should I handle it for the elements that return empty string even in old modes (that would otherwise return [object])? For <a> and <area> elements, they return empty string in *all* modes.
Also I'd have to special case either this, or having it set to NULL (since I'll use a separate constructor now), because as you noted below, the decoration must also not be added to it.
i.e. it literally returns empty string, not [object] or anything else.
Okay, I'm just not sure how to deal with the use_generic thing, since right now it uses a different constructor/vtbl. Do I have to duplicate that, too? I don't even know what it's used for.
Or just ignore it? What should I base the new constructor on, the generic one (HTMLGenericElement_dispex), or the HTMLElement_dispex?
Noted.
Thanks, Gabriel
On 9/27/21 6:54 PM, Gabriel Ivăncescu wrote:
It doesn't return empty string, it returns content of href prof. See [1] and the attached test. In this case, we may not use the default dispex_to_string implementation for anchor elements at all. We could use NodeImplVtbl for that. (BTW, it's also an interesting test for the rest of the series that you sent earlier).
I think that current "use_generic" behaviour is not exactly right and it will not be needed once we have proper constructors: just assume it's always true; it will not be used for known tags anyway.
Or just ignore it? What should I base the new constructor on, the generic one (HTMLGenericElement_dispex), or the HTMLElement_dispex?
HTMLElement_dispex
Thanks,
Jacek
[1] https://developer.mozilla.org/en-US/docs/Web/API/HTMLAnchorElement/toString
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=98872
Your paranoid android.
=== w8adm (32 bit report) ===
mshtml: events.c:1089: Test failed: unexpected call img_onerror events: Timeout
=== w8adm (32 bit report) ===
mshtml: htmldoc.c:3084: Test failed: Incorrect error code: -2146697211 htmldoc.c:3089: Test failed: Page address: L"http://test.winehq.org/tests/winehq_snapshot/" htmldoc.c:5861: Test failed: expected OnChanged_1012 htmldoc.c:5862: Test failed: expected Exec_HTTPEQUIV htmldoc.c:5864: Test failed: expected Exec_SETTITLE htmldoc.c:5905: Test failed: expected FireNavigateComplete2
=== w1064_tsign (32 bit report) ===
mshtml: htmldoc.c:2541: Test failed: unexpected call UpdateUI htmldoc.c:2853: Test failed: unexpected call Exec_UPDATECOMMANDS htmldoc.c:350: Test failed: expected Exec_SETTITLE htmldoc.c:2859: Test failed: unexpected call Exec_SETTITLE
=== w1064_tsign (64 bit report) ===
mshtml: htmldoc.c:2541: Test failed: unexpected call UpdateUI htmldoc.c:2853: Test failed: unexpected call Exec_UPDATECOMMANDS
=== w7u_adm (32 bit report) ===
mshtml: script.c:624: Test failed: L"/index.html?es5.js:date_now: unexpected Date.now() result 1632767288919 expected 1632767288981"
=== debiant2 (32 bit report) ===
mshtml: script.c:624: Test failed: L"/index.html?es5.js:toString: Got exception "
=== debiant2 (32 bit Arabic:Morocco report) ===
mshtml: script.c:624: Test failed: L"/index.html?es5.js:toString: Got exception "
=== debiant2 (32 bit German report) ===
mshtml: script.c:624: Test failed: L"/index.html?es5.js:toString: Got exception "
=== debiant2 (32 bit French report) ===
mshtml: script.c:624: Test failed: L"/index.html?es5.js:toString: Got exception "
=== debiant2 (32 bit Hebrew:Israel report) ===
mshtml: script.c:624: Test failed: L"/index.html?es5.js:toString: Got exception "
=== debiant2 (32 bit Hindi:India report) ===
mshtml: script.c:624: Test failed: L"/index.html?es5.js:toString: Got exception "
=== debiant2 (32 bit Japanese:Japan report) ===
mshtml: script.c:624: Test failed: L"/index.html?es5.js:toString: Got exception "
=== debiant2 (32 bit Chinese:China report) ===
mshtml: script.c:624: Test failed: L"/index.html?es5.js:toString: Got exception "
=== debiant2 (32 bit WoW report) ===
mshtml: script.c:624: Test failed: L"/index.html?es5.js:toString: Got exception "
=== debiant2 (64 bit WoW report) ===
mshtml: script.c:624: Test failed: L"/index.html?es5.js:toString: Got exception "