<commit_before>export default class Permission {

  constructor(win) {
    this._win = win;
    this.DEFAULT = 'default';
    this.GRANTED = 'granted';
    this.DENIED = 'denied';
    this._permissions = [
      this.GRANTED,
      this.DEFAULT,
      this.DENIED
    ];
  }

  /**
   * Requests permission for desktop notifications
   * @param {Function} onGranted - Function to execute once permission is granted
   * @param {Function} onDenied - Function to execute once permission is denied
   * @return {void}
   */
  request(onGranted, onDenied) {
    const existing = this.get();

    /* Permissions already set */
    if (existing !== this.DEFAULT) {
      if (existing === this.GRANTED || existing === 0) {
        if (onGranted) onGranted();
      } else if (onDenied) onDenied();
    }
    /* Safari 6+, Chrome 23+ */
    else if (this._win.Notification && this._win.Notification.requestPermission) {
      this._win.Notification.requestPermission().then(callback).catch(function () {
        if (onDenied) onDenied();
      });
    }
    /* Legacy webkit browsers */
    else if (this._win.webkitNotifications && this._win.webkitNotifications.checkPermission)
      this._win.webkitNotifications.requestPermission(callback);
    /* Let the user continue by default */
    else if (onGranted) onGranted();
  }

  /**
   * Returns whether Push has been granted permission to run
   * @return {Boolean}
   */
  has() {
    return this.get() === this.GRANTED;
  }

  /**
   * Gets the permission level
   * @return {Permission} The permission level
   */
  get() {
    let permission;
<commit_msg>Fixed Permission issue causing tests to stall<commit_after>export default class Permission {

  constructor(win) {
    this._win = win;
    this.DEFAULT = 'default';
    this.GRANTED = 'granted';
    this.DENIED = 'denied';
    this._permissions = [
      this.GRANTED,
      this.DEFAULT,
      this.DENIED
    ];
  }

  /**
   * Requests permission for desktop notifications
   * @param {Function} onGranted - Function to execute once permission is granted
   * @param {Function} onDenied - Function to execute once permission is denied
   * @return {void}
   */
  request(onGranted, onDenied) {
    const existing = this.get();

    var resolve = (result) => {
      if (result === this.GRANTED || result === 0) {
        if (onGranted) onGranted();
      } else if (onDenied) onDenied();
    }

    /* Permissions already set */
    if (existing !== this.DEFAULT) {
      resolve(existing);
    }
    /* Safari 6+, Chrome 23+ */
    else if (this._win.Notification && this._win.Notification.requestPermission) {
      this._win.Notification.requestPermission().then(resolve).catch(function () {
        if (onDenied) onDenied();
      });
    }
    /* Legacy webkit browsers */
    else if (this._win.webkitNotifications && this._win.webkitNotifications.checkPermission)
      this._win.webkitNotifications.requestPermission(resolve);
    /* Let the user continue by default */
    else if (onGranted) onGranted();
  }

  /**
   * Returns whether Push has been granted permission to run
   * @return {Boolean}
   */
  has() {
    return this.get() === this.GRANTED;
  }

  /**
   * Gets the permission level
   * @return {Permission} The permission level
   */
  get() {
    let permission;

{'fraction_non_alphanumeric': 0.12666666666666668, 'fraction_numerical': 0.0024242424242424242, 'mean_word_length': 2.7511363636363635, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, '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': '3069467', 'n_tokens_mistral': 1029, 'n_tokens_neox': 959, 'n_words': 258}