code: function isBookmarkInFolder(uri, folderId)
  {
    var ids = bookmarksService.getBookmarkIdsForURI(uri, {});
    for (let i = 0; i < ids.length; i++) {
      if (bookmarksService.getFolderIdForItem(ids[i]) == folderId)
        return true;
    }
  
    return false;
  }
docs: Check if an URI is bookmarked within the specified folder
  
  @param (nsIURI) uri
  URI of the bookmark
  @param {String} folderId
  Folder in which the search has to take place
  @return Returns if the URI exists in the given folder
  @type Boolean