Skip to content

Commit

Permalink
Disable beforeunload event for document picture in picture
Browse files Browse the repository at this point in the history
Bug: 1450120
Change-Id: I43cea1e1f6ad3bdd1153e1adffd511bba227e0c8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4590969
Commit-Queue: Benjamin Keen <bkeen@google.com>
Reviewed-by: Tommy Steimel <steimel@chromium.org>
Reviewed-by: Joey Arhar <jarhar@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1153535}
  • Loading branch information
Benjamin Keen authored and chromium-wpt-export-bot committed Jun 5, 2023
1 parent efeaa7c commit 00a0518
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions document-picture-in-picture/beforeunload-is-disabled.https.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!DOCTYPE html>
<title>Test that onbeforeunload is disabled for document picture in picture</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-vendor.js"></script>

<body>
<script>
promise_test(async (t) => {
await test_driver.bless('request PiP window from top window');
const pipWindow = await documentPictureInPicture.requestWindow();
var onbeforeunloadDisabled = true;
pipWindow.window.onbeforeunload = () => {
onbeforeunloadDisabled = false;
return "This is a test";
}
pipWindow.close();
assert_true(onbeforeunloadDisabled, 'onbeforeunload should be disabled for document picture in picture');
});
</script>
</body>

0 comments on commit 00a0518

Please sign in to comment.