1
0
Fork 0
firefox/testing/web-platform/tests/partitioned-popins/partitioned-popins.proxy-cross.tentative.sub.https.window.js
Daniel Baumann 5e9a113729
Adding upstream version 140.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
2025-06-25 09:37:52 +02:00

37 lines
1.3 KiB
JavaScript

// META: script=/resources/testdriver.js
// META: script=/resources/testdriver-vendor.js
// META: script=/partitioned-popins/resources/proxy-helpers.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 cross-site popin.
// Step 3 (popin) Set up listener to resolve messages as they come in.
// Step 4 (popin) Test and report usable methods against window.
// Step 5 (window) Test and compare usable methods against popin.
// Step 6 (popin) Cleanup.
// Step 7 (window) Cleanup.
async_test(t => {
let popin_proxy;
// Step 1
window.addEventListener("message", t.step_func(e => {
switch (e.data.type) {
case 'ready':
// Step 5
assert_equals(e.data.message, "Closed,Then,");
assert_equals(getUsableMethods(popin_proxy), "Closed,Then,");
popin_proxy.postMessage({type: "cleanup"}, "*");
break;
case 'cleanup':
// Step 7
t.done();
break;
}
}));
// Step 2
popin_proxy = window.open("https://{{hosts[alt][]}}:{{ports[https][0]}}/partitioned-popins/resources/partitioned-popins.proxy-popin.html", '_blank', 'popin');
}, "Verify cross-site Partitioned Popins proxies only have access to postMessage and closed methods.");