Closed Bug 1661495 Opened 4 years ago Closed 4 years ago

Broken tracking of current browsing context after opening new windows

Categories

(Remote Protocol :: Marionette, defect, P1)

Firefox 81
defect

Tracking

(Fission Milestone:M6c, firefox-esr68 unaffected, firefox-esr78 unaffected, firefox80 wontfix, firefox81+ fixed, firefox82+ fixed)

RESOLVED FIXED
82 Branch
Fission Milestone M6c
Tracking Status
firefox-esr68 --- unaffected
firefox-esr78 --- unaffected
firefox80 --- wontfix
firefox81 + fixed
firefox82 + fixed

People

(Reporter: whimboo, Assigned: whimboo)

References

(Regression, )

Details

(Keywords: regression, Whiteboard: [marionette-fission-mvp], [wptsync upstream])

Attachments

(7 files)

47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review

[Tracking Requested - why for this release]:
As discovered while working on bug 1493108 and later by users on Github we have a major regression in Marionette. Several commands operate on a different window than the expected one and as such cause invalid data to be returned. The patch from bug 1654628 as landed cannot be backed out given that a certain amount of other dependent patches already landed. So this needs to block the 81 release.

Here a try push for the required changes:

https://treeherder.mozilla.org/#/jobs?repo=try&revision=07f34218f3ecfbb2a3316f558e8eef0d85c3a747

Alex and Titus, could you both please check if the following build from the try push fixes the problem for you?

https://firefox-ci-tc.services.mozilla.com/api/queue/v1/task/NgogFoBUS9qDfTRYV5p9oQ/runs/0/artifacts/public/build/target.tar.bz2

Thanks!

Flags: needinfo?(titus.fortner)
Flags: needinfo?(alexeiatyahoodotcom+mzllbgzll)

It should be possible to get the browsing context not only for the
currently selected context (chrome vs. content), but also for a
specific one.

If a window does no longer exist the associated browsing context
will no longer be valid and set to null.

Depends on D88439

With the changes on bug 1654628 we do not completely track the current
browsing contexts, but loose the reference when windows are closed.
With this patch the appropriate browsing contexts will be correctly
reset.

Also the commands for switching frames are operating on content
windows and as such are not allowed to update the currently
selected chrome browsing context.

Depends on D88440

Looks good to me so far! Thank you!

Flags: needinfo?(alexeiatyahoodotcom+mzllbgzll)
Fission Milestone: --- → M6c

GeckoView allows only a single tab. But that shouldn't prevent the
code to make use of switchToTab() as long as the target tab is
the currently selected one.

Also reftests currently override window.gBrowser which leads to a
wrong detection of Firefox instead of GeckoView. Checking for
Android first will workaround the problem for now.

Depends on D88440

Blocks: 1559120

Thanks for testing Alexei. Good to hear that it's also fixed for you.

The problem with GeckoView was that the reftest code always sets window.gBrowser and that leads to a wrong detection of the tabBrowser in Marionette.

The newly uploaded revision fixes that. Here a new try build:
https://treeherder.mozilla.org/#/jobs?repo=try&revision=1b143c986e27fd67bc6db265d863c8bcd32de50e

Whiteboard: [marionette-fission-mvp]
Pushed by hskupin@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/b7ca12380fdd
[marionette] Add context argument to getBrowsingContext. r=marionette-reviewers,maja_zf
https://hg.mozilla.org/integration/autoland/rev/d0d932e73944
[marionette] Account for a non-existent browsing context in getBrowsingContext. r=marionette-reviewers,maja_zf
https://hg.mozilla.org/integration/autoland/rev/bf8d8cb0f57c
[marionette] Allow usage of switchToTab for GeckoView. r=marionette-reviewers,maja_zf
https://hg.mozilla.org/integration/autoland/rev/7d76fc9a1d41
[marionette] Improve tracking of browsing contexts. r=marionette-reviewers,maja_zf

Actually this is not fixed yet. By running the New Window command it is still broken. I will get this patched too, and actually add wdspec tests for both cases, which I formerly missed.

Status: RESOLVED → REOPENED
Resolution: FIXED → ---

There is actually a second regression but now in Firefox 80 with the landing of bug 1652932. Here we accidentally set the current content browsing context to the newly created browser while it should only be done by WebDriver:SetWindowHandle.

Since the patch on bug 1652932 landed in Firefox 80 we accidentally
update the current content browsing context. That leads to an unexpected
change of the current window handle, which is only allowed via
"WebDriver:SetWindowHandle".

Attachment #9172986 - Attachment description: Bug 1661495 - [marionette] Don't set the current content browsing context when registering a new browser. → Bug 1661495 - [marionette] Don't always set the current content browsing context when registering a new browser.

If a navigation in the current browser causes a remoteness change,
the current content browsing context needs to be updated.

Depends on D88771

