Index: templates/bootstrap.js.tmpl |
=================================================================== |
--- a/templates/bootstrap.js.tmpl |
+++ b/templates/bootstrap.js.tmpl |
@@ -22,16 +22,27 @@ function startup(params, reason) |
Services.obs.addObserver(RequireObserver, "{{metadata.get('general', 'basename')}}-require", true); |
onShutdown.add(function() |
{ |
Services.obs.removeObserver(RequireObserver, "{{metadata.get('general', 'basename')}}-require"); |
}); |
{%- set hasShutdownHandlers = True %} |
{%- endif %} |
+ {%- if hasWebExtension %} |
+ let port = params.webExtension.startup().then(({browser}) => |
+ { |
+ return new Promise((resolve, reject) => |
+ { |
+ browser.runtime.onConnect.addListener(resolve); |
+ }); |
+ }); |
+ require.scopes.webextension = {exports: port}; |
+ {%- endif %} |
+ |
require("main"); |
} |
function shutdown(params, reason) |
{ |
{%- if chromeWindows %} |
let windowNames = {{chromeWindows|json}}; |
for (let i = 0; i < windowNames.length; i++) |