Closed
Bug 330192
Opened 18 years ago
Closed 18 years ago
Provide bookmark service function for changing URL of bookmark
Categories
(Firefox :: Bookmarks & History, defect, P2)
Tracking
()
RESOLVED
FIXED
Firefox 2 alpha2
People
(Reporter: brettw, Assigned: mozilla)
References
Details
(Keywords: fixed1.8.1)
Attachments
(1 file, 3 obsolete files)
This would handle migrating annotations, favicons, and conflict resolution. Perhaps there should be an option to just change one instance in one folder or to change all instances of this bookmark.
Updated•18 years ago
|
Priority: -- → P2
Target Milestone: --- → Firefox 2 alpha2
Assignee | ||
Comment 1•18 years ago
|
||
Attachment #215940 -
Flags: superreview?(bugs)
Attachment #215940 -
Flags: review?
Assignee | ||
Updated•18 years ago
|
Attachment #215940 -
Flags: review? → review?(brettw)
Assignee | ||
Comment 2•18 years ago
|
||
Attachment #215940 -
Attachment is obsolete: true
Attachment #215952 -
Flags: review?(brettw)
Attachment #215940 -
Flags: superreview?(bugs)
Attachment #215940 -
Flags: review?(brettw)
Updated•18 years ago
|
Attachment #215952 -
Flags: superreview+
Reporter | ||
Comment 3•18 years ago
|
||
Comment on attachment 215952 [details] [diff] [review] Added brett's copyAnnotations patch from 329861 and a GetAnnotationService() method >+ // Now that we're satisfied with the quality of our input, the >+ // actual work starts here. >+ >+ PRInt64 *folders; >+ PRUint32 folderCount; >+ rv = GetBookmarkFolders(aOldURI, &folderCount, &folders); >+ NS_ENSURE_SUCCESS(rv, rv); All the error conditions will cause this array to leak. And, since you never even free it at the botton, success will also cause this array to leak :) >+ >+ rv = BeginUpdateBatch(); Use the nsBookmarksUpdateBatcher to do this instead. Every error condition from here on will exit without ending the batch, which will make all kinds of bad things happen. What I suggest is changing GetBookmarkFolders. Create a new version GetBookmarkFoldersTArray or something that returns a TArray and copy the TArray-filling code from GetBookmarkFolders into that. Then GetBookmarkFolders just becomes the raw-array-based wrapper. Then you can just call the TArray version here and not worry about the memory. >+ NS_ENSURE_SUCCESS(rv, rv); >+ >+ // in folders, replace all instances of old URI with new URI >+ for (PRUint32 i = 0; i < folderCount; i++) { >+ rv = ReplaceItem(folders[i], aOldURI, aNewURI); >+ NS_ENSURE_SUCCESS(rv, rv); >+ } >+ >+ // copy title from old URI to new URI >+ nsAutoString title; >+ rv = GetItemTitle(aOldURI, title); >+ NS_ENSURE_SUCCESS(rv, rv); >+ rv = SetItemTitle(aNewURI, title); >+ NS_ENSURE_SUCCESS(rv, rv); >+ >+ // copy keyword (shortcut) from old URI to new URI >+ nsAutoString keyword; >+ rv = GetKeywordForURI(aOldURI, keyword); >+ NS_ENSURE_SUCCESS(rv, rv); >+ rv = SetKeywordForURI(aNewURI, keyword); >+ NS_ENSURE_SUCCESS(rv, rv); You probably don't want to set the keyword if the oldURI keyword is empty. If they already have a keyword for the new URI, this will delete it. >+ // copy annotations from old URI to new URI >+ nsAnnotationService* annoService = >+ nsAnnotationService::GetAnnotationService(); >+ NS_ENSURE_TRUE(annoService, NS_ERROR_UNEXPECTED); >+ rv = annoService->CopyAnnotations(aOldURI, aNewURI, PR_TRUE); >+ NS_ENSURE_SUCCESS(rv, rv); >+ rv = annoService->RemovePageAnnotations(aOldURI); >+ NS_ENSURE_SUCCESS(rv, rv); I don't think we should remove the old annotations. Many annotations may not be associated with the bookmark, but rather the page. Leaving it there will essentially fork the annotations, which I think is fine. You should document this, however. >+ // associate favicon from old URI (if present) with new URI >+ nsFaviconService* faviconService = nsFaviconService::GetFaviconService(); >+ NS_ENSURE_TRUE(faviconService, NS_ERROR_UNEXPECTED); >+ nsCOMPtr<nsIURI> faviconURI; >+ rv = faviconService->GetFaviconForPage(aOldURI, getter_AddRefs(faviconURI)); >+ if (NS_SUCCEEDED(rv)) { >+ rv = faviconService->SetFaviconUrlForPage(aNewURI, faviconURI); >+ NS_ENSURE_SUCCESS(rv, rv); >+ } I don't think you should overwrite a favicon if the newURI already has one. The favicon is really associated with the URI and not the bookmark. It will be reset next time they visit the page. Better to keep it what we already knew it was.
Attachment #215952 -
Flags: review?(brettw) → review-
Assignee | ||
Comment 4•18 years ago
|
||
Attachment #215952 -
Attachment is obsolete: true
Attachment #215963 -
Flags: review?(brettw)
Reporter | ||
Comment 5•18 years ago
|
||
Comment on attachment 215963 [details] [diff] [review] Updated to incorporate brettw's feedback Looks good. When you checkin, can you add a comment above the tagRoot in the .idl file that explains it's currently 0. I don't want people getting confused before we're done implementing it.
Attachment #215963 -
Flags: review?(brettw) → review+
Assignee | ||
Comment 6•18 years ago
|
||
Attachment #215963 -
Attachment is obsolete: true
Assignee | ||
Comment 7•18 years ago
|
||
Landed on branch & trunk.
Comment 8•15 years ago
|
||
Bug 451915 - move Firefox/Places bugs to Firefox/Bookmarks and History. Remove all bugspam from this move by filtering for the string "places-to-b-and-h". In Thunderbird 3.0b, you do that as follows: Tools | Message Filters Make sure the correct account is selected. Click "New" Conditions: Body contains places-to-b-and-h Change the action to "Delete Message". Select "Manually Run" from the dropdown at the top. Click OK. Select the filter in the list, make sure "Inbox" is selected at the bottom, and click "Run Now". This should delete all the bugspam. You can then delete the filter. Gerv
Component: Places → Bookmarks & History
QA Contact: places → bookmarks
You need to log in
before you can comment on or make changes to this bug.
Description
•