function loadLogFile(logFileContents, fileName) {
    // Try and parse the log dump as a single JSON string.  If this succeeds,
    // it's most likely a full log dump.  Otherwise, it may be a dump created by
    // --log-net-log.
    var parsedDump = null;
    var errorString = '';
    try {
      parsedDump = JSON.parse(logFileContents);
    } catch (error) {
      try {
        // We may have a --log-net-log=blah log dump.  If so, remove the comma
        // after the final good entry, and add the necessary close brackets.
        var end = Math.max(
            logFileContents.lastIndexOf(',\n'),
            logFileContents.lastIndexOf(',\r'));
        if (end != -1) {
          parsedDump = JSON.parse(logFileContents.substring(0, end) + ']}');
          errorString += 'Log file truncated.  Events may be missing.\n';
        }
      } catch (error2) {
      }
    }

    if (!parsedDump)
      return 'Unable to parse log dump as JSON file.';
    return errorString + loadLogDump(parsedDump, fileName);
  }
/**
   * Loads a log dump from the string |logFileContents|, which can be either a
   * full net-internals dump, or a NetLog dump only.  Returns a string
   * containing a log of the load.
   */
Loads a log dump from the string |logFileContents|, which can be either a
full net-internals dump, or a NetLog dump only.  Returns a string
containing a log of the load.
Loads a log dump from the string |logFileContents| which can be either a full net - internals dump or a NetLog dump only . Returns a string containing a log of the load .
function loadLogFile(logFileContents, fileName) {
    var parsedDump = null;
    var errorString = '';
    try {
      parsedDump = JSON.parse(logFileContents);
    } catch (error) {
      try {
        var end = Math.max(
            logFileContents.lastIndexOf(',\n'),
            logFileContents.lastIndexOf(',\r'));
        if (end != -1) {
          parsedDump = JSON.parse(logFileContents.substring(0, end) + ']}');
          errorString += 'Log file truncated.  Events may be missing.\n';
        }
      } catch (error2) {
      }
    }
    if (!parsedDump)
      return 'Unable to parse log dump as JSON file.';
    return errorString + loadLogDump(parsedDump, fileName);
  }
function loadLogFile ( logFileContents , fileName ) { var parsedDump = null ; var errorString = '' ; try { parsedDump = JSON . parse ( logFileContents ) ; } catch ( error ) { try { var end = Math . max ( logFileContents . lastIndexOf ( ',\n' ) , logFileContents . lastIndexOf ( ',\r' ) ) ; if ( end != - 1 ) { parsedDump = JSON . parse ( logFileContents . substring ( 0 , end ) + ']}' ) ; errorString += 'Log file truncated.  Events may be missing.\n' ; } } catch ( error2 ) { } } if ( ! parsedDump ) return 'Unable to parse log dump as JSON file.' ; return errorString + loadLogDump ( parsedDump , fileName ) ; }
Loads a log dump from the string |logFileContents|, which can be either a
 full net-internals dump, or a NetLog dump only.
Loads a log dump from the string |logFileContents| which can be either a full net - internals dump or a NetLog dump only .
// Try and parse the log dump as a single JSON string.  If this succeeds, // it's most likely a full log dump.  Otherwise, it may be a dump created by // --log-net-log. // We may have a --log-net-log=blah log dump.  If so, remove the comma // after the final good entry, and add the necessary close brackets.