(In reply to Henrik Skupin (:whimboo) [⌚️UTC+2] from comment #6)
There is one behavior of GeckoView based applications which isn't clear to me yet. What should happen when
window.open() gets called? Is a new tab opened or a new window. Or does it even depend on the vehicle itself how it handles that?
I think it must depend on the vehicle itself. I'm free-handing this, but the mental model I'm using is by comparison with an Android WebView. For a browser-like vehicle,
window.open() should do what browsers do on Android, which is generally open a new tab (with
window.opener set, etc). But for, say, browsing inside the Facebook App, there's no concept of tabs, so I don't know what happens. Maybe the current
window.location is replaced (so we load in the same WebView)? Maybe the function is just ignored? That depends on the vehicle, but what is clear is that WebView has a callback interface for the consumer to say what they want; see, for example this discussion (which itself links to API docs). GeckoView must (or already does) provide some version of that callback interface API.
If it is the latter what is the best way to wait for the new window/tab to have been opened? What kind of event or observer could be used here? Or would we have to poll a specific state?
My expectation is that we can have GeckoView's callback interface API include enough richness that Marionette (and other automation-y things) can discover that the
window.open has been processed and either a new window has been opened (or a new tab?), or the request has been denied. Here I really am free-handing, 'cuz I don't know what GeckoView mechanisms there are for this. I really hope we can avoid polling!
What is it that Marionette actually needs to know about the
window.open? Is the goal for Marionette to be able to open tabs/windows to implement the Web Driver API (or equivalent)? Or does Marionette need to know when arbitrary content does such opening, so that it can instrument the opened Web Contexts in some way?
Looking at #c0, the answer must be "don't use
tabBrowser" 'cuz that's Fennec-specific. But that doesn't actually help you :(