Skip to content

Commit

Permalink
Bug 1861547 [wpt PR 42797] - [document pip] Allow resizeTo()/resizeBy…
Browse files Browse the repository at this point in the history
…() via user gesture, a=testonly

Automatic update from web-platform-tests
[document pip] Allow resizeTo()/resizeBy() via user gesture

Currently, we don't allow picture-in-picture windows to use the
resizeTo() and resizeBy() APIs to prevent abuse. This CL adds a user
gesture requirement to those APIs for document picture-in-picture
windows to allow them to use those APIs while limiting the potential
for abuse.

Specification: WICG/document-picture-in-picture#104

Bug: 1354325
Change-Id: I6eabb2e9b8923ec1fc395cb44e3cc00ad674f5da
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4980802
Reviewed-by: Daniel Cheng <dchengchromium.org>
Reviewed-by: Fr <beaufort.francoisgmail.com>
Reviewed-by: Frank Liberato <liberatochromium.org>
Reviewed-by: Scott Violet <skychromium.org>
Commit-Queue: Tommy Steimel <steimelchromium.org>
Cr-Commit-Position: refs/heads/main{#1230725}

--

wpt-commits: 7007ee235ed368079546dd0a8ef45a7dfa88305a
wpt-pr: 42797

UltraBlame original commit: 224ecf406e0698fdabef03cb95b70595b5657bb6
  • Loading branch information
marco-c committed Dec 7, 2023
1 parent 4508a87 commit a12d5ca
Showing 1 changed file with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!DOCTYPE html>
<title>Test that calling resizeTo() or resizeBy() on a document
picture-in-picture window requires user gesture</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();

await assert_throws_dom('NotAllowedError', pipWindow.DOMException, () => {
pipWindow.resizeBy(10, 10);
}, 'resizeBy() requires a user gesture for document picture-in-picture');
await assert_throws_dom('NotAllowedError', pipWindow.DOMException, () => {
pipWindow.resizeTo(400, 400);
}, 'resizeTo() requires a user gesture for document picture-in-picture');
});
</script>
</body>

0 comments on commit a12d5ca

Please sign in to comment.