Closed
Bug 852057
Opened 12 years ago
Closed 12 years ago
[Contacts] Contacts are randomly sorted, when one field is same and either givenName or familyName field is NULL.
Categories
(Firefox OS Graveyard :: Gaia::Contacts, defect)
Tracking
(blocking-b2g:-, b2g18+)
People
(Reporter: leo.bugzilla.gecko, Assigned: leo.bugzilla.gecko)
Details
Attachments
(2 files)
868 bytes,
patch
|
gwagner
:
review+
|
Details | Diff | Splinter Review |
2.12 KB,
patch
|
gwagner
:
review+
|
Details | Diff | Splinter Review |
Contacts are randomly sorted, when one field is same and either givenName or familyName field is NULL.
For instance,
There are two contacts with same givenName, and one of them only has familyName.
In this case, contacts are randomly sorted.
That's because the return value of "function sortfunction(a, b)" in ContactService.jsm becomes always "1", when familyName field of either contact "a" or "b" is NULL.
So, My suggestion is as below. (Line 113)
Please check this issue.
Thanks you.
Original Code>>
98 function sortfunction(a, b){
...
107 do {
108 while (xIndex < sortBy.length && !x) {
109 x = a.properties[sortBy[xIndex]] ? a.properties[sortBy[xIndex]][0].toLowerCase() : null;
110 xIndex++;
111 }
112 if (!x) {
113 return sortOrder == 'ascending' ? 1 : -1;
114 }
Solution Code>>
98 function sortfunction(a, b){
...
107 do {
108 while (xIndex < sortBy.length && !x) {
109 x = a.properties[sortBy[xIndex]] ? a.properties[sortBy[xIndex]][0].toLowerCase() : null;
110 xIndex++;
111 }
112 if (!x) {
113 return sortOrder == 'descending' ? 1 : -1;
114 }
Assignee | ||
Updated•12 years ago
|
blocking-b2g: --- → leo?
Updated•12 years ago
|
Group: core-security
Comment 1•12 years ago
|
||
Not a critical blocker, but worthwhile to track and fix in the v1 timeframe.
Please attach the patch to this bug, and request review from somebody within Mozilla engineering.
blocking-b2g: leo? → -
tracking-b2g18:
--- → +
Comment 2•12 years ago
|
||
Adding Gregor to track it
Assignee | ||
Comment 3•12 years ago
|
||
Let me know the way to contribute to git repository in Gecko layer.
I think It's different from the way of Gaia.git.
Comment 4•12 years ago
|
||
(In reply to leo.bugzilla.gecko from comment #3)
> Let me know the way to contribute to git repository in Gecko layer.
> I think It's different from the way of Gaia.git.
MDN has useful information on how to create a properly formatted patch:
https://developer.mozilla.org/en-US/docs/Developer_Guide/How_to_Submit_a_Patch#Creating_a_patch
[bug852057] Contacts are randomly sorted, when one field is same and either givenName or familyName field is NULL.
It is the patch for this issue
Attachment #731047 -
Flags: review?(anygregor)
Comment 6•12 years ago
|
||
Thanks for the patch!
Please add a testcase and I will review it right away.
You can add it somewhere in:
https://hg.mozilla.org/mozilla-central/file/aae004a3c5d9/dom/contacts/tests/test_contacts_basics.html
Please ask if you need help running the tests.
Comment 7•12 years ago
|
||
(In reply to Gregor Wagner [:gwagner] from comment #6)
This is already covered by our tests, the problem is that the checkStr function in test_contacts_basics should do |is| instead of |ok|. I have a patch that fixes this in a another bug, I'll extract the fix and attach it here.
Comment 8•12 years ago
|
||
Assignee | ||
Comment 9•12 years ago
|
||
(In reply to Gregor Wagner [:gwagner] from comment #6)
Please let me know how to run the tests.
Comment 10•12 years ago
|
||
(In reply to leo.bugzilla.gecko from comment #9)
> (In reply to Gregor Wagner [:gwagner] from comment #6)
>
> Please let me know how to run the tests.
You most likely have a git clone of our whole B2G project right? So gecko is compiled for the phone and you can't run tests for it.
The easiest way to run tests locally is to checkout the source for the desktop version, build it and run the tests there.
1) getting the source: https://developer.mozilla.org/en-US/docs/Simple_Firefox_build
hg clone https://hg.mozilla.org/mozilla-central
2) build: https://developer.mozilla.org/en-US/docs/Configuring_Build_Options
create a .mozconfig file and build the source.
3) run the tests:
you have to be in your gecko folder and ff-dbg is the object directory in my case. You probably have to change it.
TEST_PATH=dom/contacts/tests/ make -C ff-dbg/ mochitest-plain
Updated•12 years ago
|
Attachment #731047 -
Flags: review?(anygregor) → review+
Updated•12 years ago
|
Attachment #732124 -
Flags: review+
Comment 11•12 years ago
|
||
Comment 12•12 years ago
|
||
Assignee: nobody → leo.bugzilla.gecko
Status: NEW → RESOLVED
Closed: 12 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Comment 13•12 years ago
|
||
I(In reply to Gregor Wagner [:gwagner] from comment #10)
Thanks for your guide. So I could run the test on Desktop.
However, I have another question.
Let me know how to run the test on not Desktop but Our Target Device.
Please advise it.
Thanks.
> (In reply to leo.bugzilla.gecko from comment #9)
> > (In reply to Gregor Wagner [:gwagner] from comment #6)
> >
> > Please let me know how to run the tests.
>
> You most likely have a git clone of our whole B2G project right? So gecko is
> compiled for the phone and you can't run tests for it.
>
> The easiest way to run tests locally is to checkout the source for the
> desktop version, build it and run the tests there.
>
> 1) getting the source:
> https://developer.mozilla.org/en-US/docs/Simple_Firefox_build
> hg clone https://hg.mozilla.org/mozilla-central
>
> 2) build: https://developer.mozilla.org/en-US/docs/Configuring_Build_Options
> create a .mozconfig file and build the source.
>
> 3) run the tests:
> you have to be in your gecko folder and ff-dbg is the object directory in my
> case. You probably have to change it.
> TEST_PATH=dom/contacts/tests/ make -C ff-dbg/ mochitest-plain
You need to log in
before you can comment on or make changes to this bug.
Description
•