Closed Bug 636917 Opened 15 years ago Closed 15 years ago

Livemark only added to _livemarks array after anno has been added

Categories

(Firefox :: Bookmarks & History, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: rnewman, Assigned: mak)

References

Details

(Keywords: regression, Whiteboard: [places-next-wanted])

Attachments

(1 file, 4 obsolete files)

This means that handlers for livemark annotations get the wrong answer from nodeIsLivemarkContainer when the livemark service has been loaded. Uh oh. mak suggested "in the new bug add a note that we should check current views code since onItemAdded livemarks live update could fail". This was discovered in the course of fixing Bug 387138.
Blocks: 560198
this one wants a test.
Flags: in-testsuite?
Attached patch patch v1.0 (obsolete) — — Splinter Review
I made this along the weekend but forgot to attach it. It's a pretty much safe change, with a dedicated test, since isLivemark is used both by internal code and by Sync, its reliability should be good. Due to the above, I would appreciate approval too.
Assignee: nobody → mak77
Status: NEW → ASSIGNED
Attachment #516113 - Flags: review?(dietrich)
This is actually a regression we made in 3.6
Blocks: 492796
Keywords: regression
Attached patch real patch v1.0 (obsolete) — — Splinter Review
I attached random stuff :(
Attachment #516113 - Attachment is obsolete: true
Attachment #516113 - Flags: review?(dietrich)
Attachment #516115 - Flags: review?(dietrich)
Comment on attachment 516115 [details] [diff] [review] real patch v1.0 bah, I should cleanup my patches queue sometimes...
Attachment #516115 - Attachment is obsolete: true
Attachment #516115 - Flags: review?(dietrich)
Attached patch patch v1.0 (obsolete) — — Splinter Review
ok, this should be the correct one :p
Attachment #516121 - Flags: review?(dietrich)
Attached patch patch v1.1 (obsolete) — — Splinter Review
Actually, we are also not respecting the idl in get/setFeedURI, should throw if the id is not a livemark... This fixes that, so the check in setFeedURI is not needed (you can't set a feeduri to a folder to transform it to a livemark)
Attachment #516121 - Attachment is obsolete: true
Attachment #516121 - Flags: review?(dietrich)
Attachment #516227 - Flags: review?(dietrich)
Comment on attachment 516227 [details] [diff] [review] patch v1.1 > _createFolder: > function LS__createFolder(aParentId, aName, aSiteURI, aFeedURI, aIndex) { > var folderId = bms.createFolder(aParentId, aName, aIndex); > bms.setFolderReadonly(folderId, true); > > // Add an annotation to map the folder id to the livemark feed URI >+ this._lastCreatedLivemarkFolderId = folderId; > ans.setItemAnnotation(folderId, LMANNO_FEEDURI, aFeedURI.spec, > 0, ans.EXPIRE_NEVER); also add a comment about why storing the id. > try { > this._getLivemarkIndex(aFolderId); > return true; > } > catch (ex) {} >+ // There is an edge case here, if a AnnotationChanged notification asks for >+ // isLivemark and the livemark is currently being added, it is not yet in >+ // the _livemarks array. In such a case go the slow path. >+ if (this._lastCreatedLivemarkFolderId === aFolderId) >+ return ans.itemHasAnnotation(aFolderId, LMANNO_FEEDURI); > return false; > }, why here instead of in _getLivemarkIndex? > getFeedURI: function LS_getFeedURI(aFolderId) { >+ this._ensureLivemark(aFolderId); >+ what about side-effects in other code that doesn't expect this to throw? (and same for setFeedURI) i'm worried about making this change so late in the cycle.
(In reply to comment #8) > > try { > > this._getLivemarkIndex(aFolderId); > > return true; > > } > > catch (ex) {} > >+ // There is an edge case here, if a AnnotationChanged notification asks for > >+ // isLivemark and the livemark is currently being added, it is not yet in > >+ // the _livemarks array. In such a case go the slow path. > >+ if (this._lastCreatedLivemarkFolderId === aFolderId) > >+ return ans.itemHasAnnotation(aFolderId, LMANNO_FEEDURI); > > return false; > > }, > > why here instead of in _getLivemarkIndex? the livemark is not yet in the _livemarks array. it cannot have a index. > > getFeedURI: function LS_getFeedURI(aFolderId) { > >+ this._ensureLivemark(aFolderId); > >+ > > what about side-effects in other code that doesn't expect this to throw? > > (and same for setFeedURI) > > i'm worried about making this change so late in the cycle. the idl says we should throw, so I'm not worried by code that expect it to not throw.
(In reply to comment #9) > > > getFeedURI: function LS_getFeedURI(aFolderId) { > > >+ this._ensureLivemark(aFolderId); > > >+ > > > > what about side-effects in other code that doesn't expect this to throw? > > > > (and same for setFeedURI) > > > > i'm worried about making this change so late in the cycle. > > the idl says we should throw, so I'm not worried by code that expect it to not > throw. I'm referring to internal code that doesn't handle an exception when calling this, causing other fallout (regressions) because of that. This change is not at all related to this bug. Please remove it from this patch and we can discuss it in a new bug.
ok, fine for me!
Attached patch patch v2.0 — — Splinter Review
reduced patch, splitted the remaining part to bug 638412
Attachment #516227 - Attachment is obsolete: true
Attachment #516227 - Flags: review?(dietrich)
Attachment #516564 - Flags: review?(dietrich)
Comment on attachment 516564 [details] [diff] [review] patch v2.0 r=me, thanks!
Attachment #516564 - Flags: review?(dietrich) → review+
Comment on attachment 516564 [details] [diff] [review] patch v2.0 Asking approval for this small fix. Handles an edge case where isLivemark returns false when it should be true. it is important because isLivemark is used in most of our UI and now in Sync. The fix is pretty much trivial, and comes with a dedicated test.
Attachment #516564 - Flags: approval2.0?
Can you push to try, and re-request if it's green?
Attachment #516564 - Flags: approval2.0?
Comment on attachment 516564 [details] [diff] [review] patch v2.0 retrying with green try results!
Attachment #516564 - Flags: approval2.0?
Attachment #516564 - Flags: approval2.0? → approval2.0-
Whiteboard: [places-next-wanted]
Whiteboard: [places-next-wanted] → [places-next-wanted][fixed-in-cedar]
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Whiteboard: [places-next-wanted][fixed-in-cedar] → [places-next-wanted]
Flags: in-testsuite? → in-testsuite+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: