Skip to content

Commit

Permalink
[Partitioned Popins] Test RSA localStorage via WPTs
Browse files Browse the repository at this point in the history
We need to run these in the chrome shell to see any changes due to
calling requestStorageAccess.

Bug: 340606651
Change-Id: Id23f342c76e8f62533a181f90c55a3f900d7a24d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6316335
Commit-Queue: Ari Chivukula <[email protected]>
Auto-Submit: Ari Chivukula <[email protected]>
Reviewed-by: Chris Fredrickson <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1428048}
  • Loading branch information
arichiv authored and chromium-wpt-export-bot committed Mar 5, 2025
1 parent cd0b7fb commit aeb01ec
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// META: script=/resources/testdriver.js
// META: script=/resources/testdriver-vendor.js
// META: script=/storage-access-api/helpers.js

'use strict';

Expand Down Expand Up @@ -32,12 +33,14 @@ async_test(t => {
break;
case 'popin-read':
// Step 8
assert_equals(e.data.message, "Found:ThirdParty-");
assert_equals(e.data.message, "Found:ThirdParty-FirstPartyRSA-");
t.done();
break;
}
}));

// Step 2
window.open("https://{{hosts[alt][]}}:{{ports[https][0]}}/partitioned-popins/resources/partitioned-popins.localStorage-window.html?id="+id, '_blank', 'popup');
MaybeSetStorageAccess("*", "*", "blocked").then(() => {
// Step 2
window.open("https://{{hosts[alt][]}}:{{ports[https][0]}}/partitioned-popins/resources/partitioned-popins.localStorage-window.html?id="+id, '_blank', 'popup');
});
}, "Verify Partitioned Popins only have access to third-party localStorage");
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@
} else if (window.localStorage.getItem("third-party") == id) {
message += "ThirdParty-";
}
await test_driver.set_permission({ name: 'storage-access' }, 'granted');
let handle = await document.requestStorageAccess({localStorage: true});
if (handle && handle.localStorage.getItem("first-party") == id) {
message += "FirstPartyRSA-";
}
window.opener.postMessage({type: "popin-read", message: message}, "*");
window.close();
})();
Expand Down

0 comments on commit aeb01ec

Please sign in to comment.