<commit_before>import PortMixin from 'ember-debug/mixins/port-mixin';
import PromiseAssembler from 'ember-debug/libs/promise-assembler';
var Ember = window.Ember;
var computed = Ember.computed;
var oneWay = computed.oneWay;
var EmberObject = Ember.Object;
var RSVP = Ember.RSVP;

export default EmberObject.extend(PortMixin, {
  namespace: null,
  port: oneWay('namespace.port').readOnly(),
  objectInspector: oneWay('namespace.objectInspector').readOnly(),
  adapter: oneWay('namespace.adapter').readOnly(),
  portNamespace: 'promise',
  session: oneWay('namespace.session').readOnly(),

  // created on init
  promiseAssembler: null,

  releaseMethods: computed(function() { return Ember.A(); }),

  init: function() {
    this._super();
    if (PromiseAssembler.supported()) {
      this.set('promiseAssembler', PromiseAssembler.create());
      this.get('promiseAssembler').set('promiseDebug', this);
      this.setInstrumentWithStack();
      this.sendInstrumentWithStack();
      this.get('promiseAssembler').start();
    }
  },

  delay: 100,

  willDestroy: function() {
    this.releaseAll();
    this.get('promiseAssembler').destroy();
    this.set('promiseAssembler', null);
    this._super();
  },

  messages: {
    getAndObservePromises: function() {
      this.getAndObservePromises();
    },

    supported: function() {
      this.sendMessage('supported', {
        supported: PromiseAssembler.supported()
      });<commit_msg>Only destroy the promise assembler if it exists<commit_after>import PortMixin from 'ember-debug/mixins/port-mixin';
import PromiseAssembler from 'ember-debug/libs/promise-assembler';
var Ember = window.Ember;
var computed = Ember.computed;
var oneWay = computed.oneWay;
var EmberObject = Ember.Object;
var RSVP = Ember.RSVP;

export default EmberObject.extend(PortMixin, {
  namespace: null,
  port: oneWay('namespace.port').readOnly(),
  objectInspector: oneWay('namespace.objectInspector').readOnly(),
  adapter: oneWay('namespace.adapter').readOnly(),
  portNamespace: 'promise',
  session: oneWay('namespace.session').readOnly(),

  // created on init
  promiseAssembler: null,

  releaseMethods: computed(function() { return Ember.A(); }),

  init: function() {
    this._super();
    if (PromiseAssembler.supported()) {
      this.set('promiseAssembler', PromiseAssembler.create());
      this.get('promiseAssembler').set('promiseDebug', this);
      this.setInstrumentWithStack();
      this.sendInstrumentWithStack();
      this.get('promiseAssembler').start();
    }
  },

  delay: 100,

  willDestroy: function() {
    this.releaseAll();
    if (this.get('promiseAssembler')) {
      this.get('promiseAssembler').destroy();
    }
    this.set('promiseAssembler', null);
    this._super();
  },

  messages: {
    getAndObservePromises: function() {
      this.getAndObservePromises();
    },

    supported: function() {
      this.sendMessage('supported', {
        supported: PromiseAssembler.supported()
      });
{'fraction_non_alphanumeric': 0.1478114478114478, 'fraction_numerical': 0.00202020202020202, 'mean_word_length': 4.203152364273205, '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': '3599455', 'n_tokens_mistral': 952, 'n_tokens_neox': 920, 'n_words': 163}