Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(563)

Side by Side Diff: chrome/browser/resources/net_internals/main.js

Issue 432553003: Remove redundant mapping of net errors to strings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Response to comments Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 * Dictionary of constants (Initialized soon after loading by data from browser, 6 * Dictionary of constants (Initialized soon after loading by data from browser,
7 * updated on load log). The *Types dictionaries map strings to numeric IDs, 7 * updated on load log). The *Types dictionaries map strings to numeric IDs,
8 * while the *TypeNames are the other way around. 8 * while the *TypeNames are the other way around.
9 */ 9 */
10 var EventType = null; 10 var EventType = null;
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 341
342 /** 342 /**
343 * Returns the name for netError. 343 * Returns the name for netError.
344 * 344 *
345 * Example: netErrorToString(-105) should return 345 * Example: netErrorToString(-105) should return
346 * "ERR_NAME_NOT_RESOLVED". 346 * "ERR_NAME_NOT_RESOLVED".
347 * @param {number} netError The net error code. 347 * @param {number} netError The net error code.
348 * @return {string} The name of the given error. 348 * @return {string} The name of the given error.
349 */ 349 */
350 function netErrorToString(netError) { 350 function netErrorToString(netError) {
351 var str = getKeyWithValue(NetError, netError); 351 return getKeyWithValue(NetError, netError);
352 if (str == '?')
353 return str;
354 return 'ERR_' + str;
355 } 352 }
356 353
357 /** 354 /**
358 * Returns the name for quicError. 355 * Returns the name for quicError.
359 * 356 *
360 * Example: quicErrorToString(25) should return 357 * Example: quicErrorToString(25) should return
361 * "TIMED_OUT". 358 * "TIMED_OUT".
362 * @param {number} quicError The QUIC error code. 359 * @param {number} quicError The QUIC error code.
363 * @return {string} The name of the given error. 360 * @return {string} The name of the given error.
364 */ 361 */
(...skipping 17 matching lines...) Expand all
382 * Returns a string representation of |family|. 379 * Returns a string representation of |family|.
383 * @param {number} family An AddressFamily 380 * @param {number} family An AddressFamily
384 * @return {string} A representation of the given family. 381 * @return {string} A representation of the given family.
385 */ 382 */
386 function addressFamilyToString(family) { 383 function addressFamilyToString(family) {
387 var str = getKeyWithValue(AddressFamily, family); 384 var str = getKeyWithValue(AddressFamily, family);
388 // All the address family start with ADDRESS_FAMILY_*. 385 // All the address family start with ADDRESS_FAMILY_*.
389 // Strip that prefix since it is redundant and only clutters the output. 386 // Strip that prefix since it is redundant and only clutters the output.
390 return str.replace(/^ADDRESS_FAMILY_/, ''); 387 return str.replace(/^ADDRESS_FAMILY_/, '');
391 } 388 }
OLDNEW
« no previous file with comments | « chrome/browser/guest_view/web_view/web_view_guest.cc ('k') | chrome/browser/resources/net_internals/source_entry.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698