Don't use top-level await for storage access checks (#23793)

Closes #23743
This commit is contained in:
ici-dev-gb 2023-10-12 11:28:01 +02:00 committed by GitHub
parent db7ca7fb66
commit 32b373f05f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -5,15 +5,19 @@
</head> </head>
<body> <body>
<script type="module"> <script type="module">
// Check if the browser has granted us access to 3rd-party storage (such as cookies). checkStorageAccess();
const hasAccess = await hasStorageAccess();
async function checkStorageAccess() {
// Check if the browser has granted us access to 3rd-party storage (such as cookies).
const hasAccess = await hasStorageAccess();
if (hasAccess) { if (hasAccess) {
// If so, attempt to place a cookie to test this assumption. // If so, attempt to place a cookie to test this assumption.
attemptWithTestCookie(); attemptWithTestCookie();
} else { } else {
// Otherwise, signal that 3rd-party access is not supported. // Otherwise, signal that 3rd-party access is not supported.
signalSupport(false); signalSupport(false);
}
} }
async function hasStorageAccess() { async function hasStorageAccess() {