Bug 1331534 - Temporarily ignore v4 hash completion result.
MozReview-Commit-ID: 9P68EP5CWG4
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -5183,16 +5183,18 @@ pref("browser.safebrowsing.allowOverride
#ifdef MOZILLA_OFFICIAL
// Normally the "client ID" sent in updates is appinfo.name, but for
// official Firefox releases from Mozilla we use a special identifier.
pref("browser.safebrowsing.id", "navclient-auto-ffox");
#else
pref("browser.safebrowsing.id", "Firefox");
#endif
+pref("browser.safebrowsing.temporary.take_v4_completion_result", false);
+
// Turn off Spatial navigation by default.
pref("snav.enabled", false);
// Debug-only pref to force enable the AccessibleCaret. If you want to
// control AccessibleCaret by mouse, you'll need to set
// "layout.accessiblecaret.hide_carets_for_mouse_input" to false.
pref("layout.accessiblecaret.enabled", false);
--- a/toolkit/components/url-classifier/nsUrlClassifierDBService.cpp
+++ b/toolkit/components/url-classifier/nsUrlClassifierDBService.cpp
@@ -117,16 +117,21 @@ LazyLogModule gUrlClassifierDbServiceLog
#define BLOCKED_TABLE_PREF "urlclassifier.blockedTable"
#define DOWNLOAD_BLOCK_TABLE_PREF "urlclassifier.downloadBlockTable"
#define DOWNLOAD_ALLOW_TABLE_PREF "urlclassifier.downloadAllowTable"
#define DISALLOW_COMPLETION_TABLE_PREF "urlclassifier.disallow_completions"
#define CONFIRM_AGE_PREF "urlclassifier.max-complete-age"
#define CONFIRM_AGE_DEFAULT_SEC (45 * 60)
+// TODO: The following two prefs are to be removed after we
+// roll out full v4 hash completion. See Bug 1331534.
+#define TAKE_V4_COMPLETION_RESULT_PREF "browser.safebrowsing.temporary.take_v4_completion_result"
+#define TAKE_V4_COMPLETION_RESULT_DEFAULT false
+
class nsUrlClassifierDBServiceWorker;
// Singleton instance.
static nsUrlClassifierDBService* sUrlClassifierDBService;
nsIThread* nsUrlClassifierDBService::gDbBackgroundThread = nullptr;
// Once we've committed to shutting down, don't do work in the background
@@ -1050,16 +1055,25 @@ nsUrlClassifierLookupCallback::Completio
NS_IMETHODIMP
nsUrlClassifierLookupCallback::Completion(const nsACString& completeHash,
const nsACString& tableName,
uint32_t chunkId)
{
LOG(("nsUrlClassifierLookupCallback::Completion [%p, %s, %d]",
this, PromiseFlatCString(tableName).get(), chunkId));
+
+ if (StringEndsWith(tableName, NS_LITERAL_CSTRING("-proto")) &&
+ !Preferences::GetBool(TAKE_V4_COMPLETION_RESULT_PREF,
+ TAKE_V4_COMPLETION_RESULT_DEFAULT)) {
+ // Bug 1331534 - We temporarily ignore hash completion result
+ // for v4 tables.
+ return NS_OK;
+ }
+
mozilla::safebrowsing::Completion hash;
hash.Assign(completeHash);
// Send this completion to the store for caching.
if (!mCacheResults) {
mCacheResults = new CacheResultArray();
if (!mCacheResults)
return NS_ERROR_OUT_OF_MEMORY;