Closed Bug 1855028 Opened 2 years ago Closed 2 months ago

Implement "browser.setClientWindowState" command

Categories

(Remote Protocol :: WebDriver BiDi, task, P3)

task
Points:
2

Tracking

(firefox151 fixed)

RESOLVED FIXED
151 Branch
Tracking Status
firefox151 --- fixed

People

(Reporter: whimboo, Assigned: whimboo)

References

(Blocks 4 open bugs, )

Details

(Whiteboard: [webdriver:m20], [wptsync upstream][webdriver:relnote])

Attachments

(3 files, 4 obsolete files)

No description provided.
Whiteboard: [webdriver:m9]

The WebDriver BiDi spec is not done yet. As such we cannot implement it for M9. Lets push onto the backlog for now.

Whiteboard: [webdriver:m9] → [webdriver:backlog]

I accidentally took over the points when cloning the former bug. We need to discuss the complexity.

Points: 8 → ---
Whiteboard: [webdriver:backlog] → [webdriver:10]
Whiteboard: [webdriver:10] → [webdriver:11]
Whiteboard: [webdriver:11] → [webdriver:m11]
Points: --- → 5
Whiteboard: [webdriver:m11] → [webdriver:backlog]
Summary: Implement "browser.setWindowBounds" command → Implement "browser.setClientWindowState" command
Whiteboard: [webdriver:backlog] → [webdriver:m13]

I know this is in not is not directly blocking implementing browser.getClientWindows, but shouldn't implementing this come first? browser.getClientWindows needs the getClientWindowState.

