Open Bug 1795266 Opened 2 years ago Updated 9 months ago

Allow to set the position/index of new tabs in GeckoViewTabUtil.createNewTab

Categories

(GeckoView :: General, task, P3)

All
Android
task

Tracking

(Not tracked)

People

(Reporter: jdescottes, Unassigned)

References

(Depends on 1 open bug)

Details

For automation tooling we rely on GeckoViewTabUtil.createNewTab in order to create new tabs on GeckoView.

For WebDriver BiDi we allow users to specify a "reference" context when they create a new tab. When specified, we should open the new tab in the same window as reference one, and if there is any ordering supported by the browser, it should also be added right after the reference tab.

For Firefox Desktop, we handle this by passing an "index" parameter to addTab. Would it be possible to add something similar to GeckoView's createNewTab?

Hi Olivia, do you think that such a feature would be possible for GeckoView?

Flags: needinfo?(ohall)

Hi! I think we might be able to do something similar that could be a workaround.

(In reply to Julian Descottes [:jdescottes] from comment #0)

When specified, we should open the new tab in the same window as reference one,

In GeckoView the tab/window pattern is one tab per window. So, it always opens a new window for a new tab. (We've recently talked about looking at this design pattern again and what it would take to change it, but it seems to be deeply embedded in the GV design.)

A workaround might be using the same GeckoSessionSettings as the "reference" context when we make the new window/tab. Would that capture enough of the browser context for this purpose?

If we did the workaround to use the same settings as the "reference" context session, I think we would need a way to guarantee how the new session for the window/tab is made. GeckoViewTabUtil.createNewTab calls onOpenWindow (which GV embedders implement), and that does not guarantee what session settings are used.

and if there is any ordering supported by the browser, it should also be added right after the reference tab.

From what I could tell, it is the GeckoView embedder that keeps track of windows/tabs/sessions. In bug 1583281, which seems similar, it mentions adding a delegate that would keep track of GeckoSessions. I get the impression we could maybe do something like that to have a session pseudo-order that is like a tab/window order, which could have an index? My understanding is that GV embedders handle tab (window) ordering internally to the app though - not 100% sure.

I'll bring this up in the next triage to see if I can find more information on tab handling too.

Flags: needinfo?(ohall)
Severity: -- → N/A
Type: enhancement → task
Priority: -- → P3

With bug 1825910 and specifically this changeset the GeckoViewTabUtil.createNewTab will get a new options argument similar to desktop. Once landed it should be easier to add support for index.

Depends on: 1825910
You need to log in before you can comment on or make changes to this bug.