Bug 236349
Summary: | Permission API: PermissionStatus with registered "change" listeners shouldn't be GC'd | ||
---|---|---|---|
Product: | WebKit | Reporter: | Marcos Caceres <marcos> |
Component: | New Bugs | Assignee: | Nobody <webkit-unassigned> |
Status: | NEW | ||
Severity: | Normal | CC: | cdumez, marcos, sihui_liu, webkit-bug-importer, youennf |
Priority: | P2 | Keywords: | InRadar |
Version: | Safari Technology Preview | ||
Hardware: | Unspecified | ||
OS: | Unspecified | ||
URL: | https://github.com/w3c/permissions/pull/360 | ||
Bug Depends on: | |||
Bug Blocks: | 229504 |
Marcos Caceres
Related spec change:
https://github.com/w3c/permissions/pull/360
It should be possible to get a PermissionStatus object, register a listener on it, and allow it to go out of scope (but not have it GC'd)
For example:
```JS
(async () => {
const perm = await navigator.permissions.query({ name: "geolocation" });
perm.onchange = () => { console.log("pass") };
console.log("going out of scope");
// bye bye perm
})();
// prompts for permission
navigator.geolocation.getCurrentPosition(console.log);
```
Changing the permission of Geolocation in the above should produce "pass" in the developer console.
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Marcos Caceres
Noting the works in Blink-based browsers.
youenn fablet
Right, we do not support yet onchange event handler but when it is the case, we should definitely do something about it.
Radar WebKit Bug Importer
<rdar://problem/88969778>