Add API to select the tab (window) in GeckoViewTabUtil
Categories
(GeckoView :: General, task, P3)
Tracking
(Not tracked)
People
(Reporter: Sasha, Unassigned)
References
Details
For automation tooling we rely on GeckoViewTabUtil.createNewTab in order to create new tabs (windows) on GeckoView.
For WebDriver BiDi we should create a new tab (window) by default in the foreground, but have an option to open it in the background. Right now, both for Firefox Desktop and GeckoView the API we use creates the tab in the background, but on desktop we can select the newly created tab (window) if needed, which would put it in the foreground.
Would it be possible to add something similar to GeckoViewTabUtil?
Of course, the ideal solution would to have an option on GeckoViewTabUtil.createNewTab
to control the position of the tab (window), but not sure if it's possible considering that it's not an option on desktop.
Reporter | ||
Comment 1•1 year ago
|
||
Hi Olivia, do you think that it would be possible for GeckoView?
Comment 2•1 year ago
•
|
||
Hi Sasha,
Thanks for reaching out!
Right now, my understanding is that the individual GeckoView embedders (GVE, Fenix, Focus) do most of the tab aka window aka session management internally based on bug 1583281. So, GeckoView doesn't currently have a full API to track all tabs/windows/sessions that works across platforms. (We have some similar work with extensions that might be worth looking into - i.e., GeckoViewTab, MobileWindowTracker, WebExtension tab delegate - not sure if any of it is immediately useful, but it does have a form of tab tracking.)
A possible workaround could be a utility to create the new session (what GeckoViewTabUtil.createNewTab
is doing) and add a way to set the new session (window) to be visible or foregrounded at the same time, so with a param like setToForeground = true
(To switch tabs/windows back and forth or set position, we would need a full session tracking API.)
This would require some research to make sure it was set in a way that would work across GeckoView/Fenix/Focus, but it seems possible for testing purposes. It would be more like swapping out the current content for the new session's content to make it appear foregrounded.
Reporter | ||
Comment 3•1 year ago
|
||
Oh, I actually didn't think about another command, which we have to implement, which is supposed to move the tab to the foreground and focus it. So it looks like we still need a separate API to select the tab.
Comment 4•1 year ago
•
|
||
Triage: Sasha, is this something you are going to work on?
Reporter | ||
Comment 5•1 year ago
|
||
I'm working now on the updating BiDi API to create a new tab (window) in the foreground or background and on the command to select the tab (window).
Updated•1 year ago
|
Comment 6•1 year ago
|
||
Hi Sasha,
We assigned this to you during triage based on c5. I just realized you may have only meant the webdriver side and not the GV side. I think a workaround is possible for this bug, but we'd probably need to decide what the best workaround would be based on what the BiDi API expects.
Reporter | ||
Comment 7•1 year ago
|
||
(In reply to Olivia Hall [:olivia] from comment #6)
Hi Sasha,
We assigned this to you during triage based on c5. I just realized you may have only meant the webdriver side and not the GV side. I think a workaround is possible for this bug, but we'd probably need to decide what the best workaround would be based on what the BiDi API expects.
Hi Olivia,
yes, I actually meant only WebDriver side :(
In the meantime, I found out a couple of things: it looks like a tab (window) in the GeckoView is actually open in the foreground by default, which means that we need a way to open it also in the background (because we create the API which can do both). We've implemented for now a workaround, where we focus the previously focused tab (window). That also means that focusing (or selecting) actually works fine, we just needed to use the API to focus window.
Basically what you mentioned here:
A possible workaround could be a utility to create the new session (what
GeckoViewTabUtil.createNewTab
is doing) and add a way to set the new session (window) to be visible or foregrounded at the same time, so with a param likesetToForeground = true
(To switch tabs/windows back and forth or set position, we would need a full session tracking API.)
would work for us just with setToForeground = false
. Let me know what you think.
I'll remove myself from Assignee
for now.
Reporter | ||
Updated•1 year ago
|
Description
•