Closed Bug 1754372 Opened 3 years ago Closed 3 months ago

PermissionStatus with registered "change" listeners shouldn't be GC'd

Categories

(Core :: Permission Manager, defect, P3)

defect

Tracking

()

RESOLVED INVALID

People

(Reporter: marcos, Unassigned)

References

()

Details

(Keywords: parity-chrome)

Attachments

(1 file)

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.

Component: Untriaged → Permission Manager
Keywords: parity-chrome
Product: Firefox → Core

The severity field is not set for this bug.
:timhuang, could you have a look please?

For more information, please visit auto_nag documentation.

Flags: needinfo?(tihuang)
Severity: -- → S3
Flags: needinfo?(tihuang)
Priority: -- → P3
Attached file test-case.html

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.

This bug is invalid. PermissionStatus calls KeepAliveIfHasListenersFor in the CTOR: https://searchfox.org/mozilla-central/source/dom/permission/PermissionStatus.cpp#24

Status: UNCONFIRMED → RESOLVED
Closed: 3 months ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: