Commit graph

582 commits

Author SHA1 Message Date
Justin Link
846c8bcf78 Bug 1972151: Re-arrange some math a little bit to avoid some unnecessary precision loss in floating point calculations. r=sefeng
Differential Revision: https://phabricator.services.mozilla.com/D253736
2025-06-18 16:49:28 +00:00
Cristina Horotan
0c52669b55 Revert "Bug 1972151: Re-arrange some math a little bit to avoid some unnecessary precision loss in floating point calculations. r=sefeng" for causing wpt failures at image-upscaling.html
This reverts commit 721ddbc3d36cbb54e93f922ea62fa58791e187eb.
2025-06-17 20:20:00 +00:00
Justin Link
a7ebc82fe2 Bug 1972151: Re-arrange some math a little bit to avoid some unnecessary precision loss in floating point calculations. r=sefeng
Differential Revision: https://phabricator.services.mozilla.com/D253736
2025-06-17 18:26:52 +00:00
wilsu
af5b60f407 Bug 1956211 - Fixed aIsCacelable-typo on PerformanceEventTiming.h and .cpp r=canaltinova
Differential Revision: https://phabricator.services.mozilla.com/D253024
2025-06-12 12:56:30 +00:00
Keith Cirkel
0919f7d272 Bug 1860030 - Implement scrollMargin for IntersectionObserver r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D252330
2025-06-04 09:56:12 +00:00
Nazım Can Altınova
7d12a36c10 Bug 1969825 - Add a mochitest for pointerdown without an pointerup/pointercancel/contextmenu r=sefeng
I initially tried to write a WPT test for this. But I failed to do so
because the test driver for WPT doesn't accept a pointerdown without any
matching pointer events. So either it just doesn't fire a pointerdown or
it fires pointerup with it. So that's why I chose to write one in
mochitest instead.

The test first fires a pointerdown with no up, and then fires another
pointerdown with an up instead. So the second pointerdown should clear
the old one and set its interactionId to zero. So first one should have
interactionId of zero and the second should have a non-zero
interactionId.

Differential Revision: https://phabricator.services.mozilla.com/D252110
2025-06-02 20:58:35 +00:00
Nazım Can Altınova
d346a76106 Bug 1969825 - Flush the previous pending pointerdown if it doesn't have a known interactionId by the time of next pointerdown r=sefeng
This issue seems like it's very hard to reproduce, and only happens
after keeping Firefox running after a few days. I noticed that it mostly
happens in the parent process, where it stops dispatching event timing
entries because of an unknown interactionId of a pointerdown event.

This seems to happen when a pointerdown event is fired but no pointerup,
pointercancel or contextmenu events are fired after that that match it.
I don't exactly know in which cases it happens, but I saw it happen in
the wild. If we clear the flush the older pending entries before
overriding them in the pendingPointerdowns map, we can solve this issue.

This is not in the spec, but Chrome already has this check. I updated
the spec issue to mention this in the spec as well once we rework the
pendingPointerdowns logic.

Differential Revision: https://phabricator.services.mozilla.com/D252109
2025-06-02 20:58:32 +00:00
Serban Stanca
9e7600d66a Revert "Bug 1969825 - Add a mochitest for pointerdown without an pointerup/pointercancel/contextmenu r=sefeng" for causing mochitests-plain failures.
This reverts commit 39679049ba6e496c5ee7f68bc999b1fc2a5b3998.

This reverts commit cc2941652799e434fced3620b8bbb72a1dcb07a0.
2025-06-02 18:58:01 +00:00
Nazım Can Altınova
6c01d24c00 Bug 1969825 - Add a mochitest for pointerdown without an pointerup/pointercancel/contextmenu r=sefeng
I initially tried to write a WPT test for this. But I failed to do so
because the test driver for WPT doesn't accept a pointerdown without any
matching pointer events. So either it just doesn't fire a pointerdown or
it fires pointerup with it. So that's why I chose to write one in
mochitest instead.

The test first fires a pointerdown with no up, and then fires another
pointerdown with an up instead. So the second pointerdown should clear
the old one and set its interactionId to zero. So first one should have
interactionId of zero and the second should have a non-zero
interactionId.

