gecko-dev/toolkit/components/aboutthirdparty/tests/xpcshell/test_aboutthirdparty.js
Toshihito Kikuchi 718f8615db Bug 1695817 - Part 6: Show name and publisher of an application owning a module. r=Gijs,fluent-reviewers,mhowell
This patch adds application info (Name and Publisher for now) in the
about:third-party page if a module is a part of an installed application,
which is registered in the registry and shown in Windows Control Panel.
To achieve this, we parse the registry to collect installed applications
in the background task.

Differential Revision: https://phabricator.services.mozilla.com/D109306
2021-05-28 22:35:59 +00:00

65 lines
1.8 KiB
JavaScript

/* 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."
);
});