From ab08b9bdea76d7322499142379347b3b51a602e8 Mon Sep 17 00:00:00 2001 From: arai-a Date: Sat, 30 Oct 2021 01:57:38 +0900 Subject: [PATCH] Standardize window.open() popup features and BarProp values Fixes #5872 by standardizing an internal "is popup" boolean, and how it is impacted by various window.open() features. Implementations can use this boolean (in addition to other signals) to determine whether an opened window is a popup or not. Fixes #4431 by changing the various BarProp visible properties to only reflect this "is popup" boolean, instead of reflecting the actual state of user interface elements, or the passed-in window features. Adds a "popup" window.open() feature to provide a simpler method of requesting a popup. --- source | 166 ++++++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 124 insertions(+), 42 deletions(-) diff --git a/source b/source index 895692dee23..0043c75901b 100644 --- a/source +++ b/source @@ -2187,6 +2187,7 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
  • skip ASCII whitespace
  • The ordered map data structure and the associated definitions for value, + empty, entry, exists, getting the value of an entry, @@ -79499,9 +79500,36 @@ popup4.close(); export>top-level browsing context for itself and all of the browsing contexts for which it is an ancestor browsing context.

    +
    +

    A top-level browsing context has an associated group (null or a browsing context group). It is initially null.

    +

    A top-level browsing context has an is popup boolean. It is initially + false.

    + +
    +

    The only mandatory impact in this specification of is popup is on the + visible getter of the relevant BarProp + objects. However, user agents might also use it in the following ways:

    + +
      +
    • Deciding whether or not to provide a minimal web browser user interface for the + browsing context.
    • + +
    • Performing the optional steps in set up browsing context + features.
    • +
    + +

    In both cases user agents might additionally incorporate user preferences, or present a choice + as to whether to go down the popup route.

    + +

    User agents that provides a minimal web browser user interface for such popups are encouraged + to not hide the browser's location bar.

    +
    + +
    +

    It is possible to create new browsing contexts that are related to a top-level browsing context while their container is null. Such browsing contexts are called WindowPostMessageOptions : StructuredSeri data-x="">new with no opener", then:

      +
    1. Set the target browsing context's is popup to the result of + checking if a popup window is requested, given + tokenizedFeatures.

    2. +
    3. Set up browsing context features for target browsing context given tokenizedFeatures.

    4. @@ -81010,6 +81042,68 @@ dictionary WindowPostMessageOptions : StructuredSeri
    5. Return tokenizedFeatures.

    +

    To check if a window feature is set, given + tokenizedFeatures, featureName, and defaultValue:

    + +
      +
    1. If tokenizedFeatures[featureName] exists, then return the result of parsing + tokenizedFeatures[featureName] as a boolean feature.

    2. + +
    3. Return defaultValue.

    4. +
    + +

    To check if a popup window is requested, given + tokenizedFeatures:

    + +
      +
    1. If tokenizedFeatures is empty, then return + false.

    2. + +
    3. If tokenizedFeatures["popup"] exists, then return the result of parsing + tokenizedFeatures["popup"] as a boolean + feature.

    4. + +
    5. Let location be the result of checking if + a window feature is set, given tokenizedFeatures, "location", and false.

    6. + +
    7. Let toolbar be the result of checking if + a window feature is set, given tokenizedFeatures, "toolbar", and false.

    8. + +
    9. If location and toolbar are both false, then return true.

    10. + +
    11. Let menubar be the result of checking if + a window feature is set, given tokenizedFeatures, menubar", and false.

    12. + +
    13. If menubar is false, then return true.

    14. + +
    15. Let resizable be the result of checking if + a window feature is set, given tokenizedFeatures, "resizable", and true.

    16. + +
    17. If resizable is false, then return true.

    18. + +
    19. Let scrollbars be the result of checking + if a window feature is set, given tokenizedFeatures, "scrollbars", and false.

    20. + +
    21. If scrollbars is false, then return true.

    22. + +
    23. Let status be the result of checking if + a window feature is set, given tokenizedFeatures, "status", and false.

    24. + +
    25. If status is false, then return true.

    26. + +
    27. Return false.

    28. +
    +

    A code point is a feature separator if it is ASCII whitespace, U+003D (=), or U+002C (,).

    @@ -81388,8 +81482,12 @@ dictionary WindowPostMessageOptions : StructuredSeri

    Browser interface elements

    -

    To allow web pages to integrate with web browsers, certain web browser interface elements are - exposed in a limited way to scripts in web pages.

    +

    For historical reasons, the Window interface had some attributes that represented + the visibility of certain web browser interface elements.

    + +

    For privacy and interoperability reasons, those attributes now return values that represent + whether the Window's browsing context's is + popup property is true or false.

    Each interface element is represented by a BarProp object:

    @@ -81400,75 +81498,59 @@ interface BarProp {
    window.locationbar.visible
    -

    Returns true if the location bar is visible; otherwise, returns false.

    -
    window.menubar.visible
    -

    Returns true if the menu bar is visible; otherwise, returns false.

    -
    window.personalbar.visible
    -

    Returns true if the personal bar is visible; otherwise, returns false.

    -
    window.scrollbars.visible
    -

    Returns true if the scrollbars are visible; otherwise, returns false.

    -
    window.statusbar.visible
    -

    Returns true if the status bar is visible; otherwise, returns false.

    -
    window.toolbar.visible
    -

    Returns true if the toolbar is visible; otherwise, returns false.

    +

    Returns true if the top-level browsing context is not a popup; otherwise, + returns false.

    -

    The visible attribute's getter - must run these steps:

    +

    The visible getter steps + are:

      -
    1. If this BarProp object's relevant global object's browsing context is null, then return false.

    2. +
    3. Let browsingContext be this's relevant global + object's browsing context.

    4. -
    5. If the user agent does not have a user interface element that the object represents, as - described below, then return true.

    6. +
    7. If browsingContext is null, then return true.

    8. -
    9. Return true or a value determined by the user agent to most accurately represent the - visibility state of the user interface element that the object represents, as described - below.

    10. +
    11. Return the negation of browsingContext's top-level browsing + context's is popup.

    The following BarProp objects must exist for each Window object:

    The location bar BarProp object
    -
    Represents the user interface element that contains a control that displays the - URL of the active document, or some similar interface concept.
    +
    Historically represented the user interface element that contains a control that displays the + browser's location bar.
    The menu bar BarProp object
    -
    Represents the user interface element that contains a list of commands in menu form, or some - similar interface concept.
    +
    Historically represented the user interface element that contains a list of commands in menu + form, or some similar interface concept.
    The personal bar BarProp object
    -
    Represents the user interface element that contains links to the user's favorite pages, or - some similar interface concept.
    +
    Historically represented the user interface element that contains links to the user's + favorite pages, or some similar interface concept.
    The scrollbar BarProp object
    -
    Represents the user interface element that contains a scrolling mechanism, or some similar - interface concept.
    +
    Historically represented the user interface element that contains a scrolling mechanism, or + some similar interface concept.
    The status bar BarProp object
    -
    Represents a user interface element found immediately below or after the document, as - appropriate for the user's media, which typically provides information about ongoing network - activity or information about elements that the user's pointing device is current indicating. If - the user agent has no such user interface element, then the object may act as if the - corresponding user interface element was absent (i.e. its visible attribute may return false).
    +
    Historically represented a user interface element found immediately below or after the + document, as appropriate for the user's media, which typically provides information about ongoing + network activity or information about elements that the user's pointing device is currently + indicating.
    The toolbar BarProp object
    -
    Represents the user interface element found immediately above or before the document, as - appropriate for the user's media, which typically provides session history traversal - controls (back and forward buttons, reload buttons, etc.). If the user agent has no such user - interface element, then the object may act as if the corresponding user interface element was - absent (i.e. its visible attribute may return - false).
    +
    Historically represented the user interface element found immediately above or before the + document, as appropriate for the user's media, which typically provides session + history traversal controls (back and forward buttons, reload buttons, etc.).

    The locationbar