diff options
author | mmenke@chromium.org <mmenke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-25 20:09:23 +0000 |
---|---|---|
committer | mmenke@chromium.org <mmenke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-25 20:09:23 +0000 |
commit | 4153bb442087faf931a6ab3db56c2c93e4fefa53 (patch) | |
tree | b5ace9c6f3509ee72c25441e74671fae32805a11 /chrome/browser/resources/net_internals | |
parent | 8e553f499860ac0b3bdea8326b7bc95a7650e250 (diff) | |
download | chromium_src-4153bb442087faf931a6ab3db56c2c93e4fefa53.zip chromium_src-4153bb442087faf931a6ab3db56c2c93e4fefa53.tar.gz chromium_src-4153bb442087faf931a6ab3db56c2c93e4fefa53.tar.bz2 |
Displays the most recent INIT_PROXY_RESOLVER source's log entries
on the #proxy net-internals tab.
Also adds a link to the #proxy tab to show all INIT_PROXY_RESOLVER
events on the #events tab.
BUG=56430
TEST=manual
Review URL: http://codereview.chromium.org/3990005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@63773 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/resources/net_internals')
-rw-r--r-- | chrome/browser/resources/net_internals/index.html | 11 | ||||
-rw-r--r-- | chrome/browser/resources/net_internals/main.js | 3 | ||||
-rw-r--r-- | chrome/browser/resources/net_internals/proxyview.js | 47 |
3 files changed, 59 insertions, 2 deletions
diff --git a/chrome/browser/resources/net_internals/index.html b/chrome/browser/resources/net_internals/index.html index d146242..1a95210 100644 --- a/chrome/browser/resources/net_internals/index.html +++ b/chrome/browser/resources/net_internals/index.html @@ -69,6 +69,17 @@ found in the LICENSE file. </tr></table> + <h4>Proxy auto-config initialization</h4> + <ul> + <li> + <a href='#events&q=type:INIT_PROXY_RESOLVER'>View all events</a> + </li> + <li> + Latest proxy resolver event: + <pre id=proxyResolverLog></pre> + </li> + </ul> + <h4> Proxies which have failed recently, and are marked as bad <input type=button value="Clear bad proxies" id=clearBadProxies /> diff --git a/chrome/browser/resources/net_internals/main.js b/chrome/browser/resources/net_internals/main.js index 5249789..7bfdb62 100644 --- a/chrome/browser/resources/net_internals/main.js +++ b/chrome/browser/resources/net_internals/main.js @@ -57,7 +57,8 @@ function onLoaded() { 'proxyEffectiveSettings', 'proxyReloadSettings', 'badProxiesTableBody', - 'clearBadProxies'); + 'clearBadProxies', + 'proxyResolverLog'); // Create a view which will display information on the host resolver. var dnsView = new DnsView('dnsTabContent', diff --git a/chrome/browser/resources/net_internals/proxyview.js b/chrome/browser/resources/net_internals/proxyview.js index 54bb3fc..0f7f68b 100644 --- a/chrome/browser/resources/net_internals/proxyview.js +++ b/chrome/browser/resources/net_internals/proxyview.js @@ -7,6 +7,7 @@ * * - Shows the current proxy settings. * - Has a button to reload these settings. + * - Shows the log entries for the most recent INIT_PROXY_RESOLVER source * - Shows the list of proxy hostnames that are cached as "bad". * - Has a button to clear the cached bad proxies. * @@ -17,13 +18,18 @@ function ProxyView(mainBoxId, effectiveSettingsDivId, reloadSettingsButtonId, badProxiesTbodyId, - clearBadProxiesButtonId) { + clearBadProxiesButtonId, + proxyResolverLogPreId) { DivView.call(this, mainBoxId); + this.latestProxySourceEntries_ = null; + this.latestProxySourceId_ = 0; + // Hook up the UI components. this.originalSettingsDiv_ = document.getElementById(originalSettingsDivId); this.effectiveSettingsDiv_ = document.getElementById(effectiveSettingsDivId); + this.proxyResolverLogPre_ = document.getElementById(proxyResolverLogPreId); this.badProxiesTbody_ = document.getElementById(badProxiesTbodyId); var reloadSettingsButton = document.getElementById(reloadSettingsButtonId); @@ -36,6 +42,7 @@ function ProxyView(mainBoxId, // Register to receive proxy information as it changes. g_browser.addProxySettingsObserver(this); g_browser.addBadProxiesObserver(this); + g_browser.addLogObserver(this); } inherits(ProxyView, DivView); @@ -69,3 +76,41 @@ ProxyView.prototype.onBadProxiesChanged = function(badProxies) { addTextNode(badUntilCell, badUntilDate.toLocaleString()); } }; + +ProxyView.prototype.onLogEntryAdded = function(logEntry) { + if (logEntry.source.type != LogSourceType.INIT_PROXY_RESOLVER || + this.latestProxySourceId_ > logEntry.source.id) { + return; + } + + if (logEntry.source.id > this.latestProxySourceId_) { + this.latestProxySourceId_ = logEntry.source.id; + this.latestProxySourceEntries_ = []; + } + + this.latestProxySourceEntries_.push(logEntry); + this.proxyResolverLogPre_.innerHTML = ''; + addTextNode(this.proxyResolverLogPre_, + PrintSourceEntriesAsText(this.latestProxySourceEntries_, false)); +}; + +/** + * Clears the display of and log entries for the last proxy lookup. + */ +ProxyView.prototype.clearLog_ = function() { + this.latestProxySourceEntries_ = []; + // Prevents display of partial logs. + ++this.latestProxySourceId_; + + this.proxyResolverLogPre_.innerHTML = ''; + addTextNode(this.proxyResolverLogPre_, 'Deleted.'); +}; + +ProxyView.prototype.onLogEntriesDeleted = function(sourceIds) { + if (sourceIds.indexOf(this.latestProxySourceId_) != -1) + this.clearLog_(); +}; + +ProxyView.prototype.onAllLogEntriesDeleted = function() { + this.clearLog_(); +}; |