<commit_before>var XHRObject = utils.XHRObject = function(method, url, payload) {
    var that = this;
    utils.delay(function(){that._start(method, url, payload);});
};

XHRObject.prototype = new EventEmitter(['chunk', 'finish']);

XHRObject.prototype._start = function(method, url, payload) {
    var that = this;
    if (_window.ActiveXObject) {
        // IE caches POSTs
        url += ((url.indexOf('?') === -1) ? '?' : '&') + 't='+(+new Date);
        try {
            that.xhr = new ActiveXObject('Microsoft.XMLHTTP');
        } catch(x) {};
    }
    if (!that.xhr) {
        that.xhr = new XMLHttpRequest();
    }

    // Explorer tends to keep connection open, even after the
    // tab gets closed: http://bugs.jquery.com/ticket/5280
    that.unload_ref = utils.unload_add(function(){that._cleanup(true);});
    try {
        that.xhr.open(method, url, true);
    } catch(e) {
        // IE raises an exception on wrong port.
        that.emit('finish', 0, '');
        that._cleanup();
        return;
    };

    if ('withCredentials' in that.xhr) {
        that.xhr.withCredentials = 'true';<commit_msg>Cosmetic: No need to verify window.ActiveXObject - we're already in try/catch block<commit_after>var XHRObject = utils.XHRObject = function(method, url, payload) {
    var that = this;
    utils.delay(function(){that._start(method, url, payload);});
};

XHRObject.prototype = new EventEmitter(['chunk', 'finish']);

XHRObject.prototype._start = function(method, url, payload) {
    var that = this;
    try {
        that.xhr = new _window.ActiveXObject('Microsoft.XMLHTTP');
        // IE caches POSTs
        url += ((url.indexOf('?') === -1) ? '?' : '&') + 't='+(+new Date);
    } catch(x) {};
    if (!that.xhr) {
        that.xhr = new XMLHttpRequest();
    }

    // Explorer tends to keep connection open, even after the
    // tab gets closed: http://bugs.jquery.com/ticket/5280
    that.unload_ref = utils.unload_add(function(){that._cleanup(true);});
    try {
        that.xhr.open(method, url, true);
    } catch(e) {
        // IE raises an exception on wrong port.
        that.emit('finish', 0, '');
        that._cleanup();
        return;
    };

    if ('withCredentials' in that.xhr) {
        that.xhr.withCredentials = 'true';
{'fraction_non_alphanumeric': 0.1662990736656374, 'fraction_numerical': 0.00529333921482135, 'mean_word_length': 2.6639741518578353, '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': '3159360', 'n_tokens_mistral': 736, 'n_tokens_neox': 726, 'n_words': 167}