|
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/. */ |
|
4 |
|
5 const nsIBLS = Components.interfaces.nsIBlocklistService; |
|
6 |
|
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 }]; |
|
35 |
|
36 |
|
37 function run_test() { |
|
38 createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9"); |
|
39 |
|
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")); |
|
42 |
|
43 var blocklist = Components.classes["@mozilla.org/extensions/blocklist;1"] |
|
44 .getService(nsIBLS); |
|
45 |
|
46 // blocked (sanity check) |
|
47 do_check_true(blocklist.getPluginBlocklistState(PLUGINS[0], "1", "1.9") == nsIBLS.STATE_BLOCKED); |
|
48 |
|
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); |
|
51 |
|
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); |
|
54 |
|
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); |
|
57 |
|
58 } |