Bug 1943650 - Command-line --help output misformatted after --dbus-service. r=emilio
[gecko.git] / toolkit / components / normandy / content / ShieldFrameParent.sys.mjs
blob73aa62047418f50a0cffed8e77a1e3b3a641b752
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   AboutPages: "resource://normandy-content/AboutPages.sys.mjs",
9 });
11 export class ShieldFrameParent extends JSWindowActorParent {
12   async receiveMessage(msg) {
13     let { aboutStudies } = lazy.AboutPages;
14     switch (msg.name) {
15       case "Shield:AddToWeakSet":
16         aboutStudies.addToWeakSet(this.browsingContext);
17         break;
18       case "Shield:RemoveFromWeakSet":
19         aboutStudies.removeFromWeakSet(this.browsingContext);
20         break;
21       case "Shield:GetAddonStudyList":
22         return aboutStudies.getAddonStudyList();
23       case "Shield:GetPreferenceStudyList":
24         return aboutStudies.getPreferenceStudyList();
25       case "Shield:GetMessagingSystemList":
26         return aboutStudies.getMessagingSystemList();
27       case "Shield:RemoveAddonStudy":
28         aboutStudies.removeAddonStudy(msg.data.recipeId, msg.data.reason);
29         break;
30       case "Shield:RemovePreferenceStudy":
31         aboutStudies.removePreferenceStudy(
32           msg.data.experimentName,
33           msg.data.reason
34         );
35         break;
36       case "Shield:RemoveMessagingSystemExperiment":
37         aboutStudies.removeMessagingSystemExperiment(
38           msg.data.slug,
39           msg.data.reason
40         );
41         break;
42       case "Shield:OpenDataPreferences":
43         aboutStudies.openDataPreferences();
44         break;
45       case "Shield:GetStudiesEnabled":
46         return aboutStudies.getStudiesEnabled();
47       case "Shield:ExperimentOptIn":
48         return aboutStudies.optInToExperiment(msg.data);
49     }
51     return null;
52   }