From ec097473861b1bf2752e0472c320ae746c287b09 Mon Sep 17 00:00:00 2001 From: Marcos Caceres Date: Fri, 17 Oct 2025 12:31:32 +0800 Subject: [PATCH] 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 c94c0fd..e5a6e8b 100644 --- a/fullscreen.bs +++ b/fullscreen.bs @@ -67,6 +67,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:

    @@ -266,6 +274,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. @@ -294,6 +304,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. @@ -342,6 +354,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. @@ -391,6 +407,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.