Bug 402611: Deal with changes to the safebrowsing v2 protocol. r=tony, a1.9=beltzner

This commit is contained in:
2008-01-28 15:04:43 -08:00
parent a680d3b177
commit af17275326
24 changed files with 2466 additions and 695 deletions

View File

@@ -47,6 +47,7 @@
// reportURL: When shown a warning bubble, we send back the user decision
// (get me out of here/ignore warning) to this URL (strip cookies
// first). This is optional.
// gethashURL: Url for requesting complete hashes from the provider.
// reportGenericURL: HTML page for general user feedback
// reportPhishURL: HTML page for notifying the provider of a new phishing page
// reportErrorURL: HTML page for notifying the provider of a false positive
@@ -110,6 +111,7 @@ PROT_DataProvider.prototype.loadDataProviderPrefs_ = function() {
this.lookupURL_ = this.getUrlPref_(basePref + "lookupURL");
this.keyURL_ = this.getUrlPref_(basePref + "keyURL");
this.reportURL_ = this.getUrlPref_(basePref + "reportURL");
this.gethashURL_ = this.getUrlPref_(basePref + "gethashURL");
// Urls to HTML report pages
this.reportGenericURL_ = this.getUrlPref_(basePref + "reportGenericURL");
@@ -143,6 +145,8 @@ PROT_DataProvider.prototype.updateListManager_ = function() {
// Clear the key to stop updates.
listManager.setKeyUrl("");
}
listManager.setGethashUrl(this.getGethashURL());
}
/**
@@ -206,11 +210,9 @@ PROT_DataProvider.prototype.getUpdateURL = function() {
PROT_DataProvider.prototype.getLookupURL = function() {
return this.lookupURL_;
}
PROT_DataProvider.prototype.getKeyURL = function() {
return this.keyURL_;
}
PROT_DataProvider.prototype.getReportURL = function() {
return this.reportURL_;
PROT_DataProvider.prototype.getGethashURL = function() {
return this.gethashURL_;
}
PROT_DataProvider.prototype.getReportGenericURL = function() {

View File

@@ -61,16 +61,14 @@ function PROT_MalwareWarden() {
var testUpdate =
"n:1000\ni:test-malware-simple\nad:1\n" +
"a:1:" + testData.length + "\n" +
testData +
"\n";
"a:1:32:" + testData.length + "\n" +
testData;
testData = "mozilla.com/firefox/its-a-trap.html";
testUpdate +=
"n:1000\ni:test-phish-simple\nad:1\n" +
"a:1:" + testData.length + "\n" +
testData +
"\n";
"a:1:32:" + testData.length + "\n" +
testData;
var dbService_ = Cc["@mozilla.org/url-classifier/dbservice;1"]
.getService(Ci.nsIUrlClassifierDBService);
@@ -92,7 +90,7 @@ function PROT_MalwareWarden() {
try {
dbService_.beginUpdate(listener);
dbService_.beginStream();
dbService_.beginStream("");
dbService_.updateStream(testUpdate);
dbService_.finishStream();
dbService_.finishUpdate();

View File

@@ -375,6 +375,9 @@ PROT_PhishingWarden.prototype.addWebProgressToAllTabs_ = function() {
* @param url
*/
PROT_PhishingWarden.prototype.onDocNavStart = function(request, url) {
// XXX: most of this code is dead and needs to be removed.
return;
G_Debug(this, "checkRemote: " +
(this.checkRemote_ ? "yes" : "no"));

View File

@@ -73,7 +73,7 @@ var safebrowsing = {
safebrowsing.malwareWarden = malwareWarden;
// Register tables
malwareWarden.registerBlackTable("goog-malware-sha128");
malwareWarden.registerBlackTable("goog-malware-shavar");
malwareWarden.maybeToggleUpdateChecking();
@@ -87,7 +87,7 @@ var safebrowsing = {
// Register tables
// XXX: move table names to a pref that we originally will download
// from the provider (need to workout protocol details)
phishWarden.registerBlackTable("goog-phish-sha128");
phishWarden.registerBlackTable("goog-phish-shavar");
// Download/update lists if we're in non-enhanced mode
phishWarden.maybeToggleUpdateChecking();