Bug 1369160 - Add a Shavar list to be used to suppress the infobar
The Flash infobar is showing up a bit too often. There are a few changes planned to address this. One of them is a list that will contain sites that should never display infobars. This patch allows the list to be downloaded from Shavar and updated via the URL classifier.
MozReview-Commit-ID: BgAaysyRzIE
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -5228,17 +5228,17 @@ pref("urlclassifier.phishTable", "googpu
#ifdef NIGHTLY_BUILD
pref("urlclassifier.downloadAllowTable", "goog-downloadwhite-digest256,goog-downloadwhite-proto");
pref("urlclassifier.downloadBlockTable", "goog-badbinurl-shavar,goog-badbinurl-proto");
#else
pref("urlclassifier.downloadAllowTable", "goog-downloadwhite-digest256");
pref("urlclassifier.downloadBlockTable", "goog-badbinurl-shavar");
#endif // NIGHTLY_BUILD
-pref("urlclassifier.disallow_completions", "test-malware-simple,test-phish-simple,test-unwanted-simple,test-track-simple,test-trackwhite-simple,test-block-simple,test-flashallow-simple,testexcept-flashallow-simple,test-flash-simple,testexcept-flash-simple,test-flashsubdoc-simple,testexcept-flashsubdoc-simple,goog-downloadwhite-digest256,base-track-digest256,mozstd-trackwhite-digest256,content-track-digest256,mozplugin-block-digest256,mozplugin2-block-digest256,block-flash-digest256,except-flash-digest256,allow-flashallow-digest256,except-flashallow-digest256,block-flashsubdoc-digest256,except-flashsubdoc-digest256");
+pref("urlclassifier.disallow_completions", "test-malware-simple,test-phish-simple,test-unwanted-simple,test-track-simple,test-trackwhite-simple,test-block-simple,test-flashallow-simple,testexcept-flashallow-simple,test-flash-simple,testexcept-flash-simple,test-flashsubdoc-simple,testexcept-flashsubdoc-simple,goog-downloadwhite-digest256,base-track-digest256,mozstd-trackwhite-digest256,content-track-digest256,mozplugin-block-digest256,mozplugin2-block-digest256,block-flash-digest256,except-flash-digest256,allow-flashallow-digest256,except-flashallow-digest256,block-flashsubdoc-digest256,except-flashsubdoc-digest256,except-flashinfobar-digest256");
// The table and update/gethash URLs for Safebrowsing phishing and malware
// checks.
pref("urlclassifier.trackingTable", "test-track-simple,base-track-digest256");
pref("urlclassifier.trackingWhitelistTable", "test-trackwhite-simple,mozstd-trackwhite-digest256");
// The number of random entries to send with a gethash request.
pref("urlclassifier.gethashnoise", 4);
@@ -5296,17 +5296,17 @@ pref("browser.safebrowsing.provider.goog
pref("browser.safebrowsing.reportPhishURL", "https://%LOCALE%.phish-report.mozilla.com/?hl=%LOCALE%&url=");
// The table and global pref for blocking plugin content
pref("browser.safebrowsing.blockedURIs.enabled", true);
pref("urlclassifier.blockedTable", "test-block-simple,mozplugin-block-digest256");
// The protocol version we communicate with mozilla server.
pref("browser.safebrowsing.provider.mozilla.pver", "2.2");
-pref("browser.safebrowsing.provider.mozilla.lists", "base-track-digest256,mozstd-trackwhite-digest256,content-track-digest256,mozplugin-block-digest256,mozplugin2-block-digest256,block-flash-digest256,except-flash-digest256,allow-flashallow-digest256,except-flashallow-digest256,block-flashsubdoc-digest256,except-flashsubdoc-digest256");
+pref("browser.safebrowsing.provider.mozilla.lists", "base-track-digest256,mozstd-trackwhite-digest256,content-track-digest256,mozplugin-block-digest256,mozplugin2-block-digest256,block-flash-digest256,except-flash-digest256,allow-flashallow-digest256,except-flashallow-digest256,block-flashsubdoc-digest256,except-flashsubdoc-digest256,except-flashinfobar-digest256");
pref("browser.safebrowsing.provider.mozilla.updateURL", "https://shavar.services.mozilla.com/downloads?client=SAFEBROWSING_ID&appver=%MAJOR_VERSION%&pver=2.2");
pref("browser.safebrowsing.provider.mozilla.gethashURL", "https://shavar.services.mozilla.com/gethash?client=SAFEBROWSING_ID&appver=%MAJOR_VERSION%&pver=2.2");
// Set to a date in the past to force immediate download in new profiles.
pref("browser.safebrowsing.provider.mozilla.nextupdatetime", "1");
// Block lists for tracking protection. The name values will be used as the keys
// to lookup the localized name in preferences.properties.
pref("browser.safebrowsing.provider.mozilla.lists.base.name", "mozstdName");
pref("browser.safebrowsing.provider.mozilla.lists.base.description", "mozstdDesc");
@@ -5314,16 +5314,17 @@ pref("browser.safebrowsing.provider.mozi
pref("browser.safebrowsing.provider.mozilla.lists.content.description", "mozfullDesc");
pref("urlclassifier.flashAllowTable", "test-flashallow-simple,allow-flashallow-digest256");
pref("urlclassifier.flashAllowExceptTable", "testexcept-flashallow-simple,except-flashallow-digest256");
pref("urlclassifier.flashTable", "test-flash-simple,block-flash-digest256");
pref("urlclassifier.flashExceptTable", "testexcept-flash-simple,except-flash-digest256");
pref("urlclassifier.flashSubDocTable", "test-flashsubdoc-simple,block-flashsubdoc-digest256");
pref("urlclassifier.flashSubDocExceptTable", "testexcept-flashsubdoc-simple,except-flashsubdoc-digest256");
+pref("urlclassifier.flashInfobarTable", "except-flashinfobar-digest256");
pref("plugins.http_https_only", true);
pref("plugins.flashBlock.enabled", false);
// Allow users to ignore Safe Browsing warnings.
pref("browser.safebrowsing.allowOverride", true);
#ifdef MOZILLA_OFFICIAL
--- a/toolkit/components/url-classifier/SafeBrowsing.jsm
+++ b/toolkit/components/url-classifier/SafeBrowsing.jsm
@@ -42,17 +42,18 @@ const tablePreferences = [
"urlclassifier.trackingTable",
"urlclassifier.trackingWhitelistTable",
"urlclassifier.blockedTable",
"urlclassifier.flashAllowTable",
"urlclassifier.flashAllowExceptTable",
"urlclassifier.flashTable",
"urlclassifier.flashExceptTable",
"urlclassifier.flashSubDocTable",
- "urlclassifier.flashSubDocExceptTable"
+ "urlclassifier.flashSubDocExceptTable",
+ "urlclassifier.flashInfobarTable"
];
this.SafeBrowsing = {
init: function() {
if (this.initialized) {
log("Already initialized");
return;
@@ -113,34 +114,40 @@ this.SafeBrowsing = {
this.registerTableWithURLs(this.trackingProtectionWhitelists[i]);
}
for (let i = 0; i < this.blockedLists.length; ++i) {
this.registerTableWithURLs(this.blockedLists[i]);
}
for (let i = 0; i < this.flashLists.length; ++i) {
this.registerTableWithURLs(this.flashLists[i]);
}
+ for (let i = 0; i < this.flashInfobarLists.length; ++i) {
+ this.registerTableWithURLs(this.flashInfobarLists[i]);
+ }
},
initialized: false,
phishingEnabled: false,
malwareEnabled: false,
trackingEnabled: false,
blockedEnabled: false,
trackingAnnotations: false,
flashBlockEnabled: false,
+ flashInfobarListEnabled: true,
phishingLists: [],
malwareLists: [],
downloadBlockLists: [],
downloadAllowLists: [],
trackingProtectionLists: [],
trackingProtectionWhitelists: [],
blockedLists: [],
+ flashLists: [],
+ flashInfobarLists: [],
updateURL: null,
gethashURL: null,
reportURL: null,
getReportURL: function(kind, info) {
let pref;
@@ -208,17 +215,18 @@ this.SafeBrowsing = {
this.trackingProtectionLists,
this.trackingProtectionWhitelists,
this.blockedLists,
flashAllowTable,
flashAllowExceptTable,
flashTable,
flashExceptTable,
flashSubDocTable,
- flashSubDocExceptTable] = tablePreferences.map(getLists);
+ flashSubDocExceptTable,
+ this.flashInfobarLists] = tablePreferences.map(getLists);
this.flashLists = flashAllowTable.concat(flashAllowExceptTable,
flashTable,
flashExceptTable,
flashSubDocTable,
flashSubDocExceptTable)
this.updateProviderURLs();
@@ -301,17 +309,18 @@ this.SafeBrowsing = {
}
}, this);
},
controlUpdateChecking: function() {
log("phishingEnabled:", this.phishingEnabled, "malwareEnabled:",
this.malwareEnabled, "trackingEnabled:", this.trackingEnabled,
"blockedEnabled:", this.blockedEnabled, "trackingAnnotations",
- this.trackingAnnotations, "flashBlockEnabled", this.flashBlockEnabled);
+ this.trackingAnnotations, "flashBlockEnabled", this.flashBlockEnabled,
+ "flashInfobarListEnabled:", this.flashInfobarListEnabled);
let listManager = Cc["@mozilla.org/url-classifier/listmanager;1"].
getService(Ci.nsIUrlListManager);
for (let i = 0; i < this.phishingLists.length; ++i) {
if (this.phishingEnabled) {
listManager.enableUpdate(this.phishingLists[i]);
} else {
@@ -362,16 +371,23 @@ this.SafeBrowsing = {
}
for (let i = 0; i < this.flashLists.length; ++i) {
if (this.flashBlockEnabled) {
listManager.enableUpdate(this.flashLists[i]);
} else {
listManager.disableUpdate(this.flashLists[i]);
}
}
+ for (let i = 0; i < this.flashInfobarLists.length; ++i) {
+ if (this.flashInfobarListEnabled) {
+ listManager.enableUpdate(this.flashInfobarLists[i]);
+ } else {
+ listManager.disableUpdate(this.flashInfobarLists[i]);
+ }
+ }
listManager.maybeToggleUpdateChecking();
},
addMozEntries: function() {
// Add test entries to the DB.
// XXX bug 779008 - this could be done by DB itself?
const phishURL = "itisatrap.org/firefox/its-a-trap.html";