Investigate ways to pass more context to FAC.autoCompleteSearch

RESOLVED FIXED

Status

RESOLVED FIXED
8 years ago
8 years ago

People

(Reporter: mfinkle, Assigned: mfinkle)

Tracking

Trunk
x86
Linux
Bug Flags:
in-testsuite +

Details

Attachments

(1 attachment, 1 obsolete attachment)

With e10s, we have problems passing the "field" param to FAC.autoCompleteSearch. We were passing a faked object that included a "maxLength" property for the default FAC service. Fennec now has it's own FAC override component (see bug 578691) and it would like to use more context from the field.

We can try to make a fake nsIDOMHTMLInputElement, but we'll never be able to fully simulate the interface.

We can try making a new param or a new method, that allows us to pass extra context.
From Mounir Lamouri:

I quickly look at the patch (in bug 578691) and it looks like you get the type with getAttribute and then compares it to 'email' and 'tel' but the type attribute isn't case sensitive so type='EMAIL' should work too. You can use .type which returns the type in lower case but you will have to depend on bugs implementing that (should land for ff4).

-----

So we could add .type to our fake object to get better support with very little effort.
Created attachment 461553 [details] [diff] [review]
patch

This approach works well and is forward compatible
Assignee: nobody → mark.finkle
Attachment #461553 - Flags: review?(21)
Created attachment 461614 [details] [diff] [review]
patch 2

Now with more tests
Attachment #461553 - Attachment is obsolete: true
Attachment #461614 - Flags: review?(21)
Attachment #461553 - Flags: review?(21)
(Assignee)

Updated

8 years ago
Attachment #461614 - Flags: review?(21) → review?(mbrubeck)
Comment on attachment 461614 [details] [diff] [review]
patch 2

>+// In case there are real contacts that could mess up our test counts
>+let preEmailCount = fac.autoCompleteSearch("email", "", null, null).matchCount;
>+let prePhoneCount = fac.autoCompleteSearch("tel", "", null, null).matchCount;

This looks fine, but would it be more robust to just remove the real contact provider for these tests, using |_contacts.providers = [];|?

r=mbrubeck
Attachment #461614 - Flags: review?(mbrubeck) → review+
(In reply to comment #4)
> Comment on attachment 461614 [details] [diff] [review]
> patch 2
> 
> >+// In case there are real contacts that could mess up our test counts
> >+let preEmailCount = fac.autoCompleteSearch("email", "", null, null).matchCount;
> >+let prePhoneCount = fac.autoCompleteSearch("tel", "", null, null).matchCount;
> 
> This looks fine, but would it be more robust to just remove the real contact
> provider for these tests, using |_contacts.providers = [];|?
> 
> r=mbrubeck

LOL! That was exactly my first approach. But then I worried about making _providers inaccessible, breaking these tests. So I switched to this way for now.
pushed:
http://hg.mozilla.org/mobile-browser/rev/143255567eca
Status: NEW → RESOLVED
Last Resolved: 8 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.