- From: Reilly Grant via GitHub <sysbot+gh@w3.org>
- Date: Tue, 30 Apr 2019 20:58:24 +0000
- To: public-device-apis-log@w3.org
reillyeon has just created a new issue for https://github.com/w3c/wake-lock: == Losing reference to a WakeLock object is a bug or intended behavior == Issues #128 and #133 ask about what happens when script loses its reference to a `WakeLock` object and it is potentially GCed. We have been exploring this in #171 and #183 and my opinion is that this is not an issue which the specification should attempt to resolve as it adds unnecessary complexity. If script acquires a wake lock and then loses either the associated `WakeLock` object or the `AbortSignal` it was requested with then this is either a bug or the script intends to never release the lock and there need not be a mechanism to recover from this state. The wake lock will remain held until it is revoked by the operating system, the document is no longer visible (in the case of a `"screen"` wake lock), or the document is no longer active, whichever comes first. This means, * Remove the `query()` method. User agents should provide debugging tools to inspect the state of wake locks held by the page but it is unnecessary to expose these tools to script on the page itself. * Remove the `abort()` method in favor of the `AbortSignal` passed as part of `WakeLockRequestOptions`. * Throw an `InvalidStateError` if `request()` is called while the `Promise` returned by a previous call has not been resolved, or if the wake lock is not active. Note, that to support the case where a wake lock is revoked by the operating system the `"activechange"` event should still be supported and after deactivation the `WakeLock` object should be able to be reactivated by calling `request()`. Otherwise I would recommend removing the `WakeLock` object entirely and reverting to a static `request()` method that only supports cancellation via an `AbortSignal`. CC @mounirlamouri who expressed on #128 that the suggested behavior above is unsatisfactory. Given the discussion on the issues above have you changed your mind? CC @petele who suggested the `query()` method. Is there a use case I have missed here that you would argue is not a bug? Please view or discuss this issue at https://github.com/w3c/wake-lock/issues/199 using your GitHub account
Received on Tuesday, 30 April 2019 20:58:26 UTC