Permission API: PermissionStatus with registered "change" listeners shouldn't be GC'd
https://bugs.webkit.org/show_bug.cgi?id=236349
Summary Permission API: PermissionStatus with registered "change" listeners shouldn't...
Marcos Caceres
Reported 2022-02-08 23:12:51 PST
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
Marcos Caceres
Comment 1 2022-02-08 23:15:58 PST
Noting the works in Blink-based browsers.
youenn fablet
Comment 2 2022-02-11 00:28:48 PST
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
Comment 3 2022-02-15 09:31:12 PST
Note You need to log in before you can comment on or make changes to this bug.