Bug 1857998 [wpt PR 42432] - [css-nesting-ident] Enable relaxed syntax, a=testonly
[gecko.git] / browser / actors / AboutPluginsParent.sys.mjs
blobefde242dffcf9e4d40ed436180a597be83161a20
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 lazy = {};
7 ChromeUtils.defineESModuleGetters(lazy, {
8   AddonManager: "resource://gre/modules/AddonManager.sys.mjs",
9 });
11 // Lists all the properties that plugins.html needs
12 const NEEDED_PROPS = [
13   "name",
14   "pluginLibraries",
15   "pluginFullpath",
16   "version",
17   "isActive",
18   "blocklistState",
19   "description",
22 export class AboutPluginsParent extends JSWindowActorParent {
23   async receiveMessage(message) {
24     switch (message.name) {
25       case "RequestPlugins":
26         function filterProperties(plugin) {
27           let filtered = {};
28           for (let prop of NEEDED_PROPS) {
29             filtered[prop] = plugin[prop];
30           }
31           return filtered;
32         }
34         let plugins = await lazy.AddonManager.getAddonsByTypes(["plugin"]);
35         return plugins.map(filterProperties);
36     }
38     return undefined;
39   }