2 Subject: Firefox chrome lockdown hooks |
2 Subject: Firefox chrome lockdown hooks |
3 |
3 |
4 diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js |
4 diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js |
5 --- a/browser/base/content/browser.js |
5 --- a/browser/base/content/browser.js |
6 +++ b/browser/base/content/browser.js |
6 +++ b/browser/base/content/browser.js |
7 @@ -1174,32 +1174,186 @@ function prepareForStartup() { |
7 @@ -1180,32 +1180,186 @@ function prepareForStartup() { |
8 // setup our MozApplicationManifest listener |
8 // setup our MozApplicationManifest listener |
9 gBrowser.addEventListener("MozApplicationManifest", |
9 gBrowser.addEventListener("MozApplicationManifest", |
10 OfflineApps, false); |
10 OfflineApps, false); |
11 |
11 |
12 // setup simple gestures support |
12 // setup simple gestures support |
190 UpdateUrlbarSearchSplitterState(); |
190 UpdateUrlbarSearchSplitterState(); |
191 |
191 |
192 PlacesStarButton.init(); |
192 PlacesStarButton.init(); |
193 |
193 |
194 // called when we go into full screen, even if it is |
194 // called when we go into full screen, even if it is |
195 @@ -1399,16 +1553,18 @@ function BrowserShutdown() |
195 @@ -1406,16 +1560,18 @@ function BrowserShutdown() |
196 Components.utils.reportError(ex); |
|
197 } |
196 } |
198 |
197 |
199 var os = Components.classes["@mozilla.org/observer-service;1"] |
198 var os = Components.classes["@mozilla.org/observer-service;1"] |
200 .getService(Components.interfaces.nsIObserverService); |
199 .getService(Components.interfaces.nsIObserverService); |
201 os.removeObserver(gSessionHistoryObserver, "browser:purge-session-history"); |
200 os.removeObserver(gSessionHistoryObserver, "browser:purge-session-history"); |
202 os.removeObserver(gXPInstallObserver, "xpinstall-install-blocked"); |
201 os.removeObserver(gXPInstallObserver, "xpinstall-install-blocked"); |
|
202 os.removeObserver(gMissingPluginInstaller, "plugin-crashed"); |
203 |
203 |
204 + gPrefService.removeObserver("config.lockdown.", lockdownObserver); |
204 + gPrefService.removeObserver("config.lockdown.", lockdownObserver); |
205 + |
205 + |
206 try { |
206 try { |
207 gBrowser.removeProgressListener(window.XULBrowserWindow); |
207 gBrowser.removeProgressListener(window.XULBrowserWindow); |
209 } catch (ex) { |
209 } catch (ex) { |
210 } |
210 } |
211 |
211 |
212 PlacesStarButton.uninit(); |
212 PlacesStarButton.uninit(); |
213 |
213 |
214 @@ -3208,16 +3364,23 @@ function FillHistoryMenu(aParent) { |
214 @@ -3216,16 +3372,23 @@ function FillHistoryMenu(aParent) { |
215 |
215 |
216 // Remove old entries if any |
216 // Remove old entries if any |
217 var children = aParent.childNodes; |
217 var children = aParent.childNodes; |
218 for (var i = children.length - 1; i >= 0; --i) { |
218 for (var i = children.length - 1; i >= 0; --i) { |
219 if (children[i].hasAttribute("index")) |
219 if (children[i].hasAttribute("index")) |
233 var count = sessionHistory.count; |
233 var count = sessionHistory.count; |
234 if (count <= 1) // don't display the popup for a single item |
234 if (count <= 1) // don't display the popup for a single item |
235 return false; |
235 return false; |
236 |
236 |
237 const MAX_HISTORY_MENU_ITEMS = 15; |
237 const MAX_HISTORY_MENU_ITEMS = 15; |
238 @@ -3357,16 +3520,17 @@ function BrowserCustomizeToolbar() |
238 @@ -3365,16 +3528,17 @@ function BrowserCustomizeToolbar() |
239 { |
239 { |
240 // Disable the toolbar context menu items |
240 // Disable the toolbar context menu items |
241 var menubar = document.getElementById("main-menubar"); |
241 var menubar = document.getElementById("main-menubar"); |
242 for (var i = 0; i < menubar.childNodes.length; ++i) |
242 for (var i = 0; i < menubar.childNodes.length; ++i) |
243 menubar.childNodes[i].setAttribute("disabled", true); |
243 menubar.childNodes[i].setAttribute("disabled", true); |
251 splitter.parentNode.removeChild(splitter); |
251 splitter.parentNode.removeChild(splitter); |
252 |
252 |
253 var customizeURL = "chrome://global/content/customizeToolbar.xul"; |
253 var customizeURL = "chrome://global/content/customizeToolbar.xul"; |
254 gCustomizeSheet = getBoolPref("toolbar.customization.usesheet", false); |
254 gCustomizeSheet = getBoolPref("toolbar.customization.usesheet", false); |
255 |
255 |
256 @@ -3394,16 +3558,31 @@ function BrowserCustomizeToolbar() |
256 @@ -3402,16 +3566,31 @@ function BrowserCustomizeToolbar() |
257 } else { |
257 } else { |
258 return window.openDialog(customizeURL, |
258 return window.openDialog(customizeURL, |
259 "CustomizeToolbar", |
259 "CustomizeToolbar", |
260 "chrome,titlebar,toolbar,location,resizable,dependent", |
260 "chrome,titlebar,toolbar,location,resizable,dependent", |
261 gNavToolbox); |
261 gNavToolbox); |
283 document.getElementById("customizeToolbarSheetPopup").hidePopup(); |
283 document.getElementById("customizeToolbarSheetPopup").hidePopup(); |
284 } |
284 } |
285 |
285 |
286 // Update global UI elements that may have been added or removed |
286 // Update global UI elements that may have been added or removed |
287 if (aToolboxChanged) { |
287 if (aToolboxChanged) { |
288 @@ -3411,16 +3590,27 @@ function BrowserToolboxCustomizeDone(aTo |
288 @@ -3419,16 +3598,27 @@ function BrowserToolboxCustomizeDone(aTo |
289 if (gURLBar) |
289 if (gURLBar) |
290 gURLBar.emptyText = gURLBarEmptyText.value; |
290 gURLBar.emptyText = gURLBarEmptyText.value; |
291 |
291 |
292 gProxyFavIcon = document.getElementById("page-proxy-favicon"); |
292 gProxyFavIcon = document.getElementById("page-proxy-favicon"); |
293 gHomeButton.updateTooltip(); |
293 gHomeButton.updateTooltip(); |
311 document.getElementById('Browser:Back').hasAttribute('disabled') && |
311 document.getElementById('Browser:Back').hasAttribute('disabled') && |
312 document.getElementById('Browser:Forward').hasAttribute('disabled'); |
312 document.getElementById('Browser:Forward').hasAttribute('disabled'); |
313 |
313 |
314 // support downgrading to Firefox 2.0 |
314 // support downgrading to Firefox 2.0 |
315 var navBar = document.getElementById("nav-bar"); |
315 var navBar = document.getElementById("nav-bar"); |
316 @@ -3445,18 +3635,17 @@ function BrowserToolboxCustomizeDone(aTo |
316 @@ -3453,18 +3643,17 @@ function BrowserToolboxCustomizeDone(aTo |
317 XULBrowserWindow.asyncUpdateUI(); |
317 XULBrowserWindow.asyncUpdateUI(); |
318 PlacesStarButton.updateState(); |
318 PlacesStarButton.updateState(); |
319 } |
319 } |
320 |
320 |
321 // Re-enable parts of the UI we disabled during the dialog |
321 // Re-enable parts of the UI we disabled during the dialog |
331 if (!getBoolPref("ui.click_hold_context_menus", false)) |
331 if (!getBoolPref("ui.click_hold_context_menus", false)) |
332 SetClickAndHoldHandlers(); |
332 SetClickAndHoldHandlers(); |
333 #endif |
333 #endif |
334 |
334 |
335 // XXX Shouldn't have to do this, but I do |
335 // XXX Shouldn't have to do this, but I do |
336 @@ -4544,16 +4733,19 @@ function onViewToolbarsPopupShowing(aEve |
336 @@ -4552,16 +4741,19 @@ function onViewToolbarsPopupShowing(aEve |
337 var toolbarName = toolbar.getAttribute("toolbarname"); |
337 var toolbarName = toolbar.getAttribute("toolbarname"); |
338 if (toolbarName) { |
338 if (toolbarName) { |
339 let menuItem = document.createElement("menuitem"); |
339 let menuItem = document.createElement("menuitem"); |
340 let hidingAttribute = toolbar.getAttribute("type") == "menubar" ? |
340 let hidingAttribute = toolbar.getAttribute("type") == "menubar" ? |
341 "autohide" : "collapsed"; |
341 "autohide" : "collapsed"; |
351 |
351 |
352 menuItem.addEventListener("command", onViewToolbarCommand, false); |
352 menuItem.addEventListener("command", onViewToolbarCommand, false); |
353 } |
353 } |
354 toolbar = toolbar.nextSibling; |
354 toolbar = toolbar.nextSibling; |
355 } |
355 } |
356 @@ -6421,17 +6613,23 @@ BookmarkAllTabsHandler.prototype = { |
356 @@ -6737,17 +6929,23 @@ BookmarkAllTabsHandler.prototype = { |
357 |
357 |
358 _updateCommandState: function BATH__updateCommandState(aTabClose) { |
358 _updateCommandState: function BATH__updateCommandState(aTabClose) { |
359 var numTabs = gBrowser.tabContainer.childNodes.length; |
359 var numTabs = gBrowser.tabContainer.childNodes.length; |
360 |
360 |
361 // The TabClose event is fired before the tab is removed from the DOM |
361 // The TabClose event is fired before the tab is removed from the DOM |