diff --git a/index.html b/index.html
index 2de2a3f..9661d30 100644
--- a/index.html
+++ b/index.html
@@ -91,6 +91,11 @@
updateLockButton(lockButton);
}
+ async function unlock() {
+ await screen.orientation.unlock();
+ updateLockButton();
+ }
+
screen.orientation.addEventListener("change", updateLockButton);
window.addEventListener("load", updateLockButton);
@@ -99,7 +104,7 @@
<button onclick="rotate(this)" id="button">
Lock to...
</button>
- <button onclick="screen.orientation.unlock()">
+ <button onclick="unlock()">
Unlock
</button>
@@ -392,7 +397,7 @@
[Exposed=Window]
interface ScreenOrientation : EventTarget {
Promise<undefined> lock(OrientationLockType orientation);
- undefined unlock();
+ Promise<undefined> unlock();
readonly attribute OrientationType type;
readonly attribute unsigned short angle;
attribute EventHandler onchange;
@@ -503,30 +508,29 @@
Let |document:Document| be [=this=]'s [=relevant global
object=]'s [=associated `Document`=].
- If |document| is not [=Document/fully active=],
- [=exception/throw=] an {{"InvalidStateError"}} {{DOMException}}.
+ If |document| is not
+ [=Document/fully active=], return [=a promise rejected with=] an
+ {{"InvalidStateError"}} {{DOMException}}.
- If |document| has the
- [=sandboxed orientation lock browsing context flag=] set, return
- `undefined`.
+ If |document| has the [=sandboxed orientation lock browsing
+ context flag=] set, return [=a promise resolved with=] `undefined`.
If screen's [=Screen/active orientation lock=] is `null`, return
- `undefined`.
+ return [=a promise resolved with=] `undefined`.
+
+ If |document|'s
+ {{Document/[[orientationPendingPromise]]}} is not `null`, [=reject
+ and nullify the current lock promise=] of |document| with an
+ {{"AbortError"}}.
- If |document|'s {{Document/[[orientationPendingPromise]]}} is not
- `null`, [=reject and nullify the current lock promise=] of |document|
- with an {{"AbortError"}}.
+ Set |document|'s
+ {{Document/[[orientationPendingPromise]]}} to [=a new promise=].
[=Apply orientation lock=] `null` to |document|.
+ Return |document|'s {{Document/[[orientationPendingPromise]]}}.
+
-
- {{unlock()}} does not return a promise because it is equivalent to
- locking to the [=default screen orientation=] which might or might
- not be known by the [=user agent=]. Hence, the [=user agent=] can not
- predict what the new orientation is going to be and even if it is
- going to change at all.
-