<commit_before>/*
 *  Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
 *
 *  Use of this source code is governed by a BSD-style license
 *  that can be found in the LICENSE file in the root of the source
 *  tree.
 */

/* More information about these options at jshint.com/docs/options */
/* jshint browser: true, camelcase: true, curly: true, devel: true, eqeqeq: true, forin: false, globalstrict: true, quotmark: single, undef: true, unused: strict */

'use strict';

function reportBug() {
  // Detect browser and version.
  var res = getBrowserNameAndVersion();
  var browserName = res['name']
  var browserVersion = res['version']
  console.log('Detected browser: ' + browserName + ' ' + browserVersion);

  var output = document.getElementById('output');
  var description = 'Browser: ' + browserName + ' ' + browserVersion + '\n\n' +
      'Output from the troubleshooting page at http://test.webrtc.org:\n\n' +
      output.value;

  // Labels for the bug to be filed.
  var osLabel = 'OS-';
  if (navigator.platform.indexOf('Win') != -1) osLabel += 'Windows';
  if (navigator.platform.indexOf('Mac') != -1) osLabel += 'Mac';
  if (navigator.platform.match('iPhone|iPad|iPod|iOS')) osLabel += 'iOS';
  if (navigator.platform.indexOf('Linux') != -1) osLabel += 'Linux';
  if (navigator.platform.indexOf('Android') != -1) osLabel += 'Android';

  var labels = 'webrtc-troubleshooter,Cr-Blink-WebRTC,' + osLabel;
  var url = 'https://code.google.com/p/chromium/issues/entry?' +
      'comment=' + encodeURIComponent(description) +
      '&labels=' + encodeURIComponent(labels);
  console.log('Navigating to: ' + url);
  window.location.href = url;
}

/*
 * Detects the running browser name and version.
 *
 * @return {!Object.<string, string>} Object containing the browser name and
 *     version (mapped to the keys "name" and "version").
 */
function getBrowserNameAndVersion() {
  // Code inspired by http://goo.gl/9dZZqE with
  // added support of modern Internet Explorer versions (Trident).
  var agent = navigator.userAgent;<commit_msg>Replace log output with a text instructing the user to copy+paste the log.<commit_after>/*
 *  Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
 *
 *  Use of this source code is governed by a BSD-style license
 *  that can be found in the LICENSE file in the root of the source
 *  tree.
 */

/* More information about these options at jshint.com/docs/options */
/* jshint browser: true, camelcase: true, curly: true, devel: true, eqeqeq: true, forin: false, globalstrict: true, quotmark: single, undef: true, unused: strict */

'use strict';

function reportBug() {
  // Detect browser and version.
  var res = getBrowserNameAndVersion();
  var browserName = res['name']
  var browserVersion = res['version']
  console.log('Detected browser: ' + browserName + ' ' + browserVersion);

  var description = 'Browser: ' + browserName + ' ' + browserVersion +
      ' (' + navigator.platform + ')\n\n' +
      'Output from the troubleshooting page at http://test.webrtc.org:\n\n' +
      'Please replace this text with the copy+pasted output from test page!';

  // Labels for the bug to be filed.
  var osLabel = 'OS-';
  if (navigator.platform.indexOf('Win') != -1) osLabel += 'Windows';
  if (navigator.platform.indexOf('Mac') != -1) osLabel += 'Mac';
  if (navigator.platform.match('iPhone|iPad|iPod|iOS')) osLabel += 'iOS';
  if (navigator.platform.indexOf('Linux') != -1) osLabel += 'Linux';
  if (navigator.platform.indexOf('Android') != -1) osLabel += 'Android';

  var labels = 'webrtc-troubleshooter,Cr-Blink-WebRTC,' + osLabel;
  var url = 'https://code.google.com/p/chromium/issues/entry?' +
      'comment=' + encodeURIComponent(description) +
      '&labels=' + encodeURIComponent(labels);
  console.log('Navigating to: ' + url);
  window.open(url);
}

/*
 * Detects the running browser name and version.
 *
 * @return {!Object.<string, string>} Object containing the browser name and
 *     version (mapped to the keys "name" and "version").
 */
function getBrowserNameAndVersion() {
  // Code inspired by http://goo.gl/9dZZqE with
  // added support of modern Internet Explorer versions (Trident).
  var agent = navigator.userAgent;
{'fraction_non_alphanumeric': 0.14295841209829868, 'fraction_numerical': 0.004253308128544423, 'mean_word_length': 3.8487972508591066, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 2, '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': '2879349', 'n_tokens_mistral': 1342, 'n_tokens_neox': 1299, 'n_words': 408}