1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
// turn on Cu.isInAutomation
Services.prefs.setBoolPref(PREF_DISABLE_SECURITY, true);
const ID = "addon1@tests.mozilla.org";
add_task(async function run_test() {
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2");
let xpi = createAddon({
id: ID,
targetApplications: [
{
id: "xpcshell@tests.mozilla.org",
minVersion: "0.1",
maxVersion: "0.2",
},
],
});
await manuallyInstall(xpi, AddonTestUtils.profileExtensions, ID);
AddonManager.strictCompatibility = false;
await promiseStartupManager();
let addon = await AddonManager.getAddonByID(ID);
Assert.notEqual(addon, null);
await addon.disable();
Assert.ok(addon.userDisabled);
Assert.ok(!addon.isActive);
Assert.ok(!addon.appDisabled);
let promise = promiseAddonEvent("onPropertyChanged");
AddonManager.strictCompatibility = true;
let [, properties] = await promise;
Assert.deepEqual(
properties,
["appDisabled"],
"Got onPropertyChanged for appDisabled"
);
Assert.ok(addon.appDisabled);
promise = promiseAddonEvent("onPropertyChanged");
AddonManager.strictCompatibility = false;
[, properties] = await promise;
Assert.deepEqual(
properties,
["appDisabled"],
"Got onPropertyChanged for appDisabled"
);
Assert.ok(!addon.appDisabled);
});
|