Does the only option is to rewrite my add-on as bootstrapped and then embed webextension?
Generally yes, but I think it should be possible to bootstrap an SDK-style extension from XUL. The bootstrap.js
file that is automatically included in SDK-extensions does just that, doesn’t it?
bootstrap.js
:
"use strict";
const { utils: Cu } = Components;
const rootURI = __SCRIPT_URI_SPEC__.replace("bootstrap.js", "");
const COMMONJS_URI = "resource://gre/modules/commonjs";
const { require } = Cu.import(COMMONJS_URI + "/toolkit/require.js", {});
const { Bootstrap } = require(COMMONJS_URI + "/sdk/addon/bootstrap.js");
const { startup, shutdown, install, uninstall } = new Bootstrap(rootURI);
Looks pretty straight-forward. You may have to include a .xpi
with an appropriate package.json
in you (unpacked?) XUL extension.