Extension does not work properly

Hello,
I deployed an extension that has been approved by the reviwers, but it does not work properly when install.
The extension should edit one config parameter (‘media.getusermedia.screensharing.allowed_domains’) during install, which is not happening,

here is the code of the index.js of my extension :

var prefService = require(‘sdk/preferences/service’);

var configToReferListOfAllowedDomains = ‘media.getusermedia.screensharing.allowed_domains’;
var configToEnableScreenCapturing = ‘media.getusermedia.screensharing.enabled’;

// replace your own domains with below array
var arrayOfMyOwnDomains = [’.inpi.fr’,‘www.formation-creation-reprise-entreprise.com’,‘formation-creation-reprise-entreprise.com’,‘www.demo-formation.com’,‘demo-formation.com’,‘www.campus26.com’, ‘campus26.com’,‘abc-learning.eu’, ‘www.abc-learning.eu’, '.tree-learning.fr’, ‘.tree-learning.eu’, '.tree-learning.com’, ‘.logipro.com’, '.crea-learning.com’, ‘.agora-learning.com’, ‘www.e-ifsi-midipy.fr’,‘e-ifsi-midipy.fr’, '.alpi40.fr’];
// Patterns to match the websites that may check whether ther add-on is installed.
// See https://developer.mozilla.org/en-US/Add-ons/SDK/Low-Level_APIs/util_match-pattern
var patternsOfMyDomains = [’.inpi.fr’,‘www.formation-creation-reprise-entreprise.com’,‘formation-creation-reprise-entreprise.com’,‘www.demo-formation.com’,‘demo-formation.com’,‘www.campus26.com’, ‘campus26.com’,‘abc-learning.eu’, ‘www.abc-learning.eu’, '.tree-learning.fr’, ‘.tree-learning.eu’, '.tree-learning.com’, ‘.logipro.com’, '.crea-learning.com’, ‘.agora-learning.com’, ‘www.e-ifsi-midipy.fr’,‘e-ifsi-midipy.fr’, '.alpi40.fr’];

// e.g. if 127.0.0.1 or localhost is already allowed by anyone else
var listOfSimilarAlreadyAllowedDomains = [];

// this flag is enabled by default since Firefox version 37 or 38.
// it maybe get removed in version 47-48. (As far as I can assume)
// i.e. screen capturing will always be allowed to list of allowed_domains.
prefService.set(configToEnableScreenCapturing, true);

function addMyOwnDomains() {
var existingDomains = prefService.get(configToReferListOfAllowedDomains).split(’,’);
arrayOfMyOwnDomains.forEach(function(domain) {
if (existingDomains.indexOf(domain) === -1) {
existingDomains.push(domain);
}
else if (existingDomains.indexOf(domain) !== -1) {
// Seems domain is already in the list.
// Keep it when this addon is uninstalled.
listOfSimilarAlreadyAllowedDomains.push(domain);
}
});
prefService.set(configToReferListOfAllowedDomains, existingDomains.join(’,’));
}
addMyOwnDomains();

this is the link of my extension if you want to test : https://addons.mozilla.org/fr/firefox/addon/logipro-capture-video-ecran/

Any help is appreciated

You are using SDK API with a WebExtension manifest.json, they won’t work together. You need a SDK package.json instead.

I’m surprised neither the amo linter nor the reviewer noticed this.

2 Likes

True the linter should catch it.

A note on the reviewer part though: They only are supposed to look at security/privacy issues. Some of the reviewers do make some extra effort to sometimes to point out bugs though.

1 Like

Thank you for your answer
I replaced manifest.json by package.json and tried to upload a new version; Here is the error I got :
No install.rdf or manifest.json found
Is this related to replacing the addons by webextension ?? Here is what I got on addons page:


"We are planning to deprecate the use by Firefox add-ons of the techniques described in this document.

Don’t use these techniques to develop new add-ons. Use WebExtensions instead…"

You need to build your addon with jpm xpi. That will create the install.rdf and bootstrap.js for yoru SDK addon. To install jpm you need to install node. Then you can install jpm. Here is a guide:

1 Like

Thank you, this works for me, the extension has been published and works properly

1 Like