Differential Revision: https://phabricator.services.mozilla.com/D252110
2025-06-02 15:05:53 +00:00
Nazım Can Altınova
4eada477fa Bug 1969825 - Flush the previous pending pointerdown if it doesn't have a known interactionId by the time of next pointerdown r=sefeng
This issue seems like it's very hard to reproduce, and only happens
after keeping Firefox running after a few days. I noticed that it mostly
happens in the parent process, where it stops dispatching event timing
entries because of an unknown interactionId of a pointerdown event.

This seems to happen when a pointerdown event is fired but no pointerup,
pointercancel or contextmenu events are fired after that that match it.
I don't exactly know in which cases it happens, but I saw it happen in
the wild. If we clear the flush the older pending entries before
overriding them in the pendingPointerdowns map, we can solve this issue.

This is not in the spec, but Chrome already has this check. I updated
the spec issue to mention this in the spec as well once we rework the
pendingPointerdowns logic.

Differential Revision: https://phabricator.services.mozilla.com/D252109
2025-06-02 15:05:50 +00:00
Nazım Can Altınova
5a7a46071c Bug 1956288 - Expose interactionId for keypress r=sefeng
This keypress event is not in the spec yet, but it's in the process of
being added. The logic is quite simple because before every keypress
event there has to be a keydown event right before it. So we simply use
the current interaction value of that keydown entry.

Differential Revision: https://phabricator.services.mozilla.com/D251400
2025-05-28 16:28:48 +00:00
Nazım Can Altınova
2ed76ce30c Bug 1968724 - Assign the last keydown interaction value on keydown instead of keyup r=sefeng
mLastKeydownInteractionValue was initially assigned in keyup instead of
keydown because the spec was initially generating the interactionId of
keydown while we are at keyup, so it was delaying the keydown events.
But since bug 1964426, we don't do this delayed assignment for keydown
events.

So it's a lot easier to implement the correct fix for this after bug 1964426.
Now we simply move this mLastKeydownInteractionValue assignment
to keydown event. Which is the correct location.

Differential Revision: https://phabricator.services.mozilla.com/D251380
2025-05-28 15:37:35 +00:00
Nazım Can Altınova
ab87190a27 Bug 1964695 - Handle contextmenu while computing interactionId r=sefeng
Previously we weren't handling the contextmenu even which was incorrect, but
also it wasn't a part of the spec. This change implements my proposed solution
in https://github.com/w3c/event-timing/issues/155.

Differential Revision: https://phabricator.services.mozilla.com/D248032
2025-05-26 21:46:50 +00:00
Sean Feng
e6d5c813f0 Bug 1963917 - Ignore the TAO check for cross origin images for LCP r=mstange
There was an update to LCP spec such that the `renderTime` is no longer
protected by Timing-Allow-Origin due to it's easy to side channel attack
it and it isn't needed for CORS protected images.

The solution was to coarsen the timestamp by 4ms (this is what Chrome did).

To do something similar in Firefox, we don't need to coarsen the
timestamp because we already reduce more precisions. We just need to
always expose this.

Spec discussion: https://github.com/w3c/largest-contentful-paint/issues/111

Differential Revision: https://phabricator.services.mozilla.com/D247492
2025-05-26 21:42:27 +00:00
Justin Link
d4f4040e35 Bug 1925191: Don't create profiler markers for performance.measure() calls with timestamps that are too far in the future r=mstange
Differential Revision: https://phabricator.services.mozilla.com/D233309
2025-05-23 16:03:16 +00:00
Justin Link
2d4040d0c9 Bug 1925191: Moved the adding of profiler markers from performance.measure() calls into its own function r=mstange
Differential Revision: https://phabricator.services.mozilla.com/D233308
2025-05-23 16:03:13 +00:00
Alexandru Marc
7cce6b4b4d Revert "Bug 1963917 - Ignore the TAO check for cross origin images for LCP r=mstange" for causing wpt failures
This reverts commit 5d41ea2cd4d30dca9143770dcd794f9093b8065f.
2025-05-16 12:09:50 +00:00
Sean Feng
77b5d2edc9 Bug 1963917 - Ignore the TAO check for cross origin images for LCP r=mstange
There was an update to LCP spec such that the `renderTime` is no longer
protected by Timing-Allow-Origin due to it's easy to side channel attack
it and it isn't needed for CORS protected images.

The solution was to coarsen the timestamp by 4ms (this is what Chrome did).

To do something similar in Firefox, we don't need to coarsen the
timestamp because we already reduce more precisions. We just need to
always expose this.

