Proposal for standardizing window.open with features and BarProp

This document proposes how the features parameter of window.open interacts with where the newly created browsing context is opened, and how it interacts with BarProps.

Modify window open steps

Insert the following steps before "step 11.1. Set up browsing context features...", with:

  1. Let isPopup be the result of checking if popup window is requested, given tokenizedFeatures.

  2. Set the target browsing context's is popup to isPopup.

Modify top-level browsing context

After "A top-level browsing context has an associated", insert:

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

User agents can use is popup value to decide what kind of web browser interface to provide for the browsing context, or provide an option to users to do or not do so.

For example, user agents can provide a minimal UI if is popup is true. In the minimal UI, it's encouraged not to hide the browser interface element that displays the URL or the domain of the active document.

User agents can use is popup to decide whether to perform the optional steps in set up browsing context features steps or not, or provide an option to users to do or not do so.

Additional algorithms

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

  1. If tokenizedFeatures[featureName] exists, then:

    1. Return the result of parsing tokenizedFeatures[featureName] as a boolean feature.

  2. Return defaultValue.

To check if popup window is requested, given tokenizedFeatures:

  1. If tokenizedFeatures is empty, then return false.

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

  3. Let location be the result of checking if window feature is set, given tokenizedFeatures, "location", and false.

  4. Let toolbar be the result of checking if window feature is set, given tokenizedFeatures, "toolbar", and false.

  5. If location and toolbar are both false, then return true.

  6. Let menubar be the result of checking if window feature is set, given tokenizedFeatures, "menubar", and false.

  7. If menubar is false, then return true.

  8. Let resizable be the result of checking if window feature is set, given tokenizedFeatures, "resizable", and true.

  9. If resizable is false, then return true.

  10. Let scrollbars be the result of checking if window feature is set, given tokenizedFeatures, "scrollbars", and false.

  11. If scrollbars is false, then return true.

  12. Let status be the result of checking if window feature is set, given tokenizedFeatures, "status", and false.

  13. If status is false, then return true.

  14. Return false.

Replace Browser interface elements

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

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

Each interface element is represented by a BarProp object:

[Exposed=Window]
interface BarProp {
  readonly attribute boolean visible;
};
window . locationbar . visible
window . menubar . visible
window . personalbar . visible
window . scrollbars . visible
window . statusbar . visible
window . toolbar . visible

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

The visible attribute's getter must run these steps:

  1. Let browsingContext be BarProp object's relevant global object's browsing context.
  2. If browsingContext is null, then return true.
  3. Return the negation of browsingContext's top-level browsing context's is popup.

The following BarProp objects must exist for each Window object:

Technically, those attributes can share single object. If there's no web-compat issue, we can eliminate per-attribute BarProp object.

The location bar BarProp object

Historically represented the user interface element that contains a control that displays the URL of the active document, or some similar interface concept.

The menu bar BarProp object

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

Historically represented the user interface element that contains links to the user's favorite pages, or some similar interface concept.

The scrollbar BarProp object

Historically represented the user interface element that contains a scrolling mechanism, or some similar interface concept.

The status bar BarProp object

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

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 attribute must return the location bar BarProp object.

The menubar attribute must return the menu bar BarProp object.

The personalbar attribute must return the personal bar BarProp object.

The scrollbars attribute must return the scrollbar BarProp object.

The statusbar attribute must return the status bar BarProp object.

The toolbar attribute must return the toolbar BarProp object.