B2G/gecko/toolkit/components/url-classifier/content/listmanager.js
/**
 * A ListManager keeps track of black and white lists and knows
 * how to update them.
 *
 * @constructor
 */
A ListManager keeps track of black and white lists and knows
how to update them.

@constructor
A ListManager keeps track of black and white lists and knows how to update them . @constructor
function PROT_ListManager() {
  this.debugZone = "listmanager";
  G_debugService.enableZone(this.debugZone);
  this.currentUpdateChecker_ = null;   
  this.prefs_ = new G_Preferences();
  this.updateInterval = this.prefs_.getPref("urlclassifier.updateinterval", 30 * 60) * 1000;
  this.updateserverURL_ = null;
  this.gethashURL_ = null;
  this.isTesting_ = false;
  this.tablesData = {};
  this.observerServiceObserver_ = new G_ObserverServiceObserver(
                                          'quit-application',
                                          BindToObject(this.shutdown_, this),
                                          true );
  this.keyManager_ = null;
  this.rekeyObserver_ = new G_ObserverServiceObserver(
                                          'url-classifier-rekey-requested',
                                          BindToObject(this.rekey_, this),
                                          false);
  this.updateWaitingForKey_ = false;
  this.cookieObserver_ = new G_ObserverServiceObserver(
                                          'cookie-changed',
                                          BindToObject(this.cookieChanged_, this),
                                          false);
  var backoffInterval = 30 * 60 * 1000;
  backoffInterval += Math.floor(Math.random() * (30 * 60 * 1000));
  this.requestBackoff_ = new RequestBackoff(2 ,
                                      60*1000 ,
                                            4 ,
                                   60*60*1000 ,
                              backoffInterval ,
                                 8*60*60*1000 );
  this.dbService_ = Cc["@mozilla.org/url-classifier/dbservice;1"]
                   .getService(Ci.nsIUrlClassifierDBService);
  this.hashCompleter_ = Cc["@mozilla.org/url-classifier/hashcompleter;1"]
                        .getService(Ci.nsIUrlClassifierHashCompleter);
}
function PROT_ListManager ( ) { this . debugZone = "listmanager" ; G_debugService . enableZone ( this . debugZone ) ; this . currentUpdateChecker_ = null ; this . prefs_ = new G_Preferences ( ) ; this . updateInterval = this . prefs_ . getPref ( "urlclassifier.updateinterval" , 30 * 60 ) * 1000 ; this . updateserverURL_ = null ; this . gethashURL_ = null ; this . isTesting_ = false ; this . tablesData = { } ; this . observerServiceObserver_ = new G_ObserverServiceObserver ( 'quit-application' , BindToObject ( this . shutdown_ , this ) , true ) ; this . keyManager_ = null ; this . rekeyObserver_ = new G_ObserverServiceObserver ( 'url-classifier-rekey-requested' , BindToObject ( this . rekey_ , this ) , false ) ; this . updateWaitingForKey_ = false ; this . cookieObserver_ = new G_ObserverServiceObserver ( 'cookie-changed' , BindToObject ( this . cookieChanged_ , this ) , false ) ; var backoffInterval = 30 * 60 * 1000 ; backoffInterval += Math . floor ( Math . random ( ) * ( 30 * 60 * 1000 ) ) ; this . requestBackoff_ = new RequestBackoff ( 2 , 60 * 1000 , 4 , 60 * 60 * 1000 , backoffInterval , 8 * 60 * 60 * 1000 ) ; this . dbService_ = Cc [ "@mozilla.org/url-classifier/dbservice;1" ] . getService ( Ci . nsIUrlClassifierDBService ) ; this . hashCompleter_ = Cc [ "@mozilla.org/url-classifier/hashcompleter;1" ] . getService ( Ci . nsIUrlClassifierHashCompleter ) ; }
A ListManager keeps track of black and white lists and knows
 how to update them.
A ListManager keeps track of black and white lists and knows how to update them .
// set when we toggle updates /*only once*/ // Lazily create the key manager (to avoid fetching keys when they // aren't needed). /* Backoff interval should be between 30 and 60 minutes. */ /* max errors */ /* retry interval, 1 min */ /* num requests */ /* request time, 60 min */ /* backoff interval, 60 min */ /* max backoff, 8hr */