Spec discussion: https://github.com/w3c/largest-contentful-paint/issues/111

Differential Revision: https://phabricator.services.mozilla.com/D247492
2025-05-16 00:36:15 +00:00
Nazım Can Altınova
2298bd8df1 Bug 1964426 - Always assign an interactionId to keydown events r=sefeng
Differential Revision: https://phabricator.services.mozilla.com/D247840
2025-05-06 22:07:10 +00:00
Nazım Can Altınova
68c91c6f23 Bug 1964426 - Move pending keydown and pointerdown logic from finalize step to ComputeInteractionId step r=sefeng
This patch doesn't change the behavior of the keydown and pointerdown logic.
But it's needed for the next patch which I will change the keydown behavior and
make it non-lazy.

Differential Revision: https://phabricator.services.mozilla.com/D247839
2025-05-06 22:07:07 +00:00
Nazım Can Altınova
efc96734bd Bug 1963464 - Initial implementation of PaintTimingMixin for the PaintTiming and LCP entries r=sefeng,webidl
This patch implements PaintTimingMixin with only the `paintTime`, without the
`presentationTime`. The presentationTime property is nullable in the spec and
the browsers might choose to not implement it. We would like to implement it
in the future, but we will do that as a follow-up.

Differential Revision: https://phabricator.services.mozilla.com/D247305
2025-05-05 04:15:18 +00:00
Nazım Can Altınova
007ffde4ec Bug 1962362 - Preemptively queue performance entries that have known interactionId until one without interactionId is found r=sefeng
Previous implementation was waiting for all entries in the list to be queued to
have known interactionIds. But that delays dispatching some event entries when
there are a lot of events being dispatched quickly, like typing very fast or
smashing the keyboard. So this helps in those cases where there are a lot of
events being waited to be queued.

Differential Revision: https://phabricator.services.mozilla.com/D246576
2025-05-01 03:51:49 +00:00
Chris H-C
6913922bbe Bug 1958899 - Update Glean tags r=janerik,translations-reviewers,sidebar-reviewers,nordzilla
In bug 1889943 "Firefox :: Translation" was renamed to "Firefox :: Translations"
In bug 1956746 "Core :: DOM: Performance" became "Core :: DOM: Performance APIs"

I had to manually add "Toolkit :: Default Browser Agent" back into tags.yaml
because that component is not built on Linux (which is the platform on which I
ran ./mach update-glean-tags).

Differential Revision: https://phabricator.services.mozilla.com/D244667
2025-04-08 14:18:30 +00:00
Sebastian Hengst
46c412db76 Bug 1956746 - about file to Bugzilla mapping for performance files. r=davehunt
Differential Revision: https://phabricator.services.mozilla.com/D243270
2025-04-01 19:05:12 +00:00
Nazım Can Altınova
526c70c25c Bug 1957607 - Cast to MouseEvent instead of PointerEvent during interactionId computation r=sefeng
Differential Revision: https://phabricator.services.mozilla.com/D243794
2025-04-01 15:58:50 +00:00
Nazım Can Altınova
11205277af Bug 1934683 - Set keydown interactionId to the simulated key click r=sefeng
This is not in the spec yet. I filed this spec issue for this problem:
https://github.com/w3c/event-timing/issues/147

The spec will be updated to reflect this solution.

Differential Revision: https://phabricator.services.mozilla.com/D239193
2025-03-24 19:11:43 +00:00
Nazım Can Altınova
c39da82d34 Bug 1934683 - Move the first-input and event count logic to later dispatch and simplify it r=sefeng
This is not in the spec yet. I filed this spec issue for this problem:
https://github.com/w3c/event-timing/issues/146

The author has a spec PR up for review already that matches this implementation:
https://github.com/w3c/event-timing/pull/151

Differential Revision: https://phabricator.services.mozilla.com/D239190
2025-03-24 19:11:43 +00:00
Nazım Can Altınova
63df710560 Bug 1934683 - Changes on the performance event timing dispatch logic r=sefeng
This is not in the spec yet. I filed this spec issue for this problem:
https://github.com/w3c/event-timing/issues/145

The spec issue will be addressed soon.

