B2G/gecko/browser/components/migration/src/ChromeProfileMigrator.js
/**
 * Insert bookmark items into specific folder.
 *
 * @param   aFolderId
 *          id of folder where items will be inserted
 * @param   aItems
 *          bookmark items to be inserted
 */
Insert bookmark items into specific folder.
@param   aFolderId
id of folder where items will be inserted
@param   aItems
bookmark items to be inserted
Insert bookmark items into specific folder . @param aFolderId id of folder where items will be inserted @param aItems bookmark items to be inserted
function insertBookmarkItems(aFolderId, aItems)
{
  for (let i = 0; i < aItems.length; i++) {
    let item = aItems[i];
    try {
      if (item.type == "url") {
        PlacesUtils.bookmarks.insertBookmark(aFolderId,
                                             NetUtil.newURI(item.url),
                                             PlacesUtils.bookmarks.DEFAULT_INDEX,
                                             item.name);
      } else if (item.type == "folder") {
        let newFolderId =
          PlacesUtils.bookmarks.createFolder(aFolderId,
                                             item.name,
                                             PlacesUtils.bookmarks.DEFAULT_INDEX);
        insertBookmarkItems(newFolderId, item.children);
      }
    } catch (e) {
      Cu.reportError(e);
    }
  }
}
function insertBookmarkItems ( aFolderId , aItems ) { for ( let i = 0 ; i < aItems . length ; i ++ ) { let item = aItems [ i ] ; try { if ( item . type == "url" ) { PlacesUtils . bookmarks . insertBookmark ( aFolderId , NetUtil . newURI ( item . url ) , PlacesUtils . bookmarks . DEFAULT_INDEX , item . name ) ; } else if ( item . type == "folder" ) { let newFolderId = PlacesUtils . bookmarks . createFolder ( aFolderId , item . name , PlacesUtils . bookmarks . DEFAULT_INDEX ) ; insertBookmarkItems ( newFolderId , item . children ) ; } } catch ( e ) { Cu . reportError ( e ) ; } } }
Insert bookmark items into specific folder.
Insert bookmark items into specific folder .