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 import { BaseAction } from "resource://normandy/actions/BaseAction.sys.mjs";
7 const OPT_OUT_STUDIES_ENABLED_PREF = "app.shield.optoutstudies.enabled";
10 * Base class for local study actions.
12 * This should be subclassed. Subclasses must implement _run() for
13 * per-recipe behavior, and may implement _finalize for actions to be
14 * taken once after recipes are run.
16 * For actions that need to be taken once before recipes are run
17 * _preExecution may be overriden but the overridden method must
18 * call the parent method to ensure the appropriate checks occur.
20 * Other methods should be overridden with care, to maintain the life
21 * cycle events and error reporting implemented by this class.
23 export class BaseStudyAction extends BaseAction {
25 if (!Services.policies.isAllowed("Shield")) {
26 this.log.debug("Disabling Shield because it's blocked by policy.");
30 if (!Services.prefs.getBoolPref(OPT_OUT_STUDIES_ENABLED_PREF, true)) {
32 "User has opted-out of opt-out experiments, disabling action."