-
Notifications
You must be signed in to change notification settings - Fork 1
/
bootstrap.js
122 lines (105 loc) · 3.57 KB
/
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
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
/* See license.txt for terms of usage */
// ********************************************************************************************* //
// XPCOM
var {classes: Cc, interfaces: Ci, utils: Cu} = Components;
// ********************************************************************************************* //
// Constants
// Default preferences for bootstrap extensions are registered dynamically.
var defaultPrefs =
{
"DBG_FIRECLOSURE": true,
}
// ********************************************************************************************* //
// Firefox Bootstrap API
function install(data, reason) {}
function uninstall(data, reason) {}
function startup(data, reason) { firebugStartup(); }
function shutdown(data, reason) { firebugShutdown(); }
// ********************************************************************************************* //
// Firebug Bootstrap API
/**
* Executed by Firebug framework when Firebug is started. Since the order of Firebug
* and its bootstrapped extensions is not guaranteed this function is executed twice
* (of course the registration happens just once):
*
* 1) When Firebug is loaded
* 2) When this extension is loaded
*
* If Firebug is not loaded an exception happens
*/
function firebugStartup()
{
try
{
Cu.import("resource://firebug/loader.js");
FirebugLoader.registerBootstrapScope(this);
FirebugLoader.registerDefaultPrefs(defaultPrefs);
}
catch (e)
{
// If an exception happens it's probably because Firebug hasn't been
// started yet. Just ignore it.
}
}
/**
* Executed by Firefox when this extension shutdowns.
*/
function firebugShutdown()
{
try
{
Cu.import("resource://firebug/loader.js");
FirebugLoader.unregisterBootstrapScope(this);
}
catch (e)
{
Cu.reportError(e);
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
/**
* Executed by Firebug framework for every browser window. Use this function to append
* any new elements into the browser window (browser.xul). Don't forget to remove
* these elements in topWindowUnload.
*
* @param {Window} win The browser window
*/
function topWindowLoad(win)
{
// TODO: overlay global browser window
}
/**
* Executed by Firebug framework when this extension
* @param {Object} win
*/
function topWindowUnload(win)
{
// TODO: remove global browser window overlays
}
/**
* Entire Firebug UI is running inside an iframe (firebugFrame.xul). This function
* is executed by Firebug framework when the frame is loaded. This happens when
* the user requires Firebug for the first time (doesn't have to happen during the
* Firefox session at all)
*
* @param {Window} win The Firebug window
*/
function firebugFrameLoad(Firebug)
{
// Register trace listener the customizes trace logs coming from this extension.
Firebug.registerTracePrefix("FireClosure;", "DBG_FIRECLOSURE", true,
"chrome://fireclosure/skin/fireclosure.css");
// The registration process will automatically look for 'main' module and load it.
// The is the same what happens in a XUL overlay applied on:
// chrome://firebug/content/firebugOverlay.xul
var config = {id: "[email protected]"};
Firebug.registerExtension("fireclosure", config);
}
function firebugFrameUnload(Firebug)
{
if (!Firebug.isInitialized)
return;
Firebug.unregisterExtension("fireclosure");
Firebug.unregisterTracePrefix("FireClosure;");
}
// ********************************************************************************************* //