!import
closeWindow
1 function closeWindow(aClose, aPromptFunction)
2 {
3 var windowCount = 0;
4 var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
5 .getService(Components.interfaces.nsIWindowMediator);
6 var e = wm.getEnumerator(null);
7
8 while (e.hasMoreElements()) {
9 var w = e.getNext();
10 if (++windowCount == 2)
11 break;
12 }
13
14 //@line 21 "/home/visbrero/mnt/roisin/rev_control/hg/mozilla/toolkit/content/globalOverlay.js"
15 if (typeof(aPromptFunction) == "function" && !aPromptFunction())
16 return false;
17
18 if (aClose)
19 window.close();
20
21 return true;
22 }
23
canQuitApplication
Called: ChromeWindow:createInstance (1 calls, 42 v-uS)
ChromeWindow:getService (1 calls, 22 v-uS)
ChromeWindow:notifyObservers (1 calls, 413 v-uS)
Called By: globalOverlay.js:goQuitApplication (1 calls, 698 v-uS)
24 function canQuitApplication()
25 {
26 var os = Components.classes["@mozilla.org/observer-service;1"]
27 .getService(Components.interfaces.nsIObserverService);
28 if (!os) return true;
29
30 try {
31 var cancelQuit = Components.classes["@mozilla.org/supports-PRBool;1"]
32 .createInstance(Components.interfaces.nsISupportsPRBool);
33 os.notifyObservers(cancelQuit, "quit-application-requested", null);
34
35 // Something aborted the quit process.
36 if (cancelQuit.data)
37 return false;
38 }
39 catch (ex) { }
40 return true;
41 }
42
goQuitApplication
Called: ChromeWindow:getService (1 calls, 762 v-uS)
ChromeWindow:quit (1 calls, 148 v-uS)
globalOverlay.js:canQuitApplication (1 calls, 698 v-uS)
Called By: bloatTestOverlay.js:handleMailState (1 calls, 1756 v-uS)
43 function goQuitApplication()
44 {
45 if (!canQuitApplication())
46 return false;
47
48 var appStartup = Components.classes['@mozilla.org/toolkit/app-startup;1'].
49 getService(Components.interfaces.nsIAppStartup);
50
51 appStartup.quit(Components.interfaces.nsIAppStartup.eAttemptQuit);
52 return true;
53 }
54
55 //
56 // Command Updater functions
57 //
goUpdateCommand
Called: ChromeWindow:getControllerForCommand (267 calls, 13298 v-uS)
globalOverlay.js:goSetCommandEnabled (267 calls, 23770 v-uS)
ChromeWindow:isCommandEnabled (85 calls, 16854 v-uS)
Called By: ComposerCommands.js:goUpdateComposerMenuItems (114 calls, 18752 v-uS)
MsgComposeCommands.js:updateComposeItems (63 calls, 27731 v-uS)
utilityOverlay.js:goUpdateGlobalEditMenuItems (56 calls, 10010 v-uS)
mailWindowOverlay.js:goUpdateMailMenuItems (14 calls, 4854 v-uS)
addressbook.js:CommandUpdate_AddressBook (9 calls, 2291 v-uS)
utilityOverlay.js:goUpdateUndoEditMenuItems (6 calls, 863 v-uS)
utilityOverlay.js:goUpdateSelectEditMenuItems (4 calls, 1092 v-uS)
abCommon.js:DirPaneSelectionChange (1 calls, 128 v-uS)
58 function goUpdateCommand(aCommand)
59 {
60 try {
61 var controller = top.document.commandDispatcher
62 .getControllerForCommand(aCommand);
63
64 var enabled = false;
65 if (controller)
66 enabled = controller.isCommandEnabled(aCommand);
67
68 goSetCommandEnabled(aCommand, enabled);
69 }
70 catch (e) {
71 dump("An error occurred updating the " + aCommand + " command\n");
72 }
73 }
74
goDoCommand
75 function goDoCommand(aCommand)
76 {
77 try {
78 var controller = top.document.commandDispatcher
79 .getControllerForCommand(aCommand);
80 if (controller && controller.isCommandEnabled(aCommand))
81 controller.doCommand(aCommand);
82 }
83 catch (e) {
84 dump("An error occurred executing the " + aCommand + " command\n" + e + "\n");
85 }
86 }
87
88
goSetCommandEnabled
Called: ChromeWindow:getElementById (268 calls, 5125 v-uS)
ChromeWindow:setAttribute (244 calls, 9691 v-uS)
ChromeWindow:removeAttribute (24 calls, 2871 v-uS)
Called By: globalOverlay.js:goUpdateCommand (267 calls, 23770 v-uS)
MsgComposeCommands.js:MessageComposeOfflineStateChanged (1 calls, 77 v-uS)
89 function goSetCommandEnabled(aID, aEnabled)
90 {
91 var node = document.getElementById(aID);
92
93 if (node) {
94 if (aEnabled)
95 node.removeAttribute("disabled");
96 else
97 node.setAttribute("disabled", "true");
98 }
99 }
100
Called: ChromeWindow:getAttribute (3 calls, 43 v-uS)
ChromeWindow:getElementById (3 calls, 79 v-uS)
ChromeWindow:setAttribute (1 calls, 36 v-uS)
Called By: ChromeWindow:isCommandEnabled (2 calls, 146 v-uS)
mailWindowOverlay.js:UpdateDeleteCommand (1 calls, 162 v-uS)
101 function goSetMenuValue(aCommand, aLabelAttribute)
102 {
103 var commandNode = top.document.getElementById(aCommand);
104 if (commandNode) {
105 var label = commandNode.getAttribute(aLabelAttribute);
106 if (label)
107 commandNode.setAttribute("label", label);
108 }
109 }
110
goSetAccessKey
Called: ChromeWindow:getAttribute (1 calls, 14 v-uS)
ChromeWindow:getElementById (1 calls, 14 v-uS)
ChromeWindow:setAttribute (1 calls, 29 v-uS)
Called By: mailWindowOverlay.js:UpdateDeleteCommand (1 calls, 111 v-uS)
111 function goSetAccessKey(aCommand, aValueAttribute)
112 {
113 var commandNode = top.document.getElementById(aCommand);
114 if (commandNode) {
115 var value = commandNode.getAttribute(aValueAttribute);
116 if (value)
117 commandNode.setAttribute("accesskey", value);
118 }
119 }
120
121 // this function is used to inform all the controllers attached to a node that an event has occurred
122 // (e.g. the tree controllers need to be informed of blur events so that they can change some of the
123 // menu items back to their default values)
goOnEvent
124 function goOnEvent(aNode, aEvent)
125 {
126 var numControllers = aNode.controllers.getControllerCount();
127 var controller;
128
129 for (var controllerIndex = 0; controllerIndex < numControllers; controllerIndex++) {
130 controller = aNode.controllers.getControllerAt(controllerIndex);
131 if (controller)
132 controller.onEvent(aEvent);
133 }
134 }
135
visitLink
136 function visitLink(aEvent) {
137 var node = aEvent.target;
138 while (node.nodeType != Node.ELEMENT_NODE)
139 node = node.parentNode;
140 var url = node.getAttribute("link");
141 if (!url)
142 return;
143
144 var protocolSvc = Components.classes["@mozilla.org/uriloader/external-protocol-service;1"]
145 .getService(Components.interfaces.nsIExternalProtocolService);
146 var ioService = Components.classes["@mozilla.org/network/io-service;1"]
147 .getService(Components.interfaces.nsIIOService);
148 var uri = ioService.newURI(url, null, null);
149
150 // if the scheme is not an exposed protocol, then opening this link
151 // should be deferred to the system's external protocol handler
152 if (protocolSvc.isExposedProtocol(uri.scheme)) {
153 var win = window.top;
154 if (win instanceof Components.interfaces.nsIDOMChromeWindow) {
155 while (win.opener && !win.opener.closed)
156 win = win.opener;
157 }
158 win.open(uri.spec);
159 }
160 else
161 protocolSvc.loadUrl(uri);
162 }
163
isValidLeftClick
164 function isValidLeftClick(aEvent, aName)
165 {
166 return (aEvent.button == 0 && aEvent.originalTarget.localName == aName);
167 }
168
setTooltipText
169 function setTooltipText(aID, aTooltipText)
170 {
171 var element = document.getElementById(aID);
172 if (element)
173 element.setAttribute("tooltiptext", aTooltipText);
174 }
175
FillInTooltip
176 function FillInTooltip ( tipElement )
177 {
178 var retVal = false;
179 var textNode = document.getElementById("TOOLTIP-tooltipText");
180 if (textNode) {
181 while (textNode.hasChildNodes())
182 textNode.removeChild(textNode.firstChild);
183 var tipText = tipElement.getAttribute("tooltiptext");
184 if (tipText) {
185 var node = document.createTextNode(tipText);
186 textNode.appendChild(node);
187 retVal = true;
188 }
189 }
190 return retVal;
191 }
192
anon:193:30
193 __defineGetter__("NS_ASSERT", function() {
194 delete this.NS_ASSERT;
195 var tmpScope = {};
196 Components.utils.import("resource://gre/modules/debug.js", tmpScope);
197 return this.NS_ASSERT = tmpScope.NS_ASSERT;
198 });