| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * This view displays options for importing/exporting the captured data. Its | 6 * This view displays options for importing/exporting the captured data. Its |
| 7 * primarily usefulness is to allow users to copy-paste their data in an easy | 7 * primarily usefulness is to allow users to copy-paste their data in an easy |
| 8 * to read format for bug reports. | 8 * to read format for bug reports. |
| 9 * | 9 * |
| 10 * - Has a button to generate a text report. | 10 * - Has a button to generate a text report. |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 | 31 |
| 32 var text = []; | 32 var text = []; |
| 33 | 33 |
| 34 // Print some basic information about our environment. | 34 // Print some basic information about our environment. |
| 35 text.push('Data exported on: ' + (new Date()).toLocaleString()); | 35 text.push('Data exported on: ' + (new Date()).toLocaleString()); |
| 36 text.push(''); | 36 text.push(''); |
| 37 text.push('Number of passively captured events: ' + | 37 text.push('Number of passively captured events: ' + |
| 38 g_browser.getAllPassivelyCapturedEvents().length); | 38 g_browser.getAllPassivelyCapturedEvents().length); |
| 39 text.push('Number of actively captured events: ' + | 39 text.push('Number of actively captured events: ' + |
| 40 g_browser.getAllActivelyCapturedEvents().length); | 40 g_browser.getAllActivelyCapturedEvents().length); |
| 41 text.push('Timetick to timestamp offset: ' + g_browser.timeTickOffset_); | |
| 42 text.push(''); | 41 text.push(''); |
| 43 // TODO(eroman): fill this with proper values. | 42 // TODO(eroman): fill this with proper values. |
| 44 text.push('Chrome version: ' + 'TODO'); | 43 text.push('Chrome version: ' + 'TODO'); |
| 45 text.push('Command line switches: ' + 'TODO'); | 44 text.push('Command line switches: ' + 'TODO'); |
| 46 | 45 |
| 47 text.push(''); | 46 text.push(''); |
| 48 text.push('----------------------------------------------'); | 47 text.push('----------------------------------------------'); |
| 49 text.push(' Proxy settings'); | 48 text.push(' Proxy settings'); |
| 50 text.push('----------------------------------------------'); | 49 text.push('----------------------------------------------'); |
| 51 text.push(''); | 50 text.push(''); |
| 52 | 51 |
| 53 text.push(g_browser.proxySettings_.currentData_); | 52 text.push(g_browser.proxySettings_.currentData_); |
| 54 | 53 |
| 55 text.push(''); | 54 text.push(''); |
| 56 text.push('----------------------------------------------'); | 55 text.push('----------------------------------------------'); |
| 57 text.push(' Bad proxies cache'); | 56 text.push(' Bad proxies cache'); |
| 58 text.push('----------------------------------------------'); | 57 text.push('----------------------------------------------'); |
| 59 text.push(''); | |
| 60 | 58 |
| 61 var badProxiesList = g_browser.badProxies_.currentData_; | 59 var badProxiesList = g_browser.badProxies_.currentData_; |
| 62 if (badProxiesList.length == 0) { | 60 if (badProxiesList.length == 0) { |
| 61 text.push(''); |
| 63 text.push('None'); | 62 text.push('None'); |
| 64 } else { | 63 } else { |
| 65 this.appendPrettyPrintedTable_(badProxiesList, text); | 64 for (var i = 0; i < badProxiesList.length; ++i) { |
| 65 var e = badProxiesList[i]; |
| 66 text.push(''); |
| 67 text.push('(' + (i+1) + ')'); |
| 68 text.push('Proxy: ' + e.proxy_uri); |
| 69 text.push('Bad until: ' + this.formatExpirationTime_(e.bad_until)); |
| 70 } |
| 66 } | 71 } |
| 67 | 72 |
| 68 text.push(''); | 73 text.push(''); |
| 69 text.push('----------------------------------------------'); | 74 text.push('----------------------------------------------'); |
| 70 text.push(' Host resolver cache'); | 75 text.push(' Host resolver cache'); |
| 71 text.push('----------------------------------------------'); | 76 text.push('----------------------------------------------'); |
| 72 text.push(''); | 77 text.push(''); |
| 73 | 78 |
| 74 var hostResolverCache = g_browser.hostResolverCache_.currentData_; | 79 var hostResolverCache = g_browser.hostResolverCache_.currentData_; |
| 75 | 80 |
| 76 text.push('Capcity: ' + hostResolverCache.capacity); | 81 text.push('Capcity: ' + hostResolverCache.capacity); |
| 77 text.push('Time to live for successful resolves (ms): ' + | 82 text.push('Time to live for successful resolves (ms): ' + |
| 78 hostResolverCache.ttl_success_ms); | 83 hostResolverCache.ttl_success_ms); |
| 79 text.push('Time to live for failed resolves (ms): ' + | 84 text.push('Time to live for failed resolves (ms): ' + |
| 80 hostResolverCache.ttl_failure_ms); | 85 hostResolverCache.ttl_failure_ms); |
| 81 | 86 |
| 82 if (hostResolverCache.entries.length > 0) { | 87 if (hostResolverCache.entries.length > 0) { |
| 88 for (var i = 0; i < hostResolverCache.entries.length; ++i) { |
| 89 var e = hostResolverCache.entries[i]; |
| 90 |
| 91 text.push(''); |
| 92 text.push('(' + (i+1) + ')'); |
| 93 text.push('Hostname: ' + e.hostname); |
| 94 text.push('Address family: ' + e.address_family); |
| 95 |
| 96 if (e.error != undefined) { |
| 97 text.push('Error: ' + e.error); |
| 98 } else { |
| 99 for (var j = 0; j < e.addresses.length; ++j) { |
| 100 text.push('Address ' + (j + 1) + ': ' + e.addresses[j]); |
| 101 } |
| 102 } |
| 103 |
| 104 text.push('Valid until: ' + this.formatExpirationTime_(e.expiration)); |
| 105 } |
| 106 } else { |
| 83 text.push(''); | 107 text.push(''); |
| 84 this.appendPrettyPrintedTable_(hostResolverCache.entries, text); | 108 text.push('None'); |
| 85 } | 109 } |
| 86 | 110 |
| 87 text.push(''); | 111 text.push(''); |
| 88 text.push('----------------------------------------------'); | 112 text.push('----------------------------------------------'); |
| 89 text.push(' Requests'); | 113 text.push(' Requests'); |
| 90 text.push('----------------------------------------------'); | 114 text.push('----------------------------------------------'); |
| 91 text.push(''); | 115 text.push(''); |
| 92 | 116 |
| 93 this.appendRequestsPrintedAsText_(text); | 117 this.appendRequestsPrintedAsText_(text); |
| 94 | 118 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 | 170 |
| 147 /** | 171 /** |
| 148 * Helper function to set this view's content to |text|. | 172 * Helper function to set this view's content to |text|. |
| 149 */ | 173 */ |
| 150 DataView.prototype.setText_ = function(text) { | 174 DataView.prototype.setText_ = function(text) { |
| 151 this.textPre_.innerHTML = ''; | 175 this.textPre_.innerHTML = ''; |
| 152 addTextNode(this.textPre_, text); | 176 addTextNode(this.textPre_, text); |
| 153 }; | 177 }; |
| 154 | 178 |
| 155 /** | 179 /** |
| 156 * Stringifies |arrayData| to formatted table output, and appends it to the | 180 * Format a time ticks count as a timestamp. |
| 157 * line buffer |out|. | |
| 158 */ | 181 */ |
| 159 DataView.prototype.appendPrettyPrintedTable_ = function(arrayData, out) { | 182 DataView.prototype.formatExpirationTime_ = function(timeTicks) { |
| 160 for (var i = 0; i < arrayData.length; ++i) { | 183 var d = g_browser.convertTimeTicksToDate(timeTicks); |
| 161 var e = arrayData[i]; | 184 var isExpired = d.getTime() < (new Date()).getTime(); |
| 162 var eString = '[' + i + ']: '; | 185 return 't=' + d.getTime() + (isExpired ? ' [EXPIRED]' : ''); |
| 163 for (var key in e) { | |
| 164 eString += key + "=" + e[key] + "; "; | |
| 165 } | |
| 166 out.push(eString); | |
| 167 } | |
| 168 }; | 186 }; |
| 169 | 187 |
| 188 |
| OLD | NEW |