PermissionStatus with registered "change" listeners shouldn't be GC'd
Categories
(Core :: Permission Manager, defect, P3)
Tracking
()
People
(Reporter: marcos, Unassigned)
References
()
Details
(Keywords: parity-chrome)
Attachments
(1 file)
751 bytes,
text/html
|
Details |
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.3 Safari/605.1.15
Steps to reproduce:
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:
(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);
Actual results:
Changing the permission of Geolocation in the above does nothing (so presumedly "perm" got CG'ed).
Expected results:
Changing the permission of Geolocation in the above should produce "pass" in the developer console.
Comment 1•3 years ago
|
||
The severity field is not set for this bug.
:timhuang, could you have a look please?
For more information, please visit auto_nag documentation.
Updated•3 years ago
|
That doesn't seem GC related, the same happens even when holding a strong reference to the PermissionStatus
object (see attachement). The issue looks more like onchange
is not supported at all here, contrarily to what compat data states.
Comment 3•3 months ago
|
||
This bug is invalid. PermissionStatus calls KeepAliveIfHasListenersFor
in the CTOR: https://searchfox.org/mozilla-central/source/dom/permission/PermissionStatus.cpp#24
Description
•