(In reply to Dan from comment #3)

I know this is in not is not directly blocking implementing browser.getClientWindows, but shouldn't implementing this come first? browser.getClientWindows needs the getClientWindowState.

Okay, I looked at the dependency graph again, and this issue is dependent on browser.getClientWindows. browser.getClientWindows does need to return the current state of the client window as part of its return object. So I am not sure if setting it should come first.

Whiteboard: [webdriver:m13] → [webdriver:m14]
Whiteboard: [webdriver:m14] → [webdriver:m15]
Assignee: nobody → temidayoazeez032
Status: NEW → ASSIGNED
Attachment #9445471 - Attachment description: Bug 1855028 - [wdspec] Implement "browser.setClientWindowState" command tests.?whimboo → Bug 1855028 - [wdspec] Implement "browser.setClientWindowState" command tests.r?whimboo
Attachment #9445471 - Attachment description: Bug 1855028 - [wdspec] Implement "browser.setClientWindowState" command tests.r?whimboo → Bug 1855028 - [wdspec] Implement "browser.setClientWindowState" command tests. r?whimboo
Points: 5 → ---
Whiteboard: [webdriver:m15] → [webdriver:m15][webdriver:external]

Comment on attachment 9445393 [details]
Bug 1855028 - Migrated GeckoDriver window methods to Window Manager. r?whimboo

Revision D233020 was moved to bug 1942849. Setting attachment 9445393 [details] to obsolete.

Attachment #9445393 - Attachment is obsolete: true
Depends on: 1942849
Whiteboard: [webdriver:m15][webdriver:external] → [webdriver:m16][webdriver:external]
Attachment #9488492 - Attachment is obsolete: true

No update for > 1 month, maybe should be moved to backlog for now.

Whiteboard: [webdriver:m16][webdriver:external] → [webdriver:m17][webdriver:external]

Sorry that is my fault. I didn't notice that the revision, that we are waiting for, was updated. I'll do the review.

Attachment #9444655 - Attachment description: Bug 1855028 - Implement "browser.setClientWindowState" command. r?whimboo → Bug 1855028 - [webdriver-bidi] Implement "browser.setClientWindowState" command.
Attachment #9445471 - Attachment description: Bug 1855028 - [wdspec] Implement "browser.setClientWindowState" command tests. r?whimboo → Bug 1855028 - [wdspec] Implement "browser.setClientWindowState" command tests.

I pushed a try build with the latest modifications but I still see quite a number of test failures across platforms:
https://treeherder.mozilla.org/jobs?repo=try&revision=84b8c7f0343094540cbd5aa7b45abcc1d69411ef

Here some things to ensure:

  1. We need metadata files for Android given that all these tests cannot be run and need to be disabled for that platform
  2. Transitions between states seem to be fragile - especially minimized to fullscreen seems to fail a lot
  3. We probably want to run each test in a new window that we can close at the end of the test to not affect the following tests
  4. We need special handling of assertions for Wayland given that we cannot move the window

Dan, are you still interested to continue working on this bug? I'll make sure to more promptly reply, and in case I miss something you can always ping me on Matrix. Please let us know. Thanks.

Flags: needinfo?(temidayoazeez032)

Hi Henrik. Yes, I am still interested in working on the bug.

Flags: needinfo?(temidayoazeez032)

Dan: I'm removing it from the milestone because we don't have to track contributions as milestone bugs, but this has no impact on the priority. Feel free to keep working on this and thanks again for your help on this bug!

Whiteboard: [webdriver:m17][webdriver:external] → [webdriver:backlog][webdriver:external]
Attachment #9445471 - Attachment description: Bug 1855028 - [wdspec] Implement "browser.setClientWindowState" command tests. → Bug 1855028 - [wdspec] Implement "browser.setClientWindowState" command tests. r?whimboo

Hi Dan, I want to check if you may have an update for us regarding this implementation. If you don't have the time please give us a note and someone can take over the remaining work. Thanks!

Flags: needinfo?(temidayoazeez032)

Hi Dan. I assume that you may not find the time to update this patch. Are you ok when one of us is taking over the remaining work? Thanks for the contribution so far!

Dan, I think that we can pick-up the remaining work to finally get this API landed. For that work we expect 3 points and we could do it in the next milestone starting in October.

Points: --- → 2
Priority: P2 → P3
Whiteboard: [webdriver:backlog][webdriver:external] → [webdriver:m18][webdriver:external]
Assignee: temidayoazeez032 → nobody
Status: ASSIGNED → NEW
Flags: needinfo?(temidayoazeez032)

Liam will take a look at finishing up the patches. Thanks!

Assignee: nobody → ldebeasi
Mentor: hskupin
Status: NEW → ASSIGNED

Hey there,

I'm working on getting the tests for this passing. I'm using the work from the previous contributor as a starting point since that has already received reviews from you. Can you clarify the intent behind the stress.py tests? I'd like to better understand what part of the implementation this is testing.

Flags: needinfo?(hskupin)

Great and that's a good starting point!

Regarding the stress tests.... in the past we had issues with the stability of the window resizing methods and especially when you change between different modes and sizes side effects were shown. As such we are trying to stress-test Firefox to see that the way how we implemented the related API works as expected. The tests were already present for the WebDriver classic tests and were just ported over.

Flags: needinfo?(hskupin)
Points: 2 → ---
Depends on: 2002949
Whiteboard: [webdriver:m18][webdriver:external] → [webdriver:m19][webdriver:external]
Attachment #9525224 - Attachment description: Bug 1855028 - Implement browser.setClientWindowState command r=whimboo → Bug 1855028 - [webdriver-bidi] Add the "browser.setClientWindowState" command.

We cannot directly transition from the minimized to the fullscreen state and need to restore the window first if minimized. There is https://github.com/w3c/webdriver-bidi/issues/1035 on file for it.

I've created https://github.com/w3c/webdriver-bidi/pull/1063 to fix the transition issue.

Attachment #9445471 - Attachment is obsolete: true
Attachment #9444655 - Attachment is obsolete: true

As discussed with Liam I'm going to fix the remaining issue so that we can get this API landed soon. For the remaining work we agreed on 2 points.

Assignee: ldebeasi → hskupin
Mentor: hskupin
Points: --- → 2
Whiteboard: [webdriver:m19][webdriver:external] → [webdriver:m19]
Depends on: 2011471

I just noticed that the WebDriver tests need to be updated so that we use Javascript to get the actual window state. Right now we only rely on the values as returned by the command, which doesn't mean it's true.

(In reply to Henrik Skupin [:whimboo][⌚️UTC+1] from comment #26)

I just noticed that the WebDriver tests need to be updated so that we use Javascript to get the actual window state. Right now we only rely on the values as returned by the command, which doesn't mean it's true.

Actually there’s no way to retrieve the actual OS-level window state via a web API, so we can’t add those checks; at least not in the public tests. However, I can add Mozilla-specific tests that obtain the window state via chrome JS.

Otherwise I noticed a discrepancy in the current BiDi spec between OS-level fullscreen and document fullscreen. Right now, BiDi is using document fullscreen, which is not equivalent to the OS-level fullscreen window state. Since this command is intended to modify the OS-level window state, I’m not sure why the document fullscreen API was chosen. It seems like this should be changed.

Lets get this discussed in our next triage meeting.

Whiteboard: [webdriver:m19] → [webdriver:m19][webdriver:triage]

As discussed in the meeting today there is not a clear concept of a OS-level window between different operating systems and browsers. So it should be fine to use window.fullScreen = true to activate the fullscreen mode, a``nd win.fullScreen = false to restore the normal state.

If we get any complain that something is not working as expected we can see in how we can update the specification.

Whiteboard: [webdriver:m19][webdriver:triage] → [webdriver:m19]
Blocks: 2022342
Blocks: 2022451
Attachment #9525225 - Attachment description: Bug 1855028 - [wdspec] Implement browser.setClientWindowState command tests r=whimboo → Bug 1855028 - [wdspec] Add initial tests for the "browser.setClientWindowState" command.

I can actually see issues on Wayland with the newly added minimization tests. Under that config a request for window.minimize() I can see that the window gets minimized but the window state stays at the former window state. Also waiting for a sizemodechange event doesn't seem to be successful and we timeout after 5s.

Martin, are you aware of issues with minimizing a window on Wayland? Do you have an idea why no sizemodechange event is emitted? If that's expected we might not have to wait for it, but then the window state should be correct.

Flags: needinfo?(stransky)

Hello Henrik, Wayland client generally can't manage its state for security reasons - for instance hide itself and run on background. So there's perhaps a bug in event processing or so but we can't expect client itself can control its state (window position & so). AFAIK only exception is fullscreen state which can be set by application itself.

Flags: needinfo?(stransky)

(In reply to Martin Stránský [:stransky] (ni? me) from comment #31)

Hello Henrik, Wayland client generally can't manage its state for security reasons - for instance hide itself and run on background. So there's perhaps a bug in event processing or so but we can't expect client itself can control its state (window position & so). AFAIK only exception is fullscreen state which can be set by application itself.

Hm, but when I run the tests locally with Wayland enabled I can see that the window is hidden. If it's not allowed I would expect that this is a no-op. Also there is bug 1923833 which doesn't let us restore the window from minimize. Given all that I wonder if we should not allow a window to get minimized when Firefox is run in headful mode with Wayland active. The command may return an unsupported error.

Flags: needinfo?(stransky)
Depends on: 2023978

(In reply to Henrik Skupin [:whimboo][⌚️UTC+1] from comment #32)

Hm, but when I run the tests locally with Wayland enabled I can see that the window is hidden.

Yes, the outcome may differ on actual environment - but it's not guaranteed.

Flags: needinfo?(stransky)
Whiteboard: [webdriver:m19] → [webdriver:m20]
Pushed by hskupin@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/b3a1c8dde023 https://hg.mozilla.org/integration/autoland/rev/0a7afdef5078 [webdriver-bidi] Add the "browser.setClientWindowState" command. r=Sasha https://github.com/mozilla-firefox/firefox/commit/2fa364b2e057 https://hg.mozilla.org/integration/autoland/rev/e17bbefb75d9 [wdspec] Set initial window position to (200,100) to account for possible OS docks and menus. r=Sasha https://github.com/mozilla-firefox/firefox/commit/05faf9fa7d8d https://hg.mozilla.org/integration/autoland/rev/8e5815c0aa24 [wdspec] Add initial tests for the "browser.setClientWindowState" command. r=Sasha
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/58882 for changes under testing/web-platform/tests
Whiteboard: [webdriver:m20] → [webdriver:m20], [wptsync upstream]
Pushed by asilaghi@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/edb7554b8d64 https://hg.mozilla.org/integration/autoland/rev/59e243611dcb Revert "Bug 1855028 - [wdspec] Add initial tests for the "browser.setClientWindowState" command. r=Sasha" for causing wd failures at window_rect/set.py

Backed out for causing wd failures at window_rect/set.py

Backout link
Push with failures
Failure Log
Failure line TEST-UNEXPECTED-FAIL | /webdriver/tests/classic/set_window_rect/set.py | test_partial_input[x] - AssertionError: assert 0 == 250

Flags: needinfo?(hskupin)

The problem here is:

[task 2026-03-31T18:34:13.003+00:00] 18:34:13     INFO -         # Wayland forbids programmatic window movement in headful mode.
[task 2026-03-31T18:34:13.003+00:00] 18:34:13     INFO -         if is_wayland_headful:
[task 2026-03-31T18:34:13.003+00:00] 18:34:13     INFO - >           assert value["x"] == rect.get("x", original["x"])

Given that this affects the WebDriver classic tests the changes in https://phabricator.services.mozilla.com/D287168 should have caused that. And indeed it looks like that I made a mistake when resolving the merge conflicts. The logic of the test shouldn't have touched at all and should remain as:

https://searchfox.org/firefox-main/rev/65f89c383b216d3b4f210657c9af12a32048fb67/testing/web-platform/tests/webdriver/tests/classic/set_window_rect/set.py#212-218

Flags: needinfo?(hskupin)
Pushed by hskupin@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/34a9fcf52f8a https://hg.mozilla.org/integration/autoland/rev/f0d334bd721d [webdriver-bidi] Add the "browser.setClientWindowState" command. r=Sasha https://github.com/mozilla-firefox/firefox/commit/c77bd8f68762 https://hg.mozilla.org/integration/autoland/rev/e9dae3de1d2c [wdspec] Set initial window position to (200,100) to account for possible OS docks and menus. r=Sasha https://github.com/mozilla-firefox/firefox/commit/f88febf73988 https://hg.mozilla.org/integration/autoland/rev/c7a664437631 [wdspec] Add initial tests for the "browser.setClientWindowState" command. r=Sasha
Status: ASSIGNED → RESOLVED
Closed: 2 months ago
Resolution: --- → FIXED
Target Milestone: --- → 151 Branch
Upstream PR merged by moz-wptsync-bot
Pushed by wptsync@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/5836b8265b7e https://hg.mozilla.org/integration/autoland/rev/6a0707fa2b9f [wpt PR 58882] - [Gecko Bug 1855028] [wdspec] Set initial window position to (200,100) to account for possible OS docks and menus., a=testonly
Whiteboard: [webdriver:m20], [wptsync upstream] → [webdriver:m20], [wptsync upstream][webdriver:relnote]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: