-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathbootstrap.js
More file actions
68 lines (54 loc) · 1.5 KB
/
bootstrap.js
File metadata and controls
68 lines (54 loc) · 1.5 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/**
*
* This code was inspired by
* https://github.com/Mardak/restartless/blob/examples/registerService/bootstrap.js
*
* All credits to Edward Lee
*
*/
"use strict";
const {interfaces: Ci, manager: Cm, results: Cr, utils: Cu} = Components;
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
// about:me constants
const aboutMeContract = "@mozilla.org/network/protocol/about;1?what=me";
const aboutMeDescription = "About Me";
const aboutMeUUID = Components.ID("5cc26918-9daa-4124-a742-29a1dba85fbd");
// about:me factory
let aboutMeFactory =
{
createInstance: function(outer, iid)
{
if (outer != null)
throw Cr.NS_ERROR_NO_AGGREGATION;
return aboutMe.QueryInterface(iid);
}
};
// about:me
let aboutMe =
{
QueryInterface: XPCOMUtils.generateQI([Ci.nsIAboutModule]),
getURIFlags: function(aURI)
{
return Ci.nsIAboutModule.ALLOW_SCRIPT;
},
newChannel: function(aURI)
{
if (aURI.spec != "about:me")
return;
let uri = Services.io.newURI("chrome://aboutme/content/aboutMe.xhtml", null, null);
return Services.io.newChannelFromURI(uri);
}
};
function startup(data, reason)
{
Cm.QueryInterface(Ci.nsIComponentRegistrar).
registerFactory(aboutMeUUID, aboutMeDescription, aboutMeContract, aboutMeFactory);
}
function shutdown(data, reason)
{
Cm.QueryInterface(Ci.nsIComponentRegistrar).
unregisterFactory(aboutMeUUID, aboutMeFactory);
}
function install(data, reason) {}
function uninstall(data, reason) {}