<commit_before>// Spoof the prompt service. Interesting thread on mozillazine:
// http://www.mail-archive.com/dev-tech-xpcom@lists.mozilla.org/msg00193.html

const CC = Components.classes;
const CI = Components.interfaces;
const CR = Components.results;
const CU = Components.utils;

CU.import("resource://gre/modules/XPCOMUtils.jsm");

var EXCLUDED_NAMES = [
  'QueryInterface',
  'alert',
  'alertCheck',
  'confirm',
  'confirmCheck',
  'confirmEx',
  'getPrompt',
  'prompt',
  'promptPassword',
  'promptUsernameAndPassword',
  'select'
];

function addInterfaces(to, delegate, interfaces) {
  goog.array.forEach(interfaces, function(iid) {
    try {
      var queried = delegate.QueryInterface(iid);
      for (var i in queried) {
        if (!goog.array.contains(EXCLUDED_NAMES,  i.toString())) {
          Logger.dumpn("adding: " + i);
          to[i] = queried[i];
        }
      }
    } catch (ignored) {}
  });
}

// Implementation of nsIPrompt
function ObservingAlert(parentWindow, delegate) {
  Components.utils.import('resource://fxdriver/modules/utils.js');
<commit_msg>SimonStewart: Less verboseness when setting up the prompt service<commit_after>// Spoof the prompt service. Interesting thread on mozillazine:
// http://www.mail-archive.com/dev-tech-xpcom@lists.mozilla.org/msg00193.html

const CC = Components.classes;
const CI = Components.interfaces;
const CR = Components.results;
const CU = Components.utils;

CU.import("resource://gre/modules/XPCOMUtils.jsm");

var EXCLUDED_NAMES = [
  'QueryInterface',
  'alert',
  'alertCheck',
  'confirm',
  'confirmCheck',
  'confirmEx',
  'getPrompt',
  'prompt',
  'promptPassword',
  'promptUsernameAndPassword',
  'select'
];

function addInterfaces(to, delegate, interfaces) {
  goog.array.forEach(interfaces, function(iid) {
    try {
      var queried = delegate.QueryInterface(iid);
      for (var i in queried) {
        if (!goog.array.contains(EXCLUDED_NAMES,  i.toString())) {
          to[i] = queried[i];
        }
      }
    } catch (ignored) {}
  });
}

// Implementation of nsIPrompt
function ObservingAlert(parentWindow, delegate) {
  Components.utils.import('resource://fxdriver/modules/utils.js');

{'fraction_non_alphanumeric': 0.1433150183150183, 'fraction_numerical': 0.004578754578754579, 'mean_word_length': 3.7916666666666665, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 2, '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': '1462313', 'n_tokens_mistral': 748, 'n_tokens_neox': 720, 'n_words': 140}