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

Sync siteSettings with browser data #6721

Merged
merged 1 commit into from Jan 19, 2017

Conversation

@ayumi
Copy link
Contributor

ayumi commented Jan 19, 2017

Auditors: @diracdeltas

Test Plan:

Prep:

  1. Update sync lib to brave/sync #fix/resolve-delete-nonexistant-props.
  2. Prepare 2 instances (pyramids) of Brave with Sync enabled.
    a. Enable Sync and close Brave.
    b. Copy {userData}/brave-development to {userData}/brave-development-2.
    c. Edit brave-development-2/session-store-1 deviceId to 1.
    d. To browser-laptop package.json add "start2": "node ./tools/start.js --user-data-dir=brave-development-2 --debug=5859 --enable-logging --v=0 --enable-extension-activity-logging --enable-sandbox-logging --enable-dcheck",
  3. In appConfig.js sync.fetchInterval reduce to 5 seconds.

Play:

  1. Open both pyramid 1 and pyramid 2.
  2. In pyramid 1 visit a webpage and open up the bravery panel.
  3. In pyramid 2 visit the same page and open up the bravery panel.
  4. In pyramid 2 toggle each available siteSetting. Observe it appears in pyramid 1 after 1–5s.
  5. Try toggling multiple settings at once, and toggling different settings simulatenously on both pyramids.
  6. In both go to Preferences #Shields. Clear siteSettings with the Clear links and the red X's. Observe they sync over.
@ayumi ayumi requested a review from diracdeltas Jan 19, 2017
@ayumi ayumi added the feature/sync label Jan 19, 2017
@ayumi ayumi force-pushed the feature/syncing-settings branch 2 times, most recently from 59e0379 to b928fb6 Jan 19, 2017
let existingObject = this.getObjectById(objectId, category)
if (!existingObject) {
applySetting('objectId', objectId)
existingObject = this.getObjectById(objectId, category)

This comment has been minimized.

Copy link
@diracdeltas

diracdeltas Jan 19, 2017

Member

does this fail when record.action is DELETE?

This comment has been minimized.

Copy link
@ayumi

ayumi Jan 19, 2017

Author Contributor

I think Deletes are only sent when objectId is set, however it's probably good to check and skip it if it's a Delete.

This comment has been minimized.

Copy link
@diracdeltas
} else if (key === 'cookieControl') {
value = cookieControlEnum[value]
}
if (existingObjectData.get(key) === value) { continue }

This comment has been minimized.

Copy link
@diracdeltas

diracdeltas Jan 19, 2017

Member

i think this needs to call applySetting anyway (instead of continue) when the action is DELETE. null may be a valid siteSetting

@@ -620,11 +628,15 @@ const handleAppAction = (action) => {
let propertyName = action.temporary ? 'temporarySiteSettings' : 'siteSettings'
let newSiteSettings = new Immutable.Map()
appState.get(propertyName).map((entry, hostPattern) => {
// const value = entry.get(action.key)

This comment has been minimized.

Copy link
@diracdeltas

diracdeltas Jan 19, 2017

Member

minor: unnecessary comment

@diracdeltas
Copy link
Member

diracdeltas commented Jan 19, 2017

i tried the test plan and it was mostly glorious. however there is an issue where some site settings are not being removed.

repro

  1. goto https://docs.npmjs.com/cli/init in 2 pyramids
  2. toggle every site setting in the lion menu on one of the pyramids
  3. go to about:preferences#shields in both pyramids
  4. in one of the pyramids, click 'clear all' in each category
  5. in the other pyramid, all of the site settings should be cleared. however 'Ad Control', 'Block Phishing' and 'HTTPS Everywhere' are not cleared.

screen shot 2017-01-19 at 3 05 50 am

@diracdeltas
Copy link
Member

diracdeltas commented Jan 19, 2017

when i go to 'History' > 'Clear browsing data' > 'Clear site settings' it doesn't clear the site settings in the other pyramid. i noticed this doesn't work for historySItes either, so i guess it's an issue for another PR

@ayumi ayumi force-pushed the feature/syncing-settings branch from b928fb6 to 05d0927 Jan 19, 2017
@ayumi
Copy link
Contributor Author

ayumi commented Jan 19, 2017

@diracdeltas i made the changes!

For the last thing: Currently clearing Synced data categories clears it locally and only prevents future records from being synced; it doesn't clear categories on devices which have already synced the data.
I think that feature/fix should be a separate PR.

Auditors: @diracdeltas

Test Plan:

Prep:

0. Update sync lib to `brave/sync #fix/resolve-delete-nonexistant-props`.
1. Prepare 2 instances (pyramids) of Brave with Sync enabled.
  - Enable Sync and close Brave.
  - Copy `{userData}/brave-development` to `{userData}/brave-development-2`.
  - Edit `brave-development-2/session-store-1` `deviceId` to `1`.
  - To `browser-laptop` `package.json` add `"start2": "node ./tools/start.js --user-data-dir=brave-development-2 --debug=5859 --enable-logging --v=0 --enable-extension-activity-logging --enable-sandbox-logging --enable-dcheck",`
2. In `appConfig.js` `sync.fetchInterval` reduce to 5 seconds.

Play:

3. Open both pyramid 1 and pyramid 2.
4. In pyramid 1 visit a webpage and open up the bravery panel.
5. In pyramid 2 visit the same page and open up the bravery panel.
6. In pyramid 2 toggle each available siteSetting. Observe it appears in pyramid 1 after 1–5s.
7. Try toggling multiple settings at once, and toggling different settings simulatenously on both pyramids.
8. In both go to Preferences #Shields. Clear siteSettings with the Clear links and the red X's. Observe they sync over.
@ayumi ayumi force-pushed the feature/syncing-settings branch from 05d0927 to 54b16a8 Jan 19, 2017
@diracdeltas
Copy link
Member

diracdeltas commented Jan 19, 2017

For the last thing: Currently clearing Synced data categories clears it locally and only prevents future records from being synced; it doesn't clear categories on devices which have already synced the data.
I think that feature/fix should be a separate PR.

sgtm, can you open an issue in brave/sync for tracking?

Copy link
Member

diracdeltas left a comment

🔥

@diracdeltas diracdeltas merged commit 6ef5574 into feature/syncing-0.13.1 Jan 19, 2017
0 of 2 checks passed
0 of 2 checks passed
continuous-integration/travis-ci/pr The Travis CI build is in progress
Details
continuous-integration/travis-ci/push The Travis CI build is in progress
Details
@diracdeltas diracdeltas deleted the feature/syncing-settings branch Jan 19, 2017
@ayumi
Copy link
Contributor Author

ayumi commented Jan 19, 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.

None yet

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