Closed Bug 583238 Opened 9 years ago Closed 9 years ago

Investigate ways to pass more context to FAC.autoCompleteSearch

Categories

(Firefox for Android Graveyard :: General, defect)

x86
Linux
defect
Not set

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: mfinkle, Assigned: mfinkle)

Details

Attachments

(1 file, 1 obsolete file)

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.
Attached patch patch (obsolete) — Splinter Review
This approach works well and is forward compatible
Assignee: nobody → mark.finkle
Attachment #461553 - Flags: review?(21)
Attached patch patch 2Splinter Review
Now with more tests
Attachment #461553 - Attachment is obsolete: true
Attachment #461614 - Flags: review?(21)
Attachment #461553 - Flags: review?(21)
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
Closed: 9 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.