Differential Revision: https://phabricator.services.mozilla.com/D239188
2025-03-24 19:11:43 +00:00
Nazım Can Altınova
dcdea271b9 Bug 1949814 - Implement interactionCount for Performance interface r=sefeng,webidl,saschanaz
Differential Revision: https://phabricator.services.mozilla.com/D239186
2025-03-24 19:11:43 +00:00
Nazım Can Altınova
1fcdec95ec Bug 1934683 - Implement interactionId for PerformanceEventTiming directly from the spec r=sefeng,webidl,smaug
This patch tries to follow the spec as much as possible. But unfortunately this
wasn't enough to pass all the web-platform tests and there were some issues
in the spec logic.

I'm adding the fixes to various issues in the following patches, to easily see
what needs to be updated in the spec. Please see the following patches.

Spec: https://w3c.github.io/event-timing/#sec-computing-interactionid

Differential Revision: https://phabricator.services.mozilla.com/D239185
2025-03-24 19:11:42 +00:00
Nazım Can Altınova
f31890d369 Bug 1948647 - Do not dispatch the first-input event if there is a pending pointer down r=sefeng
The spec for dispatching the first-input event can be found here:
https://w3c.github.io/event-timing/#sec-dispatch-pending

Specifically step 6.2.2 handles this part of the code change.

The old code was following the spec, but some web-platform-tests were failing
because of it. After looking at the Chromium's codebase, I noticed that it
doesn't match the spec and it has this additional check. After adding it to our
code, it passes the tests as well. So it's clear that the spec doesn't match
the web platform tests or the Chromium implementation. It's more likely that
the spec needs to be updated.

Filed a spec bug here:
https://github.com/w3c/event-timing/issues/142

Differential Revision: https://phabricator.services.mozilla.com/D238470
2025-03-24 19:11:42 +00:00
Olli Pettay
c30ee2e964 Bug 1941846, don't assert but return early if MaplikeHelpers::Get fails, r=peterv
Differential Revision: https://phabricator.services.mozilla.com/D236484
2025-02-03 09:51:25 +00:00
Ho Cheung
6e57d7085f Bug 1914992 - Remove ContentIdentifierHashEntry r=emilio
ContentIdentifierHashEntry is not being used. We should just remove it.

Differential Revision: https://phabricator.services.mozilla.com/D236476
2025-02-02 14:24:45 +00:00
Florian Quèze
258754e5c1 Bug 1879329 - script generated replacement of the GleanMetrics.h includes, r=chutten,valentin,media-playback-reviewers,cookie-reviewers,anti-tracking-reviewers,profiler-reviewers,win-reviewers,rkraesig,emz,aabh,padenot.
Differential Revision: https://phabricator.services.mozilla.com/D234744
2025-01-21 11:21:45 +00:00
Hiroyuki Ikezoe
0ee2acba3d Bug 1915589 - Allow co-existing entrypTypes and buffered options in PerformanceObserver.observe() method. r=sefeng
It's allowed, but the buffered option is ignored. This is what Blink
does [1], what WebKit does [2]. (Both code blocks are inside the else
branch of if `has entryTypes`)

The web-platform-test in this change was originally copied from
buffered-flag-after-timeout.any.js and modified.

[1] https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/core/timing/performance_observer.cc;l=264-273;drc=78780a188fe3c79fe815b170f4ea33e62ceb6e04
[2] https://searchfox.org/wubkat/rev/6c800745251d53d6486443d63b35828504446c5d/Source/WebCore/page/PerformanceObserver.cpp#90-100
[3] https://searchfox.org/mozilla-central/rev/e24277e20c492b4a785b4488af02cca062ec7c2c/testing/web-platform/tests/performance-timeline/buffered-flag-after-timeout.any.js

Differential Revision: https://phabricator.services.mozilla.com/D233447
2025-01-09 21:01:13 +00:00
Denis Palmeiro
e9139dadbc Bug 1928466: Check if markerFile is defined during NowUnclamped diagnostic assert. r=mstange
Differential Revision: https://phabricator.services.mozilla.com/D227537
2024-11-06 14:29:37 +00:00
Andrew Sutherland
78936f73aa Bug 1900706 - Expose equivalent of nsContentUtils::ReportToConsole on nsIGlobalObject. r=smaug
A notable change in this stack is to ensure that we populate mOwner on
workers.

