Automatic update from web-platform-tests WebKit export: PerformanceObserver invokes callback too early (#54597) https://bugs.webkit.org/show_bug.cgi?id=297765 -- wpt-commits: 9fb0c34afd20d2cd5ea73cd50e2400a0c5b3159f wpt-pr: 54597
34 lines
981 B
HTML
34 lines
981 B
HTML
<!doctype html>
|
|
<html>
|
|
<head>
|
|
<script src="/resources/testharness.js"></script>
|
|
<script src="/resources/testharnessreport.js"></script>
|
|
</head>
|
|
<body>
|
|
<script>
|
|
async_test(function(test) {
|
|
let first_callback_called = false
|
|
let callback_can_run_now = false
|
|
|
|
new Promise( (resolve) => {
|
|
new PerformanceObserver( (entries, observer) => {
|
|
first_callback_called = true
|
|
observer.disconnect()
|
|
resolve()
|
|
}).observe({ type: "mark", buffered: true })
|
|
})
|
|
.then( () => {
|
|
new PerformanceObserver ( (entries) => {
|
|
assert_true(callback_can_run_now, "Callback shouldn't be invoked inside the .observe() call")
|
|
test.done()
|
|
}).observe({ type: "mark", buffered: true })
|
|
callback_can_run_now = true
|
|
})
|
|
assert_false(first_callback_called)
|
|
performance.mark('mark')
|
|
}, "Buffered PerformanceObservers should not invoke callbacks synchronously.");
|
|
|
|
</script>
|
|
</body>
|
|
</html>
|