Closed
Bug 914687
Opened 11 years ago
Closed 11 years ago
API for presetting GUIDs on bookmarks
Categories
(Toolkit :: Places, defect)
Toolkit
Places
Tracking
()
RESOLVED
FIXED
mozilla28
People
(Reporter: asaf, Assigned: asaf)
References
Details
Attachments
(1 file, 2 obsolete files)
25.17 KB,
patch
|
Details | Diff | Splinter Review |
So as it turns out setting guids directly into the db isn't an options because the initial guid is exposed through observers and results. NOTE: for some reason the last test fails. On that now.
Attachment #802397 -
Flags: review?(mak77)
Assignee | ||
Comment 1•11 years ago
|
||
Attachment #802397 -
Attachment is obsolete: true
Attachment #802397 -
Flags: review?(mak77)
Attachment #802402 -
Flags: review?(mak77)
Comment 2•11 years ago
|
||
Comment on attachment 802402 [details] [diff] [review] tests pass Review of attachment 802402 [details] [diff] [review]: ----------------------------------------------------------------- ::: toolkit/components/places/nsINavBookmarksService.idl @@ +277,5 @@ > * @param aTitle > * The title for the new bookmark > + * @param [optional] aGUID > + * The GUID to be set for the new item. If not set, > + * a new GUID is generated. I think it would be nice to scare people thinking to (ab)use this, stating that generally it's a bad idea to pass a guid! @@ +305,5 @@ > * @param aIndex > * The index to insert at, or DEFAULT_INDEX to append > + * @param [optional] aGUID > + * The GUID to be set for the new item. If not set, > + * a new GUID is generated. ditto @@ +363,5 @@ > * @param aIndex > * The separator's index under folder, or DEFAULT_INDEX to append > + * @param [optional] aGUID > + * The GUID to be set for the new item. If not set, > + * a new GUID is generated. ditto ::: toolkit/components/places/nsNavBookmarks.cpp @@ +481,5 @@ > rv = stmt->BindInt64ByName(NS_LITERAL_CSTRING("last_modified"), aDateAdded); > } > NS_ENSURE_SUCCESS(rv, rv); > > + // Could use IsEmpty becuase our callers check for GUID validity, typo: becuase @@ +482,5 @@ > } > NS_ENSURE_SUCCESS(rv, rv); > > + // Could use IsEmpty becuase our callers check for GUID validity, > + // but it doesn't hurt. I'd probably also MOZ_ASSERT an additional IsValidGUID check, it doesn't hurt :) ::: toolkit/components/places/nsNavBookmarks.h @@ +396,5 @@ > nsNavBookmarks* bookmarks = nsNavBookmarks::GetBookmarksService(); > NS_ENSURE_TRUE(bookmarks, NS_ERROR_OUT_OF_MEMORY); > int64_t newFolder; > return bookmarks->CreateContainerWithID(mID, mParent, mTitle, true, > + &mIndex, EmptyCString(), &newFolder); while here please fix the trailing space ::: toolkit/components/places/tests/unit/test_pageGuid_bookmarkGuid.js @@ +163,5 @@ > + "1 title", BOOKMARK_GUID); > + bmsvc.insertSeparator(folder, bmsvc.DEFAULT_INDEX, SEPARATOR_GUID); > + > + let result = PlacesUtils.getFolderContents(folder); > + let root = result.root; can do in one step @@ +164,5 @@ > + bmsvc.insertSeparator(folder, bmsvc.DEFAULT_INDEX, SEPARATOR_GUID); > + > + let result = PlacesUtils.getFolderContents(folder); > + let root = result.root; > + root.containerOpen = true; iirc getFolderContents returns an already open container @@ +179,5 @@ > +add_task(function test_emptyGUIDIgnored() { > + let folder = bmsvc.createFolder(bmsvc.placesRoot, "test folder", > + bmsvc.DEFAULT_INDEX, ""); > + do_check_eq(PlacesUtils.getFolderContents(folder) > + .root.bookmarkGuid.length, 12); you can use do_check_valid_places_guid() that is in head_common.js
Attachment #802402 -
Flags: review?(mak77) → review+
Assignee | ||
Updated•11 years ago
|
Attachment #802402 -
Flags: superreview?(gavin.sharp)
Comment 3•11 years ago
|
||
Comment on attachment 802402 [details] [diff] [review] tests pass Do we ever make any attempt at detecting duplicate GUIDs? Does the DB schema enforce the uniqueness somehow?
Attachment #802402 -
Flags: superreview?(gavin.sharp) → superreview+
Assignee | ||
Comment 6•11 years ago
|
||
The tree is closed right now.
Attachment #802402 -
Attachment is obsolete: true
Assignee | ||
Comment 7•11 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/424d6f2a4ea7
Comment 8•11 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/424d6f2a4ea7
Status: NEW → RESOLVED
Closed: 11 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → mozilla28
You need to log in
before you can comment on or make changes to this bug.
Description
•