Pushed by hskupin@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/46f9aa946264
[marionette] Don't always set the current content browsing context when registering a new browser. r=marionette-reviewers,maja_zf
https://hg.mozilla.org/integration/autoland/rev/c5cdfb592493
[marionette] Update content browsing context for remoteness changes. r=marionette-reviewers,maja_zf
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/25300 for changes under testing/web-platform/tests
Whiteboard: [marionette-fission-mvp] → [marionette-fission-mvp], [wptsync upstream]
Flags: needinfo?(hskupin)

Fixes a regression from bug 1661495, which missed to reset the
current content browsing context if the new chrome window isn't
a browser window.

Depends on D88827

Status: REOPENED → RESOLVED
Closed: 4 years ago4 years ago
Resolution: --- → FIXED
Pushed by hskupin@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/19c8806a5dcb
[marionette] Don't always set the current content browsing context when registering a new browser. r=marionette-reviewers,maja_zf
https://hg.mozilla.org/integration/autoland/rev/29bba6616e18
[marionette] Update content browsing context for remoteness changes. r=marionette-reviewers,maja_zf
https://hg.mozilla.org/integration/autoland/rev/c8320f7940b2
[marionette] Reset content browsing context if new chrome window is not a browser window. r=marionette-reviewers,maja_zf

Comment on attachment 9172429 [details]
Bug 1661495 - [marionette] Add context argument to getBrowsingContext.

Beta/Release Uplift Approval Request

  • User impact if declined: The code refactoring for Fission caused a regression where Marionette looses the reference to the currently selected browsing context. That means when new windows or tabs are getting opened or closed, automated tests will fail. Affected here are also 3rd-party tools like Selenium, which are heavily used by web developers to test their websites.

There is no feasible workaround available, which means that running tests against Firefox 81 will be completely broken.

  • Is this code covered by automated tests?: Yes
  • Has the fix been verified in Nightly?: No
  • Needs manual test from QE?: No
  • If yes, steps to reproduce: Given that the nightly build isn't available yet, the fix has been verified based on the CI build for the mozilla-central merge.
  • List of other uplifts needed: None
  • Risk to taking this patch: Medium
  • Why is the change risky/not risky? (and alternatives if risky): As the previously not failing tests after the refactoring have been shown the test coverage was not complete. By adding more tests now we have better confidence, but there is still a remaining chance that not all available code paths have been covered yet, but those will be less often utilized.

The original reporter has also verified that the fix is working for him.

We would like to get this fixed on beta to get further early feedback from the Selenium community so that we can ship a high quality Marionette experience.

  • String changes made/needed: no
Flags: needinfo?(hskupin)
Attachment #9172429 - Flags: approval-mozilla-beta?
Attachment #9172430 - Flags: approval-mozilla-beta?
Attachment #9172431 - Flags: approval-mozilla-beta?
Attachment #9172475 - Flags: approval-mozilla-beta?
Attachment #9172986 - Flags: approval-mozilla-beta?
Attachment #9173062 - Flags: approval-mozilla-beta?
Attachment #9173197 - Flags: approval-mozilla-beta?

At least the "Improve tracking of browsing contexts." patch has conflicts with Beta. Please rebase. Feel free to link to a Try push w/ the rebased patches like we've done in the past for big patch stacks.

Flags: needinfo?(hskupin)

Two of the patches have indeed merge conflicts, which are mostly for tests. Here a try push with the grafted patch stack on beta:

https://treeherder.mozilla.org/#/jobs?repo=try&revision=3c32b0c3bb69360180808680e8af81160b944dce

Flags: needinfo?(titus.fortner)
Flags: needinfo?(hskupin)

Ryan, finally here is the try build with the correctly grafted commits on mozilla-beta:
https://treeherder.mozilla.org/#/jobs?repo=try&revision=e2debb0d0520edb47fa9d7011b8edd5ee37d041d

Flags: needinfo?(ryanvm)

(In reply to Web Platform Test Sync Bot (Matrix: #interop:mozilla.org) from comment #15)

Created web-platform-tests PR
https://github.com/web-platform-tests/wpt/pull/25300 for changes under
testing/web-platform/tests

James, can you please check what's stopping us from getting this PR merged? Thanks.

Flags: needinfo?(james)

https://github.com/web-platform-tests/wpt/pull/25300/checks?check_run_id=1053492897 is pretty clear; the user prompt tests are unstable in gecko, presumably working once and failing on reload. If this is expected we can admin merge the PR.

Flags: needinfo?(james)

Comment on attachment 9172429 [details]
Bug 1661495 - [marionette] Add context argument to getBrowsingContext.

Approved for 81.0b6.

Flags: needinfo?(ryanvm)
Attachment #9172429 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
Attachment #9172430 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
Attachment #9172431 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
Attachment #9172475 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
Attachment #9172986 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
Attachment #9173062 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
Attachment #9173197 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
Upstream PR merged by jgraham
Product: Testing → Remote Protocol
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: