<commit_before>var core      = require("./core").dom.level2.core,
    events    = require("./core").dom.level2.events,
    URL       = require("url"),
    Path      = require('path'),
    fs        = require("fs"),
    http      = require('http'),
    https      = require('https');

// Setup the javascript language processor
core.languageProcessors = {
  javascript : require("./languages/javascript").javascript
};

core.resourceLoader = {
  load: function(element, href, callback) {
    var ownerImplementation = element._ownerDocument.implementation, url;

    if (ownerImplementation.hasFeature('FetchExternalResources', element.tagName.toLowerCase())) {
      var full = this.resolve(element._ownerDocument, href);
      url = URL.parse(full);
      if (url.hostname) {
        this.download(full, this.enqueue(element, callback));
      }
      else {
        this.readFile(full, this.enqueue(element, callback, url));
      }
    }
  },
  enqueue: function(element, callback, filename) {
    var loader = this,
        doc    = element.nodeType === core.Node.DOCUMENT_NODE ?
                 element                :
                 element._ownerDocument;

    if (!doc._queue) {
      return function() {};
    }

    return doc._queue.push(function(err, data) {
      var ev = doc.createEvent('HTMLEvents');

      if (!err) {
        try {
          callback.call(element, data, filename || doc.URL);
          ev.initEvent('load', false, false);
        }
        catch(e) {
          err = e;
        }
      }

      if (err) {
        ev.initEvent('error', false, false);<commit_msg>The first parameter of function download should be object returned by URL.parse().<commit_after>var core      = require("./core").dom.level2.core,
    events    = require("./core").dom.level2.events,
    URL       = require("url"),
    Path      = require('path'),
    fs        = require("fs"),
    http      = require('http'),
    https      = require('https');

// Setup the javascript language processor
core.languageProcessors = {
  javascript : require("./languages/javascript").javascript
};

core.resourceLoader = {
  load: function(element, href, callback) {
    var ownerImplementation = element._ownerDocument.implementation, url;

    if (ownerImplementation.hasFeature('FetchExternalResources', element.tagName.toLowerCase())) {
      var full = this.resolve(element._ownerDocument, href);
      url = URL.parse(full);
      if (url.hostname) {
        this.download(url, this.enqueue(element, callback));
      }
      else {
        this.readFile(full, this.enqueue(element, callback, url));
      }
    }
  },
  enqueue: function(element, callback, filename) {
    var loader = this,
        doc    = element.nodeType === core.Node.DOCUMENT_NODE ?
                 element                :
                 element._ownerDocument;

    if (!doc._queue) {
      return function() {};
    }

    return doc._queue.push(function(err, data) {
      var ev = doc.createEvent('HTMLEvents');

      if (!err) {
        try {
          callback.call(element, data, filename || doc.URL);
          ev.initEvent('load', false, false);
        }
        catch(e) {
          err = e;
        }
      }

      if (err) {
        ev.initEvent('error', false, false);
{'fraction_non_alphanumeric': 0.1382262996941896, 'fraction_numerical': 0.0012232415902140672, 'mean_word_length': 2.271, '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': 3, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7523771', 'n_tokens_mistral': 935, 'n_tokens_neox': 916, 'n_words': 192}