diff --git a/fullscreen.bs b/fullscreen.bs index 16ad739..db2a19b 100644 --- a/fullscreen.bs +++ b/fullscreen.bs @@ -68,6 +68,13 @@ stated otherwise it is unset.

All documents have an associated list of pending fullscreen events, which is an ordered set of (string, element) tuples. It is initially empty. +

All documents have a +pending fullscreen request, which is a boolean. It is initially false. + +

All documents have an associated pending fullscreen request promise, +which is a nullable {{Promise}}. It is initially null. It represents the current pending +fullscreen request. +

To fullscreen an element:

    @@ -265,10 +272,14 @@ are:
    1. Let pendingDoc be this's node document. -

    2. Let promise be a new promise. -

    3. If pendingDoc is not fully active, then reject promise with a - {{TypeError}} exception and return promise. +

    4. Let promise be [=a new promise=] in [=this=]'s [=relevant realm=]. + +

    5. Set pendingDoc's [=Document/pending fullscreen request promise=] to promise. + +

    6. If pendingDoc is not fully active, then set pendingDoc's + [=Document/pending fullscreen request promise=] to null, reject promise with a + {{TypeError}} exception, and return promise.

    7. Let error be false. @@ -295,6 +306,8 @@ are:

    8. If error is false, then consume user activation given pendingDoc's relevant global object. +

    9. If error is false, then set pendingDoc's [=Document/pending fullscreen request=] to true. +

    10. Return promise, and run the remaining steps in parallel.

    11. @@ -343,6 +356,10 @@ are:

      If error is true:

        +
      1. Set pendingDoc's [=Document/pending fullscreen request=] to false. + +

      2. Set pendingDoc's [=Document/pending fullscreen request promise=] to null. +

      3. Append ({{fullscreenerror}}, this) to pendingDoc's list of pending fullscreen events. @@ -392,6 +409,10 @@ are:

        The order in which elements are fullscreened is not observable, because run the fullscreen steps is invoked in tree order. +

      4. Set pendingDoc's [=Document/pending fullscreen request=] to false. + +

      5. Set pendingDoc's [=Document/pending fullscreen request promise=] to null. +

      6. Resolve promise with undefined.