Closed Bug 1796183 Opened 2 years ago Closed 1 year ago

[meta] Add API support for event pages

Categories

(GeckoView :: Extensions, task, P2)

All
Android
task

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: amejia, Unassigned)

References

Details

(Keywords: meta, Whiteboard: [fxdroid] [foundation])

No description provided.
Blocks: 1796175
Severity: -- → N/A
Type: enhancement → task

MV3 P2

Priority: -- → P2

Rob 👋, are you aware of any specific changes to the event page APIs that we have to exposed or handled on GeckoView that are concerned to Android?

Thanks in advance!

Flags: needinfo?(rob)

While the event page implementation itself is generic and not platform-specific, there are some tasks to meet the minimum bar of compatibility.

Convert ExtensionAPI to ExtensionAPIPersistent

There are only a few remaining mobile-specific extension API implementations that need to be updated to account for the possibility of being suspended:

Here are examples of how the desktop implementations were updated (plus unit tests):

The conversion itself is trivial, so it could be a good exercise in running extension tests and making small changes there. The testing of the downloads API would be much more involved, but if you're experienced with GV development it should be feasible to mock the download internals (via DownloadDelegate; see patches from bug 1656336), either as a xpcshell test or a mochitest.

Devtools integration

about:debugging for add-ons on desktop features the state of the event page and the ability to suspend/wake up the event page. This was added in bug 1748529. Need to confirm that this works for mobile too.

Keep alive for Native messaging

In bug 1770696, logic was added to make sure that the event page does not shut down early when there is an open connection to a nativeMessaging application. While Firefox for Android does not support third-party nativeMessaging like desktop, it does offer the nativeMessaging API to allow (privileged) extensions to connect with GV/embedders. In these cases, the event page should also be kept alive.

Evaluate compatibility with non-persistent background scripts

An event page is like a background page, but non-persistent. The internals of GV (and consumers such as A-C/Fenix?) should be audited, to see if there is anything that assumes the extension to be alive forever. They should not assume that, because event pages codify that the background scripts of extensions can be terminates/resumed during the extension's lifetime, by design.

Flags: needinfo?(rob)

Thanks for all the details!

Priority: P2 → P3
Depends on: 1815310
Whiteboard: [geckoview:m112?]
Whiteboard: [geckoview:m112?]
Keywords: meta
Priority: P3 → P2
Summary: Add API support for event pages → [meta] Add API support for event pages
Whiteboard: [addons-jira]
Whiteboard: [addons-jira] → [addons-jira] [fxdroid] [foundation]
Whiteboard: [addons-jira] [fxdroid] [foundation] → [fxdroid] [foundation]
Depends on: 1822865
Depends on: 1823426
Depends on: 1823432
Depends on: 1823436

Android-specific work has mostly been completed ( https://bugzilla.mozilla.org/show_bug.cgi?id=1823436#c1 ).

There are still improvements to event pages that we can make, but that is an effort shared with the desktop implementation (bug 1748522).

Status: NEW → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.