Source code

Revision control

Copy as Markdown

Other Tools

Test Info: Warnings

// META: script=/resources/testdriver.js
// META: script=/resources/testdriver-vendor.js
'use strict';
// Step 1 (main-window) Set up listener to resolve messages as they come in.
// Step 2 (main-window) Open window for other origin.
// Step 3 (other-window) Write first-party localStorage key and report success.
// Step 4 (main-window) Embed iframe for other origin.
// Step 5 (main-iframe) Write third-party localStorage key and report success.
// Step 6 (main-window) Open partitioned popin for other origin.
// Step 7 (main-popin) Check localStorage for first-/third-party keys and report success.
// Step 8 (main-window) Cleanup.
async_test(t => {
const id = String(Date.now());
// Step 1
window.addEventListener("message", t.step_func(e => {
switch (e.data.type) {
case 'window-set':
// Step 4
assert_equals(e.data.message, "Set first-party data");
const iframe = document.createElement("iframe");
document.body.appendChild(iframe);
break;
case 'iframe-set':
// Step 6
assert_equals(e.data.message, "Set third-party data");
break;
case 'popin-read':
// Step 8
assert_equals(e.data.message, "Found:ThirdParty-");
t.done();
break;
}
}));
// Step 2
}, "Verify Partitioned Popins only have access to third-party localStorage");