Closed Bug 1217463 Opened 9 years ago Closed 9 years ago

Deal with case where 'places' bookmark is missing.

Categories

(Firefox OS Graveyard :: Sync, defect, P1)

ARM
Gonk (Firefox OS)
defect

Tracking

(Not tracked)

RESOLVED FIXED
FxOS-S10 (30Oct)

People

(Reporter: mbdejong, Assigned: danhuang)

References

Details

Attachments

(1 file)

The test account sync2dot5@mailinator has no bookmarks folder with id 'places' (even though the parentId of the 'unfiled' folder is set to 'places').
Priority: -- → P1
Target Milestone: --- → FxOS-S10 (30Oct)
It seems this happens when you create a new account, but don't go into the Bookmarks manager to create any folders.
https://github.com/ferjm/gaia/commit/1fa877f130100aee48d3823c7d3cb521a876343a#diff-ed4ae19263bf74556f7542b37c38dbefR64

I think that line needs to be SyncBrowserDB.getBookmark({ parentid: 'places' }, bookmark => {...});
Flags: needinfo?(selee)
Here is the sample code to fix the case:
SyncBrowserDB.getBookmark({ parentid: 'places' }, bookmark => {
  // make sure if firefox synced data saved in indexdDB
  if(bookmark) {
    this.cache.push({
      id: 'places',
      // XXX we need UX's suggestion to have a folder name for root folder
      //     and don't forget to handle l10n case.
      title: 'Synced Bookmarks',
      type: 'folder',
      readOnly: true
    });
  }

  // get bookmark data from origin indexdDB
  BrowserDB.getBookmarks(bookmarks => {
    this.cache = this.cache.concat(bookmarks);
    resolve();
  });
});
Flags: needinfo?(selee)
Hey Dan, Could you give your comments here for this case? Thank you.
Flags: needinfo?(dhuang)
Fernando and Sean's sample code looks good to me. I will fix this.
Flags: needinfo?(dhuang)
Assignee: nobody → dhuang
Comment on attachment 8678730 [details] [review]
[gaia] danhuang1202:1217463_deal_places_not_exist > mozilla-b2g:master

Please help me to review. This patch update the way to check if the synced bookmark data is saved in indexedDB. Thanks.
Attachment #8678730 - Flags: review?(selee)
See Also: → 1217710
Comment on attachment 8678730 [details] [review]
[gaia] danhuang1202:1217463_deal_places_not_exist > mozilla-b2g:master

LGTM. Thanks :)
Attachment #8678730 - Flags: review?(selee) → review+
Dan, please see my comments and fix them. Thank you!
Thank for the review.
merge in master:
https://github.com/mozilla-b2g/gaia/commit/f847caf6826baca3d31543c9e2593abfff0d8b70
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: