-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
executable file
·28 lines (24 loc) · 908 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
//let { window: {navigator} } = require('sdk/addon/window');
var data = require("sdk/self").data;
var sp = require("sdk/simple-prefs");
var a = sp.prefs['whitelist'].split(",");
var whitelist = new Array();
for (var k in a) {
var v = a[k].trim();
if (v)
whitelist.push(v);
v = null;
}
a = null;
//commented because the script doesn't seem to work properly and out of memory error
// occurs when cloning a plugin object (but as long as plugins is empty everything's fine)
//var cs = data.load("script.js");
//cs = cs.replace("$$WHITELIST_EXTENSIONS$$", sp.prefs['whitelistExtensions']);
var cs = 'Object.defineProperty(unsafeWindow.navigator, "plugins", {value: cloneInto({length:0}, unsafeWindow.navigator)});';
require('sdk/page-mod').PageMod({
include: /.*/,
exclude: [/^about:.*$/].concat(whitelist),
contentScriptWhen: "start",
attachTo: ['existing', 'top', 'frame'],
contentScript: cs
});