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
56
57
58
59
60
61
62
63
64
65
|
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
add_task(async () => {
Assert.equal(
kATP.lookupModuleType(kExtensionModuleName),
0,
"lookupModuleType() returns 0 before system info is collected."
);
// Make sure successive calls of collectSystemInfo() do not
// cause anything bad.
const kLoopCount = 100;
const promises = [];
for (let i = 0; i < kLoopCount; ++i) {
promises.push(kATP.collectSystemInfo());
}
const collectSystemInfoResults = await Promise.allSettled(promises);
Assert.equal(collectSystemInfoResults.length, kLoopCount);
for (const result of collectSystemInfoResults) {
Assert.ok(
result.status == "fulfilled",
"All results from collectSystemInfo() are resolved."
);
}
Assert.equal(
kATP.lookupModuleType("SHELL32.dll"),
Ci.nsIAboutThirdParty.ModuleType_ShellExtension,
"Shell32.dll is always registered as a shell extension."
);
Assert.equal(
kATP.lookupModuleType(""),
Ci.nsIAboutThirdParty.ModuleType_Unknown,
"Looking up an empty string succeeds and returns ModuleType_Unknown."
);
Assert.equal(
kATP.lookupModuleType(null),
Ci.nsIAboutThirdParty.ModuleType_Unknown,
"Looking up null succeeds and returns ModuleType_Unknown."
);
Assert.equal(
kATP.lookupModuleType("invalid name"),
Ci.nsIAboutThirdParty.ModuleType_Unknown,
"Looking up an invalid name succeeds and returns ModuleType_Unknown."
);
Assert.equal(
kATP.lookupApplication(""),
null,
"Looking up an empty string returns null."
);
Assert.equal(
kATP.lookupApplication("invalid path"),
null,
"Looking up an invalid path returns null."
);
});
|