Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 const nsIBLS = Components.interfaces.nsIBlocklistService;
7 var PLUGINS = [{
8 // Normal blacklisted plugin, before an invalid regexp
9 name: "test_bug468528_1",
10 version: "5",
11 disabled: false,
12 blocklisted: false
13 },
14 {
15 // Normal blacklisted plugin, with an invalid regexp
16 name: "test_bug468528_2",
17 version: "5",
18 disabled: false,
19 blocklisted: false
20 },
21 {
22 // Normal blacklisted plugin, after an invalid regexp
23 name: "test_bug468528_3",
24 version: "5",
25 disabled: false,
26 blocklisted: false
27 },
28 {
29 // Non-blocklisted plugin
30 name: "test_bug468528_4",
31 version: "5",
32 disabled: false,
33 blocklisted: false
34 }];
37 function run_test() {
38 createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9");
40 // We cannot force the blocklist to update so just copy our test list to the profile
41 copyBlocklistToProfile(do_get_file("data/test_bug468528.xml"));
43 var blocklist = Components.classes["@mozilla.org/extensions/blocklist;1"]
44 .getService(nsIBLS);
46 // blocked (sanity check)
47 do_check_true(blocklist.getPluginBlocklistState(PLUGINS[0], "1", "1.9") == nsIBLS.STATE_BLOCKED);
49 // not blocked - won't match due to invalid regexp
50 do_check_true(blocklist.getPluginBlocklistState(PLUGINS[1], "1", "1.9") == nsIBLS.STATE_NOT_BLOCKED);
52 // blocked - the invalid regexp for the previous item shouldn't affect this one
53 do_check_true(blocklist.getPluginBlocklistState(PLUGINS[2], "1", "1.9") == nsIBLS.STATE_BLOCKED);
55 // not blocked - the previous invalid regexp shouldn't act as a wildcard
56 do_check_true(blocklist.getPluginBlocklistState(PLUGINS[3], "1", "1.9") == nsIBLS.STATE_NOT_BLOCKED);
58 }