Closed Bug 1587531 Opened 5 years ago Closed 5 years ago

[wpt-sync] Sync PR 19600 - wake lock: Implement new proposed API.

Categories

(Testing :: web-platform-tests, task, P4)

task

Tracking

(firefox72 fixed)

RESOLVED FIXED
mozilla72
Tracking Status
firefox72 --- fixed

People

(Reporter: mozilla.org, Unassigned)

References

()

Details

(Whiteboard: [wptsync downstream])

Sync web-platform-tests PR 19600 into mozilla-central (this bug is closed when the sync is complete).

PR: https://github.com/web-platform-tests/wpt/pull/19600
Details from upstream follow.

Raphael Kubo da Costa <raphael.kubo.da.costa@intel.com> wrote:

wake lock: Implement new proposed API.

This is another big update to the implementation, which now follows the
API proposed in https://github.com/w3c/wake-lock/issues/226.

From a Blink/Chromium internals perspective, things have not changed much,
and we still perform the same permission checks and connect to the wake lock
service via WakeLockStateRecord. The biggest change is that WakeLockController
was merged into WakeLock itself.

From an end-user perspective, though, the API now looks like a mix of the
old, navigator-based API and the one we implemented a few months ago:

  • The main idea is that WakeLock.request() no longer returns a promise that
    does not resolve while the lock is held, as that is not very intuitive.
    Instead, it returns a new WakeLockSentinel object.
  • WakeLockSentinel is a new interface that can release() a lock and receive
    "release" events.
  • We do go back to a Navigator-based API, but we also support
    WorkerNavigator.
  • There is no WakeLockRequest interface or state tracking in the WakeLock
    interface.
  • WakeLock.requestPermission() was removed.
  • Consequently, we now have a WakeLockEvent interface.

The changes to the spec still need to land, but there is some rough
consensus on what the API should look like, and we do not want to miss the
M79 branch cut.

Bug: 257511, 1010162
Change-Id: If1baed914ccd9eb7103a1bb71a40529976777ec2
Reviewed-on: https://chromium-review.googlesource.com/1849683
WPT-Export-Revision: 778dd375b986c9b810a8896ff1e4a8ef5e24bb96

## GitHub CI Results
wpt.fyi [PR Results](https://wpt.fyi/results/?sha=7d08fd394fbfc28fbbbfe546d3182409b6501899&label=pr_head) [Base Results](https://wpt.fyi/results/?sha=7d08fd394fbfc28fbbbfe546d3182409b6501899&label=pr_base)

Ran 13 tests and 59 subtests

### Firefox
  OK     : 11
  PASS   : 8
  FAIL   : 43

### Chrome
  OK     : 11
  PASS   : 24
  FAIL   : 27

### Safari
  OK     : 11
  PASS   : 8
  FAIL   : 43

### Existing tests that now have a worse result

/wake-lock/wakelock-abortsignal.https.any.html: Firefox: OK->MISSING, Chrome: OK->MISSING, Safari: OK->MISSING

/wake-lock/wakelock-abortsignal.https.any.worker.html: Firefox: OK->MISSING, Chrome: OK->MISSING, Safari: OK->MISSING

### Other new tests that's don't pass

/wake-lock/idlharness.https.any.worker.html
   WakeLock interface: calling request(WakeLockType, WakeLockRequestOptions) on navigator.wakeLock with too few arguments must throw TypeError: Firefox: FAIL, Chrome: FAIL, Safari: FAIL
   WakeLock interface: navigator.wakeLock must inherit property "request(WakeLockType, WakeLockRequestOptions)" with the proper type: Firefox: FAIL, Chrome: FAIL, Safari: FAIL
   Stringification of navigator.wakeLock: Firefox: FAIL, Chrome: FAIL, Safari: FAIL
   WakeLock interface: navigator.wakeLock must not have property "requestPermission": Firefox: FAIL, Chrome: FAIL, Safari: FAIL
   WakeLock must be primary interface of navigator.wakeLock: Firefox: FAIL, Chrome: FAIL, Safari: FAIL

/wake-lock/wakelock-active-document.https.window.html
   navigator.wakeLock.request() aborts if the document is not active.: Firefox: FAIL, Chrome: FAIL, Safari: FAIL
   navigator.wakeLock.request() aborts if the document is active, but not fully active.: Firefox: FAIL, Chrome: FAIL, Safari: FAIL

/wake-lock/idlharness.https.any.html
   WakeLock interface: navigator.wakeLock must inherit property "requestPermission(WakeLockType)" with the proper type: Firefox: FAIL, Chrome: FAIL, Safari: FAIL
   WakeLock interface: calling request(WakeLockType, WakeLockRequestOptions) on navigator.wakeLock with too few arguments must throw TypeError: Firefox: FAIL, Chrome: FAIL, Safari: FAIL
   WakeLock interface: navigator.wakeLock must inherit property "request(WakeLockType, WakeLockRequestOptions)" with the proper type: Firefox: FAIL, Chrome: FAIL, Safari: FAIL
   Stringification of navigator.wakeLock: Firefox: FAIL, Chrome: FAIL, Safari: FAIL
   WakeLock interface: calling requestPermission(WakeLockType) on navigator.wakeLock with too few arguments must throw TypeError: Firefox: FAIL, Chrome: FAIL, Safari: FAIL
   WakeLock must be primary interface of navigator.wakeLock: Firefox: FAIL, Chrome: FAIL, Safari: FAIL
Pushed by james@hoppipolla.co.uk:
https://hg.mozilla.org/integration/mozilla-inbound/rev/48db767a35dd
[wpt PR 19600] - wake lock: Implement new proposed API., a=testonly
https://hg.mozilla.org/integration/mozilla-inbound/rev/a1fc432a134a
[wpt PR 19600] - Update wpt metadata, a=testonly
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla72
You need to log in before you can comment on or make changes to this bug.