Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/mshtml/dispex.c | 4 ++++ dlls/mshtml/htmldoc.c | 15 ++++++++------- dlls/mshtml/mshtml_private.h | 1 + dlls/mshtml/tests/documentmode.js | 1 + 4 files changed, 14 insertions(+), 7 deletions(-)
diff --git a/dlls/mshtml/dispex.c b/dlls/mshtml/dispex.c index 35044bc..1ddb9ee 100644 --- a/dlls/mshtml/dispex.c +++ b/dlls/mshtml/dispex.c @@ -1502,6 +1502,10 @@ HRESULT dispex_to_string(DispatchEx *dispex, BSTR *ret) if(compat_mode < COMPAT_MODE_IE9 || !name) p--; else { + if(dispex->info->desc->vtbl && dispex->info->desc->vtbl->get_compat_name) { + const WCHAR *tmp = dispex->info->desc->vtbl->get_compat_name(compat_mode); + if(tmp) name = tmp; + } len = wcslen(name); assert(len <= 28); memcpy(p, name, len * sizeof(WCHAR)); diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c index d6ba072..9a77464 100644 --- a/dlls/mshtml/htmldoc.c +++ b/dlls/mshtml/htmldoc.c @@ -1703,12 +1703,7 @@ static HRESULT WINAPI HTMLDocument_toString(IHTMLDocument2 *iface, BSTR *String)
TRACE("(%p)->(%p)\n", This, String);
- if(!String) - return E_INVALIDARG; - - *String = SysAllocString(L"[object]"); - return *String ? S_OK : E_OUTOFMEMORY; - + return dispex_to_string(&This->doc_node->node.event_target.dispex, String); }
static HRESULT WINAPI HTMLDocument_createStyleSheet(IHTMLDocument2 *iface, BSTR bstrHref, @@ -5563,6 +5558,11 @@ static compat_mode_t HTMLDocumentNode_get_compat_mode(DispatchEx *dispex) return lock_document_mode(This); }
+static const WCHAR *HTMLDocumentNode_get_compat_name(compat_mode_t compat_mode) +{ + return compat_mode < COMPAT_MODE_IE11 ? L"Document" : NULL; +} + static nsISupports *HTMLDocumentNode_get_gecko_target(DispatchEx *dispex) { HTMLDocumentNode *This = impl_from_DispatchEx(dispex); @@ -5605,7 +5605,8 @@ static const event_target_vtbl_t HTMLDocumentNode_event_target_vtbl = { NULL, HTMLDocumentNode_invoke, HTMLDocumentNode_get_compat_mode, - NULL + NULL, + HTMLDocumentNode_get_compat_name }, HTMLDocumentNode_get_gecko_target, HTMLDocumentNode_bind_event, diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index 5cf53bb..483fc58 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -325,6 +325,7 @@ typedef struct { HRESULT (*invoke)(DispatchEx*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*,IServiceProvider*); compat_mode_t (*get_compat_mode)(DispatchEx*); HRESULT (*populate_props)(DispatchEx*); + const WCHAR* (*get_compat_name)(compat_mode_t); } dispex_static_data_vtbl_t;
typedef struct { diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index 3317f77..f2cee48 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -195,6 +195,7 @@ sync_test("builtin_toString", function() { test("clientRect", e.getClientRects()[0], "ClientRect"); test("clientRects", e.getClientRects(), "ClientRectList"); test("currentStyle", e.currentStyle, "MSCurrentStyleCSSProperties"); + test("document", document, v < 11 ? "Document" : "HTMLDocument"); test("elements", document.getElementsByTagName("body"), "HTMLCollection"); test("history", window.history, "History"); test("implementation", document.implementation, "DOMImplementation");