mozilla

Compare Revisions

How to implement a custom autocomplete search component

Change Revisions

Revision 37909:

Revision 37909 by Mozdevuser22 on

Revision 37910:

Revision 37910 by Mozdevuser22 on

Title:
How to implement a custom autocomplete search component
How to implement a custom autocomplete search component
Slug:
How_to_implement_custom_autocomplete_search_component
How_to_implement_custom_autocomplete_search_component
Content:

Revision 37909
Revision 37910
n288      <span style="font-size: x-large;"><strong>Introduced in Gecn288      <span style="font-size: x-large;"><strong>&nbsp;&nbsp;Intro
>ko 2 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1)</strong></span>duced in Gecko 2</strong> <span style="font-size: large;"><strong
>>>>(Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1)</strong></span></s
 >pan>
n291      The components registration was changed (see &nbsp;more infn291      &nbsp;&nbsp;The components registration was changed (see &n
>o here:&nbsp;<a href="/en/XPCOM/XPCOM_changes_in_Gecko_2.0" title>bsp;more info here:&nbsp;<a href="/en/XPCOM/XPCOM_changes_in_Geck
>="https://developer.mozilla.org/en/XPCOM/XPCOM_changes_in_Gecko_2>o_2.0" title="https://developer.mozilla.org/en/XPCOM/XPCOM_change
>.0">https://developer.mozilla.org/en/XPCOM/XPCOM_changes_in_Gecko>s_in_Gecko_2.0">https://developer.mozilla.org/en/XPCOM/XPCOM_chan
>_2.0</a>),>ges_in_Gecko_2.0</a>),
n294      So you need to make the following 2 additional changes:n294      &nbsp;&nbsp;So you need to make the following 2 additional 
 >changes:
n297      <u><strong>Change 1 - Add "<em>NSGetFactory</em>", after "<n297      <u><strong>&nbsp;&nbsp;Change 1 - Add "<em>NSGetFactory</em
>em>NSGetModule</em>", in the end of JS file, as follows:</strong>>>", after "<em>NSGetModule</em>", in the end of JS file, as follo
></u>>ws:</strong></u>
n300      <code>function NSGetFactory(cid) {</code>n300      <code>&nbsp;&nbsp;function NSGetFactory(cid) {</code>
n303      <code>&nbsp;&nbsp;if (cid.toString().toUpperCase() != CLASSn303      <code>&nbsp;&nbsp; &nbsp;if (cid.toString().toUpperCase() !
>_ID.toString().toUpperCase())</code>>= CLASS_ID.toString().toUpperCase())</code>
n306      <code>&nbsp;&nbsp; &nbsp; &nbsp;throw Components.results.NSn306      <code>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;throw Components.res
>_ERROR_FACTORY_NOT_REGISTERED;</code>>ults.NS_ERROR_FACTORY_NOT_REGISTERED;</code>
307    </div>
308    <div class="geckoVersionNote">
309      <code><br></code>
n315      <code>}</code>n312      <code>&nbsp;&nbsp;}</code>
n318      <u><strong>Change 2 - explictly register the compienent by n315      <u><strong>&nbsp;&nbsp;Change 2 - explictly register the co
>adding the following 2 lines in the "chrome.manifest":</strong></>mpienent by adding the following 2 lines in the "chrome.manifest"
>u>>:</strong></u>
n322        <code>component {<span class="Apple-style-span" style="fon319        <code>&nbsp;&nbsp;component {6224daa1-71a2-4d1a-ad90-01ca
>nt-family: 'Courier New', 'Andale Mono', monospace; line-height: >1c08e3237} components/[YourFileName].js</code>
>normal; white-space: pre;">6224daa1-71a2-4d1a-ad90-01ca1c08e323</ 
>span>7} components/[YourFileName].js</code> 
t325        <code>contract @mozilla.org/autocomplete/search;1?name=<st322        <code>&nbsp;&nbsp;contract @mozilla.org/autocomplete/sear
>pan class="Apple-style-span" style="font-family: 'Courier New', '>ch;1?name=simple-autocomplete {6224daa1-71a2-4d1a-ad90-01ca1c08e3
>Andale Mono', monospace; line-height: normal; white-space: pre;">>23}</code>
>simple-autocomplete</span> {<span class="Apple-style-span" style= 
>"font-family: 'Courier New', 'Andale Mono', monospace; line-heigh 
>t: normal; white-space: pre;">6224daa1-71a2-4d1a-ad90-01ca1c08e32 
>3</span>}</code> 

Back to History