B2G/gecko/browser/components/feeds/src/WebContentConverter.js
/**
   * Save Web Content Handler metadata to persistent preferences. 
   * @param   contentType
   *          The content Type being handled
   * @param   uri
   *          The uri of the web service
   * @param   title
   *          The human readable name of the web service
   *
   * This data is stored under:
   * 
   *    browser.contentHandlers.type0 = content/type
   *    browser.contentHandlers.uri0 = http://www.foo.com/q=%s
   *    browser.contentHandlers.title0 = Foo 2.0alphr
   */
Save Web Content Handler metadata to persistent preferences.
@param   contentType
The content Type being handled
@param   uri
The uri of the web service
@param   title
The human readable name of the web service

This data is stored under.


Save Web Content Handler metadata to persistent preferences . @param contentType The content Type being handled @param uri The uri of the web service @param title The human readable name of the web service This data is stored under .
function WCCR__saveContentHandlerToPrefs(contentType, uri, title) {
    var ps = 
        Cc["@mozilla.org/preferences-service;1"].
        getService(Ci.nsIPrefService);
    var i = 0;
    var typeBranch = null;
    while (true) {
      typeBranch = 
        ps.getBranch(PREF_CONTENTHANDLERS_BRANCH + i + ".");
      try {
        typeBranch.getCharPref("type");
        ++i;
      }
      catch (e) {
        break;
      }
    }
    if (typeBranch) {
      typeBranch.setCharPref("type", contentType);
      var pls = 
          Cc["@mozilla.org/pref-localizedstring;1"].
          createInstance(Ci.nsIPrefLocalizedString);
      pls.data = uri;
      typeBranch.setComplexValue("uri", Ci.nsIPrefLocalizedString, pls);
      pls.data = title;
      typeBranch.setComplexValue("title", Ci.nsIPrefLocalizedString, pls);
      ps.savePrefFile(null);
    }
  }
function WCCR__saveContentHandlerToPrefs ( contentType , uri , title ) { var ps = Cc [ "@mozilla.org/preferences-service;1" ] . getService ( Ci . nsIPrefService ) ; var i = 0 ; var typeBranch = null ; while ( true ) { typeBranch = ps . getBranch ( PREF_CONTENTHANDLERS_BRANCH + i + "." ) ; try { typeBranch . getCharPref ( "type" ) ; ++ i ; } catch ( e ) { break ; } } if ( typeBranch ) { typeBranch . setCharPref ( "type" , contentType ) ; var pls = Cc [ "@mozilla.org/pref-localizedstring;1" ] . createInstance ( Ci . nsIPrefLocalizedString ) ; pls . data = uri ; typeBranch . setComplexValue ( "uri" , Ci . nsIPrefLocalizedString , pls ) ; pls . data = title ; typeBranch . setComplexValue ( "title" , Ci . nsIPrefLocalizedString , pls ) ; ps . savePrefFile ( null ) ; } }
Save Web Content Handler metadata to persistent preferences.
Save Web Content Handler metadata to persistent preferences .
// No more handlers