Bug 1269347 - Part2 Add support for embedded webextension in SDK test addons. r=mossop

This commit make it possible the creation of hybrid addons as part of the set of
SDK test addons.

Unfortunately these SDK test addons are build using the old cfx tool and the its
related module loader, and so this patch applies the changes needed to:

- optionally include an `hasEmbeddedWebExtension` option in the generated "install.rdf"
  (if the test addon "package.json" contains a property with the same name
  in its "package.json")

- initialize the "sdk/webextension" from the bootstrap method params
  (as already done in the previous patch for the new SDK module loader)

- include the "webextension/" dir in the generated xpi, if any (similarly
  to how it is already done for the "chrome/" dir, which an SDK addon can optionally
  contain)

MozReview-Commit-ID: 4WS5ZYkl8FY
This commit is contained in:
Luca Greco
2016-05-23 23:02:18 +02:00
parent 3bd4edb382
commit d4e3fe7590
3 changed files with 20 additions and 7 deletions

View File

@@ -133,6 +133,11 @@ def gen_manifest(template_root_dir, target_cfg, jid,
# booleans in the .json file, not strings.
manifest.set("em:unpack", "true" if target_cfg.get("unpack") else "false")
if target_cfg.get('hasEmbeddedWebExtension', False):
elem = dom.createElement("em:hasEmbeddedWebExtension");
elem.appendChild(dom.createTextNode("true"))
dom.documentElement.getElementsByTagName("Description")[0].appendChild(elem)
for translator in target_cfg.get("translators", [ ]):
elem = dom.createElement("em:translator");
elem.appendChild(dom.createTextNode(translator))