Skip to content

Picture-in-Picture test not waiting for event handler to run#58039

Open
theIDinside wants to merge 2 commits intoweb-platform-tests:masterfrom
theIDinside:fix-pip-tests
Open

Picture-in-Picture test not waiting for event handler to run#58039
theIDinside wants to merge 2 commits intoweb-platform-tests:masterfrom
theIDinside:fix-pip-tests

Conversation

@theIDinside
Copy link
Contributor

@theIDinside theIDinside commented Feb 25, 2026

See what the attribute says in the spec: https://w3c.github.io/picture-in-picture/#disable-pip:~:text=so%2E-,When,algorithm%2E and discussion w3c/picture-in-picture#184

This PR also addresses both the newly created one and the only one to actually wait for the event handler to execute so to not pass without running them as before.

This closes #58040

Fix the tests that passed on browsers without ever hitting the asserts because we did not wait for them to run.
video.addEventListener('leavepictureinpicture', t.step_func_done(event => {
assert_equals(pictureInPictureWindow, event.pictureInPictureWindow);
const leavePipPromise = new Promise(resolve => {
video.addEventListener('leavepictureinpicture', t.step_func(event => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not step_func_done there?

let pictureInPictureWindow;
const video = await loadVideo();

video.addEventListener('enterpictureinpicture', t.step_func_done(event => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should it be t.step_func instead?

}));
});

await requestPictureInPictureWithTrustedClick(video)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing ;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Picture in Picture test not waiting for event handlers

3 participants