Skip to content

Commit

Permalink
Handle exceptions thrown when requesting storage-access permission (k…
Browse files Browse the repository at this point in the history
  • Loading branch information
jonkoops committed Feb 27, 2024
1 parent 6bd7b5b commit e29c2ca
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,15 @@
}

// Otherwise, check whether unpartitioned cookie access has been granted to another same-site embed.
const permission = await navigator.permissions.query({
name: "storage-access",
});
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") {
Expand Down

0 comments on commit e29c2ca

Please sign in to comment.