From: Gabriel Ivăncescu gabrielopcode@gmail.com
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/mshtml/mshtml_private.h | 1 + dlls/mshtml/mshtml_private_iface.idl | 13 +++++++++++ dlls/mshtml/omnavigator.c | 34 ++++++++++++++++++++++++++++ dlls/mshtml/tests/documentmode.js | 9 ++++++++ 4 files changed, 57 insertions(+)
diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index 63e21b44c3a..c40ef0d6639 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -304,6 +304,7 @@ typedef struct ScriptHost ScriptHost; XIID(IWineHTMLWindowCompatPrivate) \ XIID(IWinePageTransitionEvent) \ XIID(IWineXMLHttpRequestPrivate) \ + XIID(IWinePerformancePrivate) \ XIID(IWineMSHTMLConsole) \ XIID(IWineMSHTMLMediaQueryList) \ XIID(IWineMSHTMLMutationObserver) diff --git a/dlls/mshtml/mshtml_private_iface.idl b/dlls/mshtml/mshtml_private_iface.idl index 503593d1c25..e43056b6dbe 100644 --- a/dlls/mshtml/mshtml_private_iface.idl +++ b/dlls/mshtml/mshtml_private_iface.idl @@ -113,6 +113,19 @@ interface IWineMSHTMLMediaQueryList : IDispatch HRESULT removeListener([in] VARIANT *listener); }
+[ + odl, + oleautomation, + dual, + hidden, + uuid(6ac5491e-1758-4b82-98a2-83e31a7c8870) +] +interface IWinePerformancePrivate : IDispatch +{ + [id(1)] + HRESULT now([retval, out] double *p); +} + const long DISPID_IWINEHTMLWINDOWPRIVATE_MUTATIONOBSERVER = 55; [ odl, diff --git a/dlls/mshtml/omnavigator.c b/dlls/mshtml/omnavigator.c index b9f0f677b0a..8b893bd3309 100644 --- a/dlls/mshtml/omnavigator.c +++ b/dlls/mshtml/omnavigator.c @@ -1672,6 +1672,7 @@ static dispex_static_data_t HTMLPerformanceNavigation_dispex = { typedef struct { DispatchEx dispex; IHTMLPerformance IHTMLPerformance_iface; + IWinePerformancePrivate IWinePerformancePrivate_iface;
HTMLInnerWindow *window; IHTMLPerformanceNavigation *navigation; @@ -1772,6 +1773,34 @@ static const IHTMLPerformanceVtbl HTMLPerformanceVtbl = { HTMLPerformance_toJSON };
+static inline HTMLPerformance *impl_from_IWinePerformancePrivate(IWinePerformancePrivate *iface) +{ + return CONTAINING_RECORD(iface, HTMLPerformance, IWinePerformancePrivate_iface); +} + +DISPEX_IDISPATCH_IMPL(HTMLPerformancePrivate, IWinePerformancePrivate, impl_from_IWinePerformancePrivate(iface)->dispex) + +static HRESULT WINAPI HTMLPerformancePrivate_now(IWinePerformancePrivate *iface, double *p) +{ + HTMLPerformance *This = impl_from_IWinePerformancePrivate(iface); + + TRACE("(%p)->(%p)\n", This, p); + + *p = get_time_stamp() - This->window->navigation_start_time; + return S_OK; +} + +static const IWinePerformancePrivateVtbl WinePerformancePrivateVtbl = { + HTMLPerformancePrivate_QueryInterface, + HTMLPerformancePrivate_AddRef, + HTMLPerformancePrivate_Release, + HTMLPerformancePrivate_GetTypeInfoCount, + HTMLPerformancePrivate_GetTypeInfo, + HTMLPerformancePrivate_GetIDsOfNames, + HTMLPerformancePrivate_Invoke, + HTMLPerformancePrivate_now, +}; + static inline HTMLPerformance *HTMLPerformance_from_DispatchEx(DispatchEx *iface) { return CONTAINING_RECORD(iface, HTMLPerformance, dispex); @@ -1783,6 +1812,8 @@ static void *HTMLPerformance_query_interface(DispatchEx *dispex, REFIID riid)
if(IsEqualGUID(&IID_IHTMLPerformance, riid)) return &This->IHTMLPerformance_iface; + if(IsEqualGUID(&IID_IWinePerformancePrivate, riid)) + return &This->IWinePerformancePrivate_iface;
return NULL; } @@ -1830,6 +1861,8 @@ static void HTMLPerformance_init_dispex_info(dispex_data_t *info, compat_mode_t {DISPID_UNKNOWN} }; dispex_info_add_interface(info, IHTMLPerformance_tid, mode < COMPAT_MODE_IE9 ? hooks : NULL); + if(mode >= COMPAT_MODE_IE10) + dispex_info_add_interface(info, IWinePerformancePrivate_tid, NULL); }
static dispex_static_data_t HTMLPerformance_dispex = { @@ -1850,6 +1883,7 @@ HRESULT create_performance(HTMLInnerWindow *window, IHTMLPerformance **ret) return E_OUTOFMEMORY;
performance->IHTMLPerformance_iface.lpVtbl = &HTMLPerformanceVtbl; + performance->IWinePerformancePrivate_iface.lpVtbl = &WinePerformancePrivateVtbl; performance->window = window; IHTMLWindow2_AddRef(&window->base.IHTMLWindow2_iface);
diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index 1394010966e..fdf918d95ee 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -19,6 +19,10 @@ var compat_version; var tests = [];
+if(performance.now) { + var t = performance.now(); + ok(t - performance.timing.navigationStart < 2000, "performance.now() more than 2 sec away from navigationStart: " + t + " vs " + performance.timing.navigationStart); +} ok(performance.timing.navigationStart > 0, "navigationStart <= 0"); ok(performance.timing.fetchStart == performance.timing.navigationStart, "fetchStart != navigationStart"); ok(performance.timing.domainLookupStart >= performance.timing.fetchStart, "domainLookupStart < fetchStart"); @@ -578,6 +582,11 @@ sync_test("perf_props", function() { test_exposed("timing", true); test_exposed("toJSON", v >= 9); test_exposed("toString", true); + test_exposed("now", v >= 10); + test_exposed("eventCounts", false); + test_exposed("measureUserAgentSpecificMemory", false); + test_exposed("memory", false); + test_exposed("timeOrigin", false);
obj = window.performance.navigation, name = "PerformanceNavigation";