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

@Honry,  thank you for looking into this matter.

 I have assumed that Generic Sensor instances follow the JavaScript language garbage collection rules, expect where the Generic Sensor specification states otherwise (e.g. where it says "must not" be collected).

Regarding reading without an `onreading` handler, the problem is subtle so perhaps I have misunderstood. The specification says:

> A Sensor object whose [[state]] is "activated" must not be garbage collected if there are any event listeners registered for "reading" events, or "error" events.

And it also says:

> When a Sensor object whose [[state]] is "activated" or "activating" is eligible for garbage collection, the user agent must invoke deactivate a sensor object with this object as argument

If a Sensor is in the activated state without an `onreading` handler, it is eligible for collection. Therefore, it must be deactivated. That all follows directly from the specification. It seems reasonable that a deactivated sensor does not generate new readings and consequently does not update the latest reading. If it were to do so, what would be the difference between an active and an inactive sensor?

-- 
GitHub Notification of comment by phoddie
Please view or discuss this issue at https://github.com/w3c/sensors/issues/372#issuecomment-423289326 using your GitHub account

Received on Thursday, 20 September 2018 18:38:18 UTC