make sure the bookmarks sidebar is open before rebuilding it

bug=342739
r=mconnor
This commit is contained in:
myk%mozilla.org 2007-01-14 05:38:00 +00:00
parent 845848730d
commit f54e9cad8f

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