Hello all,

If you don't use WebExtension in your app you can stop reading.

We recently landed the replacement for registerWebExtension, called
installBuiltIn [1][2]. This will be available in GeckoView 78.

installBuiltIn has a few advantages over registerWebExtension:

- The extension will be installed, so you only need to call installBuiltIn
only once, or when the extension is updated (calling it at every startup,
however, is fine too).
- The extension will show up in about:debugging, so it can be debugged like
any ordinary third party extension
- The extension will be available at early startup, which should give a
more consistent user experience

To migrate over there are some small changes that you need to make to your
code:

- The extension needs an ID  and a version in the manifest, for example:

  "browser_specific_settings": {
    "gecko": {
        "id": "your...@your-domain.com"
    }
  },
  "version": "1.0",

- If you passed ALLOW_CONTENT_MESSAGING you now need to add
"nativeMessagingFromContent" to the manifest permissions ("nativeMessaging"
is also still required) e.g.

"permissions": [
  "geckoViewAddons",
  "nativeMessaging",
  "nativeMessagingFromContent"
]

- If you allow third party extensions and have a UI to display the list of
installed extensions you might want to hide built in extensions, filtering
for extension.metaData.isBuiltIn (this last part is landing right now and
should be available in tomorrow's nightly, see [4])

As usual don't hesitate to contact me and the rest of the GeckoView team
here or on Matrix at https://chat.mozilla.org/#/room/#geckoview:mozilla.org

Happy hacking!


[1]:
https://mozilla.github.io/geckoview/javadoc/mozilla-central/org/mozilla/geckoview/WebExtensionController.html#installBuiltIn-java.lang.String-
[2]: https://bugzilla.mozilla.org/show_bug.cgi?id=1601067
[3]:
https://mozilla.github.io/geckoview/consumer/docs/web-extensions#running-extensions-in-geckoview
[4]: https://bugzilla.mozilla.org/show_bug.cgi?id=1637803
_______________________________________________
mobile-firefox-dev mailing list
mobile-firefox-dev@mozilla.org
https://mail.mozilla.org/listinfo/mobile-firefox-dev

Reply via email to