UNPKG

1.38 kBJavaScriptView Raw
1/* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
3 * You can obtain one at http://mozilla.org/MPL/2.0/.
4 */
5var domains = ["simplewebrtc.com"];
6var addon_domains = []; // list of domains the addon added
7var PREF = "media.getusermedia.screensharing.allowed_domains";
8
9function startup(data, reason) {
10 if (reason === APP_STARTUP) {
11 return;
12 }
13 var prefs = Components.classes["@mozilla.org/preferences-service;1"]
14 .getService(Components.interfaces.nsIPrefBranch);
15 var values = prefs.getCharPref(PREF).split(',');
16 domains.forEach(function (domain) {
17 if (values.indexOf(domain) === -1) {
18 values.push(domain);
19 addon_domains.push(domain);
20 }
21 });
22 prefs.setCharPref(PREF, values.join(','));
23}
24
25function shutdown(data, reason) {
26 if (reason === APP_SHUTDOWN) {
27 return;
28 }
29
30 var prefs = Components.classes["@mozilla.org/preferences-service;1"]
31 .getService(Components.interfaces.nsIPrefBranch);
32 var values = prefs.getCharPref(PREF).split(',');
33 values = values.filter(function (value) {
34 return addon_domains.indexOf(value) === -1;
35 });
36 prefs.setCharPref(PREF, values.join(','));
37}
38
39function install(data, reason) {}
40
41function uninstall(data, reason) {}