- From: Marcos Cáceres <notifications@github.com>
- Date: Sun, 25 Jul 2021 23:15:36 -0700
- To: w3c/permissions <permissions@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Monday, 26 July 2021 06:15:49 UTC
@jyasskin, @rakina, yes, you are right. In [reading the current permission state](https://w3c.github.io/permissions/#reading-current-states), we can check if the |document| is "fully active" (and reject at that point?). Concretely in JS below. * Chrome: resolves the promise with `undefined`. * Firefox: never resolves. ```JS async function test() { const iframe = await loadIframe(); // Prevent GC from collecting the permissions object. const permissions = iframe.contentWindow.navigator.permissions; // Make iframe no longer fully active iframe.remove(); // Deny or throw? const perm = await permissions.query({ name: "geolocation", }); console.assert( perm.state === "denied", "Expected permission state to be 'denied'" ); } async function loadIframe() { const iframe = document.createElement("iframe"); iframe.src = "/"; document.body.appendChild(iframe); await new Promise((resolve) => { iframe.onload = resolve; }); return iframe; } test(); ``` -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/w3c/permissions/issues/162#issuecomment-886409154
Received on Monday, 26 July 2021 06:15:49 UTC