Skip to content

Commit

Permalink
[Partitioned Popins] The popin cannot open popins
Browse files Browse the repository at this point in the history
We disallow this in the renderer/browser as it would cause issues with
the way modal popups work.

Explainer: https://explainers-by-googlers.github.io/partitioned-popins/
I2P: https://groups.google.com/a/chromium.org/g/blink-dev/c/ApU_zUmpQ2g/

Bug: 340606651
Change-Id: Ib6bac72db4ff3c48038c0e92c7fecb9d3b624ea8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5816450
Commit-Queue: Ari Chivukula <arichiv@chromium.org>
Reviewed-by: Nasko Oskov <nasko@chromium.org>
Reviewed-by: Philip Rogers <pdr@chromium.org>
Auto-Submit: Ari Chivukula <arichiv@chromium.org>
Commit-Queue: Nasko Oskov <nasko@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1348976}
  • Loading branch information
arichiv authored and chromium-wpt-export-bot committed Aug 30, 2024
1 parent daf9128 commit a97e8f7
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// META: script=/resources/testdriver.js
// META: script=/resources/testdriver-vendor.js

'use strict';

// Spec: https://explainers-by-googlers.github.io/partitioned-popins/
// Step 1 (window) Set up listener to resolve messages as they come in.
// Step 2 (window) Open popin.
// Step 3 (popin) Try to open popin and report failure.
// Step 4 (main-window) Cleanup.

async_test(t => {
// Step 1
window.addEventListener("message", t.step_func(e => {
switch (e.data.type) {
case 'popin':
// Step 4
assert_equals(e.data.message, "Could not open inner popin");
t.done();
break;
}
}));

// Step 2
window.open("/partitioned-popins/resources/partitioned-popins.recursive.html", '_blank', 'popin');
}, "Verify Partitioned Popins cannot open their own popin");
18 changes: 18 additions & 0 deletions partitioned-popins/resources/partitioned-popins.recursive.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!doctype html>
<meta charset="utf-8">
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
<script>
(async function() {
test_driver.set_test_context(window.opener);

// Step 3 (partitioned-popins/partitioned-popins.recursive.tentative.sub.https.window.js)
let message = "Could not open inner popin";
try {
window.open("/partitioned-popins/resources/partitioned-popins.close.html", '_blank', 'popin');
message = "Did open inner popin";
} catch (_) {}
window.opener.postMessage({type: "popin", message: message}, "*");
window.close();
})();
</script>

0 comments on commit a97e8f7

Please sign in to comment.