[PATCH v3 3/3] mshtml: Add console object stub implementation.

Paul Gofman pgofman at codeweavers.com
Wed Jul 7 07:03:49 CDT 2021


Signed-off-by: Paul Gofman <pgofman at codeweavers.com>
---
v3:
    - add console getter interface to HTMLWindow.

 dlls/mshtml/Makefile.in              |   1 +
 dlls/mshtml/console.c                | 294 +++++++++++++++++++++++++++
 dlls/mshtml/dispex.c                 |  21 +-
 dlls/mshtml/htmlwindow.c             |  97 +++++++++
 dlls/mshtml/mshtml_private.h         |  12 ++
 dlls/mshtml/mshtml_private_iface.idl | 115 +++++++++++
 dlls/mshtml/tests/es5.js             |  64 ++++++
 7 files changed, 601 insertions(+), 3 deletions(-)
 create mode 100644 dlls/mshtml/console.c

diff --git a/dlls/mshtml/Makefile.in b/dlls/mshtml/Makefile.in
index ce7ddb40bde..9c5585ad4b9 100644
--- a/dlls/mshtml/Makefile.in
+++ b/dlls/mshtml/Makefile.in
@@ -7,6 +7,7 @@ EXTRADLLFLAGS = -mno-cygwin
 
 C_SRCS = \
 	conpoint.c \
+	console.c \
 	dispex.c \
 	editor.c \
 	htmlanchor.c \
