Bug 223751 - Standardize the condition for opening popup from window.open, and BarProp values
Summary: Standardize the condition for opening popup from window.open, and BarProp values
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-03-25 10:13 PDT by Tooru Fujisawa [:arai]
Modified: 2022-08-10 14:57 PDT (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tooru Fujisawa [:arai] 2021-03-25 10:13:48 PDT
https://github.com/whatwg/html/issues/5872 is about standardizing when a popup is opened by `window.open` call.
https://github.com/whatwg/html/issues/4431 is about standardizing what value window's `BarProp` attributes (`window.locationbar.visible` etc) returns.

Draft proposal for fixing those issues in https://arai-a.github.io/window-open-features/proposal.html
I'll open spec and test PRs within a few days and post the URLs here.

The condition for opening popup in the proposal is based on the current Safari behavior, so no change is required for that part.
`BarProp` values in the proposal are different than the current Safari/WebKit behavior (they based on Chromium), so that part requires change.
Comment 2 Tooru Fujisawa [:arai] 2021-03-25 10:36:09 PDT
Spec PR: https://github.com/whatwg/html/pull/6530
test PR: https://github.com/web-platform-tests/wpt/pull/28243
Comment 3 Radar WebKit Bug Importer 2021-04-01 10:14:20 PDT
<rdar://problem/76109253>
Comment 4 Tooru Fujisawa [:arai] 2021-11-01 01:59:34 PDT
the proposal is merged into the spec.

(In reply to Tooru Fujisawa [:arai] from comment #0)
> The condition for opening popup in the proposal is based on the current
> Safari behavior, so no change is required for that part.

The proposal was modified to follow Chromium behavior,
so this part requires change.

> `BarProp` values in the proposal are different than the current
> Safari/WebKit behavior (they based on Chromium), so that part requires
> change.

This was my misunderstanding, and it's also different than current Chromium.
`BarProp` now returns whether the browsing context is opened by requesting popup or not, regardless of the actual visibility or each feature value.
anyway this part still requires change.
Comment 5 Ahmad Saleem 2022-08-10 09:32:54 PDT
WPT passes all WPT tests related BarProp:

https://wpt.fyi/results/html/browsers/the-window-object?label=master&label=experimental&aligned&view=subtest&q=barprop

Do we need to do something here? Thanks!
Comment 7 Tooru Fujisawa [:arai] 2022-08-10 14:57:57 PDT
The latest file for the test is here
https://github.com/web-platform-tests/wpt/blob/master/html/browsers/the-window-object/open-close/open-features-is-popup-condition.html

that can be visible here:
https://wpt.fyi/results/html/browsers/the-window-object?label=master&label=experimental&aligned&view=subtest&q=open-features-is-popup-condition


Given the actual UI style is browser dependent, the testcase uses the relation between the `window.open`'s features parameter and `BarProp.visible`, that represents "is popup" of browser context.

https://html.spec.whatwg.org/multipage/browsers.html#is-popup
> A top-level browsing context has an is popup boolean. It is initially false.
> 
> NOTE:
> 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.

https://html.spec.whatwg.org/multipage/window-object.html#window-open-steps
> The window open steps, given a string url, a string target, and a string
> features, are as follows:
> ...
>  4. Let tokenizedFeatures be the result of tokenizing features.
> ...
> 11. If windowType is either "new and unrestricted" or "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.

https://html.spec.whatwg.org/multipage/window-object.html#popup-window-is-requested
> To check if a 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 a window feature is set,
>      given tokenizedFeatures, "location", and false.
>   4. Let toolbar be the result of checking if a 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 a 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 a 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 a 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 a window feature is set,
>      given tokenizedFeatures, "status", and false.
>  13. If status is false, then return true.
>  14. Return false.

https://html.spec.whatwg.org/multipage/window-object.html#dom-barprop-visible
> The visible getter steps are:
>   1. Let browsingContext be this'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.