Name Description Size
data
head_urlclassifier.js -*- indent-tabs-mode: nil; js-indent-level: 2 -*- * function dumpn(s) { dump(s + "\n"); } const NS_APP_USER_PROFILE_50_DIR = "ProfD"; const NS_APP_USER_PROFILE_LOCAL_50_DIR = "ProfLD"; var { HTTP_400, HTTP_401, HTTP_402, HTTP_403, HTTP_404, HTTP_405, HTTP_406, HTTP_407, HTTP_408, HTTP_409, HTTP_410, HTTP_411, HTTP_412, HTTP_413, HTTP_414, HTTP_415, HTTP_417, HTTP_500, HTTP_501, HTTP_502, HTTP_503, HTTP_504, HTTP_505, HttpError, HttpServer, } = ChromeUtils.importESModule("resource://testing-common/httpd.sys.mjs"); do_get_profile(); // Ensure PSM is initialized before the test Cc["@mozilla.org/psm;1"].getService(Ci.nsISupports); // Disable hashcompleter noise for tests Services.prefs.setIntPref("urlclassifier.gethashnoise", 0); // Enable malware/phishing checking for tests Services.prefs.setBoolPref("browser.safebrowsing.malware.enabled", true); Services.prefs.setBoolPref("browser.safebrowsing.blockedURIs.enabled", true); Services.prefs.setBoolPref("browser.safebrowsing.phishing.enabled", true); Services.prefs.setBoolPref( "browser.safebrowsing.provider.test.disableBackoff", true ); // Add testing tables, we don't use moztest-* here because it doesn't support update Services.prefs.setCharPref("urlclassifier.phishTable", "test-phish-simple"); Services.prefs.setCharPref( "urlclassifier.malwareTable", "test-harmful-simple,test-malware-simple,test-unwanted-simple" ); Services.prefs.setCharPref("urlclassifier.blockedTable", "test-block-simple"); Services.prefs.setCharPref("urlclassifier.trackingTable", "test-track-simple"); Services.prefs.setCharPref( "urlclassifier.trackingWhitelistTable", "test-trackwhite-simple" ); // Enable all completions for tests Services.prefs.setCharPref("urlclassifier.disallow_completions", ""); // Hash completion timeout Services.prefs.setIntPref("urlclassifier.gethash.timeout_ms", 5000); function delFile(name) { try { // Delete a previously created sqlite file var file = Services.dirsvc.get("ProfLD", Ci.nsIFile); file.append(name); if (file.exists()) { file.remove(false); } } catch (e) {} } function cleanUp() { delFile("urlclassifier3.sqlite"); delFile("safebrowsing/classifier.hashkey"); delFile("safebrowsing/test-phish-simple.sbstore"); 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"); delFile("safebrowsing/moz-phish-simple.pset"); delFile("testLarge.pset"); delFile("testNoDelta.pset"); } // Update uses allTables by default var allTables = "test-phish-simple,test-malware-simple,test-unwanted-simple,test-track-simple,test-trackwhite-simple,test-block-simple"; var mozTables = "moz-phish-simple"; var dbservice = Cc["@mozilla.org/url-classifier/dbservice;1"].getService( Ci.nsIUrlClassifierDBService ); var streamUpdater = Cc[ "@mozilla.org/url-classifier/streamupdater;1" ].getService(Ci.nsIUrlClassifierStreamUpdater); /* Builds an update from an object that looks like: { "test-phish-simple" : [{ "chunkType" : "a", // 'a' is assumed if not specified "chunkNum" : 1, // numerically-increasing chunk numbers are assumed // if not specified "urls" : [ "foo.com/a", "foo.com/b", "bar.com/" ] } 14568
test_addsub.js 9491
test_backoff.js 2422
test_bug1274685_unowned_list.js 2376
test_canonicalization.js Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ 3292
test_channelClassifierService.js Unit tests for the nsIUrlClassifierSkipListService implementation. 6300
test_dbservice.js 7606
test_digest256.js 4502
test_exceptionListService.js Unit tests for the nsIUrlClassifierExceptionListService implementation. 7431
test_features.js Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ 2062
test_hashcompleter.js Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ 13150
test_hashcompleter_v4.js 9408
test_listmanager.js 11465
test_malwaretable_pref.js 256
test_partial.js DummyCompleter() lets tests easily specify the results of a partial hash completion request. 17715
test_platform_specific_threats.js Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ 2786
test_pref.js 492
test_prefixset.js 4846
test_provider_url.js 1637
test_rsListService.js Unit tests for the nsIUrlClassifierRemoteSettingsService implementation. 12425
test_safebrowsing_protobuf.js 753
test_shouldclassify.js Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ 4347
test_streamupdater.js 7503
test_threat_type_conversion.js 1913
xpcshell.toml 958