Android Sync blindly applies titles for downloaded special records

RESOLVED WONTFIX

Status

()

P1
normal
RESOLVED WONTFIX
7 years ago
a year ago

People

(Reporter: tchung, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

7 years ago
See screenshots.   Using both clean profiles on desktop and fennec, i got the original "Mobile Bookmarks" folder titled to change to "mobile" after syncing fennec->desktop->fennec again.

Good news: no bookmarks have been lost.

Screenshots:
Before sync: https://bug731267.bugzilla.mozilla.org/attachment.cgi?id=603163
After Sync: http://i.imgur.com/x7Rpg.png

Repro:
1) install clean fennec nighly, 3-6-2012 build, Galaxy Nexus
2) take note in awesomecreen, there's a folder called "Mobile Bookmarks"
3) setup new sync profile on desktop firefox, sync some stuff over to fennec
4) go to fennec, bookmark some more stuff there, and sync it back to desktop
5) back to desktop, make some more bookmark changes, and sync back to fennec
6) finally, open fennec > awesomescreen > bookmarks, and note that the former "Mobile Bookmarks" folder is now showing "mobile".   Data in mobile folder is intact.

Expected:
- no name change of "Mobile Bookmarks"

Actual:
- "Mobile Bookmarks" becomes "mobile"

Updated

7 years ago
Whiteboard: sync
dupe of bug 731273?
tchung: could you run this in a privileged web console?

Components.utils.import("resource://services-sync/main.js");
Components.utils.import("resource://services-sync/record.js");
let recordType = Weave.Engines.get("bookmarks")._recordObj;
let coll = new Collection(Weave.Service.storageURL + "bookmarks/", recordType);
coll.full = true;
coll.ids = ["mobile"];
coll.recordHandler = function(item) {
  item.collection = "bookmarks";
  item.decrypt();
  console.log(item.cleartext);
};
coll.get();

