<commit_before>// import localforage from
//   '../../../node_modules/localforage/dist/localforage.nopromises';
import {sendException} from '../support/fshGa';
import stringifyError from '../common/stringifyError';

function forageGet(forage, dfr) {
  localforage.getItem(forage, function getItemCallback(err, data) {
    if (err) {
      sendException(forage + ' localforage.getItem error ' +
        stringifyError(err), false);
      dfr.reject(err);
    } else {
      // returns null if key does not exist
      dfr.resolve(data);
    }
  });
}

export default function getForage(forage) {
  // Wrap in jQuery Deferred because we're using 1.7
  // rather than using ES6 promise
  var dfr = $.Deferred();
  if (window.localforage) {
    forageGet(forage, dfr);
  }
  return dfr.promise();
}<commit_msg>Firefox IndexedDB Unknown Error handler<commit_after>// import localforage from
//   '../../../node_modules/localforage/dist/localforage.nopromises';
import {sendException} from '../support/fshGa';
import stringifyError from '../common/stringifyError';

function forageGet(forage, dfr) {
  localforage.getItem(forage).then(function(data) {
    // returns null if key does not exist
    dfr.resolve(data);
  }).catch(function(err) {
    if (err.name === 'UnknownError') {
      $('#dialog_msg').html('Firefox IndexedDB - UnknownError<br>' +
        err.message + '<br>' +
        '<a href="https://bugzilla.mozilla.org/show_bug.cgi?id=944918">' +
        'More Info</a>').dialog('open');
    } else {
      sendException(forage + ' localforage.getItem error ' +
        stringifyError(err), false);
    }
    dfr.reject(err);
  });
}

export default function getForage(forage) {
  // Wrap in jQuery Deferred because we're using 1.7
  // rather than using ES6 promise
  var dfr = $.Deferred();
  if (window.localforage) {
    forageGet(forage, dfr);
  }
  return dfr.promise();
}
{'fraction_non_alphanumeric': 0.15082315454062667, 'fraction_numerical': 0.006372809346787042, 'mean_word_length': 3.2818181818181817, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 1, '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': '1659078', 'n_tokens_mistral': 624, 'n_tokens_neox': 614, 'n_words': 138}