Closed Bug 1511033 Opened Last year Closed 2 months ago

Support ServiceWorkerClients.openWindow()


(GeckoView :: General, enhancement, P3)



(firefox70 wontfix, firefox71 fixed)

Tracking Status
firefox70 --- wontfix
firefox71 --- fixed


(Reporter: snorp, Assigned: estirling)



(Whiteboard: [geckoview:m1909] )


(1 file)

In Fennec this just launches Fennec with the specified URL, but this doesn't make sense under GeckoView. We'd need the app to tell us what do in such a case. Maybe something similar to the crash handler where they tell us which Service should be launched. The app can then decide from there which Activity (if any) to launch.
Priority: P5 → P3
Whiteboard: [geckoview:fenix]
Product: Firefox for Android → GeckoView

This won't be useful until we support Web Push.

Depends on: 1343678
Whiteboard: [geckoview:fenix]
Assignee: nobody → estirling

So. The way this API works in Fennec, is that an intent is fired to launch Fennec and focus the requested tab. That's not gonna work for GeckoView for obvious reasons (we are not an app). For GeckoView, we just need to add a new delegate to GeckoRuntime and let the app take care of the work. I imagine something like:

interface ServiceWorkerDelegate {
    GeckoResult<GeckoSession> onOpenWindow(String url);

class GeckoRuntime {
    setServiceWorkerDelegate(ServiceWorkerDelegate delegate);

Similar to the other "open a tab" APIs we have, the app is responsible for creating a new GeckoSession (or not) and displaying it using whatever means necessary. It can call startActivity() if it wishes, but that won't affect what we're doing -- we just need the GeckoSession. I'm not sure if we should load the requested URL ourselves or let the app do it, but I'm leaning towards the latter.

The DOM bits for this are located in ClientOpenWindowUtils.cpp[0]. There is a bunch of machinery in there to try to detect when the window is opened and then wait for the page to load. I believe we can avoid all of that for GeckoView if we handle waiting for the page to load ourselves before returning the GeckoSession to the DOM. This might be tricky, though, because the app likely set its own progress delegate, and we can only have one. We may want to add an internal GeckoResult<Boolean> waitForPageLoad() for this to GeckoSession.


(In reply to Chris Peterson [:cpeterson] from comment #1)

This won't be useful until we support Web Push.

It's more useful if we have Web Push, but this doesn't actually depend on it AFAIK.

Adds a ServiceWorkerDelegate to GeckoRuntime that allows GeckoView applications
to handle ServiceWorkerClient.openWindow() requests.

Whiteboard: [geckoview:m1909]
Pushed by
Support ServiceWorkerClients.openWindow() r=geckoview-reviewers,snorp,smaug
Closed: 2 months ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla71

firefox70=wontfix because Elliot says we don't need to uplift this openWindow fix to GV 70 Beta.

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