| Index: chrome/browser/resources/net_internals/dataview.js
|
| ===================================================================
|
| --- chrome/browser/resources/net_internals/dataview.js (revision 88439)
|
| +++ chrome/browser/resources/net_internals/dataview.js (working copy)
|
| @@ -53,8 +53,9 @@
|
| this.capturingTextSpan_ = document.getElementById(capturingTextSpanId);
|
| this.loggingTextSpan_ = document.getElementById(loggingTextSpanId);
|
|
|
| - document.getElementById(loadLogFileId).onclick =
|
| - g_browser.loadLogFile.bind(g_browser);
|
| + var loadLogFileElement = document.getElementById(loadLogFileId);
|
| + loadLogFileElement.onchange =
|
| + this.logFileChanged.bind(this, loadLogFileElement);
|
|
|
| this.updateEventCounts_();
|
| this.waitingForUpdate_ = false;
|
| @@ -137,6 +138,37 @@
|
| }
|
|
|
| /**
|
| + * Called when a log file is selected.
|
| + *
|
| + * Gets the log file from the input element and tries to read from it.
|
| + */
|
| +DataView.prototype.logFileChanged = function(loadLogFileElement) {
|
| + var logFile = loadLogFileElement.files[0];
|
| + if (logFile) {
|
| + var fileReader = new FileReader();
|
| +
|
| + fileReader.onload = this.onLoadLogFile.bind(this);
|
| + fileReader.onerror = this.onLoadLogFileError.bind(this);
|
| +
|
| + fileReader.readAsText(logFile);
|
| + }
|
| +}
|
| +
|
| +/**
|
| + * Displays an error message when unable to read the selected log file.
|
| + */
|
| +DataView.prototype.onLoadLogFileError = function(event) {
|
| + alert('Error ' + event.target.error.code + '. Unable to load file.');
|
| +}
|
| +
|
| +/**
|
| + * Tries to load the contents of the log file.
|
| + */
|
| +DataView.prototype.onLoadLogFile = function(event) {
|
| + g_browser.loadedLogFile(event.target.result);
|
| +}
|
| +
|
| +/**
|
| * If not already waiting for results from all updates, triggers all
|
| * updates and starts waiting for them to complete.
|
| */
|
|
|