Skip to content

Commit

Permalink
Allow co-existing entrypTypes and buffered options in PerformanceObse…
Browse files Browse the repository at this point in the history
…rver.observe() method.

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

bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1915589
gecko-commit: fb9d78b726556ac65a13e937410fe92f159b203f
gecko-reviewers: sefeng
  • Loading branch information
hiikezoe authored and moz-wptsync-bot committed Jan 10, 2025
1 parent 13cc1fb commit 4419515
Showing 1 changed file with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
async_test(t => {
performance.mark('foo');
// Use a timeout to ensure the remainder of the test runs after the entry is created.
t.step_timeout(() => {
// `buffered` flag set to true but with entryTypes so that
// the `buffered` flag should be ignored, thus there should be no entry.
new PerformanceObserver(() => {
assert_unreached('Should not have observed any entry!');
}).observe({entryTypes: ['mark'], buffered: true});
// Use a timeout to give time to the observer.
t.step_timeout(t.step_func_done(() => {}), 100);
}, 0);
}, 'PerformanceObserver without buffered flag set to false cannot see past entries.');

0 comments on commit 4419515

Please sign in to comment.