-
Notifications
You must be signed in to change notification settings - Fork 0
/
bootstrap.js
39 lines (35 loc) · 938 Bytes
/
bootstrap.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
29
30
31
32
33
34
35
36
37
38
39
const { utils: Cu } = Components;
function startup(data, reason) {
load("chrome://browseridp/content/options.js");
Options.startup(data);
load("chrome://browseridp/content/interceptor.js");
Interceptor.startup(data);
}
function shutdown(data, reason) {
Options.shutdown(data);
Interceptor.shutdown(data);
// unload imported scripts
if ("_urls" in load) {
Object.keys(load._urls).forEach(function(key) {
if (!/^:/.test(key)) {
return;
}
Cu.unload(key.substr(1));
});
}
}
// These are unused, but shuts up warnings
function install() {}
function uninstall() {}
// Sub-script loading helper
function load(aURL) {
if (!("_urls" in load)) {
load._urls = {};
}
var urlKey = ":" + aURL;
if (load._urls.hasOwnProperty(urlKey)) {
Cu.unload(aURL);
}
Cu.import(aURL);
load._urls[urlKey] = true;
}