Bug 1185549 - Add two test domains to test-track-simple for testing and touring tracking protection. r=francois

--HG--
extra : commitid : LsqBSGfXUYA
extra : rebase_source : 6ea924ebaf755b427ffdb4af716fa4ee9ff55f82
This commit is contained in:
Matthew Noorenberghe 2015-07-27 11:05:26 -07:00
Родитель 457d562ce1
Коммит 6f9a19b6df
3 изменённых файлов: 19 добавлений и 7 удалений

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

@ -4730,11 +4730,11 @@ pref("urlclassifier.malwareTable", "goog-malware-shavar,goog-unwanted-shavar,tes
pref("urlclassifier.phishTable", "goog-phish-shavar,test-phish-simple");
pref("urlclassifier.downloadBlockTable", "");
pref("urlclassifier.downloadAllowTable", "");
pref("urlclassifier.disallow_completions", "test-malware-simple,test-phish-simple,test-unwanted-simple,goog-downloadwhite-digest256,mozpub-track-digest256");
pref("urlclassifier.disallow_completions", "test-malware-simple,test-phish-simple,test-unwanted-simple,test-track-simple,goog-downloadwhite-digest256,mozpub-track-digest256");
// The table and update/gethash URLs for Safebrowsing phishing and malware
// checks.
pref("urlclassifier.trackingTable", "mozpub-track-digest256");
pref("urlclassifier.trackingTable", "test-track-simple,mozpub-track-digest256");
pref("browser.trackingprotection.updateURL", "https://tracking.services.mozilla.com/downloads?client=SAFEBROWSING_ID&appver=%VERSION%&pver=2.2");
pref("browser.trackingprotection.gethashURL", "https://tracking.services.mozilla.com/gethash?client=SAFEBROWSING_ID&appver=%VERSION%&pver=2.2");

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

@ -214,6 +214,10 @@ this.SafeBrowsing = {
const phishURL = "itisatrap.org/firefox/its-a-trap.html";
const malwareURL = "itisatrap.org/firefox/its-an-attack.html";
const unwantedURL = "itisatrap.org/firefox/unwanted.html";
const trackerURLs = [
"trackertest.org/",
"itisatracker.org/",
];
let update = "n:1000\ni:test-malware-simple\nad:1\n" +
"a:1:32:" + malwareURL.length + "\n" +
@ -224,6 +228,11 @@ this.SafeBrowsing = {
update += "n:1000\ni:test-unwanted-simple\nad:1\n" +
"a:1:32:" + unwantedURL.length + "\n" +
unwantedURL;
trackerURLs.forEach((trackerURL, i) => {
update += "n:1000\ni:test-track-simple\nad:1\n" +
"a:" + (i + 1) + ":32:" + trackerURL.length + "\n" +
trackerURL;
});
log("addMozEntries:", update);
let db = Cc["@mozilla.org/url-classifier/dbservice;1"].
@ -238,7 +247,8 @@ this.SafeBrowsing = {
};
try {
db.beginUpdate(dummyListener, "test-malware-simple,test-phish-simple,test-unwanted-simple", "");
let tables = "test-malware-simple,test-phish-simple,test-unwanted-simple,test-track-simple";
db.beginUpdate(dummyListener, tables, "");
db.beginStream("", "");
db.updateStream(update);
db.finishStream();

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

@ -54,17 +54,20 @@ function cleanUp() {
delFile("safebrowsing/test-phish-simple.sbstore");
delFile("safebrowsing/test-malware-simple.sbstore");
delFile("safebrowsing/test-unwanted-simple.sbstore");
delFile("safebrowsing/test-track-simple.sbstore");
delFile("safebrowsing/test-phish-simple.cache");
delFile("safebrowsing/test-malware-simple.cache");
delFile("safebrowsing/test-unwanted-simple.cache");
delFile("safebrowsing/test-track-simple.cache");
delFile("safebrowsing/test-phish-simple.pset");
delFile("safebrowsing/test-malware-simple.pset");
delFile("safebrowsing/test-unwanted-simple.pset");
delFile("safebrowsing/test-track-simple.pset");
delFile("testLarge.pset");
delFile("testNoDelta.pset");
}
var allTables = "test-phish-simple,test-malware-simple,test-unwanted-simple";
var allTables = "test-phish-simple,test-malware-simple,test-unwanted-simple,test-track-simple";
var dbservice = Cc["@mozilla.org/url-classifier/dbservice;1"].getService(Ci.nsIUrlClassifierDBService);
var streamUpdater = Cc["@mozilla.org/url-classifier/streamupdater;1"]
@ -144,8 +147,7 @@ function doSimpleUpdate(updateText, success, failure) {
updateSuccess: function(requestedTimeout) { success(requestedTimeout); }
};
dbservice.beginUpdate(listener,
"test-phish-simple,test-malware-simple,test-unwanted-simple");
dbservice.beginUpdate(listener, allTables);
dbservice.beginStream("", "");
dbservice.updateStream(updateText);
dbservice.finishStream();
@ -187,7 +189,7 @@ function doStreamUpdate(updateText, success, failure, downloadFailure) {
downloadFailure = failure;
}
streamUpdater.downloadUpdates("test-phish-simple,test-malware-simple,test-unwanted-simple", "",
streamUpdater.downloadUpdates(allTables, "",
dataUpdate, success, failure, downloadFailure);
}