Closed Bug 1565536 Opened 5 years ago Closed 5 years ago

Ensure that new GeckoSessions are correctly marked as active ( docShellIsActive )

Categories

(GeckoView :: Extensions, defect, P3)

Unspecified
All
defect

Tracking

(firefox70 affected)

RESOLVED INVALID
Tracking Status
firefox70 --- affected

People

(Reporter: robwu, Unassigned)

References

(Blocks 2 open bugs)

Details

When I call window.open from a mochitest, the opened page appears to be visible in the foreground, yet its browser.docShellIsActive is false. Consequently, extensions are unable to identify the active tab in mochitests in GeckoView (as they rely on it, in ext-utils.js via tab.getActive.

This unexpected behavior is not limited to TestRunnerActivity (which is used by mochitest). When I call window.open from a webpage in geckoview_example, then the urlbar is updated, but the content is not, and browser.docShellIsActive is also false.

Currently GeckoView’s setSession seems responsible for marking a session as active, via the "GeckoView:SetActive" message, which ends up setting docShellIsActive.

My interest in this originates from the the attempt to support the active property in the tabs API, but as the last link above shows, there is more to the "GeckoView:SetActive" message than just setting the docShellIsActive flag.

If we are mainly interested in docShellIsActive, then setting it when necessary would work (rpl suggested that we may be able to set it at the end of startup in geckoview.js).
If the only concern is the "active" flag of the tabs API, then there are also other hacks, such as noticing that a tab is currently only active iff its window equals Services.wm.getMostRecentBrowserWindow() (relying on this looks like a hack though).

Priority: -- → P3
Blocks: 1543755
See Also: → 1581661
Blocks: 1507167

Those tests are currently disabled because tabs.active is not implemented:
https://searchfox.org/mozilla-central/rev/7ed8e2d3d1d7a1464ba42763a33fd2e60efcaedc/mobile/android/components/extensions/test/mochitest/mochitest.ini#23,33,38,40

The immediate cause for the test timeouts is that the implementation throws when BrowserApp.selectTab is called: https://searchfox.org/mozilla-central/rev/7ed8e2d3d1d7a1464ba42763a33fd2e60efcaedc/mobile/android/components/extensions/ext-tabs.js#416
(for the stack trace, see https://bugzilla.mozilla.org/show_bug.cgi?id=1507167#c4)

The BrowserApp.selectTab call must be replaced, but that depends on the ability to change and query active tabs, which is the subject of this bug.

Mass moving bugs to the Extension component.

Component: General → Extensions
See Also: → 1616625

We decoupled docShellIsActive and the active property of the WebExtension API in Bug 1597793 so this bug should not be relevant anymore as apps have full control on whatever tab is the current active tab (including the test runner which sets it here: https://searchfox.org/mozilla-central/rev/c1e3d3edd4a9b784971555dc74a5de23d768b2e1/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/TestRunnerActivity.java#266

Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → INVALID
Blocks: 1824796
You need to log in before you can comment on or make changes to this bug.