and let me know what you see?
(In reply to Tracy Walker [:tracy] from comment #1)
> dupe of bug 731273?

Unlikely.
Here is the issue:

--
[12:15:07.016] en._createRecord("mobile")
[12:15:07.146] ({cleartext:{id:"mobile", type:"folder", parentName:"", title:"mobile", description:null, children:["1ROdlTuIoddD", "3Z_bMIHPSZQ8", "4mSDUuOo2iVB", "8aEdE9IIrJVr", "9DzPTmkkZRDb", "Qwwb99HtVKsD", "s8tM36aGPKbq", "JMTi61hOO3JV", "JQUDk0wSvYip", "LmVH-J1r3HLz", "NhgQlC5ykYGW", "OVanevUUaqO2", "OtQVX0PMiWQj", "_GP5cF595iie", "fkRssjXSZDL3", "k7K_NwIA1Ya0", "raox_QGzvqh1", "vXYL-xHjK06k", "QKHKUN6Dm-xv", "pmN2dYWT2MJ_", "EVeO_J1SQiwL", "7N-qkepS7bec", "NIGa3ha-HVOE", "2Phv1I25wbuH", "TTSIAH1fV0VE", "WOmZ8PfH39Da", "gDTXNg4m1AJZ", "ayI30OZslHbO", "zSEs4O3n6CzQ", "oWTDR0gO2aWf", "wWHUoFaInXi9", "F7QTuVJDpsTM", "FIboggegplk-", "G4HWrT5nfRYS", "MHA7y9bupDdv", "T_Ldzmj0Ttte", "U9eYu3SxsE_U", "bk463Kl9IO_m", "brUfrqJjFNSR", "ccpawfWsD-bY", "l7p2xqOTMMXw", "o-nSDKtXYln7"], parentid:"places"}, data:{payload:{ciphertext:null}, id:"mobile", sortindex:1000000}, collection:"bookmarks"})


That is, desktop Firefox does not upload a record with a real title. It expects clients to localize special folders.
Summary: After syncing from fennec to desktop and back, "Mobile Bookmarks" title becomes "mobile" → Android Sync blindly applies titles for downloaded special records
Status: NEW → ASSIGNED
Component: General → Android Sync
Priority: -- → P2
Product: Fennec Native → Mozilla Services
QA Contact: general → android-sync
Whiteboard: sync
Version: Trunk → unspecified
And here's the root cause of both this and Bug 731273: desktop.

This is all on a profile that has never synced with Android, but is syncing with XUL Fennec.


This is the string that's shown in Firefox, regardless of DB contents:
--
[12:26:14.830] Str.sync.get("mobile.label")
[12:26:14.833] "Mobile Bookmarks"
--

This runs at the start of a sync.
--
[12:36:41.412] Engines.get("bookmarks")._tracker._ensureMobileQuery()
--

This is how Sync finds the mobile folder in _ensureMobileQuery.
--
[12:38:11.678] find(MOBILE_ANNO)
[12:38:11.683] [4372]
--

This is how we find the title from an ID.
--
[12:39:08.250] PlacesUtils.bookmarks.getItemTitle(4372)
[12:39:08.257] "Mobile Bookmarks"
--

So where does this "mobile" thing come from?

Oh dear.
--
[12:39:41.192] Engines.get("bookmarks")._store.idForGUID("mobile")
[12:39:41.199] 474
--

… because:
--
[12:43:28.237] Cu.import("resource://services-sync/engines/bookmarks.js").kSpecialIds.findMobileRoot(false);
[12:43:28.243] 474
--


The ID lookup is using MOBILEROOT_ANNO to find the mobile root. But there's another folder with the MOBILE_ANNO that's getting the right title.
Depends on: 733507
(Reporter)

Comment 6

7 years ago
(In reply to Richard Newman [:rnewman] from comment #4)
> Here is the issue:
> 
> --
> [12:15:07.016] en._createRecord("mobile")
> [12:15:07.146] ({cleartext:{id:"mobile", type:"folder", parentName:"",
> title:"mobile", description:null, children:["1ROdlTuIoddD", "3Z_bMIHPSZQ8",
> "4mSDUuOo2iVB", "8aEdE9IIrJVr", "9DzPTmkkZRDb", "Qwwb99HtVKsD",
> "s8tM36aGPKbq", "JMTi61hOO3JV", "JQUDk0wSvYip", "LmVH-J1r3HLz",
> "NhgQlC5ykYGW", "OVanevUUaqO2", "OtQVX0PMiWQj", "_GP5cF595iie",
> "fkRssjXSZDL3", "k7K_NwIA1Ya0", "raox_QGzvqh1", "vXYL-xHjK06k",
> "QKHKUN6Dm-xv", "pmN2dYWT2MJ_", "EVeO_J1SQiwL", "7N-qkepS7bec",
> "NIGa3ha-HVOE", "2Phv1I25wbuH", "TTSIAH1fV0VE", "WOmZ8PfH39Da",
> "gDTXNg4m1AJZ", "ayI30OZslHbO", "zSEs4O3n6CzQ", "oWTDR0gO2aWf",
> "wWHUoFaInXi9", "F7QTuVJDpsTM", "FIboggegplk-", "G4HWrT5nfRYS",
> "MHA7y9bupDdv", "T_Ldzmj0Ttte", "U9eYu3SxsE_U", "bk463Kl9IO_m",
> "brUfrqJjFNSR", "ccpawfWsD-bY", "l7p2xqOTMMXw", "o-nSDKtXYln7"],
> parentid:"places"}, data:{payload:{ciphertext:null}, id:"mobile",
> sortindex:1000000}, collection:"bookmarks"})
> 
> 
> That is, desktop Firefox does not upload a record with a real title. It
> expects clients to localize special folders.

Richard, you got what you need?  sorry, just got back from lunch.
And here is the explanation of precisely what occurs:

https://bugzilla.mozilla.org/show_bug.cgi?id=733507#c1
(In reply to Tony Chung [:tchung] from comment #6)

> Richard, you got what you need?  sorry, just got back from lunch.

Yes, thank you.
Short-term fix: have Android Sync do what desktop does, and ignore the requests of other clients.

(Fennec should also use a localized "magic" string for the title, rather than looking in the database; if it doesn't, then folder names won't track localization switches on the device, rather keeping whichever title was in play when the DB was initialized.)

Long-term fix: correct behavior on desktop.
Priority: P2 → P1
I changed my mind on this.

I believe that desktop does not use a real title because it expects localization. Using a fixed string like "mobile" allows for easier reconciling.

After Bug 733515, Native Fennec does this correctly, so we don't have to -- and shouldn't -- ignore any titles when we sync.
Status: ASSIGNED → RESOLVED
Last Resolved: 7 years ago
Depends on: 733515
Resolution: --- → WONTFIX
(Assignee)

Updated

6 years ago
Component: Android Sync → Android Sync
Product: Mozilla Services → Android Background Services

Updated

a year ago
Product: Android Background Services → Firefox for Android
You need to log in before you can comment on or make changes to this bug.