diff options
Diffstat (limited to 'toolkit/components/url-classifier/tests/mochitest/test_safebrowsing_bug1272239.html')
-rw-r--r-- | toolkit/components/url-classifier/tests/mochitest/test_safebrowsing_bug1272239.html | 87 |
1 files changed, 0 insertions, 87 deletions
diff --git a/toolkit/components/url-classifier/tests/mochitest/test_safebrowsing_bug1272239.html b/toolkit/components/url-classifier/tests/mochitest/test_safebrowsing_bug1272239.html deleted file mode 100644 index 8066c2a37..000000000 --- a/toolkit/components/url-classifier/tests/mochitest/test_safebrowsing_bug1272239.html +++ /dev/null @@ -1,87 +0,0 @@ -<!DOCTYPE HTML> -<html> -<head> - <title>Bug 1272239 - Only tables with provider could register gethash url in listmanager.</title> - <script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> - <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"> -</head> - -<body> -<p id="display"></p> -<div id="content" style="display: none"> -</div> -<pre id="test"> - -<script class="testbody" type="text/javascript"> - -var Cc = SpecialPowers.Cc; -var Ci = SpecialPowers.Ci; - -// List all the tables -const prefs = [ - "urlclassifier.phishTable", - "urlclassifier.malwareTable", - "urlclassifier.downloadBlockTable", - "urlclassifier.downloadAllowTable", - "urlclassifier.trackingTable", - "urlclassifier.trackingWhitelistTable", - "urlclassifier.blockedTable" -]; - -var prefService = Cc["@mozilla.org/preferences-service;1"] - .getService(Ci.nsIPrefService); - -// Get providers -var providers = {}; - -var branch = prefService.getBranch("browser.safebrowsing.provider."); -var children = branch.getChildList("", {}); - -for (var child of children) { - var prefComponents = child.split("."); - var providerName = prefComponents[0]; - providers[providerName] = {}; -} - -// Get lists from |browser.safebrowsing.provider.PROVIDER_NAME.lists| preference. -var listsWithProvider = []; -var listsToProvider = []; -for (var provider in providers) { - var pref = "browser.safebrowsing.provider." + provider + ".lists"; - var list = SpecialPowers.getCharPref(pref).split(","); - - listsToProvider = listsToProvider.concat(list.map( () => { return provider; })); - listsWithProvider = listsWithProvider.concat(list); -} - -// Get all the lists -var lists = []; -for (var pref of prefs) { - lists = lists.concat(SpecialPowers.getCharPref(pref).split(",")); -} - -var listmanager = Cc["@mozilla.org/url-classifier/listmanager;1"]. - getService(Ci.nsIUrlListManager); - -for (var list of lists) { - if (!list) - continue; - - // For lists having a provider, it should have a correct gethash url - // For lists without a provider, for example, test-malware-simple, it should not - // have a gethash url. - var url = listmanager.getGethashUrl(list); - var index = listsWithProvider.indexOf(list); - if (index >= 0) { - var provider = listsToProvider[index]; - var pref = "browser.safebrowsing.provider." + provider + ".gethashURL"; - is(url, SpecialPowers.getCharPref(pref), list + " matches its gethash url"); - } else { - is(url, "", list + " should not have a gethash url"); - } -} - -</script> -</pre> -</body> -</html> |