diff --git a/dom/performance/Performance.h b/dom/performance/Performance.h index cf26f3206493..adf1c00e52e7 100644 --- a/dom/performance/Performance.h +++ b/dom/performance/Performance.h @@ -149,6 +149,8 @@ class Performance : public DOMEventTargetHelper { virtual class EventCounts* EventCounts() = 0; + virtual uint64_t InteractionCount() = 0; + virtual void QueueNavigationTimingEntry() = 0; virtual void UpdateNavigationTimingEntry() = 0; diff --git a/dom/performance/PerformanceInteractionMetrics.h b/dom/performance/PerformanceInteractionMetrics.h index e0751be5a78e..71d0b6060a26 100644 --- a/dom/performance/PerformanceInteractionMetrics.h +++ b/dom/performance/PerformanceInteractionMetrics.h @@ -30,6 +30,8 @@ class PerformanceInteractionMetrics final { return mPendingPointerDowns; } + uint64_t InteractionCount() { return mInteractionCount; } + uint64_t IncreaseInteractionValueAndCount(); virtual ~PerformanceInteractionMetrics() = default; diff --git a/dom/performance/PerformanceMainThread.cpp b/dom/performance/PerformanceMainThread.cpp index 6c4b3941e714..b6d5bcaa4247 100644 --- a/dom/performance/PerformanceMainThread.cpp +++ b/dom/performance/PerformanceMainThread.cpp @@ -559,6 +559,11 @@ EventCounts* PerformanceMainThread::EventCounts() { return mEventCounts; } +uint64_t PerformanceMainThread::InteractionCount() { + MOZ_ASSERT(StaticPrefs::dom_performance_event_timing_enable_interactionid()); + return mInteractionMetrics.InteractionCount(); +} + void PerformanceMainThread::GetEntries( nsTArray>& aRetval) { aRetval = mResourceEntries.Clone(); diff --git a/dom/performance/PerformanceMainThread.h b/dom/performance/PerformanceMainThread.h index 2040f98348a1..a25a108d1579 100644 --- a/dom/performance/PerformanceMainThread.h +++ b/dom/performance/PerformanceMainThread.h @@ -114,6 +114,8 @@ class PerformanceMainThread final : public Performance, class EventCounts* EventCounts() override; + uint64_t InteractionCount() override; + bool IsGlobalObjectWindow() const override { return true; }; bool HasDispatchedInputEvent() const { return mHasDispatchedInputEvent; } diff --git a/dom/performance/PerformanceWorker.h b/dom/performance/PerformanceWorker.h index 2c3d8d4d475a..867042a52ac6 100644 --- a/dom/performance/PerformanceWorker.h +++ b/dom/performance/PerformanceWorker.h @@ -90,6 +90,10 @@ class PerformanceWorker final : public Performance { MOZ_CRASH("This should not be called on workers"); } + uint64_t InteractionCount() override { + MOZ_CRASH("This should not be called on workers"); + } + protected: ~PerformanceWorker(); diff --git a/dom/webidl/Performance.webidl b/dom/webidl/Performance.webidl index f8ea8dfdc9b7..06ae9fa4fc91 100644 --- a/dom/webidl/Performance.webidl +++ b/dom/webidl/Performance.webidl @@ -94,4 +94,7 @@ partial interface Performance { partial interface Performance { [Pref="dom.enable_event_timing", SameObject] readonly attribute EventCounts eventCounts; + + [Pref="dom.performance.event_timing.enable_interactionid"] + readonly attribute unsigned long long interactionCount; }; diff --git a/testing/web-platform/meta/event-timing/idlharness.any.js.ini b/testing/web-platform/meta/event-timing/idlharness.any.js.ini index d088a3c14e1a..3700a39fed0e 100644 --- a/testing/web-platform/meta/event-timing/idlharness.any.js.ini +++ b/testing/web-platform/meta/event-timing/idlharness.any.js.ini @@ -4,12 +4,6 @@ if os == "win": [OK, TIMEOUT] [idlharness.any.html] - [Performance interface: attribute interactionCount] - expected: FAIL - - [Performance interface: performance must inherit property "interactionCount" with the proper type] - expected: FAIL - [idlharness.any.sharedworker.html] diff --git a/testing/web-platform/meta/event-timing/idlharness.window.js.ini b/testing/web-platform/meta/event-timing/idlharness.window.js.ini deleted file mode 100644 index 7602771fe7fb..000000000000 --- a/testing/web-platform/meta/event-timing/idlharness.window.js.ini +++ /dev/null @@ -1,6 +0,0 @@ -[idlharness.window.html] - [Performance interface: attribute interactionCount] - expected: FAIL - - [Performance interface: performance must inherit property "interactionCount" with the proper type] - expected: FAIL diff --git a/testing/web-platform/meta/event-timing/interaction-count-click.html.ini b/testing/web-platform/meta/event-timing/interaction-count-click.html.ini deleted file mode 100644 index 4c4b090ba2ce..000000000000 --- a/testing/web-platform/meta/event-timing/interaction-count-click.html.ini +++ /dev/null @@ -1,8 +0,0 @@ -[interaction-count-click.html] - expected: - if debug and (os == "win") and (processor == "x86_64"): CRASH - if debug and (os == "linux") and fission: CRASH - if debug and (os == "android"): CRASH - if not debug and (os == "android"): [OK, CRASH] - [EventTiming: verify interactionCount for click interaction] - expected: FAIL diff --git a/testing/web-platform/meta/event-timing/interaction-count-tap.html.ini b/testing/web-platform/meta/event-timing/interaction-count-tap.html.ini deleted file mode 100644 index 3881e883662d..000000000000 --- a/testing/web-platform/meta/event-timing/interaction-count-tap.html.ini +++ /dev/null @@ -1,3 +0,0 @@ -[interaction-count-tap.html] - [EventTiming: verify interactionCount for tap interaction] - expected: FAIL