diff --git a/dlls/mshtml/console.c b/dlls/mshtml/console.c
new file mode 100644
index 00000000000..58df32896cc
--- /dev/null
+++ b/dlls/mshtml/console.c
@@ -0,0 +1,294 @@
+/*
+ * Copyright 2021 Paul Gofman for CodeWeavers
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include <stdarg.h>
+
+#define COBJMACROS
+
+#include "windef.h"
+#include "winbase.h"
+#include "winuser.h"
+#include "ole2.h"
+#include "mshtmdid.h"
+#include "shlguid.h"
+#include "shobjidl.h"
+#include "exdispid.h"
+
+#include "wine/debug.h"
+
+#include "mshtml_private.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
+
+struct console {
+    DispatchEx dispex;
+    IWineMSHTMLConsole IWineMSHTMLConsole_iface;
+    LONG ref;
+};
+
+static inline struct console *impl_from_IWineMSHTMLConsole(IWineMSHTMLConsole *iface)
+{
+    return CONTAINING_RECORD(iface, struct console, IWineMSHTMLConsole_iface);
+}
+
+static HRESULT WINAPI console_QueryInterface(IWineMSHTMLConsole *iface, REFIID riid, void **ppv)
+{
+    struct console *console = impl_from_IWineMSHTMLConsole(iface);
+
+    TRACE("(%p)->(%s %p)\n", console, debugstr_mshtml_guid(riid), ppv);
+
+    if(IsEqualGUID(&IID_IUnknown, riid)) {
+        *ppv = &console->IWineMSHTMLConsole_iface;
+    }else if(IsEqualGUID(&IID_IWineMSHTMLConsole, riid)) {
+        *ppv = &console->IWineMSHTMLConsole_iface;
+    }else if(dispex_query_interface(&console->dispex, riid, ppv)) {
+        return *ppv ? S_OK : E_NOINTERFACE;
+    }else {
+        WARN("(%p)->(%s %p)\n", console, debugstr_mshtml_guid(riid), ppv);
+        *ppv = NULL;
+        return E_NOINTERFACE;
+    }
+
+    IUnknown_AddRef((IUnknown*)*ppv);
+    return S_OK;
+}
+
+static ULONG WINAPI console_AddRef(IWineMSHTMLConsole *iface)
+{
+    struct console *console = impl_from_IWineMSHTMLConsole(iface);
+    LONG ref = InterlockedIncrement(&console->ref);
+
+    TRACE("(%p) ref=%d\n", console, ref);
+
+    return ref;
+}
+
+static ULONG WINAPI console_Release(IWineMSHTMLConsole *iface)
+{
+    struct console *console = impl_from_IWineMSHTMLConsole(iface);
+    LONG ref = InterlockedDecrement(&console->ref);
+
+    TRACE("(%p) ref=%d\n", console, ref);
+
+    if(!ref) {
+        release_dispex(&console->dispex);
+        heap_free(console);
+    }
+
+    return ref;
+}
+
+static HRESULT WINAPI console_GetTypeInfoCount(IWineMSHTMLConsole *iface, UINT *pctinfo)
+{
+    struct console *console = impl_from_IWineMSHTMLConsole(iface);
+    FIXME("(%p)->(%p)\n", console, pctinfo);
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI console_GetTypeInfo(IWineMSHTMLConsole *iface, UINT iTInfo,
+        LCID lcid, ITypeInfo **ppTInfo)
+{
+    struct console *console = impl_from_IWineMSHTMLConsole(iface);
+
+    return IDispatchEx_GetTypeInfo(&console->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
+}
+
+static HRESULT WINAPI console_GetIDsOfNames(IWineMSHTMLConsole *iface, REFIID riid,
+        LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
+{
+    struct console *console = impl_from_IWineMSHTMLConsole(iface);
+
+    return IDispatchEx_GetIDsOfNames(&console->dispex.IDispatchEx_iface, riid, rgszNames, cNames,
+            lcid, rgDispId);
+}
+
+static HRESULT WINAPI console_Invoke(IWineMSHTMLConsole *iface, DISPID dispIdMember,
+        REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
+        VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
+{
+    struct console *console = impl_from_IWineMSHTMLConsole(iface);
+
+    return IDispatchEx_Invoke(&console->dispex.IDispatchEx_iface, dispIdMember, riid, lcid, wFlags,
+            pDispParams, pVarResult, pExcepInfo, puArgErr);
+}
+
+static HRESULT WINAPI console_assert(IWineMSHTMLConsole *iface, VARIANT_BOOL *assertion, VARIANT *vararg_start)
+{
+    FIXME("iface %p, assertion %p, vararg_start %p stub.\n", iface, assertion, vararg_start);
+
+    return S_OK;
+}
+
+static HRESULT WINAPI console_clear(IWineMSHTMLConsole *iface)
+{
+    FIXME("iface %p stub.\n", iface);
+
+    return S_OK;
+}
+
+static HRESULT WINAPI console_count(IWineMSHTMLConsole *iface, VARIANT *label)
+{
+    FIXME("iface %p, label %p stub.\n", iface, label);
+
+    return S_OK;
+}
+
+static HRESULT WINAPI console_debug(IWineMSHTMLConsole *iface, VARIANT *vararg_start)
+{
+    FIXME("iface %p, vararg_start %p stub.\n", iface, vararg_start);
+
+    return S_OK;
+}
+
+static HRESULT WINAPI console_dir(IWineMSHTMLConsole *iface, VARIANT *object)
+{
+    FIXME("iface %p, object %p stub.\n", iface, object);
+
+    return S_OK;
+}
+
+static HRESULT WINAPI console_dirxml(IWineMSHTMLConsole *iface, VARIANT *object)
+{
+    FIXME("iface %p, object %p stub.\n", iface, object);
+
+    return S_OK;
+}
+
+static HRESULT WINAPI console_error(IWineMSHTMLConsole *iface, VARIANT *vararg_start)
+{
+    FIXME("iface %p, vararg_start %p stub.\n", iface, vararg_start);
+
+    return S_OK;
+}
+
+static HRESULT WINAPI console_group(IWineMSHTMLConsole *iface, VARIANT *label)
+{
+    FIXME("iface %p, label %p stub.\n", iface, label);
+
+    return S_OK;
+}
+
+static HRESULT WINAPI console_group_collapsed(IWineMSHTMLConsole *iface, VARIANT *label)
+{
+    FIXME("iface %p, label %p stub.\n", iface, label);
+
+    return S_OK;
+}
+
+static HRESULT WINAPI console_group_end(IWineMSHTMLConsole *iface)
+{
+    FIXME("iface %p, stub.\n", iface);
+
+    return S_OK;
+}
+
+static HRESULT WINAPI console_info(IWineMSHTMLConsole *iface, VARIANT *vararg_start)
+{
+    FIXME("iface %p, vararg_start %p stub.\n", iface, vararg_start);
+
+    return S_OK;
+}
+
+static HRESULT WINAPI console_log(IWineMSHTMLConsole *iface, VARIANT *vararg_start)
+{
+    FIXME("iface %p, vararg_start %p stub.\n", iface, vararg_start);
+
+    return S_OK;
+}
+
+static HRESULT WINAPI console_time(IWineMSHTMLConsole *iface, VARIANT *label)
+{
+    FIXME("iface %p, label %p stub.\n", iface, label);
+
+    return S_OK;
+}
+
+static HRESULT WINAPI console_time_end(IWineMSHTMLConsole *iface, VARIANT *label)
+{
+    FIXME("iface %p, label %p stub.\n", iface, label);
+
+    return S_OK;
+}
+
+static HRESULT WINAPI console_trace(IWineMSHTMLConsole *iface, VARIANT *vararg_start)
+{
+    FIXME("iface %p, vararg_start %p stub.\n", iface, vararg_start);
+
+    return S_OK;
+}
+
+static HRESULT WINAPI console_warn(IWineMSHTMLConsole *iface, VARIANT *vararg_start)
+{
+    FIXME("iface %p, vararg_start %p stub.\n", iface, vararg_start);
+
+    return S_OK;
+}
+
+static const IWineMSHTMLConsoleVtbl WineMSHTMLConsoleVtbl = {
+    console_QueryInterface,
+    console_AddRef,
+    console_Release,
+    console_GetTypeInfoCount,
+    console_GetTypeInfo,
+    console_GetIDsOfNames,
+    console_Invoke,
+    console_assert,
+    console_clear,
+    console_count,
+    console_debug,
+    console_dir,
+    console_dirxml,
+    console_error,
+    console_group,
+    console_group_collapsed,
+    console_group_end,
+    console_info,
+    console_log,
+    console_time,
+    console_time_end,
+    console_trace,
+    console_warn,
+};
+
+static const tid_t console_iface_tids[] = {
+    IWineMSHTMLConsole_tid,
+    0
+};
+static dispex_static_data_t console_dispex = {
+    NULL,
+    IWineMSHTMLConsole_tid,
+    console_iface_tids
+};
+
+void create_console(IWineMSHTMLConsole **ret)
+{
+    struct console *obj;
+
+    obj = heap_alloc_zero(sizeof(*obj));
+    if(!obj)
+    {
+        ERR("No memory.\n");
+        return;
+    }
+
+    obj->IWineMSHTMLConsole_iface.lpVtbl = &WineMSHTMLConsoleVtbl;
+    obj->ref = 1;
+    init_dispatch(&obj->dispex, (IUnknown*)&obj->IWineMSHTMLConsole_iface, &console_dispex, COMPAT_MODE_NONE);
+
+    *ret = &obj->IWineMSHTMLConsole_iface;
+}
diff --git a/dlls/mshtml/dispex.c b/dlls/mshtml/dispex.c
index 6d248691d6b..e0c2ea2c121 100644
--- a/dlls/mshtml/dispex.c
+++ b/dlls/mshtml/dispex.c
@@ -111,7 +111,7 @@ struct dispex_dynamic_data_t {
 
 #define FDEX_VERSION_MASK 0xf0000000
 
-static ITypeLib *typelib;
+static ITypeLib *typelib, *typelib_private;
 static ITypeInfo *typeinfos[LAST_tid];
 static struct list dispex_data_list = LIST_INIT(dispex_data_list);
 
@@ -119,6 +119,8 @@ static REFIID tid_ids[] = {
 #define XIID(iface) &IID_ ## iface,
 #define XDIID(iface) &DIID_ ## iface,
 TID_LIST
+    NULL,
+PRIVATE_TID_LIST
 #undef XIID
 #undef XDIID
 };
@@ -136,7 +138,17 @@ static HRESULT load_typelib(void)
 
     if(InterlockedCompareExchangePointer((void**)&typelib, tl, NULL))
         ITypeLib_Release(tl);
-    return hres;
+
+    hres = LoadTypeLibEx(L"mshtml.dll\\1", REGKIND_NONE, &tl);
+    if(FAILED(hres)) {
+        ERR("LoadTypeLibEx failed for private typelib: %08x\n", hres);
+        return hres;
+    }
+
+    if(InterlockedCompareExchangePointer((void**)&typelib_private, tl, NULL))
+        ITypeLib_Release(tl);
+
+    return S_OK;
 }
 
 static HRESULT get_typeinfo(tid_t tid, ITypeInfo **typeinfo)
@@ -151,7 +163,7 @@ static HRESULT get_typeinfo(tid_t tid, ITypeInfo **typeinfo)
     if(!typeinfos[tid]) {
         ITypeInfo *ti;
 
-        hres = ITypeLib_GetTypeInfoOfGuid(typelib, tid_ids[tid], &ti);
+        hres = ITypeLib_GetTypeInfoOfGuid(tid > LAST_public_tid ? typelib_private : typelib, tid_ids[tid], &ti);
         if(FAILED(hres)) {
             ERR("GetTypeInfoOfGuid(%s) failed: %08x\n", debugstr_mshtml_guid(tid_ids[tid]), hres);
             return hres;
@@ -197,6 +209,7 @@ void release_typelib(void)
             ITypeInfo_Release(typeinfos[i]);
 
     ITypeLib_Release(typelib);
+    ITypeLib_Release(typelib_private);
     DeleteCriticalSection(&cs_dispex_static_data);
 }
 
@@ -210,6 +223,8 @@ HRESULT get_class_typeinfo(const CLSID *clsid, ITypeInfo **typeinfo)
         return hres;
 
     hres = ITypeLib_GetTypeInfoOfGuid(typelib, clsid, typeinfo);
+    if (FAILED(hres))
+        hres = ITypeLib_GetTypeInfoOfGuid(typelib_private, clsid, typeinfo);
     if(FAILED(hres))
         ERR("GetTypeInfoOfGuid failed: %08x\n", hres);
     return hres;
diff --git a/dlls/mshtml/htmlwindow.c b/dlls/mshtml/htmlwindow.c
index 4196d1f45ad..f4d83ad26c5 100644
--- a/dlls/mshtml/htmlwindow.c
+++ b/dlls/mshtml/htmlwindow.c
@@ -189,6 +189,8 @@ static HRESULT WINAPI HTMLWindow2_QueryInterface(IHTMLWindow2 *iface, REFIID rii
         *ppv = &This->IProvideMultipleClassInfo_iface;
     }else if(IsEqualGUID(&IID_IProvideMultipleClassInfo, riid)) {
         *ppv = &This->IProvideMultipleClassInfo_iface;
+    }else if(IsEqualGUID(&IID_IWineConsoleGetter, riid)) {
+        *ppv = &This->IWineConsoleGetter_iface;
     }else if(IsEqualGUID(&IID_IMarshal, riid)) {
         *ppv = NULL;
         FIXME("(%p)->(IID_IMarshal %p)\n", This, ppv);
@@ -314,6 +316,9 @@ static ULONG WINAPI HTMLWindow2_Release(IHTMLWindow2 *iface)
     TRACE("(%p) ref=%d\n", This, ref);
 
     if(!ref) {
+        if (This->console)
+            IWineMSHTMLConsole_Release(This->console);
+
         if(is_outer_window(This))
             release_outer_window(This->outer_window);
         else
@@ -3033,6 +3038,91 @@ static const IProvideMultipleClassInfoVtbl ProvideMultipleClassInfoVtbl = {
     ProvideMultipleClassInfo_GetInfoOfIndex
 };
 
+static inline HTMLWindow *impl_from_IWineConsoleGetterVtbl(IWineConsoleGetter *iface)
+{
+    return CONTAINING_RECORD(iface, HTMLWindow, IWineConsoleGetter_iface);
+}
+
+static HRESULT WINAPI console_getter_QueryInterface(IWineConsoleGetter *iface,
+        REFIID riid, void **ppv)
+{
+    HTMLWindow *This = impl_from_IWineConsoleGetterVtbl(iface);
+
+    return IHTMLWindow2_QueryInterface(&This->IHTMLWindow2_iface, riid, ppv);
+}
+
+static ULONG WINAPI console_getter_AddRef(IWineConsoleGetter *iface)
+{
+    HTMLWindow *This = impl_from_IWineConsoleGetterVtbl(iface);
+
+    return IHTMLWindow2_AddRef(&This->IHTMLWindow2_iface);
+}
+
+static ULONG WINAPI console_getter_Release(IWineConsoleGetter *iface)
+{
+    HTMLWindow *This = impl_from_IWineConsoleGetterVtbl(iface);
+
+    return IHTMLWindow2_Release(&This->IHTMLWindow2_iface);
+}
+
+static HRESULT WINAPI console_getter_GetTypeInfoCount(IWineConsoleGetter *iface, UINT *pctinfo)
+{
+    HTMLWindow *This = impl_from_IWineConsoleGetterVtbl(iface);
+
+    return IDispatchEx_GetTypeInfoCount(&This->IDispatchEx_iface, pctinfo);
+}
+
+static HRESULT WINAPI console_getter_GetTypeInfo(IWineConsoleGetter *iface, UINT iTInfo,
+                                              LCID lcid, ITypeInfo **ppTInfo)
+{
+    HTMLWindow *This = impl_from_IWineConsoleGetterVtbl(iface);
+
+    return IDispatchEx_GetTypeInfo(&This->IDispatchEx_iface, iTInfo, lcid, ppTInfo);
+}
+
+static HRESULT WINAPI console_getter_GetIDsOfNames(IWineConsoleGetter *iface, REFIID riid,
+                                                LPOLESTR *rgszNames, UINT cNames,
+                                                LCID lcid, DISPID *rgDispId)
+{
+    HTMLWindow *This = impl_from_IWineConsoleGetterVtbl(iface);
+
+    return IDispatchEx_GetIDsOfNames(&This->IDispatchEx_iface, riid, rgszNames, cNames, lcid,
+            rgDispId);
+}
+
+static HRESULT WINAPI console_getter_Invoke(IWineConsoleGetter *iface, DISPID dispIdMember,
+                            REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
+                            VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
+{
+    HTMLWindow *This = impl_from_IWineConsoleGetterVtbl(iface);
+
+    return IDispatchEx_Invoke(&This->IDispatchEx_iface, dispIdMember, riid, lcid, wFlags,
+            pDispParams, pVarResult, pExcepInfo, puArgErr);
+}
+
+static HRESULT WINAPI console_getter_get_console(IWineConsoleGetter *iface, IDispatch **console)
+{
+    HTMLWindow *This = impl_from_IWineConsoleGetterVtbl(iface);
+
+    TRACE("iface %p, console %p.\n", iface, console);
+
+    *console = (IDispatch *)This->console;
+    if (This->console)
+        IWineMSHTMLConsole_AddRef(This->console);
+    return S_OK;
+}
+
+static const IWineConsoleGetterVtbl WineConsoleGetterVtbl = {
+    console_getter_QueryInterface,
+    console_getter_AddRef,
+    console_getter_Release,
+    console_getter_GetTypeInfoCount,
+    console_getter_GetTypeInfo,
+    console_getter_GetIDsOfNames,
+    console_getter_Invoke,
+    console_getter_get_console,
+};
+
 static inline HTMLWindow *impl_from_IDispatchEx(IDispatchEx *iface)
 {
     return CONTAINING_RECORD(iface, HTMLWindow, IDispatchEx_iface);
@@ -3179,6 +3269,7 @@ HRESULT search_window_props(HTMLInnerWindow *This, BSTR bstrName, DWORD grfdex,
 /* DISPIDs not exposed by interfaces */
 #define DISPID_IHTMLWINDOW_IE10_REQUESTANIMATIONFRAME 1300
 
