Closed
Bug 1127277
Opened 10 years ago
Closed 9 years ago
Calling Bookmarks.insert() without a type throws an unhelpful error
Categories
(Toolkit :: Places, defect)
Toolkit
Places
Tracking
()
Tracking | Status | |
---|---|---|
firefox39 | --- | fixed |
People
(Reporter: ttaubert, Assigned: ttaubert)
References
(Blocks 1 open bug)
Details
Attachments
(1 file, 1 obsolete file)
(deleted),
patch
|
mak
:
review+
|
Details | Diff | Splinter Review |
Sometimes when converting tests to the new Bookmarks API I would forget specifying a type property when calling Bookmarks.insert() to create a bookmark. When passing a URI as one does when inserting a bookmark it will fail with: Invalid value for property 'url': http://example.com/ The |validIf| for |url| fails before we even start checking for required properties. Knowing that |type| is required would however be much more helpful than telling me the value for |url| is invalid :)
Comment 1•10 years ago
|
||
yeah, actually we wanted to make type optional if url is provided, since it's clear it's a TYPE_BOOKMARK
Assignee | ||
Comment 2•10 years ago
|
||
That sounds like a good idea too!
Assignee | ||
Updated•10 years ago
|
Points: --- → 2
Assignee | ||
Updated•10 years ago
|
Flags: qe-verify-
Flags: firefox-backlog+
Assignee | ||
Comment 3•9 years ago
|
||
Assignee | ||
Updated•9 years ago
|
Iteration: --- → 39.2 - 23 Mar
Comment 4•9 years ago
|
||
Comment on attachment 8575983 [details] [diff] [review] 0001-Bug-1127277-Default-to-TYPE_BOOKMARK-when-no-type-is.patch Review of attachment 8575983 [details] [diff] [review]: ----------------------------------------------------------------- ::: toolkit/components/places/Bookmarks.jsm @@ +148,2 @@ > let insertInfo = validateBookmarkObject(info, > { type: { required: true } wouldn't be the same if you'd just replace required: true here with defaultValue: this.TYPE_BOOKMARK ? ::: toolkit/components/places/tests/bookmarks/test_bookmarks_insert.js @@ +251,5 @@ > +add_task(function* create_bookmark_without_type() { > + let bm = yield PlacesUtils.bookmarks.insert({ parentGuid: PlacesUtils.bookmarks.unfiledGuid, > + url: "http://example.com/", > + title: "a bookmark" }); > + checkBookmarkObject(bm); additionally check it's a TYPE_BOOKMARK and the url?
Attachment #8575983 -
Flags: review?(mak77) → feedback+
Assignee | ||
Comment 5•9 years ago
|
||
Attachment #8575983 -
Attachment is obsolete: true
Attachment #8576117 -
Flags: review?(mak77)
Comment 6•9 years ago
|
||
Comment on attachment 8576117 [details] [diff] [review] 0001-Bug-1127277-Default-to-TYPE_BOOKMARK-when-no-type-is.patch, v2 Review of attachment 8576117 [details] [diff] [review]: ----------------------------------------------------------------- ::: toolkit/components/places/Bookmarks.jsm @@ +139,5 @@ > // Ensure to use the same date for dateAdded and lastModified, even if > // dateAdded may be imposed by the caller. > let time = (info && info.dateAdded) || new Date(); > let insertInfo = validateBookmarkObject(info, > + { type: { required: true, defaultValue: this.TYPE_BOOKMARK } defaultValue makes required pointless.
Attachment #8576117 -
Flags: review?(mak77) → review+
Assignee | ||
Comment 7•9 years ago
|
||
https://hg.mozilla.org/integration/fx-team/rev/d31ed2b38332
Comment 8•9 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/d31ed2b38332
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
status-firefox39:
--- → fixed
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → mozilla39
You need to log in
before you can comment on or make changes to this bug.
Description
•