fix for bug #384731: "Bookmark This Page" throws exception on close in bookmarkProperties.js if you have "bookmarkPropertiesDialog/lastUsed" annotations that point to itemIds for folder that don't exist

fix for bug #384733:  "Add Bookmark" dialog truncated if you have "bookmarkPropertiesDialog/lastUsed" annotations that point to itemIds for folder that don't exist

r=mano
This commit is contained in:
sspitzer@mozilla.org 2007-06-22 16:19:47 -07:00
Родитель 907d30783a
Коммит 751a4ccf41
1 изменённых файлов: 16 добавлений и 3 удалений

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

@ -371,12 +371,19 @@ var BookmarkPropertiesPanel = {
* @return the new menu item.
*/
_appendFolderItemToMenupopup:
function BPP__appendFolderItemToMenuList(aMenupopup, aFolderId) {
function BPP__appendFolderItemToMenupopup(aMenupopup, aFolderId) {
try {
var folderTitle = PlacesUtils.bookmarks.getItemTitle(aFolderId);
}
catch (ex) {
NS_ASSERT(folderTitle, "no title found for folderId of " + aFolderId);
return null;
}
// First make sure the folders-separator is visible
this._element("foldersSeparator").hidden = false;
var folderMenuItem = document.createElement("menuitem");
var folderTitle = PlacesUtils.bookmarks.getItemTitle(aFolderId)
folderMenuItem.folderId = aFolderId;
folderMenuItem.setAttribute("label", folderTitle);
folderMenuItem.className = "menuitem-iconic folder-icon";
@ -424,6 +431,12 @@ var BookmarkPropertiesPanel = {
var defaultItem =
this._getFolderMenuItem(this._defaultInsertionPoint.itemId, true);
// if we fail to get a menuitem for the default insertion point
// use the Bookmarks root
if (!defaultItem)
defaultItem = this._element("bookmarksRootItem");
this._folderMenuList.selectedItem = defaultItem;
},