+
 static HRESULT WINAPI WindowDispEx_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD grfdex, DISPID *pid)
 {
     HTMLWindow *This = impl_from_IDispatchEx(iface);
@@ -3566,6 +3657,9 @@ static void HTMLWindow_init_dispex_info(dispex_data_t *info, compat_mode_t compa
 {
     if(compat_mode >= COMPAT_MODE_IE9)
         dispex_info_add_interface(info, IHTMLWindow7_tid, NULL);
+    if(compat_mode >= COMPAT_MODE_IE10)
+        dispex_info_add_interface(info, IWineConsoleGetter_tid, NULL);
+
     dispex_info_add_interface(info, IHTMLWindow5_tid, NULL);
     EventTarget_init_dispex_info(info, compat_mode);
 }
@@ -3627,8 +3721,11 @@ static void *alloc_window(size_t size)
     window->ITravelLogClient_iface.lpVtbl = &TravelLogClientVtbl;
     window->IObjectIdentity_iface.lpVtbl = &ObjectIdentityVtbl;
     window->IProvideMultipleClassInfo_iface.lpVtbl = &ProvideMultipleClassInfoVtbl;
+    window->IWineConsoleGetter_iface.lpVtbl = &WineConsoleGetterVtbl;
     window->ref = 1;
 
+    create_console(&window->console);
+
     return window;
 }
 
diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h
index 6228cf1298d..89d06de4ca7 100644
--- a/dlls/mshtml/mshtml_private.h
+++ b/dlls/mshtml/mshtml_private.h
@@ -272,10 +272,18 @@ typedef struct EventTarget EventTarget;
     XIID(ISVGTSpanElement) \
     XIID(ISVGTextContentElement)
 
+#define PRIVATE_TID_LIST \
+    XDIID(DispWineConsoleGetter) \
+    XDIID(DispWineMSHTMLConsole) \
+    XIID(IWineConsoleGetter) \
+    XIID(IWineMSHTMLConsole)
+
 typedef enum {
 #define XIID(iface) iface ## _tid,
 #define XDIID(iface) iface ## _tid,
 TID_LIST
+    LAST_public_tid,
+PRIVATE_TID_LIST
 #undef XIID
 #undef XDIID
     LAST_tid
@@ -485,6 +493,9 @@ struct HTMLWindow {
     ITravelLogClient   ITravelLogClient_iface;
     IObjectIdentity    IObjectIdentity_iface;
     IProvideMultipleClassInfo IProvideMultipleClassInfo_iface;
+    IWineConsoleGetter IWineConsoleGetter_iface;
+
+    IWineMSHTMLConsole *console;
 
     LONG ref;
 
@@ -1401,3 +1412,4 @@ void set_statustext(HTMLDocumentObj*,INT,LPCWSTR) DECLSPEC_HIDDEN;
 IInternetSecurityManager *get_security_manager(void) DECLSPEC_HIDDEN;
 
 extern HINSTANCE hInst DECLSPEC_HIDDEN;
+void create_console(IWineMSHTMLConsole **ret) DECLSPEC_HIDDEN;
diff --git a/dlls/mshtml/mshtml_private_iface.idl b/dlls/mshtml/mshtml_private_iface.idl
index 60ad70eede7..d721d09190a 100644
--- a/dlls/mshtml/mshtml_private_iface.idl
+++ b/dlls/mshtml/mshtml_private_iface.idl
@@ -30,4 +30,119 @@ import "dispex.idl";
 ]
 library MSHTML_private
 {
+
+importlib("stdole2.tlb");
+
+[
+    odl,
+    oleautomation,
+    dual,
+    hidden,
+    uuid(fd55b4b6-2813-4fb4-829d-380099474ab1)
+]
+interface IWineMSHTMLConsole : IDispatch
+{
+    [id(1)]
+    HRESULT assert([in] VARIANT_BOOL *assertion,
+                   [in, optional] VARIANT *varargStart);
+    [id(2)]
+    HRESULT clear();
+    [id(3)]
+    HRESULT count([in, optional] VARIANT *label);
+    [id(4)]
+    HRESULT debug([in, optional] VARIANT *varargStart);
+    [id(5)]
+    HRESULT dir([in, optional] VARIANT *object);
+    [id(6)]
+    HRESULT dirxml([in, optional] VARIANT *object);
+    [id(7)]
+    HRESULT error([in, optional] VARIANT *varargStart);
+    [id(8)]
+    HRESULT group([in, optional] VARIANT *label);
+    [id(9)]
+    HRESULT groupCollapsed([in, optional] VARIANT *label);
+    [id(10)]
+    HRESULT groupEnd();
+    [id(11)]
+    HRESULT info([in, optional] VARIANT *varargStart);
+    [id(12)]
+    HRESULT log([in, optional] VARIANT *varargStart);
+    [id(13)]
+    HRESULT time([in, optional] VARIANT *label);
+    [id(14)]
+    HRESULT timeEnd([in, optional] VARIANT *label);
+    [id(15)]
+    HRESULT trace([in, optional] VARIANT *varargStart);
+    [id(16)]
+    HRESULT warn([in, optional] VARIANT *varargStart);
+}
+
+[
+    hidden,
+    uuid(b61c3206-7c3d-4b56-bf16-a9f264747f58)
+]
+dispinterface DispWineMSHTMLConsole
+{
+properties:
+methods:
+    [id(1)]
+    void assert([in] VARIANT_BOOL *assertion,
+                [in, optional] VARIANT *varargStart);
+    [id(2)]
+    void clear();
+    [id(3)]
+    void count([in, optional] VARIANT *label);
+    [id(4)]
+    void debug([in, optional] VARIANT *varargStart);
+    [id(5)]
+    void dir([in, optional] VARIANT *object);
+    [id(6)]
+    void dirxml([in, optional] VARIANT *object);
+    [id(7)]
+    void error([in, optional] VARIANT *varargStart);
+    [id(8)]
+    void group([in, optional] VARIANT *label);
+    [id(9)]
+    void groupCollapsed([in, optional] VARIANT *label);
+    [id(10)]
+    void groupEnd();
+    [id(11)]
+    void info([in, optional] VARIANT *varargStart);
+    [id(12)]
+    void log([in, optional] VARIANT *varargStart);
+    [id(13)]
+    void time([in, optional] VARIANT *label);
+    [id(14)]
+    void timeEnd([in, optional] VARIANT *label);
+    [id(15)]
+    void trace([in, optional] VARIANT *varargStart);
+    [id(16)]
+    void warn([in, optional] VARIANT *varargStart);
+}
+
+[
+    odl,
+    oleautomation,
+    dual,
+    hidden,
+    uuid(1b5939fc-8f84-43f3-8d89-f9a92069fad7)
+]
+interface IWineConsoleGetter : IDispatch
+{
+    [propget, id(1)]
+    HRESULT console([retval, out] IDispatch **console);
+}
+
+[
+    hidden,
+    uuid(b84d405a-8057-4cc7-86c6-e872bb6205ad)
+]
+dispinterface DispWineConsoleGetter
+{
+properties:
+methods:
+    [propget, id(1)]
+    IDispatch *console();
+}
+
 } /* library MSHTML_private */
diff --git a/dlls/mshtml/tests/es5.js b/dlls/mshtml/tests/es5.js
index a520253569c..e57aed5ca35 100644
--- a/dlls/mshtml/tests/es5.js
+++ b/dlls/mshtml/tests/es5.js
@@ -1448,3 +1448,67 @@ sync_test("functions scope", function() {
     ok(val == 8, "val != 8");
     ok(w == 9, "w != 9");
 });
+
+sync_test("console", function() {
+    var except
+
+    window.console.log('1', '2');
+    console.info('1', '2', '3');
+    console.info();
+    console.log();
+    console.trace();
+    console.warn();
+    console.debug();
+    console.error();
+
+    console.assert(false, '1');
+    console.assert(true, '1');
+    console.assert('1');
+
+    console.clear();
+    console.count('1');
+    console.count(1);
+
+
+    except = false;
+    try
+    {
+        console.countReset('1');
+    }
+    catch(e)
+    {
+        except = true;
+    }
+    ok(except, "console.countReset: expected exception");
+    console.dir(document);
+    console.dir();
+    console.dirxml(document);
+    console.group('1');
+    console.groupCollapsed('1');
+    console.groupEnd();
+
+    except = false;
+    try
+    {
+        console.table(['1', '2']);
+    }
+    catch(e)
+    {
+        except = true;
+    }
+    ok(except, "console.table: expected exception");
+
+    console.time('1');
+    console.timeEnd('1');
+
+    except = false;
+    try
+    {
+        console.timeLog('1');
+    }
+    catch(e)
+    {
+        except = true;
+    }
+    ok(except, "console.timeLog: expected exception");
+});
-- 
2.31.1




More information about the wine-devel mailing list