<commit_before>var Chrome = require('chrome-remote-interface');
var events = require('events');
var util = require('util');
var common = require('./common.js');
var Page = require('./Page.js');

var CLEANUP_SCRIPT =
    'chrome.benchmarking.closeConnections();' +
    'chrome.benchmarking.clearHostResolverCache();';

var Client = function (urls, options) {
    var self = this;

    self.pages = [];

    Chrome(function (chrome) {
        // load the next URL or exit if done
        function loadNextURL() {
            var id = self.pages.length;
            var url = urls[id];
            if (url) {
                if (!url.match(/^http[s]?:/)) {
                    url = 'http://' + url;
                }
                var page = new Page(id, url);
                self.emit('pageStart', url);
                page.start();
                chrome.Runtime.evaluate({'expression': CLEANUP_SCRIPT});
                chrome.Page.navigate({'url': url});
                self.pages.push(page);
            }
            return url;<commit_msg>Add some more cleanup functions<commit_after>var Chrome = require('chrome-remote-interface');
var events = require('events');
var util = require('util');
var common = require('./common.js');
var Page = require('./Page.js');

var CLEANUP_SCRIPT =
    'var x;' +
    'x=chrome.benchmarking.clearCache; x&&x();' +
    'x=chrome.benchmarking.clearHostResolverCache; x&&x();' +
    'x=chrome.benchmarking.clearPredictorCache; x&&x();' +
    'x=chrome.benchmarking.closeConnections; x&&x();';

var Client = function (urls, options) {
    var self = this;

    self.pages = [];

    Chrome(function (chrome) {
        // load the next URL or exit if done
        function loadNextURL() {
            var id = self.pages.length;
            var url = urls[id];
            if (url) {
                if (!url.match(/^http[s]?:/)) {
                    url = 'http://' + url;
                }
                var page = new Page(id, url);
                self.emit('pageStart', url);
                page.start();
                chrome.Runtime.evaluate({'expression': CLEANUP_SCRIPT});
                chrome.Page.navigate({'url': url});
                self.pages.push(page);
            }
            return url;
{'fraction_non_alphanumeric': 0.15425531914893617, 'fraction_numerical': 0.0, 'mean_word_length': 1.931168831168831, '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': '4758071', 'n_tokens_mistral': 674, 'n_tokens_neox': 643, 'n_words': 147}