From f54e9cad8f892a59a8b1d1900b9cf88ab96a3c92 Mon Sep 17 00:00:00 2001 From: "myk%mozilla.org" Date: Sun, 14 Jan 2007 05:38:00 +0000 Subject: [PATCH] make sure the bookmarks sidebar is open before rebuilding it bug=342739 r=mconnor --- .../microsummaries/src/nsMicrosummaryService.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/browser/components/microsummaries/src/nsMicrosummaryService.js b/browser/components/microsummaries/src/nsMicrosummaryService.js index 59559cc6be52..4e61a3520799 100644 --- a/browser/components/microsummaries/src/nsMicrosummaryService.js +++ b/browser/components/microsummaries/src/nsMicrosummaryService.js @@ -670,8 +670,13 @@ MicrosummaryService.prototype = { // rebuild the bookmarks sidebar var sidebar = win.document.getElementById("sidebar"); - if (sidebar.contentWindow && sidebar.contentWindow.location == - "chrome://browser/content/bookmarks/bookmarksPanel.xul") { + // sidebar.docShell is null if the sidebar isn't showing, in which case + // sidebar.contentWindow will throw an exception (because it assumes + // the existence of sidebar.docShell), so we have to check for .docShell + // before we check for .contentWindow. + if (sidebar && sidebar.docShell && sidebar.contentWindow && + sidebar.contentWindow.location == + "chrome://browser/content/bookmarks/bookmarksPanel.xul") { var treeElement = sidebar.contentDocument.getElementById("bookmarks-view"); treeElement.tree.builder.rebuild(); }