nsUrlClassifierListManager

nsUrlClassifierListManager - [email protected] 37

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
[email protected] 37 "e:\builds\moz2_slave\win32_build\build\toolkit\components\url- classifier\src\nsUrlClassifierListManager.js" const Cc = Components.classes; const Ci = Components.interfaces; [email protected] 37 "e:\builds\moz2_slave\win32_build\build\toolkit\components\url- classifier\content\listmanager.js" // A class that manages lists, namely white and black lists for // phishing or malware protection. The ListManager knows how to fetch, // update, and store lists. // // There is a single listmanager for the whole application. // // TODO more comprehensive update tests, for example add unittest check // that the listmanagers tables are properly written on updates function QueryAdapter(callback) { this.callback_ = callback; }; QueryAdapter.prototype.handleResponse = function(value) { this.callback_.handleEvent(value); } /** * 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; // set when we toggle updates 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 /*only once*/); // Lazily create the key manager (to avoid fetching keys when they // aren't needed). this.keyManager_ = null; this.rekeyObserver_ = new G_ObserverServiceObserver(
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
'url-classifier-rekey-requested', BindToObject(this.rekey_, this), false); this.updateWaitingForKey_ = false; this.cookieObserver_ = new G_ObserverServiceObserver( 'cookie-changed', BindToObject(this.cookieChanged_, this), false); /* Backoff interval should be between 30 and 60 minutes. */ var backoffInterval = 30 * 60 * 1000; backoffInterval += Math.floor(Math.random() * (30 * 60 * 1000)); this.requestBackoff_ = new RequestBackoff(2 /* max errors */, 60*1000 /* retry interval, 1 min */, 4 /* num requests */, 60*60*1000 /* request time, 60 min */, backoffInterval /* backoff interval, 60 min */, 8*60*60*1000 /* max backoff, 8hr */); this.dbService_ = Cc["@mozilla.org/url-classifier/dbservice;1"] .getService(Ci.nsIUrlClassifierDBService); this.hashCompleter_ = Cc["@mozilla.org/url-classifier/hashcompleter;1"] .getService(Ci.nsIUrlClassifierHashCompleter); } /** * xpcom-shutdown callback * Delete all of our data tables which seem to leak otherwise. */ PROT_ListManager.prototype.shutdown_ = function() { if (this.keyManager_) { this.keyManager_.shutdown(); } for (var name in this.tablesData) { delete this.tablesData[name]; } } /** * Set the url we check for updates. If the new url is valid and different, * update our table list. * * After setting the update url, the caller is responsible for registering
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 03/11/2010 for the course ISD 125 taught by Professor 3ant during the Spring '10 term at École Normale Supérieure.

Page1 / 11

nsUrlClassifierListManager - [email protected] 37

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online