<commit_before>"use strict";
// Cu is defined in xpc_head.js
/* globals Cu */

Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/Task.jsm");
Cu.import("resource://testing-common/httpd.js"); /* globals HttpServer */
Cu.import("resource://gre/modules/osfile.jsm", this); /* globals OS */
Cu.import("resource://shield-recipe-client/lib/NormandyApi.jsm", this);

class PrefManager {
  constructor() {
    this.oldValues = {};
  }

  setCharPref(name, value) {
    if (!(name in this.oldValues)) {
      this.oldValues[name] = Services.prefs.getCharPref(name);
    }
    Services.prefs.setCharPref(name, value);
  }

  cleanup() {
    for (const name of this.oldValues) {
      Services.setCharPref(name, this.oldValues[name]);
    }
  }
}

function withServer(task) {
  return function* inner() {<commit_msg>Fix errors in NormandyAPI XPCShell tests.<commit_after>"use strict";
// Cu is defined in xpc_head.js
/* globals Cu */

Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/Task.jsm");
Cu.import("resource://testing-common/httpd.js"); /* globals HttpServer */
Cu.import("resource://gre/modules/osfile.jsm", this); /* globals OS */
Cu.import("resource://shield-recipe-client/lib/NormandyApi.jsm", this);

class PrefManager {
  constructor() {
    this.oldValues = {};
  }

  setCharPref(name, value) {
    if (!(name in this.oldValues)) {
      this.oldValues[name] = Services.prefs.getCharPref(name);
    }
    Services.prefs.setCharPref(name, value);
  }

  cleanup() {
    for (const name of Object.keys(this.oldValues)) {
      Services.prefs.setCharPref(name, this.oldValues[name]);
    }
  }
}

function withServer(task) {
  return function* inner() {
{'fraction_non_alphanumeric': 0.1746952988972722, 'fraction_numerical': 0.0, 'mean_word_length': 3.775623268698061, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '972412', 'n_tokens_mistral': 595, 'n_tokens_neox': 576, 'n_words': 99}