diff options
author | mmenke@chromium.org <mmenke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-22 14:47:28 +0000 |
---|---|---|
committer | mmenke@chromium.org <mmenke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-22 14:47:28 +0000 |
commit | 5724cf6df03d7cb924b97d32ed319976d67b7640 (patch) | |
tree | cebeb6132cad4cc25adbf9a53bd2e47d8db70bc7 /chrome/browser | |
parent | 98fcfe18d6112e6eb32c61e493afdba6ddfd3d73 (diff) | |
download | chromium_src-5724cf6df03d7cb924b97d32ed319976d67b7640.zip chromium_src-5724cf6df03d7cb924b97d32ed319976d67b7640.tar.gz chromium_src-5724cf6df03d7cb924b97d32ed319976d67b7640.tar.bz2 |
Adds Winsock service providers to log dumps, and converts a couple of their numeric values to strings.
Also adds the OS version from the user-agent string to the top of the log dump.
TEST=manual
BUG=53474
BUG=54302
Review URL: http://codereview.chromium.org/3416015
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@60175 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/resources/net_internals/dataview.js | 45 | ||||
-rw-r--r-- | chrome/browser/resources/net_internals/serviceprovidersview.js | 100 | ||||
-rw-r--r-- | chrome/browser/resources/net_internals/util.js | 12 |
3 files changed, 127 insertions, 30 deletions
diff --git a/chrome/browser/resources/net_internals/dataview.js b/chrome/browser/resources/net_internals/dataview.js index 331b857..d3b1275 100644 --- a/chrome/browser/resources/net_internals/dataview.js +++ b/chrome/browser/resources/net_internals/dataview.js @@ -96,6 +96,10 @@ DataView.prototype.onExportToText_ = function() { ' (' + ClientInfo.official + ' ' + ClientInfo.cl + ') ' + ClientInfo.version_mod); + // Third value in first set of parentheses in user-agent string. + var platform = /\(.*?;.*?; (.*?);/.exec(navigator.userAgent); + if (platform) + text.push('Platform: ' + platform[1]); text.push('Command line: ' + ClientInfo.command_line); text.push(''); @@ -201,6 +205,47 @@ DataView.prototype.onExportToText_ = function() { this.appendSocketPoolsAsText_(text); + if (g_browser.isPlatformWindows()) { + text.push(''); + text.push('----------------------------------------------'); + text.push(' Winsock layered service providers'); + text.push('----------------------------------------------'); + text.push(''); + + var serviceProviders = g_browser.serviceProviders_.currentData_; + var layeredServiceProviders = serviceProviders.service_providers; + for (var i = 0; i < layeredServiceProviders.length; ++i) { + var provider = layeredServiceProviders[i]; + text.push('name: ' + provider.name); + text.push('version: ' + provider.version); + text.push('type: ' + + ServiceProvidersView.getLayeredServiceProviderType(provider)); + text.push('socket_type: ' + + ServiceProvidersView.getSocketType(provider)); + text.push('socket_protocol: ' + + ServiceProvidersView.getProtocolType(provider)); + text.push('path: ' + provider.path); + text.push(''); + } + + text.push(''); + text.push('----------------------------------------------'); + text.push(' Winsock namespace providers'); + text.push('----------------------------------------------'); + text.push(''); + + var namespaceProviders = serviceProviders.namespace_providers; + for (var i = 0; i < namespaceProviders.length; ++i) { + var provider = namespaceProviders[i]; + text.push('name: ' + provider.name); + text.push('version: ' + provider.version); + text.push('type: ' + + ServiceProvidersView.getNamespaceProviderType(provider)); + text.push('active: ' + provider.active); + text.push(''); + } + } + // Open a new window to display this text. this.setText_(text.join('\n')); diff --git a/chrome/browser/resources/net_internals/serviceprovidersview.js b/chrome/browser/resources/net_internals/serviceprovidersview.js index 5921ceb..0ea36be 100644 --- a/chrome/browser/resources/net_internals/serviceprovidersview.js +++ b/chrome/browser/resources/net_internals/serviceprovidersview.js @@ -32,16 +32,77 @@ function ServiceProvidersView(tabId, inherits(ServiceProvidersView, DivView); ServiceProvidersView.prototype.onServiceProvidersChanged = - function(serviceProviders) { +function(serviceProviders) { this.updateServiceProviders_(serviceProviders["service_providers"]); this.updateNamespaceProviders_(serviceProviders["namespace_providers"]); }; /** + * Returns type of a layered service provider. + */ +ServiceProvidersView.getLayeredServiceProviderType = +function(serviceProvider) { + if (serviceProvider.chain_length == 0) + return 'Layer'; + if (serviceProvider.chain_length == 1) + return 'Base'; + return 'Chain'; +}; + +ServiceProvidersView.namespaceProviderType_ = { + '12': 'NS_DNS', + '15': 'NS_NLA', + '16': 'NS_BTH', + '32': 'NS_NTDS', + '37': 'NS_EMAIL', + '38': 'NS_PNRPNAME', + '39': 'NS_PNRPCLOUD' +}; + +/** + * Returns the type of a namespace provider as a string. + */ +ServiceProvidersView.getNamespaceProviderType = function(namespaceProvider) { + return tryGetValueWithKey(ServiceProvidersView.namespaceProviderType_, + namespaceProvider.type); +}; + +ServiceProvidersView.socketType_ = { + '1': 'SOCK_STREAM', + '2': 'SOCK_DGRAM', + '3': 'SOCK_RAW', + '4': 'SOCK_RDM', + '5': 'SOCK_SEQPACKET' +}; + +/** + * Returns socket type of a layered service provider as a string. + */ +ServiceProvidersView.getSocketType = function(layeredServiceProvider) { + return tryGetValueWithKey(ServiceProvidersView.socketType_, + layeredServiceProvider.socket_type); +}; + +ServiceProvidersView.protocolType_ = { + '1': 'IPPROTO_ICMP', + '6': 'IPPROTO_TCP', + '17': 'IPPROTO_UDP', + '58': 'IPPROTO_ICMPV6' +}; + +/** + * Returns protocol type of a layered service provider as a string. + */ +ServiceProvidersView.getProtocolType = function(layeredServiceProvider) { + return tryGetValueWithKey(ServiceProvidersView.protocolType_, + layeredServiceProvider.socket_protocol); +}; + + /** * Updates the table of layered service providers. */ ServiceProvidersView.prototype.updateServiceProviders_ = - function(serviceProviders) { +function(serviceProviders) { this.serviceProvidersTbody_.innerHTML = ''; // Add a table row for each service provider. @@ -51,35 +112,19 @@ ServiceProvidersView.prototype.updateServiceProviders_ = addNodeWithText(tr, 'td', entry.name); addNodeWithText(tr, 'td', entry.version); - - if (entry.chain_length == 0) - addNodeWithText(tr, 'td', 'Layer'); - else if (entry.chain_length == 1) - addNodeWithText(tr, 'td', 'Base'); - else - addNodeWithText(tr, 'td', 'Chain'); - - addNodeWithText(tr, 'td', entry.socket_type); - addNodeWithText(tr, 'td', entry.socket_protocol); + addNodeWithText(tr, 'td', + ServiceProvidersView.getLayeredServiceProviderType(entry)); + addNodeWithText(tr, 'td', ServiceProvidersView.getSocketType(entry)); + addNodeWithText(tr, 'td', ServiceProvidersView.getProtocolType(entry)); addNodeWithText(tr, 'td', entry.path); } }; -ServiceProvidersView.namespaceProviderType_ = { - '12': 'NS_DNS', - '15': 'NS_NLA', - '16': 'NS_BTH', - '32': 'NS_NTDS', - '37': 'NS_EMAIL', - '38': 'NS_PNRPNAME', - '39': 'NS_PNRPCLOUD' -}; - /** * Updates the lable of namespace providers. */ ServiceProvidersView.prototype.updateNamespaceProviders_ = - function(namespaceProviders) { +function(namespaceProviders) { this.namespaceProvidersTbody_.innerHTML = ''; // Add a table row for each namespace provider. @@ -88,13 +133,8 @@ ServiceProvidersView.prototype.updateNamespaceProviders_ = var entry = namespaceProviders[i]; addNodeWithText(tr, 'td', entry.name); addNodeWithText(tr, 'td', entry.version); - - var typeString = ServiceProvidersView.namespaceProviderType_[entry.type]; - if (typeString) - addNodeWithText(tr, 'td', typeString); - else - addNodeWithText(tr, 'td', entry.type); - + addNodeWithText(tr, 'td', + ServiceProvidersView.getNamespaceProviderType(entry)); addNodeWithText(tr, 'td', entry.active); } }; diff --git a/chrome/browser/resources/net_internals/util.js b/chrome/browser/resources/net_internals/util.js index 7b85229..a6c7322 100644 --- a/chrome/browser/resources/net_internals/util.js +++ b/chrome/browser/resources/net_internals/util.js @@ -105,6 +105,18 @@ function getKeyWithValue(map, value) { } /** + * Looks up |key| in |map|, and returns the resulting entry, if there is one. + * Otherwise, returns |key|. Intended primarily for use with incomplete + * tables, and for reasonable behavior with system enumerations that may be + * extended in the future. + */ +function tryGetValueWithKey(map, key) { + if (key in map) + return map[key]; + return key; +} + +/** * Builds a string by repeating |str| |count| times. */ function makeRepeatedString(str, count) { |