Bug 1374731 - Don't use hardcoded test entries for the Flash classification tables. r=bytesized

MozReview-Commit-ID: 1pG11W7PX4R

--HG--
extra : rebase_source : a4c77e4b09a78f515d1485c6ef95cf81f27ee783
This commit is contained in:
Felipe Gomes 2017-06-20 18:15:44 -03:00
Родитель f5e74d23ac
Коммит a45c6fd314
3 изменённых файлов: 21 добавлений и 35 удалений

Просмотреть файл

@ -5218,7 +5218,7 @@ pref("urlclassifier.phishTable", "googpub-phish-shavar,test-phish-simple");
pref("urlclassifier.downloadAllowTable", "goog-downloadwhite-proto");
pref("urlclassifier.downloadBlockTable", "goog-badbinurl-proto");
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");
pref("urlclassifier.disallow_completions", "test-malware-simple,test-phish-simple,test-unwanted-simple,test-track-simple,test-trackwhite-simple,test-block-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.
@ -5294,12 +5294,12 @@ pref("browser.safebrowsing.provider.mozilla.lists.base.description", "mozstdDesc
pref("browser.safebrowsing.provider.mozilla.lists.content.name", "mozfullName");
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.flashAllowTable", "allow-flashallow-digest256");
pref("urlclassifier.flashAllowExceptTable", "except-flashallow-digest256");
pref("urlclassifier.flashTable", "block-flash-digest256");
pref("urlclassifier.flashExceptTable", "except-flash-digest256");
pref("urlclassifier.flashSubDocTable", "block-flashsubdoc-digest256");
pref("urlclassifier.flashSubDocExceptTable", "except-flashsubdoc-digest256");
pref("urlclassifier.flashInfobarTable", "except-flashinfobar-digest256");
pref("plugins.http_https_only", true);

Просмотреть файл

@ -400,13 +400,6 @@ this.SafeBrowsing = {
const whitelistURL = "itisatrap.org/?resource=itisatracker.org";
const blockedURL = "itisatrap.org/firefox/blocked.html";
const flashDenyURL = "flashblock.itisatrap.org/";
const flashDenyExceptURL = "except.flashblock.itisatrap.org/";
const flashAllowURL = "flashallow.itisatrap.org/";
const flashAllowExceptURL = "except.flashallow.itisatrap.org/";
const flashSubDocURL = "flashsubdoc.itisatrap.org/";
const flashSubDocExceptURL = "except.flashsubdoc.itisatrap.org/";
let update = "n:1000\ni:test-malware-simple\nad:1\n" +
"a:1:32:" + malwareURL.length + "\n" +
malwareURL + "\n";
@ -428,24 +421,6 @@ this.SafeBrowsing = {
update += "n:1000\ni:test-block-simple\nad:1\n" +
"a:1:32:" + blockedURL.length + "\n" +
blockedURL;
update += "n:1000\ni:test-flash-simple\nad:1\n" +
"a:1:32:" + flashDenyURL.length + "\n" +
flashDenyURL;
update += "n:1000\ni:testexcept-flash-simple\nad:1\n" +
"a:1:32:" + flashDenyExceptURL.length + "\n" +
flashDenyExceptURL;
update += "n:1000\ni:test-flashallow-simple\nad:1\n" +
"a:1:32:" + flashAllowURL.length + "\n" +
flashAllowURL;
update += "n:1000\ni:testexcept-flashallow-simple\nad:1\n" +
"a:1:32:" + flashAllowExceptURL.length + "\n" +
flashAllowExceptURL;
update += "n:1000\ni:test-flashsubdoc-simple\nad:1\n" +
"a:1:32:" + flashSubDocURL.length + "\n" +
flashSubDocURL;
update += "n:1000\ni:testexcept-flashsubdoc-simple\nad:1\n" +
"a:1:32:" + flashSubDocExceptURL.length + "\n" +
flashSubDocExceptURL;
log("addMozEntries:", update);
let db = Cc["@mozilla.org/url-classifier/dbservice;1"].
@ -466,7 +441,7 @@ this.SafeBrowsing = {
};
try {
let tables = "test-malware-simple,test-phish-simple,test-unwanted-simple,test-track-simple,test-trackwhite-simple,test-block-simple,test-flash-simple,testexcept-flash-simple,test-flashallow-simple,testexcept-flashallow-simple,test-flashsubdoc-simple,testexcept-flashsubdoc-simple";
let tables = "test-malware-simple,test-phish-simple,test-unwanted-simple,test-track-simple,test-trackwhite-simple,test-block-simple";
db.beginUpdate(dummyListener, tables, "");
db.beginStream("", "");
db.updateStream(update);

Просмотреть файл

@ -9,6 +9,7 @@ var classifierTester = {
IFRAME_ID: "testFrame",
FLASHBLOCK_ENABLE_PREF: "plugins.flashBlock.enabled",
FLASH_PLUGIN_USER_SETTING_PREF: "plugin.state.flash",
URLCLASSIFIER_DISALLOW_COMPLETIONS_PREF: "urlclassifier.disallow_completions",
NEVER_ACTIVATE_PREF_VALUE: 0,
ASK_TO_ACTIVATE_PREF_VALUE: 1,
ALWAYS_ACTIVATE_PREF_VALUE: 2,
@ -38,21 +39,29 @@ var classifierTester = {
{
url: "subdocument.example.com/",
db: "test-flashsubdoc-simple",
pref: "urlclassifier.flashThirdPartyTable"
pref: "urlclassifier.flashSubDocTable"
},
{
url: "exception.subdocument.example.com/",
db: "testexcept-flashsubdoc-simple",
pref: "urlclassifier.flashThirdPartyExceptTable"
pref: "urlclassifier.flashSubDocExceptTable"
}
],
setPrefs: function ({setDBs = true, flashBlockEnable = true, flashSetting = classifierTester.ALWAYS_ACTIVATE_PREF_VALUE} = {}) {
if (setDBs) {
let DBs = [];
for (let dbData of classifierTester.dbUrls) {
Services.prefs.setCharPref(dbData.pref, dbData.db);
DBs.push(dbData.db);
}
let completions = Services.prefs.getCharPref(classifierTester.URLCLASSIFIER_DISALLOW_COMPLETIONS_PREF);
completions += "," + DBs.join(",");
Services.prefs.setCharPref(classifierTester.URLCLASSIFIER_DISALLOW_COMPLETIONS_PREF, completions);
}
Services.prefs.setBoolPref(classifierTester.FLASHBLOCK_ENABLE_PREF,
flashBlockEnable);
Services.prefs.setIntPref(classifierTester.FLASH_PLUGIN_USER_SETTING_PREF,
@ -64,6 +73,8 @@ var classifierTester = {
for (let dbData of classifierTester.dbUrls) {
Services.prefs.clearUserPref(dbData.pref);
}
Services.prefs.clearUserPref(classifierTester.URLCLASSIFIER_DISALLOW_COMPLETIONS_PREF);
Services.prefs.clearUserPref(classifierTester.FLASHBLOCK_ENABLE_PREF);
Services.prefs.clearUserPref(classifierTester.FLASH_PLUGIN_USER_SETTING_PREF);
Services.prefs.clearUserPref(classifierTester.ALLOW_CTA_PREF);