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 | 12 ++++++++++ dlls/mshtml/omnavigator.c | 34 ++++++++++++++++++++++++++++ dlls/mshtml/tests/documentmode.js | 7 +++++- 4 files changed, 53 insertions(+), 1 deletion(-)
diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index eef745436fc..ce872249e62 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -320,6 +320,7 @@ struct constructor; XIID(IWineHTMLWindowCompatPrivate) \ XIID(IWineCSSProperties) \ XIID(IWinePageTransitionEvent) \ + XIID(IWinePerformancePrivate) \ XIID(IWineXMLHttpRequestPrivate) \ XIID(IWineMSHTMLConsole) \ XIID(IWineMSHTMLCrypto) \ diff --git a/dlls/mshtml/mshtml_private_iface.idl b/dlls/mshtml/mshtml_private_iface.idl index 1be0cb251d4..1cf98957fd1 100644 --- a/dlls/mshtml/mshtml_private_iface.idl +++ b/dlls/mshtml/mshtml_private_iface.idl @@ -455,6 +455,18 @@ interface IWinePageTransitionEvent : IDispatch HRESULT persisted([retval, out] VARIANT_BOOL *ret); }
+[ + odl, + oleautomation, + dual, + hidden, + uuid(c985818a-0a28-3da3-4023-9cf70955d79d) +] +interface IWinePerformancePrivate : IDispatch +{ + [id(1)] + HRESULT now([retval, out] double *p); +}
const long DISPID_IWINEXMLHTTPREQUESTPRIVATE_RESPONSE = 1; const long DISPID_IWINEXMLHTTPREQUESTPRIVATE_RESPONSETYPE = 2; diff --git a/dlls/mshtml/omnavigator.c b/dlls/mshtml/omnavigator.c index 28c47a6bd8d..fc4d2f5b408 100644 --- a/dlls/mshtml/omnavigator.c +++ b/dlls/mshtml/omnavigator.c @@ -1866,6 +1866,7 @@ dispex_static_data_t PerformanceNavigation_dispex = { typedef struct { DispatchEx dispex; IHTMLPerformance IHTMLPerformance_iface; + IWinePerformancePrivate IWinePerformancePrivate_iface;
HTMLInnerWindow *window; IHTMLPerformanceNavigation *navigation; @@ -1998,6 +1999,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); @@ -2009,6 +2038,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; } @@ -2060,6 +2091,8 @@ static void Performance_init_dispex_info(dispex_data_t *info, compat_mode_t mode {DISPID_UNKNOWN} }; dispex_info_add_interface(info, IHTMLPerformance_tid, mode < COMPAT_MODE_IE9 ? hooks : ie9_hooks); + if(mode >= COMPAT_MODE_IE10) + dispex_info_add_interface(info, IWinePerformancePrivate_tid, NULL); }
dispex_static_data_t Performance_dispex = { @@ -2079,6 +2112,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 c279a084890..5ae6624abdf 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -21,6 +21,10 @@ var tests = [];
var svg_ns = "http://www.w3.org/2000/svg";
+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"); @@ -1028,6 +1032,7 @@ sync_test("perf_props", function() { test_exposed("timing", true); test_exposed("toJSON", v >= 9); test_exposed("toString", true); + test_exposed("now", v >= 10);
obj = window.performance.navigation, name = "PerformanceNavigation";
@@ -4570,7 +4575,7 @@ sync_test("prototype props", function() { "getMeasures", "mark", "measure", "navigation", ["now",10], "setResourceTimingBufferSize", "timing", "toJSON" ], [ "clearMarks", "clearMeasures", "clearResourceTimings", "getEntries", "getEntriesByName", "getEntriesByType", "getMarks", - "getMeasures", "mark", "measure", ["now",10], "setResourceTimingBufferSize" + "getMeasures", "mark", "measure", "setResourceTimingBufferSize" ]); check(PerformanceNavigation, [ "TYPE_BACK_FORWARD", "TYPE_NAVIGATE", "TYPE_RELOAD", "TYPE_RESERVED", "redirectCount", "toJSON", "type" ], [ "TYPE_BACK_FORWARD", "TYPE_NAVIGATE", "TYPE_RELOAD", "TYPE_RESERVED" ]); check(PerformanceTiming, [