summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authormmenke@chromium.org <mmenke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-29 00:56:24 +0000
committermmenke@chromium.org <mmenke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-29 00:56:24 +0000
commit17e92030ad8eef809db6563d91a1328f96fbd24d (patch)
tree6a710fc10ea4bf34a3f075a48558972a41579c5a /chrome
parentb5bebc4add4d00422d0484701ffd230c6ff64df5 (diff)
downloadchromium_src-17e92030ad8eef809db6563d91a1328f96fbd24d.zip
chromium_src-17e92030ad8eef809db6563d91a1328f96fbd24d.tar.gz
chromium_src-17e92030ad8eef809db6563d91a1328f96fbd24d.tar.bz2
Add DNS configuration information to about:net-internals#dns,
including log dumps, when Chrome's DNS resolver is enabled. BUG=117258 Review URL: http://codereview.chromium.org/9854026 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@129545 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/resources/net_internals/dns_view.html18
-rw-r--r--chrome/browser/resources/net_internals/dns_view.js82
-rw-r--r--chrome/browser/ui/webui/net_internals/net_internals_ui.cc4
3 files changed, 91 insertions, 13 deletions
diff --git a/chrome/browser/resources/net_internals/dns_view.html b/chrome/browser/resources/net_internals/dns_view.html
index 4a5aa2b3..776665f 100644
--- a/chrome/browser/resources/net_internals/dns_view.html
+++ b/chrome/browser/resources/net_internals/dns_view.html
@@ -11,6 +11,20 @@
</li>
</ul>
+ <div>
+ <h4>Async DNS Configuration</h4>
+ <ul>
+ <li>Internal DNS client enabled:
+ <span id=dns-view-internal-dns-enabled></span>
+ <span id=dns-view-internal-dns-invalid-config class=warning-text style="display: none;">
+ (No valid configuration found)</span>
+ </li>
+ </ul>
+ <table class="styled-table">
+ <tbody id=dns-view-internal-dns-config-tbody></tbody>
+ </table>
+ </div>
+
<h4>
Host resolver cache
<input type=button value="Clear host cache" id=dns-view-clear-cache class="hide-when-not-capturing" />
@@ -18,9 +32,7 @@
<ul>
<li>Capacity: <span id=dns-view-cache-capacity></span></li>
</ul>
- <h4>
- Current State
- </h4>
+ <h4>Current State</h4>
<ul>
<li>Active entries: <span id=dns-view-cache-active></span></li>
<li>Expired entries: <span id=dns-view-cache-expired></span></li>
diff --git a/chrome/browser/resources/net_internals/dns_view.js b/chrome/browser/resources/net_internals/dns_view.js
index 14954b1d..6e9038e 100644
--- a/chrome/browser/resources/net_internals/dns_view.js
+++ b/chrome/browser/resources/net_internals/dns_view.js
@@ -46,16 +46,21 @@ var DnsView = (function() {
// IDs for special HTML elements in dns_view.html
DnsView.MAIN_BOX_ID = 'dns-view-tab-content';
- DnsView.CACHE_TBODY_ID = 'dns-view-cache-tbody';
- DnsView.CLEAR_CACHE_BUTTON_ID = 'dns-view-clear-cache';
DnsView.DEFAULT_FAMILY_SPAN_ID = 'dns-view-default-family';
DnsView.IPV6_DISABLED_SPAN_ID = 'dns-view-ipv6-disabled';
DnsView.ENABLE_IPV6_BUTTON_ID = 'dns-view-enable-ipv6';
+
+ DnsView.INTERNAL_DNS_ENABLED_SPAN_ID = 'dns-view-internal-dns-enabled';
+ DnsView.INTERNAL_DNS_INVALID_CONFIG_SPAN_ID =
+ 'dns-view-internal-dns-invalid-config';
+ DnsView.INTERNAL_DNS_CONFIG_TBODY_ID = 'dns-view-internal-dns-config-tbody';
+
+ DnsView.CLEAR_CACHE_BUTTON_ID = 'dns-view-clear-cache';
DnsView.CAPACITY_SPAN_ID = 'dns-view-cache-capacity';
+
DnsView.ACTIVE_SPAN_ID = 'dns-view-cache-active';
DnsView.EXPIRED_SPAN_ID = 'dns-view-cache-expired';
- DnsView.TTL_SUCCESS_SPAN_ID = 'dns-view-cache-ttl-success';
- DnsView.TTL_FAILURE_SPAN_ID = 'dns-view-cache-ttl-failure';
+ DnsView.CACHE_TBODY_ID = 'dns-view-cache-tbody';
cr.addSingletonGetter(DnsView);
@@ -75,6 +80,9 @@ var DnsView = (function() {
$(DnsView.ACTIVE_SPAN_ID).innerHTML = '0';
$(DnsView.EXPIRED_SPAN_ID).innerHTML = '0';
+ // Update fields containing async DNS configuration information.
+ displayAsyncDnsConfig_(hostResolverInfo);
+
// No info.
if (!hostResolverInfo || !hostResolverInfo.cache)
return false;
@@ -120,12 +128,7 @@ var DnsView = (function() {
var errorNode = addTextNode(addressesCell, 'error: ' + errorText);
addressesCell.classList.add('warning-text');
} else {
- for (var j = 0; j < e.addresses.length; ++j) {
- var address = e.addresses[j];
- if (j != 0)
- addNode(addressesCell, 'br');
- addTextNode(addressesCell, address);
- }
+ addListToNode_(addNode(addressesCell, 'div'), e.addresses);
}
var expiresDate = timeutil.convertTimeTicksToDate(e.expiration);
@@ -146,5 +149,64 @@ var DnsView = (function() {
}
};
+ /**
+ * Displays information corresponding to the current async DNS configuration.
+ * @param {Object} hostResolverInfo The host resolver information.
+ */
+ function displayAsyncDnsConfig_(hostResolverInfo) {
+ // Clear the table.
+ $(DnsView.INTERNAL_DNS_CONFIG_TBODY_ID).innerHTML = '';
+
+ // Figure out if the internal DNS resolver is disabled or has no valid
+ // configuration information, and update display accordingly.
+ var enabled = hostResolverInfo &&
+ hostResolverInfo.dns_config !== undefined;
+ var noConfig = enabled &&
+ hostResolverInfo.dns_config.nameservers === undefined;
+ $(DnsView.INTERNAL_DNS_ENABLED_SPAN_ID).innerText = enabled;
+ setNodeDisplay($(DnsView.INTERNAL_DNS_INVALID_CONFIG_SPAN_ID), noConfig);
+
+ // If the internal DNS resolver is disabled or has no valid configuration,
+ // we're done.
+ if (!enabled || noConfig)
+ return;
+
+ var dnsConfig = hostResolverInfo.dns_config;
+
+ // Display nameservers first.
+ var nameserverRow = addNode($(DnsView.INTERNAL_DNS_CONFIG_TBODY_ID), 'tr');
+ addNodeWithText(nameserverRow, 'th', 'nameservers');
+ addListToNode_(addNode(nameserverRow, 'td'), dnsConfig.nameservers);
+
+ // Add everything else in |dnsConfig| to the table.
+ for (var key in dnsConfig) {
+ if (key == 'nameservers')
+ continue;
+ var tr = addNode($(DnsView.INTERNAL_DNS_CONFIG_TBODY_ID), 'tr');
+ addNodeWithText(tr, 'th', key);
+ var td = addNode(tr, 'td');
+
+ // For lists, display each list entry on a separate line.
+ if (typeof dnsConfig[key] == 'object' &&
+ dnsConfig[key].constructor == Array) {
+ addListToNode_(td, dnsConfig[key]);
+ continue;
+ }
+
+ addTextNode(td, dnsConfig[key]);
+ }
+ }
+
+ /**
+ * Takes a last of strings and adds them all to a DOM node, displaying them
+ * on separate lines.
+ * @param {DomNode} node The parent node.
+ * @param {Array.<String>} list List of strings to add to the node.
+ */
+ function addListToNode_(node, list) {
+ for (var i = 0; i < list.length; ++i)
+ addNodeWithText(node, 'div', list[i]);
+ }
+
return DnsView;
})();
diff --git a/chrome/browser/ui/webui/net_internals/net_internals_ui.cc b/chrome/browser/ui/webui/net_internals/net_internals_ui.cc
index 5ecc2d2..6acd13c 100644
--- a/chrome/browser/ui/webui/net_internals/net_internals_ui.cc
+++ b/chrome/browser/ui/webui/net_internals/net_internals_ui.cc
@@ -867,6 +867,10 @@ void NetInternalsMessageHandler::IOThreadImpl::OnGetHostResolverInfo(
DictionaryValue* dict = new DictionaryValue();
+ base::Value* dns_config = context->host_resolver()->GetDnsConfigAsValue();
+ if (dns_config)
+ dict->Set("dns_config", dns_config);
+
dict->SetInteger(
"default_address_family",
static_cast<int>(context->host_resolver()->GetDefaultAddressFamily()));