Geoff, First, I'm moving this over to dev-addons since it is about the internals of the webextensions implementation and probably not of interest to many of the people on dev-platform. Anybody from dev-platform who is interested, feel free to follow us over to dev-addons.
The short answer is that the ExtensionPolicyService observes "document-element-inserted" and, for every document created with an extension principal (ie, for moz-extension: pages), it calls this function: https://searchfox.org/mozilla-central/rev/55da592d85c2baf8d8818010c41d9738c97013d2/toolkit/components/extensions/extension-process-script.js#275-282 If you trace the calls made from there, you'll eventually end up here, which is where the actual "browser" and "chrome" objects are created: https://searchfox.org/mozilla-central/rev/55da592d85c2baf8d8818010c41d9738c97013d2/toolkit/components/extensions/ExtensionPageChild.jsm#170-183 I've glossed over several steps, I'm happy to answer further questions on dev-addons or in #webextensions on IRC -Andrew On Tue, Aug 28, 2018 at 1:54 AM, Geoff Lankow <ge...@thunderbird.net> wrote: > > I'm trying to make WebExtensions usable on Thunderbird. My current problem > is trying to make moz-extension:// pages work in the UI. Everything happens > as expected except the page has no access to the "browser" API. > > Can somebody show me how to set things up so the API is added to new > browser elements and available when it should be? > > GL > _______________________________________________ > dev-platform mailing list > dev-platform@lists.mozilla.org > https://lists.mozilla.org/listinfo/dev-platform > _______________________________________________ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-platform