From 1cd965fc5dcf0d9476250c80f10d60b3c753e6f4 Mon Sep 17 00:00:00 2001 From: "sayrer%gmail.com" Date: Wed, 13 Dec 2006 01:05:31 +0000 Subject: [PATCH] Bug 363636. duplicate nsLivemarkService.getSiteURI in toolbar.xml. r=sspitzer/gavin --- browser/components/places/content/toolbar.xml | 21 ++++++++++++------- .../places/src/nsLivemarkService.js | 6 ++++++ 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/browser/components/places/content/toolbar.xml b/browser/components/places/content/toolbar.xml index c596d1d1c5e6..c608fc6cf2ef 100755 --- a/browser/components/places/content/toolbar.xml +++ b/browser/components/places/content/toolbar.xml @@ -116,10 +116,7 @@ this._anno = Cc["@mozilla.org/browser/annotation-service;1"]. getService(Ci.nsIAnnotationService); - this._lms = - Cc["@mozilla.org/browser/livemark-service;2"]. - getService(Ci.nsILivemarkService); - + this._bms.addObserver(this._observer, false); var t = this; window.addEventListener("resize", @@ -230,10 +227,20 @@ if (PlacesController.nodeIsLivemarkContainer(child)) { button.setAttribute("livemark", "true"); var folder = asFolder(child).folderId; - var siteURI = this._lms.getSiteURI(folder); - if (siteURI) { - button.setAttribute("siteURI", siteURI.spec); + + // duplicate nsLivemarkService.getSiteURI to avoid instantiating + // the service on startup. + var containerURI = this._bms.getFolderURI(folder); + var siteURIString; + try { + siteURIString = + this._anno.getAnnotationString(containerURI, "livemark/siteURI"); } + catch (ex) {} + // end duplication + + if (siteURIString) + button.setAttribute("siteURI", siteURIString); } var popup = document.createElementNS(XULNS, "menupopup"); popup.setAttribute("type", "places"); diff --git a/toolkit/components/places/src/nsLivemarkService.js b/toolkit/components/places/src/nsLivemarkService.js index 84886119fa9a..eaf185f424f5 100644 --- a/toolkit/components/places/src/nsLivemarkService.js +++ b/toolkit/components/places/src/nsLivemarkService.js @@ -303,6 +303,12 @@ LivemarkService.prototype = { throw Cr.NS_ERROR_INVALID_ARG; }, + /** + * n.b. -- the body of this method is duplicated in + * /browser/components/places/content/toolbar.xml + * to avoid instantiating the livemark service on + * startup. + */ getSiteURI: function LS_getSiteURI(container) { this._ensureLivemark(container); var containerURI = this._bms.getFolderURI(container);