Closed Bug 1877469 Opened 3 months ago Closed 2 months ago

When creating and switching tabs wait for the former tab's "document.visibilityState" value set to "hidden"

Categories

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

task
Points:
3

Tracking

(firefox125 fixed)

RESOLVED FIXED
125 Branch
Tracking Status
firefox125 --- fixed

People

(Reporter: whimboo, Assigned: whimboo)

References

(Blocks 4 open bugs)

Details

(Whiteboard: [webdriver:m10][wptsync upstream][webdriver:relnote])

Attachments

(2 files)

There is currently bug 1876604 which prevents the document.visibilityState property (for the previous tab) set to hidden immediately when a tab gets switched, opened, or the window minimized.

We should add more tests to verify the correct behavior.

Priority: -- → P2
Whiteboard: [webdriver:backlog]

With the patch on bug 1876604 we will get a new preference that can be used to control the unload behavior for switched away tabs. We have to update our code to use this preference that we want to set to 0, but also have to wait returning from the command until the tab's document.visibilityState is set to hidden.

Webdriver tests for browsingContext.activate and browsingContext.create should be created.

For improving stability I would suggest to add this to M10.

Summary: [wdspec] Improve tests to check that "document.visibilityState" gets immediately set → When switching tabs wait for the former tab's "document.visibilityState" value set to "hidden"
Assignee: nobody → hskupin
Status: NEW → ASSIGNED
Points: --- → 3
Whiteboard: [webdriver:backlog] → [webdriver:m10]
Summary: When switching tabs wait for the former tab's "document.visibilityState" value set to "hidden" → When creating and switching tabs wait for the former tab's "document.visibilityState" value set to "hidden"
Blocks: 1879279
Pushed by hskupin@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/4aa0d79f3e06
[webdriver-bidi] Await visibilitystatus change for previously selected tab when creating or switching tabs. r=webdriver-reviewers,Sasha
https://hg.mozilla.org/integration/autoland/rev/9bda3647e32c
[wdspec] Improve tests for "browsingContext.activate" and "browsingContext.create" for document status. r=webdriver-reviewers,Sasha
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/44494 for changes under testing/web-platform/tests
Whiteboard: [webdriver:m10] → [webdriver:m10], [wptsync upstream]
Upstream PR was closed without merging

When I was testing this feature on Android I was actually using fenix but missed to test with the testrunner even in CI. :/

The problem here is really with the testrunner only given that even you switch tabs the one in the background doesn't get the visibilityState="hidden" but stays visible. It works just fine for Fenix and geckoview_example. Sadly wpt uses testrunner only so we would need a solution for that package as well.

Olivia, do you think that this is something easy to add? Olli Petty mentioned to me that there was a similar issue last year with Fenix which got already fixed, but we cannot find this bug / PR where it was landed. Thanks.

Flags: needinfo?(hskupin) → needinfo?(ohall)
Blocks: 1879260
See Also: → 1678103

Hi Henrik,

I mentioned this bug to the GeckoView team and it looks like the conversation is happening on the linked bug 1678103. Could you give more details about how you tested? Maybe a few specific tests or test suits you recommend for us to run against? I'm not sure if we need a separate GeckoView bug for the wpt tests or if it is a bigger issue and a part of bug 1678103. It might be worth filing to keep the different issues clear.

We are a bit surprised that the bug could have been solved on certain layers, but not others, because it is a Gecko call and we expect this behavior to be implemented there, so we would have the same behavior across apps. We are trying to narrow down where the difference in behavior is coming from.

Flags: needinfo?(ohall)
Flags: needinfo?(hskupin)

Sure, just apply the patches from this bug and run as example any of the tests as added by D201062. But you can see on Treeherder that basically all the tests are failing that are creating a new tab or switching the tab.

Please let me know if you have issue with reproducing the underlying problem.

Flags: needinfo?(hskupin)

Thanks!

Quick refresh, and for others who might test, --package-name is the flag to change what device the test runs against?

I have ./mach wpt <path to test> --webdriver-binary <path to geckodriver binary> --package-name="org.mozilla.geckoview.test_runner" in my notes for test runner and package name can be swapped for Fenix or GVE too.

Yes, that's correct. And in case you don't have a geckodriver binary and running artifact builds switch into testing/geckodriver and run cargo build. Then the path is target/debug/geckodriver. To also get all the trace logs from Remote Agent use --webdriver-arg=-vv.

See Also: → 1880376

I filed bug 1880376 to make sure this issue doesn't get lost and also so it can be prioritized for investigation, especially where it is unclear where bug 1678103 stands.

(In reply to Olivia Hall [:olivia] from comment #13)

I filed bug 1880376 to make sure this issue doesn't get lost and also so it can be prioritized for investigation, especially where it is unclear where bug 1678103 stands.

Thanks and let me actually make it blocking this bug because I'm not able to land my changes without a fix or workaround for Android.

Depends on: 1880376
See Also: 1880376
Blocks: 1884142

I filed the follow-up bug 1884142 for Android. As such we are no longer blocked on bug 1880376.

No longer depends on: 1880376
Pushed by hskupin@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/3a8183cf7fab
[webdriver-bidi] Await visibilitystatus change for previously selected tab when creating or switching tabs. r=webdriver-reviewers,jgraham
https://hg.mozilla.org/integration/autoland/rev/e068a92055aa
[wdspec] Improve tests for "browsingContext.activate" and "browsingContext.create" for document status. r=webdriver-reviewers,Sasha
Status: ASSIGNED → RESOLVED
Closed: 2 months ago
Resolution: --- → FIXED
Target Milestone: --- → 125 Branch

Hi Sasha, it looks like the sync bot didn't recognize the wdspec changes and no PR got created. Can you please have a look? Thanks.

Flags: needinfo?(aborovova)

I've filed an upstream PR to mark the Puppeteer test as expected pass for Firefox: https://github.com/puppeteer/puppeteer/pull/12072

Upstream PR merged by moz-wptsync-bot

The bot missed posting a link for upstream, here it is: https://github.com/web-platform-tests/wpt/pull/44494

Flags: needinfo?(aborovova)
Regressions: 1807868
Whiteboard: [webdriver:m10], [wptsync upstream] → [webdriver:m10][wptsync upstream][webdriver:relnote]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: