Bug 1949814 - Implement interactionCount for Performance interface r=sefeng,webidl,saschanaz

Differential Revision: https://phabricator.services.mozilla.com/D239186
This commit is contained in:
Nazım Can Altınova
2025-03-24 19:11:43 +00:00
parent 7585367ae2
commit 37d219f93d
10 changed files with 18 additions and 23 deletions

View File

@@ -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;

View File

@@ -30,6 +30,8 @@ class PerformanceInteractionMetrics final {
return mPendingPointerDowns;
}
uint64_t InteractionCount() { return mInteractionCount; }
uint64_t IncreaseInteractionValueAndCount();
virtual ~PerformanceInteractionMetrics() = default;

View File

@@ -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<RefPtr<PerformanceEntry>>& aRetval) {
aRetval = mResourceEntries.Clone();

View File

@@ -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; }

View File

@@ -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();

View File

@@ -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;
};

View File

@@ -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]

View File

@@ -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

View File

@@ -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

View File

@@ -1,3 +0,0 @@
[interaction-count-tap.html]
[EventTiming: verify interactionCount for tap interaction]
expected: FAIL