diff --git a/browser/components/safebrowsing/content/test/head.js b/browser/components/safebrowsing/content/test/head.js index 7c5518da973d..c81bd8a43cbc 100644 --- a/browser/components/safebrowsing/content/test/head.js +++ b/browser/components/safebrowsing/content/test/head.js @@ -86,7 +86,7 @@ function waitForDBInit(callback) { }); } -Services.prefs.setCharPref("urlclassifier.malwareTable", "test-malware-simple,test-unwanted-simple"); +Services.prefs.setCharPref("urlclassifier.malwareTable", "test-malware-simple,test-unwanted-simple,test-harmful.simple"); Services.prefs.setCharPref("urlclassifier.phishTable", "test-phish-simple"); Services.prefs.setCharPref("urlclassifier.blockedTable", "test-block-simple"); SafeBrowsing.init(); diff --git a/toolkit/components/url-classifier/tests/mochitest/test_classifier.html b/toolkit/components/url-classifier/tests/mochitest/test_classifier.html index fa66987eb61d..9ed91d32eda0 100644 --- a/toolkit/components/url-classifier/tests/mochitest/test_classifier.html +++ b/toolkit/components/url-classifier/tests/mochitest/test_classifier.html @@ -33,7 +33,10 @@ var testData = [ }, { url: "blocked.example.com/", db: "test-block-simple" - } + }, + { url: "harmful.example.com/", + db: "test-harmful-simple" + }, ]; const Cc = SpecialPowers.Cc; @@ -81,6 +84,16 @@ var testURLs = [ table: "test-phish-simple", result: Cr.NS_ERROR_PHISHING_URI }, + { url: "http://harmful.example.com", + trackingProtection: false, + table: "test-harmful-simple", + result: Cr.NS_ERROR_HARMFUL_URI + }, + { url: "http://harmful.example.com", + trackingProtection: true, + table: "test-harmful-simple", + result: Cr.NS_ERROR_HARMFUL_URI + }, { url: "http://tracking.example.com", trackingProtection: false, table: "test-track-simple", @@ -135,7 +148,7 @@ function testService() { return; } let test = testURLs.shift(); - let tables = "test-malware-simple,test-unwanted-simple,test-phish-simple,test-track-simple,test-block-simple"; + let tables = "test-malware-simple,test-unwanted-simple,test-phish-simple,test-track-simple,test-block-simple,test-harmful-simple"; let uri = ios.newURI(test.url); let prin = ssm.createCodebasePrincipal(uri, {}); is(service.classifyLocal(uri, tables), test.table, @@ -158,10 +171,11 @@ function testService() { } SpecialPowers.pushPrefEnv( - {"set" : [["urlclassifier.malwareTable", "test-malware-simple,test-unwanted-simple"], + {"set" : [["urlclassifier.malwareTable", "test-malware-simple,test-unwanted-simple,test-harmful-simple"], ["urlclassifier.phishTable", "test-phish-simple"], ["urlclassifier.downloadBlockTable", "test-block-simple"], ["urlclassifier.trackingTable", "test-track-simple"], + ["browser.safebrowsing.debug", true], ["privacy.trackingprotection.annotate_channels", true]]}, function() { classifierHelper.waitForInit() diff --git a/toolkit/components/url-classifier/tests/unit/head_urlclassifier.js b/toolkit/components/url-classifier/tests/unit/head_urlclassifier.js index 62bcde83a738..be55f6bff4e0 100644 --- a/toolkit/components/url-classifier/tests/unit/head_urlclassifier.js +++ b/toolkit/components/url-classifier/tests/unit/head_urlclassifier.js @@ -56,12 +56,14 @@ function cleanUp() { delFile("safebrowsing/test-malware-simple.sbstore"); delFile("safebrowsing/test-unwanted-simple.sbstore"); delFile("safebrowsing/test-block-simple.sbstore"); + delFile("safebrowsing/test-harmful-simple.sbstore"); delFile("safebrowsing/test-track-simple.sbstore"); delFile("safebrowsing/test-trackwhite-simple.sbstore"); delFile("safebrowsing/test-phish-simple.pset"); delFile("safebrowsing/test-malware-simple.pset"); delFile("safebrowsing/test-unwanted-simple.pset"); delFile("safebrowsing/test-block-simple.pset"); + delFile("safebrowsing/test-harmful-simple.pset"); delFile("safebrowsing/test-track-simple.pset"); delFile("safebrowsing/test-trackwhite-simple.pset"); delFile("safebrowsing/moz-phish-simple.sbstore"); diff --git a/toolkit/components/url-classifier/tests/unit/test_threat_type_conversion.js b/toolkit/components/url-classifier/tests/unit/test_threat_type_conversion.js index f7c51b9562a7..023bcab2b34f 100644 --- a/toolkit/components/url-classifier/tests/unit/test_threat_type_conversion.js +++ b/toolkit/components/url-classifier/tests/unit/test_threat_type_conversion.js @@ -7,6 +7,7 @@ function run_test() { equal(urlUtils.convertListNameToThreatType("goog-malware-proto"), 1); equal(urlUtils.convertListNameToThreatType("googpub-phish-proto"), 2); equal(urlUtils.convertListNameToThreatType("goog-unwanted-proto"), 3); + equal(urlUtils.convertListNameToThreatType("goog-harmful-proto"), 4); equal(urlUtils.convertListNameToThreatType("goog-phish-proto"), 5); try { @@ -23,6 +24,7 @@ function run_test() { equal(urlUtils.convertThreatTypeToListNames(1), "goog-malware-proto"); equal(urlUtils.convertThreatTypeToListNames(2), "googpub-phish-proto,test-phish-proto"); equal(urlUtils.convertThreatTypeToListNames(3), "goog-unwanted-proto,test-unwanted-proto"); + equal(urlUtils.convertThreatTypeToListNames(4), "goog-harmful-proto"); equal(urlUtils.convertThreatTypeToListNames(5), "goog-phish-proto"); try {