Bug 550682 - avoid extra getService calls in browser-places.js and browser-fullZoom.js. r=gavin

This commit is contained in:
Dão Gottwald 2010-03-09 08:49:46 +01:00
parent 7e2833c5f2
commit 31b8df3d9e
2 changed files with 7 additions and 15 deletions

View File

@ -77,12 +77,6 @@ var FullZoom = {
getService(Ci.nsIContentPrefService);
},
get _prefBranch FullZoom_get__prefBranch() {
delete this._prefBranch;
return this._prefBranch = Cc["@mozilla.org/preferences-service;1"].
getService(Ci.nsIPrefBranch2);
},
// browser.zoom.siteSpecific preference cache
_siteSpecificPref: undefined,
@ -135,19 +129,19 @@ var FullZoom = {
privateBrowsingEnabled;
this._siteSpecificPref =
this._prefBranch.getBoolPref("browser.zoom.siteSpecific");
gPrefService.getBoolPref("browser.zoom.siteSpecific");
this.updateBackgroundTabs =
this._prefBranch.getBoolPref("browser.zoom.updateBackgroundTabs");
gPrefService.getBoolPref("browser.zoom.updateBackgroundTabs");
// Listen for changes to the browser.zoom branch so we can enable/disable
// updating background tabs and per-site saving and restoring of zoom levels.
this._prefBranch.addObserver("browser.zoom.", this, true);
gPrefService.addObserver("browser.zoom.", this, true);
},
destroy: function FullZoom_destroy() {
let os = Cc["@mozilla.org/observer-service;1"].
getService(Ci.nsIObserverService);
os.removeObserver(this, "private-browsing");
this._prefBranch.removeObserver("browser.zoom.", this);
gPrefService.removeObserver("browser.zoom.", this);
this._cps.removeObserver(this.name, this);
window.removeEventListener("DOMMouseScroll", this, false);
delete this._cps;
@ -213,11 +207,11 @@ var FullZoom = {
switch (aData) {
case "browser.zoom.siteSpecific":
this._siteSpecificPref =
this._prefBranch.getBoolPref("browser.zoom.siteSpecific");
gPrefService.getBoolPref("browser.zoom.siteSpecific");
break;
case "browser.zoom.updateBackgroundTabs":
this.updateBackgroundTabs =
this._prefBranch.getBoolPref("browser.zoom.updateBackgroundTabs");
gPrefService.getBoolPref("browser.zoom.updateBackgroundTabs");
break;
}
break;

View File

@ -546,9 +546,7 @@ var PlacesCommandHook = {
* UnfiledBookmarks and Tags.
*/
showPlacesOrganizer: function PCH_showPlacesOrganizer(aLeftPaneRoot) {
var wm = Cc["@mozilla.org/appshell/window-mediator;1"].
getService(Ci.nsIWindowMediator);
var organizer = wm.getMostRecentWindow("Places:Organizer");
var organizer = Services.wm.getMostRecentWindow("Places:Organizer");
if (!organizer) {
// No currently open places window, so open one with the specified mode.
openDialog("chrome://browser/content/places/places.xul",