Skip to content

Commit

Permalink
Allow documentPiP api use only with content setting popup allowed
Browse files Browse the repository at this point in the history
  • Loading branch information
uazo committed Aug 7, 2023
1 parent 3222b0d commit 41c823b
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
3 changes: 2 additions & 1 deletion build/bromite_patches_list.txt
Original file line number Diff line number Diff line change
Expand Up @@ -281,4 +281,5 @@ Timezone-customization.patch
00Cromite-Branding.patch
00Disable-Feeback-Collector.patch
00Disable-remote-altsvc-for-h3-connections.patch
00do-not-block-build-incompatible-profiles.patch
00do-not-block-build-incompatible-profiles.patch
00Allow-DocumentPiP-if-PopupsAndRedirects-are-active.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
From: uazo <[email protected]>
Date: Mon, 7 Aug 2023 11:02:18 +0000
Subject: Allow DocumentPiP if PopupsAndRedirects are active

Allow documentPiP api use only with content setting popup allowed
---
.../picture_in_picture_controller_impl.cc | 7 +++++++
1 file changed, 7 insertions(+)

diff --git a/third_party/blink/renderer/modules/document_picture_in_picture/picture_in_picture_controller_impl.cc b/third_party/blink/renderer/modules/document_picture_in_picture/picture_in_picture_controller_impl.cc
--- a/third_party/blink/renderer/modules/document_picture_in_picture/picture_in_picture_controller_impl.cc
+++ b/third_party/blink/renderer/modules/document_picture_in_picture/picture_in_picture_controller_impl.cc
@@ -361,6 +361,13 @@ void PictureInPictureControllerImpl::CreateDocumentPictureInPictureWindow(
return;
}

+ if (!opener.GetFrame()->GetContentSettingsClient()->AllowPopupsAndRedirects(false)) {
+ exception_state.ThrowDOMException(DOMExceptionCode::kNotAllowedError,
+ "Document PiP requires user popup permission");
+ resolver->Reject(exception_state);
+ return;
+ }
+
WebPictureInPictureWindowOptions web_options;
web_options.width = options->width();
web_options.height = options->height();
--
2.25.1

0 comments on commit 41c823b

Please sign in to comment.