Files
tubestation/browser/experiments/test/addons/experiment-racybranch/bootstrap.js
Kris Maglione 683a97d172 Bug 1431533: Part 5a - Auto-rewrite code to use ChromeUtils import methods. r=florian
This was done using the following script:
37e3803c7a/processors/chromeutils-import.jsm

MozReview-Commit-ID: 1Nc3XDu0wGl
2018-01-29 15:20:18 -08:00

36 lines
890 B
JavaScript

/* exported startup, shutdown, install, uninstall */
var {classes: Cc, interfaces: Ci, utils: Cu} = Components;
ChromeUtils.import("resource:///modules/experiments/Experiments.jsm");
ChromeUtils.import("resource://gre/modules/Services.jsm");
var gStarted = false;
function startup(data, reasonCode) {
if (gStarted) {
return;
}
gStarted = true;
// delay realstartup to trigger the race condition
Services.tm.dispatchToMainThread(realstartup);
}
function realstartup() {
let experiments = Experiments.instance();
let experiment = experiments._getActiveExperiment();
if (experiment.branch) {
Cu.reportError("Found pre-existing branch: " + experiment.branch);
return;
}
let branch = "racy-set";
experiments.setExperimentBranch(experiment.id, branch)
.catch(Cu.reportError);
}
function shutdown() { }
function install() { }
function uninstall() { }