Handle exceptions thrown when requesting storage-access permission (#21325)

This commit is contained in:
Jon Koops 2023-06-30 02:35:10 +02:00 committed by GitHub
parent e2ac9487f7
commit c0b0a25f71
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -29,9 +29,15 @@
}
// Otherwise, check whether unpartitioned cookie access has been granted to another same-site embed.
const permission = await navigator.permissions.query({
let permission;
try {
permission = await navigator.permissions.query({
name: "storage-access",
});
} catch (error) {
return false;
}
// If not, signal that there is no support.
if (permission.state !== "granted") {