Differential Revision: https://phabricator.services.mozilla.com/D213724
2024-10-24 03:02:39 +00:00
Emilio Cobos Álvarez
5016f02fef Bug 1918400 - Add some CC helpers to nsBaseHashtable. r=smaug,xpcom-reviewers,nika
Differential Revision: https://phabricator.services.mozilla.com/D226348
2024-10-22 19:01:13 +00:00
Tooru Fujisawa
ccc78f099f Bug 1916356 - Properly initialize the response status value even if the response head is null. r=sefeng
Differential Revision: https://phabricator.services.mozilla.com/D225434
2024-10-15 19:42:18 +00:00
Sean Feng
7f989caf84 Bug 1922980 - Make test_performance_paint_timing_helper.html no longer depends on the setTimeout r=emilio
It's written in a flaky way, should've used PerformanceObserver for it.

Differential Revision: https://phabricator.services.mozilla.com/D224822
2024-10-09 14:59:42 +00:00
Julien Wajsberg
0ebcc934a6 Bug 1922494 - Profiler markers inserted by performance.measure should use an unclamped value when no end value is submitted r=sefeng
A clamped value was used incorrectly when no end timestamp or end mark
was given by the caller.

Differential Revision: https://phabricator.services.mozilla.com/D224455
2024-10-09 11:57:46 +00:00
Tooru Fujisawa
f3d76ae1a3 Bug 1916601 - Part 2: Allow constructing PerformanceTimingData from CacheablePerformanceTimingData and timing data. r=sefeng
Also make it possible to construct CacheablePerformanceTimingData from channels
to create a cache.

Differential Revision: https://phabricator.services.mozilla.com/D223346
2024-09-30 15:43:08 +00:00
Tooru Fujisawa
80541d8f65 Bug 1916601 - Part 1: Split cacheable fields of PerformanceTimingData into CacheablePerformanceTimingData. r=sefeng
Bug 1899734 is going to cache the performance timing data from previous fetch
for the subsequent cached fetch.
All non-timing-related fields associated with the response are moved to
CacheablePerformanceTimingData.

Differential Revision: https://phabricator.services.mozilla.com/D223345
2024-09-30 15:43:08 +00:00
Andreas Farre
89c95b798e Bug 1919565 - Hide the text fragment from Navigation and Resource Timing API. r=dom-core,sefeng
Differential Revision: https://phabricator.services.mozilla.com/D222941
2024-09-30 13:17:23 +00:00
Emilio Cobos Álvarez
467b70eda8 Bug 1911448 - Remove DOMContentFlushed. r=smaug,perftest-reviewers,sparky
As per comments in bug 1910411's patches and others, it's not a useful
metric, specially now that we have LCP and so on.

Actually there doesn't seem to be any consumer of it since bug 1892001.

Differential Revision: https://phabricator.services.mozilla.com/D218489
2024-08-05 12:20:43 +00:00
Adam Vandolder
5514fdea69 Bug 1895254 - Prototype the Navigation API WebIDL. r=farre,dom-core,peterv
Differential Revision: https://phabricator.services.mozilla.com/D210088
2024-07-24 04:56:35 +00:00
Stanca Serban
0118c6342b Backed out changeset c634fecd6270 (bug 1895254) for causing build bustages in Navigation.cpp. 2024-07-24 07:27:32 +03:00
Adam Vandolder
ae44d80eeb Bug 1895254 - Prototype the Navigation API WebIDL. r=farre,dom-core,peterv
Differential Revision: https://phabricator.services.mozilla.com/D210088
2024-07-24 03:44:15 +00:00
Sean Feng
57bdf0a7d7 Bug 1874756 - Simplify and reduce the number of hashtable lookups for LCP implementation r=emilio
Two changes are introduced:

* LCP has a hashtable called `ContentIdentifiersForLCP` to store
(element, image) pairs to avoid processing the same pair multiple
times. Instead of using weak pointers for elements, this patch changes
it to use raw pointers for better performance. Also, makes the
hashtable to use element alone as the key, so that the entry
can be quickly removed when nsINode::LastRelease is called.

* Another change to make imgRequestProxy stores the
timestamps for LCP, so we can create LCP entries when the size
is available, instead of creating one temporarily and updating it
later. This allows us to eliminate a hashtable called
`mImageLCPEntryMap` for better performance.

Differential Revision: https://phabricator.services.mozilla.com/D214315
2024-07-23 20:42:40 +00:00
Sandor Molnar
f9b5817863 Backed out changeset 455d12dff44e (bug 1895254) for causing android wpt crashes @ /html/dom/idlharness.https.html CLOSED TREE 2024-07-19 22:47:01 +03:00