make sure the bookmarks sidebar is open before rebuilding it

bug=342739
r=mconnor
This commit is contained in:
myk%mozilla.org 2006-07-03 16:54:04 +00:00
parent 3e65ab7889
commit d2d74921c6

View File

@ -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();
}