diff --git a/src/parsers/installrdf.js b/src/parsers/installrdf.js
index eb5569eb1a0..138dad4547c 100644
--- a/src/parsers/installrdf.js
+++ b/src/parsers/installrdf.js
@@ -20,6 +20,7 @@ export default class InstallRdfParser {
name: this._getName(),
type: this._getAddonType(),
version: this._getVersion(),
+ restartless: this._getIsBootstrapped(),
});
}
@@ -99,6 +100,11 @@ export default class InstallRdfParser {
return addonType;
}
+ _getIsBootstrapped() {
+ return this._getNodeValue(
+ this._getTopLevelNodeByTag('em:bootstrap')) === 'true';
+ }
+
_getGUID() {
// Install.rdf only.
var guid = this._getNodeValue(this._getTopLevelNodeByTag('em:id'));
diff --git a/src/parsers/manifestjson.js b/src/parsers/manifestjson.js
index abdce1e354b..3f8ed3f3990 100644
--- a/src/parsers/manifestjson.js
+++ b/src/parsers/manifestjson.js
@@ -18,6 +18,7 @@ export default class ManifestJSONParser {
name: this._getName(),
type: this._getType(),
version: this._getVersion(),
+ restartless: true, // All web extensions are restartless
});
}
diff --git a/tests/parsers/test.installrdf.js b/tests/parsers/test.installrdf.js
index 18db35032a7..f53a79dba68 100644
--- a/tests/parsers/test.installrdf.js
+++ b/tests/parsers/test.installrdf.js
@@ -228,6 +228,65 @@ describe('InstallRdfParser._getGUID()', function() {
});
+describe('InstallRdfParser._getIsBootstrapped()', () => {
+ it('should extract that the addon is restartless', () => {
+ var rdf = validRDF('true');
+ var rdfScanner = new RDFScanner(rdf, INSTALL_RDF);
+ return rdfScanner.getContents()
+ .then((xmlDoc) => {
+ var installRdfParser = new InstallRdfParser(xmlDoc);
+ return installRdfParser._getIsBootstrapped();
+ })
+ .then((bootstrap) => {
+ assert.typeOf(bootstrap, 'boolean');
+ assert.equal(bootstrap, true);
+ });
+ });
+
+ it(`should extract that the addon isn't restartless`, () => {
+ var rdf = validRDF('false');
+ var rdfScanner = new RDFScanner(rdf, INSTALL_RDF);
+ return rdfScanner.getContents()
+ .then((xmlDoc) => {
+ var installRdfParser = new InstallRdfParser(xmlDoc);
+ return installRdfParser._getIsBootstrapped();
+ })
+ .then((bootstrap) => {
+ assert.typeOf(bootstrap, 'boolean');
+ assert.equal(bootstrap, false);
+ });
+ });
+
+ it(`should extract only the top level bootstrap value`, () => {
+ var rdf = validRDF(`true
+ false`);
+ var rdfScanner = new RDFScanner(rdf, INSTALL_RDF);
+ return rdfScanner.getContents()
+ .then((xmlDoc) => {
+ var installRdfParser = new InstallRdfParser(xmlDoc);
+ return installRdfParser._getIsBootstrapped();
+ })
+ .then((bootstrap) => {
+ assert.typeOf(bootstrap, 'boolean');
+ assert.equal(bootstrap, true);
+ });
+ });
+
+ it(`should assume that an addon isn't restartless`, () => {
+ var rdf = validRDF('123');
+ var rdfScanner = new RDFScanner(rdf, INSTALL_RDF);
+ return rdfScanner.getContents()
+ .then((xmlDoc) => {
+ var installRdfParser = new InstallRdfParser(xmlDoc);
+ return installRdfParser._getIsBootstrapped();
+ })
+ .then((bootstrap) => {
+ assert.typeOf(bootstrap, 'boolean');
+ assert.equal(bootstrap, false);
+ });
+ });
+});
+
describe('InstallRdfParser._getDescriptionNode()', function() {
it('should reject on missing RDF node', () => {