diff options
Diffstat (limited to 'toolkit/components/normandy/actions/MessagingExperimentAction.jsm')
-rw-r--r-- | toolkit/components/normandy/actions/MessagingExperimentAction.jsm | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/toolkit/components/normandy/actions/MessagingExperimentAction.jsm b/toolkit/components/normandy/actions/MessagingExperimentAction.jsm new file mode 100644 index 0000000000..76783ae8f0 --- /dev/null +++ b/toolkit/components/normandy/actions/MessagingExperimentAction.jsm @@ -0,0 +1,44 @@ +/* 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/. */ + +"use strict"; + +const { BaseStudyAction } = ChromeUtils.import( + "resource://normandy/actions/BaseStudyAction.jsm" +); + +ChromeUtils.defineModuleGetter( + this, + "ExperimentManager", + "resource://messaging-system/experiments/ExperimentManager.jsm" +); + +ChromeUtils.defineModuleGetter( + this, + "ActionSchemas", + "resource://normandy/actions/schemas/index.js" +); + +const EXPORTED_SYMBOLS = ["MessagingExperimentAction"]; +const RECIPE_SOURCE = "normandy"; + +class MessagingExperimentAction extends BaseStudyAction { + constructor() { + super(); + this.manager = ExperimentManager; + } + get schema() { + return ActionSchemas["messaging-experiment"]; + } + + async _run(recipe) { + if (recipe.arguments) { + await this.manager.onRecipe(recipe.arguments, RECIPE_SOURCE); + } + } + + async _finalize() { + this.manager.onFinalize(RECIPE_SOURCE); + } +} |