Skip to content
This repository has been archived by the owner. It is now read-only.

fix syncing error when lastAccessedTime is empty #8556

Merged
merged 1 commit into from Apr 29, 2017
Merged

fix syncing error when lastAccessedTime is empty #8556

merged 1 commit into from Apr 29, 2017

Conversation

@diracdeltas
Copy link
Member

diracdeltas commented Apr 28, 2017

fix #8552

Test Plan: unittests and syncing tests should pass

  • Submitted a ticket for my issue if one did not already exist.
  • Used Github auto-closing keywords in the commit message.
  • Added/updated tests for this change (for new code or code which already has tests).
  • Ran git rebase -i to squash commits (if needed).

Test Plan:

@diracdeltas diracdeltas added this to the 0.15.1 milestone Apr 28, 2017
@diracdeltas diracdeltas requested a review from ayumi Apr 28, 2017
@@ -607,7 +607,7 @@ module.exports.isHistoryEntry = function (siteDetail) {
// This is a Brave default newtab site
return false
}
return !!siteDetail.get('lastAccessedTime') && !isBookmarkFolder(siteDetail.get('tags'))
return !isBookmarkFolder(siteDetail.get('tags'))

This comment has been minimized.

Copy link
@ayumi

ayumi Apr 28, 2017

Contributor

I think this change causes all bookmarks to show up as History items.
It might be that https://github.com/brave/browser-laptop/blob/master/app/common/lib/historyUtil.js#L19 is now returning every site not a bookmark folder.

Repro:

  1. Start pyramid 0, enable Sync and visit archive.org and wikipedia.org
  2. Start pyramid 1, join pyramid 0's sync group
  3. Examine pyramid 1's history – it has the 2 sites.

Expected: Pyramid 1's history should be empty because history doesn't sync by default.

This comment has been minimized.

Copy link
@diracdeltas

diracdeltas Apr 28, 2017

Author Member

oops, good catch

This comment has been minimized.

Copy link
@diracdeltas

diracdeltas Apr 28, 2017

Author Member

Hm, actually I can't repro this. Did you start from fresh pyramids?

This comment has been minimized.

Copy link
@ayumi

ayumi Apr 28, 2017

Contributor

i did

Test Plan: unittests should pass
@diracdeltas diracdeltas force-pushed the fix/8552 branch from 3a8465a to f586c18 Apr 28, 2017
@diracdeltas
Copy link
Member Author

diracdeltas commented Apr 28, 2017

@ayumi i may have fixed it

return false
}
return !!siteDetail.get('lastAccessedTime') && !isBookmarkFolder(siteDetail.get('tags'))
return !!siteDetail.get('lastAccessedTime') || !tags || tags.size === 0

This comment has been minimized.

Copy link
@ayumi

ayumi Apr 29, 2017

Contributor

@diracdeltas hmm that fixed half of it

try syncing to the forsaken lindy ... group. i see a lot of history items.

should this line be

return !!siteDetail.get('lastAccessedTime') && (!tags || tags.size === 0)

This comment has been minimized.

Copy link
@diracdeltas

diracdeltas Apr 29, 2017

Author Member

@ayumi actually the crash was caused by a history entry which did not have lastAccessedTime, so changing it to !!siteDetail.get('lastAccessedTime') && (!tags || tags.size === 0) would cause it to crash again.

when i sync to forsaken..., the synced bookmarks appear in about:history. this seems like the correct behavior to me because every bookmark is by definition also a history entry.

are you seeing history entries in about:history that are not bookmarks?

This comment has been minimized.

Copy link
@ayumi

ayumi Apr 29, 2017

Contributor

i don't think there'd be a crash any more due to the change to downgrade the throw into console.log.

On bookmarks == history, I think that's not obvious to a user; so if I synced my bookmarks I'd expect history to be empty. It would only make sense if I understood the sites data model. However, this is how it currently happens in master so this is probably ok.

This comment has been minimized.

Copy link
@diracdeltas

diracdeltas Apr 29, 2017

Author Member

@ayumi right, it would fix the crash, but I think the user's data was a valid history entry and should not be ignored by sync.

i think "make synced bookmarks not part of history" is a separate issue

@ayumi
ayumi approved these changes Apr 29, 2017
@diracdeltas diracdeltas merged commit de2561a into master Apr 29, 2017
0 of 2 checks passed
0 of 2 checks passed
continuous-integration/appveyor/pr AppVeyor build failed
Details
continuous-integration/travis-ci/pr The Travis CI build failed
Details
@bsclifton bsclifton deleted the fix/8552 branch Apr 29, 2017
@alexwykoff alexwykoff mentioned this pull request Apr 30, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

3 participants
You can’t perform that action at this time.