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
Родитель 3e65ab7889
Коммит d2d74921c6
1 изменённых файлов: 7 добавлений и 2 удалений

Просмотреть файл

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