W3C home > Mailing lists > Public > public-device-apis-log@w3.org > September 2018

Re: [sensors] Garbage collection behavior unclear in Generic Sensor spec

From: smaug---- via GitHub <sysbot+gh@w3.org>
Date: Fri, 21 Sep 2018 19:29:12 +0000
To: public-device-apis-log@w3.org
Message-ID: <issue_comment.created-423646877-1537558151-sysbot+gh@w3.org>
(Trying to page in sensors API to my mind). https://w3c.github.io/sensors/#sensor-garbage-collection looks quite reasonable. If the backend of the sensor may cause new events to be dispatched and there are event listeners, the object must not be collected. And of course if JS has explicit (direct or indirect) references to the object, it can't be collected either.
Then it is up to the implementation to collect the object when it wants to, since the collection won't be exposed to the web page.

>From the initial comment:
> Following the specification, the sensor begins in the `idle` state. When `start` is called, the sensor progresses to the `activating` state. There are no Event Handlers installed, so the sensor is eligible to be garbage collected. Therefore, we run the deactivation steps which returns the state to `idle`.

No, it isn't eligible to gc, because normal "JS has access to the object" rules keep the object alive. 

GitHub Notification of comment by smaug----
Please view or discuss this issue at https://github.com/w3c/sensors/issues/372#issuecomment-423646877 using your GitHub account
Received on Friday, 21 September 2018 19:29:13 UTC

This archive was generated by hypermail 2.4.0 : Monday, 4 July 2022 12:47:55 UTC