mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-12 06:52:25 +00:00
syncing safe browsing files with branch
original bug: 341946 (bonecho patch) r=mmchew,sr=bryner
This commit is contained in:
parent
d637ae6ad4
commit
21c97ec915
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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;
|
||||
},
|
||||
|
@ -71,6 +71,8 @@ nsDocNavStartProgressListener::~nsDocNavStartProgressListener()
|
||||
}
|
||||
|
||||
mTimers.Clear();
|
||||
|
||||
mCallback = nsnull;
|
||||
}
|
||||
|
||||
// nsDocNavStartProgressListener::AttachListeners
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
Loading…
x
Reference in New Issue
Block a user