From 4f58bf4ee9d2c46ae8ee178fae2786ed023ff455 Mon Sep 17 00:00:00 2001 From: Marcos Caceres Date: Fri, 17 Oct 2025 12:31:32 +0800 Subject: [PATCH 1/4] Add pending fullscreen request flag and promise to document state This commit adds exported definitions for both 'pending fullscreen request flag' and 'pending fullscreen request promise' to document state, enabling other specifications to use modern WebIDL patterns. Changes: - Add 'pending fullscreen request flag' to document state (exported) - Add 'pending fullscreen request promise' to document state (exported) - Set flag and store promise when requestFullscreen() starts processing - Clear flag and promise when request resolves (success) or rejects (error) - Use consistent naming conventions without interface binding The flag enables detecting pending fullscreen requests, while the promise enables other specifications to use WebIDL 'react' patterns to respond to fullscreen request rejections instead of relying on flag state changes. This enables other specifications (like Screen Orientation) to detect when a document has a pending fullscreen request and react to promise rejections, allowing modern promise-based integration for web compatibility. Related to https://github.com/w3c/screen-orientation/issues/254 and https://github.com/w3c/screen-orientation/issues/255 --- fullscreen.bs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/fullscreen.bs b/fullscreen.bs index 16ad739..1113ca8 100644 --- a/fullscreen.bs +++ b/fullscreen.bs @@ -68,6 +68,14 @@ 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 an associated pending fullscreen request flag. +Unless stated otherwise it is unset. When set, it indicates that the document has an outstanding +fullscreen request that has not yet resolved or been rejected. + +

All documents have an associated pending fullscreen request promise. +Unless stated otherwise it is null. When not null, it is the promise representing the current pending +fullscreen request. +

To fullscreen an element:

    @@ -267,6 +275,8 @@ are:
  1. Let promise be a new promise. +

  2. Set pendingDoc's pending fullscreen request promise to promise. +

  3. If pendingDoc is not fully active, then reject promise with a {{TypeError}} exception and return promise. @@ -295,6 +305,8 @@ are:

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

  5. If error is false, set pendingDoc's pending fullscreen request flag. +

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

  7. @@ -343,6 +355,10 @@ are:

    If error is true:

      +
    1. Unset pendingDoc's pending fullscreen request flag. + +

    2. Set pendingDoc's pending fullscreen request promise to null. +

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

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

    4. Unset pendingDoc's pending fullscreen request flag. + +

    5. Set pendingDoc's pending fullscreen request promise to null. +

    6. Resolve promise with undefined.

    From 467cd0a58c14c5b66e81632a1772aa5c24ed55d8 Mon Sep 17 00:00:00 2001 From: Marcos Caceres Date: Mon, 16 Feb 2026 13:18:31 +1100 Subject: [PATCH 2/4] Apply review feedback --- fullscreen.bs | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/fullscreen.bs b/fullscreen.bs index 1113ca8..d9a9c0a 100644 --- a/fullscreen.bs +++ b/fullscreen.bs @@ -68,12 +68,11 @@ 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 an associated pending fullscreen request flag. -Unless stated otherwise it is unset. When set, it indicates that the document has an outstanding -fullscreen request that has not yet resolved or been rejected. +

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

    All documents have an associated pending fullscreen request promise. -Unless stated otherwise it is null. When not null, it is the promise representing the current pending +

    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: @@ -275,10 +274,11 @@ are:

  8. Let promise be a new promise. -

  9. Set pendingDoc's pending fullscreen request promise to promise. +

  10. Set pendingDoc's [=Document/pending fullscreen request promise=] to promise. -

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

  12. 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.

  13. Let error be false. @@ -305,7 +305,7 @@ are:

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

  15. If error is false, set pendingDoc's pending fullscreen request flag. +

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

  17. Return promise, and run the remaining steps in parallel. @@ -355,9 +355,9 @@ are:

    If error is true:

      -
    1. Unset pendingDoc's pending fullscreen request flag. +

    2. Set pendingDoc's [=Document/pending fullscreen request=] to false. -

    3. Set pendingDoc's pending fullscreen request promise to null. +

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

    5. Append ({{fullscreenerror}}, this) to pendingDoc's list of pending fullscreen events. @@ -408,9 +408,9 @@ are:

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

    6. Unset pendingDoc's pending fullscreen request flag. +

    7. Set pendingDoc's [=Document/pending fullscreen request=] to false. -

    8. Set pendingDoc's pending fullscreen request promise to null. +

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

    10. Resolve promise with undefined.

    From 7af7c7399e3e5dbb73b11469c7ae0edafcd33cb0 Mon Sep 17 00:00:00 2001 From: Marcos Caceres Date: Mon, 16 Feb 2026 13:55:58 +1100 Subject: [PATCH 3/4] Give promise a type --- fullscreen.bs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fullscreen.bs b/fullscreen.bs index d9a9c0a..41e6be0 100644 --- a/fullscreen.bs +++ b/fullscreen.bs @@ -272,7 +272,7 @@ are:
    1. Let pendingDoc be this's node document. -

    2. Let promise be a new promise. +

    3. Let promise be a new {{Promise}}.

    4. Set pendingDoc's [=Document/pending fullscreen request promise=] to promise. From 4a4068bd2522243c94dc4fc18811216334c84a94 Mon Sep 17 00:00:00 2001 From: Marcos Caceres Date: Mon, 16 Feb 2026 14:55:37 +1100 Subject: [PATCH 4/4] use correct promise constructor --- fullscreen.bs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fullscreen.bs b/fullscreen.bs index 41e6be0..db2a19b 100644 --- a/fullscreen.bs +++ b/fullscreen.bs @@ -272,7 +272,8 @@ are:

      1. Let pendingDoc be this's node document. -

      2. Let promise be a new {{Promise}}. + +

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

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