mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-02 18:08:58 +00:00
bug 345675: unwanted connection to www.google.com at startup with Safe
Browsing disabled patch: don't get key if sb off, don't get whitelist tables if remote checking on r=mmchew,sr=bryner
This commit is contained in:
parent
0653b5c604
commit
aa98d1eae0
@ -66,6 +66,10 @@ function PROT_DataProvider() {
|
||||
// Watch for changes in the data provider and update accordingly.
|
||||
this.prefs_.addObserver(kDataProviderIdPref,
|
||||
BindToObject(this.loadDataProviderPrefs_, this));
|
||||
|
||||
// Watch for when anti-phishing is toggled on or off.
|
||||
this.prefs_.addObserver(kPhishWardenEnabledPref,
|
||||
BindToObject(this.loadDataProviderPrefs_, this));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -114,7 +118,13 @@ PROT_DataProvider.prototype.updateListManager_ = function() {
|
||||
// pref observer that sets the update url accordingly.
|
||||
listManager.setUpdateUrl(this.getUpdateURL());
|
||||
|
||||
listManager.setKeyUrl(this.getKeyURL());
|
||||
// setKeyUrl has the side effect of fetching a key from the server.
|
||||
// This shouldn't happen if anti-phishing is disabled, so we need to
|
||||
// check for that.
|
||||
var isEnabled = this.prefs_.getPref(kPhishWardenEnabledPref, false);
|
||||
if (isEnabled) {
|
||||
listManager.setKeyUrl(this.getKeyURL());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -180,24 +180,11 @@ PROT_PhishingWarden.prototype.maybeToggleUpdateChecking = function() {
|
||||
return;
|
||||
|
||||
// We update and save to disk all tables if we don't have remote checking
|
||||
// enabled. However, as long as the warden is enabled we always update the
|
||||
// whitelist, even if remote checking is disabled. This gives a performance
|
||||
// benefit since we use the WL to suppress BL lookups.
|
||||
//
|
||||
// phishEnabled remote WLupdates BLupdates
|
||||
// T T T F
|
||||
// T F T T
|
||||
// F T F F
|
||||
// F F F F
|
||||
|
||||
if (phishWardenEnabled === true) {
|
||||
// enabled.
|
||||
if (phishWardenEnabled === true && this.checkRemote_ === false) {
|
||||
this.enableBlacklistTableUpdates();
|
||||
this.enableWhitelistTableUpdates();
|
||||
if (this.checkRemote_ === true) {
|
||||
this.disableBlacklistTableUpdates();
|
||||
} else if (this.checkRemote_ === false) {
|
||||
this.enableBlacklistTableUpdates();
|
||||
}
|
||||
} else if (phishWardenEnabled === false) {
|
||||
} else {
|
||||
this.disableBlacklistTableUpdates();
|
||||
this.disableWhitelistTableUpdates();
|
||||
}
|
||||
|
@ -268,12 +268,13 @@ PROT_ListManager.prototype.maybeToggleUpdateChecking = function() {
|
||||
// are no tables that want to be updated - we dont need to check anything.
|
||||
if (this.requireTableUpdates() === true) {
|
||||
G_Debug(this, "Starting managing lists");
|
||||
this.startUpdateChecker();
|
||||
|
||||
// Multiple warden can ask us to reenable updates at the same time, but we
|
||||
// really just need to schedule a single update.
|
||||
if (!this.currentUpdateChecker_)
|
||||
this.currentUpdateChecker_ =
|
||||
new G_Alarm(BindToObject(this.checkForUpdates, this), 3000);
|
||||
this.startUpdateChecker();
|
||||
} else {
|
||||
G_Debug(this, "Stopping managing lists (if currently active)");
|
||||
this.stopUpdateChecker(); // Cancel pending updates
|
||||
@ -301,6 +302,11 @@ PROT_ListManager.prototype.stopUpdateChecker = function() {
|
||||
this.updateChecker_.cancel();
|
||||
this.updateChecker_ = null;
|
||||
}
|
||||
// Cancel the oneoff check from maybeToggleUpdateChecking.
|
||||
if (this.currentUpdateChecker_) {
|
||||
this.currentUpdateChecker_.cancel();
|
||||
this.currentUpdateChecker_ = null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user