syncing safe browsing files with branch

original bug: 341946 (bonecho patch)
r=mmchew,sr=bryner
This commit is contained in:
tony%ponderer.org 2006-07-06 00:09:56 +00:00
parent d637ae6ad4
commit 21c97ec915
5 changed files with 34 additions and 8 deletions

View File

@ -207,6 +207,7 @@ MultiTableQuerier.prototype.run = function() {
// Break circular ref to callback.
this.evilCallback_ = null;
this.listManager_ = null;
}
}
@ -218,8 +219,13 @@ MultiTableQuerier.prototype.whiteTableCallback_ = function(isFound) {
//G_Debug(this, "whiteTableCallback_: " + isFound);
if (!isFound)
this.run();
else
else {
G_Debug(this, "Found in whitelist: " + this.url_)
// Break circular ref to callback.
this.evilCallback_ = null;
this.listManager_ = null;
}
}
/**
@ -234,5 +240,9 @@ MultiTableQuerier.prototype.blackTableCallback_ = function(isFound) {
// In the blacklist, must be an evil url.
G_Debug(this, "Found in blacklist: " + this.url_)
this.evilCallback_();
// Break circular ref to callback.
this.evilCallback_ = null;
this.listManager_ = null;
}
}

View File

@ -148,6 +148,7 @@ PROT_PhishingWarden.prototype.QueryInterface = function(iid) {
PROT_PhishingWarden.prototype.shutdown = function() {
this.progressListener_.callback = null;
this.progressListener_ = null;
this.listManager_ = null;
}
/**

View File

@ -101,6 +101,7 @@ var safebrowsing = {
// so we need to check all requests that fired before deferredStartup.
if (!phishWarden.phishWardenEnabled_) {
safebrowsing.progressListenerCallback.requests = null;
safebrowsing.progressListenerCallback.onDocNavStart = null;
safebrowsing.progressListenerCallback = null;
safebrowsing.progressListener = null;
return;
@ -115,6 +116,7 @@ var safebrowsing = {
}
// Cleanup
safebrowsing.progressListenerCallback.requests = null;
safebrowsing.progressListenerCallback.onDocNavStart = null;
safebrowsing.progressListenerCallback = null;
safebrowsing.progressListener = null;
},

View File

@ -71,6 +71,8 @@ nsDocNavStartProgressListener::~nsDocNavStartProgressListener()
}
mTimers.Clear();
mCallback = nsnull;
}
// nsDocNavStartProgressListener::AttachListeners

View File

@ -79,19 +79,30 @@ UrlClassifierTableUrl.prototype.exists = function(url, callback) {
var dbservice_ = Cc["@mozilla.org/url-classifier/dbservice;1"]
.getService(Ci.nsIUrlClassifierDBService);
var callbackHelper = new UrlLookupCallback(callback);
dbservice_.exists(this.name,
canonicalized,
BindToObject(this.dbCallback_,
this,
callback));
BindToObject(callbackHelper.dbCallback,
callbackHelper));
}
/**
* For the url table, we only need to check if the return value is a non-empty
* string.
* A helper class for handling url lookups in the database. This allows us to
* break our reference to callback to avoid memory leaks.
* @param callback nsIUrlListManagerCallback
*/
UrlClassifierTableUrl.prototype.dbCallback_ = function(callback, value) {
callback.handleEvent(value.length > 0);
function UrlLookupCallback(callback) {
this.callback_ = callback;
}
/**
* Callback function from nsIUrlClassifierDBService.exists. For url lookup,
* any non-empty string value is a database hit.
* @param value String
*/
UrlLookupCallback.prototype.dbCallback = function(value) {
this.callback_.handleEvent(value.length > 0);
this.callback_ = null;
}
/////////////////////////////////////////////////////////////////////