diff options
author | dbeam@chromium.org <dbeam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-20 02:50:45 +0000 |
---|---|---|
committer | dbeam@chromium.org <dbeam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-20 02:50:45 +0000 |
commit | c4991f239998abe4a577be06c4419666c85556cd (patch) | |
tree | 33cff918c80bc3333f095886a4d0ca0981cd9e94 | |
parent | 3024571e695e2da3e3caaed51302806b93c8973d (diff) | |
download | chromium_src-c4991f239998abe4a577be06c4419666c85556cd.zip chromium_src-c4991f239998abe4a577be06c4419666c85556cd.tar.gz chromium_src-c4991f239998abe4a577be06c4419666c85556cd.tar.bz2 |
[web_dev_style] (Boolean|Number|String) -> (boolean|number|string) and add
presubmit check.
BUG=113202
TEST=chrome/browser/resources/test_presubmit.py
Review URL: https://codereview.chromium.org/11628003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@174083 0039d316-1c4b-4281-b951-d872f2087c98
46 files changed, 150 insertions, 98 deletions
diff --git a/chrome/browser/resources/extensions/pack_extension_overlay.js b/chrome/browser/resources/extensions/pack_extension_overlay.js index 92e2607..0a4baa2 100644 --- a/chrome/browser/resources/extensions/pack_extension_overlay.js +++ b/chrome/browser/resources/extensions/pack_extension_overlay.js @@ -93,7 +93,7 @@ cr.define('extensions', function() { /** * Wrap up the pack process by showing the success |message| and closing * the overlay. - * @param {String} message The message to show to the user. + * @param {string} message The message to show to the user. */ PackExtensionOverlay.showSuccessMessage = function(message) { alertOverlay.setValues( diff --git a/chrome/browser/resources/file_manager/js/commandbutton.js b/chrome/browser/resources/file_manager/js/commandbutton.js index 4ba18eb..f550f421 100644 --- a/chrome/browser/resources/file_manager/js/commandbutton.js +++ b/chrome/browser/resources/file_manager/js/commandbutton.js @@ -46,7 +46,7 @@ CommandButton.prototype.getCommand = function() { /** * Associates command with this button. - * @param {String|cr.ui.Command} command Command id, or command object to + * @param {string|cr.ui.Command} command Command id, or command object to * associate with this button. */ CommandButton.prototype.setCommand = function(command) { @@ -78,7 +78,7 @@ CommandButton.prototype.setCommand = function(command) { /** * Returns button label - * @return {String} Button label. + * @return {string} Button label. */ CommandButton.prototype.getLabel = function() { return this.textContent; diff --git a/chrome/browser/resources/file_manager/js/default_action_dialog.js b/chrome/browser/resources/file_manager/js/default_action_dialog.js index 71c223e..3f4fc7a 100644 --- a/chrome/browser/resources/file_manager/js/default_action_dialog.js +++ b/chrome/browser/resources/file_manager/js/default_action_dialog.js @@ -81,8 +81,8 @@ cr.define('cr.filebrowser', function() { /** * Shows dialog. * - * @param {String} title Title in dialog caption. - * @param {String} message Message in dialog caption. + * @param {string} title Title in dialog caption. + * @param {string} message Message in dialog caption. * @param {Array} items Items to render in list * @param {int} defaultIndex Item to select by default. * @param {Function} onOk Callback function. diff --git a/chrome/browser/resources/file_manager/js/file_manager.js b/chrome/browser/resources/file_manager/js/file_manager.js index 29140d4..5be562b 100644 --- a/chrome/browser/resources/file_manager/js/file_manager.js +++ b/chrome/browser/resources/file_manager/js/file_manager.js @@ -2600,7 +2600,7 @@ DialogType.isModal = function(type) { /** * Handler invoked on preference setting in gdata context menu. - * @param {String} pref The preference to alter. + * @param {string} pref The preference to alter. * @param {boolean} inverted Invert the value if true. * @param {Event} event The click event. */ diff --git a/chrome/browser/resources/file_manager/js/file_tasks.js b/chrome/browser/resources/file_manager/js/file_tasks.js index 86d3e8f..6febf1c 100644 --- a/chrome/browser/resources/file_manager/js/file_tasks.js +++ b/chrome/browser/resources/file_manager/js/file_tasks.js @@ -46,7 +46,7 @@ FileTasks.prototype.init = function(urls, opt_mimeTypes) { /** * Returns amount of tasks. - * @return {Number=} amount of tasks. + * @return {number=} amount of tasks. */ FileTasks.prototype.size = function() { return (this.tasks_ && this.tasks_.length) || 0; @@ -555,8 +555,8 @@ FileTasks.decorate = function(method) { * Shows modal action picker dialog with currently available list of tasks. * * @param {DefaultActionDialog} actionDialog Action dialog to show and update. - * @param {String} title Title to use. - * @param {String} message Message to use. + * @param {string} title Title to use. + * @param {string} message Message to use. * @param {function(Object)} onSuccess Callback to pass selected task. */ FileTasks.prototype.showTaskPicker = function(actionDialog, title, message, diff --git a/chrome/browser/resources/file_manager/js/image_editor/exif_encoder.js b/chrome/browser/resources/file_manager/js/image_editor/exif_encoder.js index 4b330f4..e49aee0 100644 --- a/chrome/browser/resources/file_manager/js/image_editor/exif_encoder.js +++ b/chrome/browser/resources/file_manager/js/image_editor/exif_encoder.js @@ -130,7 +130,7 @@ ExifEncoder.prototype.setThumbnailData = function(canvas, quality) { /** * Return a range where the metadata is (or should be) located. - * @param {String} encodedImage Raw image data to look for metadata. + * @param {string} encodedImage Raw image data to look for metadata. * @return {Object} An object with from and to properties. */ ExifEncoder.prototype.findInsertionRange = function(encodedImage) { @@ -268,7 +268,7 @@ ExifEncoder.prototype.encode = function() { * @param {Object} directory A directory map as created by ExifParser. * @param {Array} resolveLater An array of tag ids for which the values will be * resolved later. - * @param {String} nextDirPointer A forward key for the pointer to the next + * @param {string} nextDirPointer A forward key for the pointer to the next * directory. If omitted the pointer is set to 0. */ ExifEncoder.encodeDirectory = function( @@ -507,7 +507,7 @@ ByteWriter.prototype.writeScalar = function(value, width, opt_signed) { /** * Writes string. - * @param {String} str String to write. + * @param {string} str String to write. */ ByteWriter.prototype.writeString = function(str) { this.validateWrite(str.length); diff --git a/chrome/browser/resources/file_manager/js/image_editor/image_buffer.js b/chrome/browser/resources/file_manager/js/image_editor/image_buffer.js index 8d0da59..4cf78aa 100644 --- a/chrome/browser/resources/file_manager/js/image_editor/image_buffer.js +++ b/chrome/browser/resources/file_manager/js/image_editor/image_buffer.js @@ -49,7 +49,7 @@ ImageBuffer.prototype.draw = function() { * @param {number} x X coordinate for cursor. * @param {number} y Y coordinate for cursor. * @param {boolean} mouseDown If mouse button is down. - * @return {String} A value for style.cursor CSS property. + * @return {string} A value for style.cursor CSS property. */ ImageBuffer.prototype.getCursorStyle = function(x, y, mouseDown) { for (var i = this.overlays_.length - 1; i >= 0; i--) { @@ -63,7 +63,7 @@ ImageBuffer.prototype.getCursorStyle = function(x, y, mouseDown) { * Searches for a click handler in the descending Z-order. * @param {number} x X coordinate for click event. * @param {number} y Y coordinate for click event. - * @return {Boolean} True if handled. + * @return {boolean} True if handled. */ ImageBuffer.prototype.onClick = function(x, y) { for (var i = this.overlays_.length - 1; i >= 0; i--) { diff --git a/chrome/browser/resources/file_manager/js/image_editor/image_encoder.js b/chrome/browser/resources/file_manager/js/image_editor/image_encoder.js index 8673fef..54eeb6d 100644 --- a/chrome/browser/resources/file_manager/js/image_editor/image_encoder.js +++ b/chrome/browser/resources/file_manager/js/image_editor/image_encoder.js @@ -51,7 +51,7 @@ ImageEncoder.encodeMetadata = function(metadata, canvas, quality) { * Return a blob with the encoded image with metadata inserted. * @param {HTMLCanvasElement} canvas The canvas with the image to be encoded. * @param {ImageEncoder.MetadataEncoder} metadataEncoder Encoder to use. - * @param {Number} quality (0..1], Encoding quality, defaults to 0.9. + * @param {number} quality (0..1], Encoding quality, defaults to 0.9. * @return {Blob} encoded data. */ ImageEncoder.getBlob = function(canvas, metadataEncoder, quality) { @@ -106,8 +106,8 @@ ImageEncoder.getBlob = function(canvas, metadataEncoder, quality) { * Why return a string? Calling atob and having the rest of the code deal * with a string is several times faster than decoding base64 in Javascript. * - * @param {String} dataURL Data URL to decode. - * @return {String} A binary string (char codes are the actual byte values). + * @param {string} dataURL Data URL to decode. + * @return {string} A binary string (char codes are the actual byte values). */ ImageEncoder.decodeDataURL = function(dataURL) { // Skip the prefix ('data:image/<type>;base64,') @@ -118,7 +118,7 @@ ImageEncoder.decodeDataURL = function(dataURL) { /** * Return a thumbnail for an image. * @param {HTMLCanvasElement} canvas Original image. - * @param {Number} opt_shrinkage Thumbnail should be at least this much smaller + * @param {number} opt_shrinkage Thumbnail should be at least this much smaller * than the original image (in each dimension). * @return {HTMLCanvasElement} Thumbnail canvas */ @@ -192,7 +192,7 @@ ImageEncoder.MetadataEncoder.prototype.setThumbnailData = /** * Return a range where the metadata is (or should be) located. - * @param {String} encodedImage //TODO(JSDOC) + * @param {string} encodedImage //TODO(JSDOC) * @return {Object} An object with from and to properties. */ ImageEncoder.MetadataEncoder.prototype. diff --git a/chrome/browser/resources/file_manager/js/media/media_controls.js b/chrome/browser/resources/file_manager/js/media/media_controls.js index 0cf6005..c0d2b87 100644 --- a/chrome/browser/resources/file_manager/js/media/media_controls.js +++ b/chrome/browser/resources/file_manager/js/media/media_controls.js @@ -70,7 +70,7 @@ MediaControls.prototype.createControl = function(className, opt_parent) { * @param {string} className Class name. * @param {function(Event)} handler Click handler. * @param {HTMLElement=} opt_parent Parent element or container if undefined. - * @param {Boolean} opt_toggle True if the button has toggle state. + * @param {boolean} opt_toggle True if the button has toggle state. * @return {HTMLElement} The new button element. */ MediaControls.prototype.createButton = function( diff --git a/chrome/browser/resources/file_manager/js/photo/gallery.js b/chrome/browser/resources/file_manager/js/photo/gallery.js index 9688c9d..19b560d 100644 --- a/chrome/browser/resources/file_manager/js/photo/gallery.js +++ b/chrome/browser/resources/file_manager/js/photo/gallery.js @@ -140,13 +140,13 @@ Gallery.openStandalone = function(path, pageState) { /** * Tools fade-out timeout im milliseconds. - * @type {Number} + * @type {number} */ Gallery.FADE_TIMEOUT = 3000; /** * First time tools fade-out timeout im milliseconds. - * @type {Number} + * @type {number} */ Gallery.FIRST_FADE_TIMEOUT = 1000; @@ -731,7 +731,7 @@ Gallery.prototype.onFilenameEditKeydown_ = function() { }; /** - * @return {Boolean} True if file renaming is currently in progress + * @return {boolean} True if file renaming is currently in progress * @private */ Gallery.prototype.isRenaming_ = function() { diff --git a/chrome/browser/resources/file_manager/js/photo/ribbon.js b/chrome/browser/resources/file_manager/js/photo/ribbon.js index d2a0036..d6170e5 100644 --- a/chrome/browser/resources/file_manager/js/photo/ribbon.js +++ b/chrome/browser/resources/file_manager/js/photo/ribbon.js @@ -48,7 +48,7 @@ Ribbon.decorate = function(self, metadataCache, dataModel, selectionModel, /** * Max number of thumbnails in the ribbon. - * @type {Number} + * @type {number} */ Ribbon.ITEMS_COUNT = 5; diff --git a/chrome/browser/resources/file_manager/js/selection.js b/chrome/browser/resources/file_manager/js/selection.js index 8afa815..cce1f8d 100644 --- a/chrome/browser/resources/file_manager/js/selection.js +++ b/chrome/browser/resources/file_manager/js/selection.js @@ -5,7 +5,7 @@ /** * The current selection object. * @param {FileManager} fileManager FileManager instance. - * @param {Array.<Number>} indexes Selected indexes. + * @param {Array.<number>} indexes Selected indexes. */ function Selection(fileManager, indexes) { this.fileManager_ = fileManager; diff --git a/chrome/browser/resources/help/help.js b/chrome/browser/resources/help/help.js index 983b2fa..709150a 100644 --- a/chrome/browser/resources/help/help.js +++ b/chrome/browser/resources/help/help.js @@ -227,7 +227,7 @@ cr.define('help', function() { /** * Sets the value of the "Build Date" field of the "More Info" section. - * @param {String} buildDate The date of the build. + * @param {string} buildDate The date of the build. * @private */ setBuildDate_: function(buildDate) { diff --git a/chrome/browser/resources/history/history.js b/chrome/browser/resources/history/history.js index 8e21e740..9bff80a 100644 --- a/chrome/browser/resources/history/history.js +++ b/chrome/browser/resources/history/history.js @@ -36,7 +36,7 @@ MenuButton.createDropDownArrows(); * @param {boolean} continued Whether this visit is on the same day as the * visit before it. * @param {HistoryModel} model The model object this entry belongs to. - * @param {Number} id The identifier for the entry. + * @param {number} id The identifier for the entry. * @constructor */ function Visit(result, continued, model, id) { @@ -296,8 +296,8 @@ HistoryModel.prototype.setView = function(view) { /** * Start a new search - this will clear out our model. - * @param {String} searchText The text to search for - * @param {Number} opt_page The page to view - this is mostly used when setting + * @param {string} searchText The text to search for + * @param {number} opt_page The page to view - this is mostly used when setting * up an initial view, use #requestPage otherwise. */ HistoryModel.prototype.setSearchText = function(searchText, opt_page) { @@ -320,7 +320,7 @@ HistoryModel.prototype.reload = function() { }; /** - * @return {String} The current search text. + * @return {string} The current search text. */ HistoryModel.prototype.getSearchText = function() { return this.searchText_; @@ -329,7 +329,7 @@ HistoryModel.prototype.getSearchText = function() { /** * Tell the model that the view will want to see the current page. When * the data becomes available, the model will call the view back. - * @param {Number} page The page we want to view. + * @param {number} page The page we want to view. */ HistoryModel.prototype.requestPage = function(page) { this.requestedPage_ = page; @@ -381,7 +381,7 @@ HistoryModel.prototype.addResults = function(info, results) { }; /** - * @return {Number} The number of visits in the model. + * @return {number} The number of visits in the model. */ HistoryModel.prototype.getSize = function() { return this.visits_.length; @@ -389,8 +389,8 @@ HistoryModel.prototype.getSize = function() { /** * Get a list of visits between specified index positions. - * @param {Number} start The start index - * @param {Number} end The end index + * @param {number} start The start index + * @param {number} end The end index * @return {Array.<Visit>} A list of visits */ HistoryModel.prototype.getNumberedRange = function(start, end) { @@ -486,7 +486,7 @@ HistoryModel.prototype.queryHistory_ = function() { /** * Check to see if we have data for the given page. - * @param {Number} page The page number. + * @param {number} page The page number. * @return {boolean} Whether we have any data for the given page. * @private */ @@ -496,7 +496,7 @@ HistoryModel.prototype.haveDataForPage_ = function(page) { /** * Check to see if we have data to fill the given page. - * @param {Number} page The page number. + * @param {number} page The page number. * @return {boolean} Whether we have data to fill the page. * @private */ @@ -852,7 +852,7 @@ function load() { /** * TODO(glen): Get rid of this function. * Set the history view to a specified page. - * @param {String} term The string to search for + * @param {string} term The string to search for */ function setSearch(term) { if (historyView) { diff --git a/chrome/browser/resources/net_internals/dns_view.js b/chrome/browser/resources/net_internals/dns_view.js index 700b6b3..45f6e6e 100644 --- a/chrome/browser/resources/net_internals/dns_view.js +++ b/chrome/browser/resources/net_internals/dns_view.js @@ -266,7 +266,7 @@ var DnsView = (function() { * 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. + * @param {Array.<string>} list List of strings to add to the node. */ function addListToNode_(node, list) { for (var i = 0; i < list.length; ++i) diff --git a/chrome/browser/resources/net_internals/main.js b/chrome/browser/resources/net_internals/main.js index 0556aec..db43481 100644 --- a/chrome/browser/resources/net_internals/main.js +++ b/chrome/browser/resources/net_internals/main.js @@ -169,7 +169,7 @@ var MainView = (function() { * without reloading the page. Must be called before passing loaded data * to the individual views. * - * @param {String} opt_fileName The name of the log file that has been + * @param {string} opt_fileName The name of the log file that has been * loaded, if we're loading a log file. */ onLoadLog: function(opt_fileName) { diff --git a/chrome/browser/resources/net_internals/tab_switcher_view.js b/chrome/browser/resources/net_internals/tab_switcher_view.js index 0c4f6daa..fb4ebfe 100644 --- a/chrome/browser/resources/net_internals/tab_switcher_view.js +++ b/chrome/browser/resources/net_internals/tab_switcher_view.js @@ -49,7 +49,7 @@ var TabSwitcherView = (function() { /** * Adds a new tab (initially hidden). * - * @param {String} id The ID for DOM node that will be made clickable to + * @param {string} id The ID for DOM node that will be made clickable to * select this tab. This is also the ID we use to * identify the "tab". * @param {!View} view The tab's actual contents. diff --git a/chrome/browser/resources/net_internals/time_util.js b/chrome/browser/resources/net_internals/time_util.js index 9e412bbf..8751947 100644 --- a/chrome/browser/resources/net_internals/time_util.js +++ b/chrome/browser/resources/net_internals/time_util.js @@ -25,7 +25,7 @@ var timeutil = (function() { * This function converts the tick count to a Javascript "time", which is * the UTC time in milliseconds. * - * @param {String} timeTicks A time represented in "time ticks". + * @param {string} timeTicks A time represented in "time ticks". * @return {number} The Javascript time that |timeTicks| represents. */ function convertTimeTicksToTime(timeTicks) { @@ -36,7 +36,7 @@ var timeutil = (function() { * The browser gives us times in terms of "time ticks" in milliseconds. * This function converts the tick count to a Date() object. * - * @param {String} timeTicks A time represented in "time ticks". + * @param {string} timeTicks A time represented in "time ticks". * @return {Date} The time that |timeTicks| represents. */ function convertTimeTicksToDate(timeTicks) { @@ -69,7 +69,7 @@ var timeutil = (function() { * Returns a string representation of |date|. * * @param {Date} date The date to be represented. - * @return {String} A string representation of |date|. + * @return {string} A string representation of |date|. */ function dateToString(date) { var dateStr = date.getFullYear() + '-' + diff --git a/chrome/browser/resources/ntp4/apps_page.js b/chrome/browser/resources/ntp4/apps_page.js index d691383..68418b1 100644 --- a/chrome/browser/resources/ntp4/apps_page.js +++ b/chrome/browser/resources/ntp4/apps_page.js @@ -89,7 +89,7 @@ cr.define('ntp', function() { /** * Appends a menu item to |this.menu|. - * @param {?String} textId If non-null, the ID for the localized string + * @param {?string} textId If non-null, the ID for the localized string * that acts as the item's label. */ appendMenuItem_: function(textId) { @@ -878,7 +878,7 @@ cr.define('ntp', function() { /** * Launches the specified app using the APP_LAUNCH_NTP_APP_RE_ENABLE * histogram. This should only be invoked from the AppLauncherHandler. - * @param {String} appID The ID of the app. + * @param {string} appID The ID of the app. */ function launchAppAfterEnable(appId) { chrome.send('launchApp', [appId, APP_LAUNCH.NTP_APP_RE_ENABLE]); diff --git a/chrome/browser/resources/ntp4/logging.js b/chrome/browser/resources/ntp4/logging.js index dfd0b14..b071a77 100644 --- a/chrome/browser/resources/ntp4/logging.js +++ b/chrome/browser/resources/ntp4/logging.js @@ -12,7 +12,7 @@ var eventLog = []; /** * Logs an event. - * @param {String} name The name of the event (can be any string). + * @param {string} name The name of the event (can be any string). * @param {boolean} shouldLogTime If true, the event is used for benchmarking * and the time is logged. Otherwise, just push the event on the event * stack. diff --git a/chrome/browser/resources/ntp4/nav_dot.js b/chrome/browser/resources/ntp4/nav_dot.js index 72a2fbc..5d7fd35 100644 --- a/chrome/browser/resources/ntp4/nav_dot.js +++ b/chrome/browser/resources/ntp4/nav_dot.js @@ -81,7 +81,7 @@ cr.define('ntp', function() { /** * Sets/gets the display title. - * @type {String} title The display name for this nav dot. + * @type {string} title The display name for this nav dot. */ get displayTitle() { return this.title; diff --git a/chrome/browser/resources/ntp4/new_tab.js b/chrome/browser/resources/ntp4/new_tab.js index 0cab2b0..483446d 100644 --- a/chrome/browser/resources/ntp4/new_tab.js +++ b/chrome/browser/resources/ntp4/new_tab.js @@ -42,7 +42,7 @@ cr.define('ntp', function() { /** * true if |loginBubble| should be shown. - * @type {Boolean} + * @type {boolean} */ var shouldShowLoginBubble = false; diff --git a/chrome/browser/resources/ntp4/other_sessions.js b/chrome/browser/resources/ntp4/other_sessions.js index 436f04b..59409c9 100644 --- a/chrome/browser/resources/ntp4/other_sessions.js +++ b/chrome/browser/resources/ntp4/other_sessions.js @@ -32,7 +32,7 @@ cr.define('ntp', function() { /** * Record an event in the UMA histogram. - * @param {Number} eventId The id of the event to be recorded. + * @param {number} eventId The id of the event to be recorded. * @private */ function recordUmaEvent_(eventId) { @@ -293,7 +293,7 @@ cr.define('ntp', function() { /** * Appends a menu item to |this.menu|. - * @param {String} textId The ID for the localized string that acts as + * @param {string} textId The ID for the localized string that acts as * the item's label. */ appendMenuItem_: function(textId) { diff --git a/chrome/browser/resources/ntp_search/apps_page.js b/chrome/browser/resources/ntp_search/apps_page.js index 1e7d1d5..dd65278 100644 --- a/chrome/browser/resources/ntp_search/apps_page.js +++ b/chrome/browser/resources/ntp_search/apps_page.js @@ -80,7 +80,7 @@ cr.define('ntp', function() { /** * Appends a menu item to |this.menu|. - * @param {?String} textId If non-null, the ID for the localized string + * @param {?string} textId If non-null, the ID for the localized string * that acts as the item's label. */ appendMenuItem_: function(textId) { @@ -730,7 +730,7 @@ cr.define('ntp', function() { /** * Launches the specified app using the APP_LAUNCH_NTP_APP_RE_ENABLE * histogram. This should only be invoked from the AppLauncherHandler. - * @param {String} appID The ID of the app. + * @param {string} appID The ID of the app. */ function launchAppAfterEnable(appId) { chrome.send('launchApp', [appId, APP_LAUNCH.NTP_APP_RE_ENABLE]); diff --git a/chrome/browser/resources/ntp_search/position_util.js b/chrome/browser/resources/ntp_search/position_util.js index 23014ce..3117f47 100644 --- a/chrome/browser/resources/ntp_search/position_util.js +++ b/chrome/browser/resources/ntp_search/position_util.js @@ -19,7 +19,7 @@ cr.define('cr.ui', function() { var AnchorType = cr.ui.AnchorType; /** - * @type {Number} + * @type {number} * @const */ var BOOKMARK_BAR_HEIGHT = 48; diff --git a/chrome/browser/resources/options/autofill_edit_address_overlay.js b/chrome/browser/resources/options/autofill_edit_address_overlay.js index c0c8fd2..b239e99 100644 --- a/chrome/browser/resources/options/autofill_edit_address_overlay.js +++ b/chrome/browser/resources/options/autofill_edit_address_overlay.js @@ -90,7 +90,7 @@ cr.define('options', function() { /** * Updates the data model for the list named |listName| with the values from * |entries|. - * @param {String} listName The id of the list. + * @param {string} listName The id of the list. * @param {Array} entries The list of items to be added to the list. */ setMultiValueList_: function(listName, entries) { diff --git a/chrome/browser/resources/options/autofill_options.js b/chrome/browser/resources/options/autofill_options.js index 2c30ade..89cd421 100644 --- a/chrome/browser/resources/options/autofill_options.js +++ b/chrome/browser/resources/options/autofill_options.js @@ -127,7 +127,7 @@ cr.define('options', function() { /** * Removes the Autofill address or credit card represented by |guid|. - * @param {String} guid The GUID of the address to remove. + * @param {string} guid The GUID of the address to remove. * @private */ removeData_: function(guid) { @@ -138,7 +138,7 @@ cr.define('options', function() { * Requests profile data for the address represented by |guid| from the * PersonalDataManager. Once the data is loaded, the AutofillOptionsHandler * calls showEditAddressOverlay(). - * @param {String} guid The GUID of the address to edit. + * @param {string} guid The GUID of the address to edit. * @private */ loadAddressEditor_: function(guid) { @@ -149,7 +149,7 @@ cr.define('options', function() { * Requests profile data for the credit card represented by |guid| from the * PersonalDataManager. Once the data is loaded, the AutofillOptionsHandler * calls showEditCreditCardOverlay(). - * @param {String} guid The GUID of the credit card to edit. + * @param {string} guid The GUID of the credit card to edit. * @private */ loadCreditCardEditor_: function(guid) { diff --git a/chrome/browser/resources/options/autofill_options_list.js b/chrome/browser/resources/options/autofill_options_list.js index 386cf46..2e16a8f 100644 --- a/chrome/browser/resources/options/autofill_options_list.js +++ b/chrome/browser/resources/options/autofill_options_list.js @@ -108,7 +108,7 @@ cr.define('options.autofillOptions', function() { /** * Creates a new value list item. * @param {AutofillValuesList} list The parent list of this item. - * @param {String} entry A string value. + * @param {string} entry A string value. * @constructor * @extends {options.InlineEditableItem} */ diff --git a/chrome/browser/resources/options/chromeos/bluetooth_device_list.js b/chrome/browser/resources/options/chromeos/bluetooth_device_list.js index c52429d..c9ce653 100644 --- a/chrome/browser/resources/options/chromeos/bluetooth_device_list.js +++ b/chrome/browser/resources/options/chromeos/bluetooth_device_list.js @@ -157,7 +157,7 @@ cr.define('options.system.bluetooth', function() { * is hidden is not properly rendered when the list becomes visible. In * addition, deleting a single item from the list results in a stale cache * requiring an invalidation. - * @param {String=} opt_selection Optional address of device to select + * @param {string=} opt_selection Optional address of device to select * after refreshing the list. */ refresh: function(opt_selection) { @@ -174,7 +174,7 @@ cr.define('options.system.bluetooth', function() { /** * Retrieves the address of the selected device, or null if no device is * selected. - * @return {?String} Address of selected device or null. + * @return {?string} Address of selected device or null. * @private */ getSelectedDevice_: function() { @@ -186,7 +186,7 @@ cr.define('options.system.bluetooth', function() { /** * Selects the device with the matching address. - * @param {String} address The unique address of the device. + * @param {string} address The unique address of the device. * @private */ setSelectedDevice_: function(address) { diff --git a/chrome/browser/resources/options/chromeos/bluetooth_pair_device_overlay.js b/chrome/browser/resources/options/chromeos/bluetooth_pair_device_overlay.js index f0e1107..4a6abb3 100644 --- a/chrome/browser/resources/options/chromeos/bluetooth_pair_device_overlay.js +++ b/chrome/browser/resources/options/chromeos/bluetooth_pair_device_overlay.js @@ -22,7 +22,7 @@ cr.define('options', function() { /** * List of IDs for conditionally visible elements in the dialog. - * @type {Array.<String>} + * @type {Array.<string>} * @const */ var ELEMENTS = ['bluetooth-pairing-passkey-display', diff --git a/chrome/browser/resources/options/chromeos/internet_detail_ip_address_field.js b/chrome/browser/resources/options/chromeos/internet_detail_ip_address_field.js index 5155ecd..d0a096c 100644 --- a/chrome/browser/resources/options/chromeos/internet_detail_ip_address_field.js +++ b/chrome/browser/resources/options/chromeos/internet_detail_ip_address_field.js @@ -83,8 +83,8 @@ cr.define('options.internet', function() { * whitespace and leading zeros from each of the octets so that they conform * to the normal format for IP addresses. * @override - * @param {String} value Input IP address to be mutated. - * @return {String} mutated IP address. + * @param {string} value Input IP address to be mutated. + * @return {string} mutated IP address. */ mutateInput: function(value) { if (!value) diff --git a/chrome/browser/resources/options/chromeos/pointer_overlay.js b/chrome/browser/resources/options/chromeos/pointer_overlay.js index a62b876..d6a4de9 100644 --- a/chrome/browser/resources/options/chromeos/pointer_overlay.js +++ b/chrome/browser/resources/options/chromeos/pointer_overlay.js @@ -55,7 +55,7 @@ cr.define('options', function() { * button that activates the overlay is also updated to stay in sync. A * message is displayed in the main settings page if no pointer devices are * available. - * @param {String} label i18n key for the overlay title. + * @param {string} label i18n key for the overlay title. */ PointerOverlay.setTitle = function(label) { var button = $('pointer-settings-button'); diff --git a/chrome/browser/resources/options/language_list.js b/chrome/browser/resources/options/language_list.js index fda0b03..6d5817a6 100644 --- a/chrome/browser/resources/options/language_list.js +++ b/chrome/browser/resources/options/language_list.js @@ -29,7 +29,7 @@ cr.define('options', function() { /** * The language code of this language. - * @type {String} + * @type {string} * @private */ languageCode_: null, diff --git a/chrome/browser/resources/options/language_options.js b/chrome/browser/resources/options/language_options.js index 5c41cd8..d5d7150 100644 --- a/chrome/browser/resources/options/language_options.js +++ b/chrome/browser/resources/options/language_options.js @@ -684,7 +684,7 @@ cr.define('options', function() { /** * Checks if languageCode is deletable or not. - * @param {String} languageCode the languageCode to check for deletability. + * @param {string} languageCode the languageCode to check for deletability. */ languageIsDeletable: function(languageCode) { // Don't allow removing the language if it's a UI language. diff --git a/chrome/browser/resources/options/manage_profile_overlay.js b/chrome/browser/resources/options/manage_profile_overlay.js index 84eba7d..52866ec 100644 --- a/chrome/browser/resources/options/manage_profile_overlay.js +++ b/chrome/browser/resources/options/manage_profile_overlay.js @@ -120,7 +120,7 @@ cr.define('options', function() { * filePath: "/path/to/profile/data/on/disk" * isCurrentProfile: false, * }; - * @param {String} mode A label that specifies the type of dialog + * @param {string} mode A label that specifies the type of dialog * box which is currently being viewed (i.e. 'create' or * 'manage'). * @private @@ -176,7 +176,7 @@ cr.define('options', function() { /** * Display the error bubble, with |errorText| in the bubble. * @param {string} errorText The localized string id to display as an error. - * @param {String} mode A label that specifies the type of dialog + * @param {string} mode A label that specifies the type of dialog * box which is currently being viewed (i.e. 'create' or * 'manage'). * @private @@ -191,7 +191,7 @@ cr.define('options', function() { /** * Hide the error bubble. - * @param {String} mode A label that specifies the type of dialog + * @param {string} mode A label that specifies the type of dialog * box which is currently being viewed (i.e. 'create' or * 'manage'). * @private @@ -204,7 +204,7 @@ cr.define('options', function() { /** * oninput callback for <input> field. * @param {Event} event The event object. - * @param {String} mode A label that specifies the type of dialog + * @param {string} mode A label that specifies the type of dialog * box which is currently being viewed (i.e. 'create' or * 'manage'). * @private @@ -242,7 +242,7 @@ cr.define('options', function() { /** * Called when the selected icon in the icon grid changes. - * @param {String} mode A label that specifies the type of dialog + * @param {string} mode A label that specifies the type of dialog * box which is currently being viewed (i.e. 'create' or * 'manage'). * @private diff --git a/chrome/browser/resources/options/options_page.js b/chrome/browser/resources/options/options_page.js index bdd0391..00e22a4 100644 --- a/chrome/browser/resources/options/options_page.js +++ b/chrome/browser/resources/options/options_page.js @@ -179,7 +179,7 @@ cr.define('options', function() { /** * Sets the title of the page. This is accomplished by calling into the * parent page API. - * @param {String} title The title string. + * @param {string} title The title string. * @private */ OptionsPage.setTitle_ = function(title) { diff --git a/chrome/browser/resources/options/search_page.js b/chrome/browser/resources/options/search_page.js index 75a50ff..234399d 100644 --- a/chrome/browser/resources/options/search_page.js +++ b/chrome/browser/resources/options/search_page.js @@ -127,7 +127,7 @@ cr.define('options', function() { /** * A boolean to prevent recursion. Used by setSearchText_(). - * @type {Boolean} + * @type {boolean} * @private */ insideSetSearchText_: false, diff --git a/chrome/browser/resources/predictors/resource_prefetch_predictor.js b/chrome/browser/resources/predictors/resource_prefetch_predictor.js index a3522c4..28d49e9 100644 --- a/chrome/browser/resources/predictors/resource_prefetch_predictor.js +++ b/chrome/browser/resources/predictors/resource_prefetch_predictor.js @@ -22,8 +22,8 @@ function updateResourcePrefetchPredictorDb(database) { /** * Truncates the string to keep the database readable. - * @param {String} str The string to truncate. - * @return {String} The truncated string. + * @param {string} str The string to truncate. + * @return {string} The truncated string. */ function truncateString(str) { return str.length < 100 ? str : str.substring(0, 99); diff --git a/chrome/browser/resources/shared/js/cr/ui/bubble.js b/chrome/browser/resources/shared/js/cr/ui/bubble.js index 18378dc..998b458 100644 --- a/chrome/browser/resources/shared/js/cr/ui/bubble.js +++ b/chrome/browser/resources/shared/js/cr/ui/bubble.js @@ -281,8 +281,8 @@ cr.define('cr.ui', function() { /** * Update the arrow so that it appears at the correct position. - * @param {Boolean} visible Whether the arrow should be visible. - * @param {Boolean} atTop Whether the arrow should be at the top of the + * @param {boolean} visible Whether the arrow should be visible. + * @param {boolean} atTop Whether the arrow should be at the top of the * bubble. * @param {number} tipOffset The horizontal distance between the tip of the * arrow and the reference edge of the bubble (as specified by the arrow @@ -357,7 +357,7 @@ cr.define('cr.ui', function() { /** * Hide or show the close button. - * @param {Boolean} isVisible True if the close button should be visible. + * @param {boolean} isVisible True if the close button should be visible. */ set closeButtonVisible(isVisible) { this.querySelector('.bubble-close').hidden = !isVisible; diff --git a/chrome/browser/resources/shared/js/cr/ui/list_single_selection_model.js b/chrome/browser/resources/shared/js/cr/ui/list_single_selection_model.js index 7afd158..8789f20 100644 --- a/chrome/browser/resources/shared/js/cr/ui/list_single_selection_model.js +++ b/chrome/browser/resources/shared/js/cr/ui/list_single_selection_model.js @@ -157,7 +157,7 @@ cr.define('cr.ui', function() { /** * Creates event with specified name and fills its {changes} property. - * @param {String} name Event name. + * @param {string} name Event name. */ createChangeEvent: function(eventName) { var e = new Event(eventName); diff --git a/chrome/browser/resources/task_manager/preload.js b/chrome/browser/resources/task_manager/preload.js index 6f4d911..ea52142 100644 --- a/chrome/browser/resources/task_manager/preload.js +++ b/chrome/browser/resources/task_manager/preload.js @@ -44,8 +44,8 @@ function getEnabledColumns() { } /** - * @return {Boolean} the given column (at |columnId|) is enabled or not. - * @param {String} columnId The ID of the collumn to be checked. + * @return {boolean} the given column (at |columnId|) is enabled or not. + * @param {string} columnId The ID of the collumn to be checked. */ function isColumnEnabled(columnId) { return (getEnabledColumns())[columnId]; @@ -53,8 +53,8 @@ function isColumnEnabled(columnId) { /** * Sets the given column either enabled or disabled. - * @param {String} columnId The ID of the collumn to be set. - * @param {Boolean} newChecked True, to set the column enable. False otherwise. + * @param {string} columnId The ID of the collumn to be set. + * @param {boolean} newChecked True, to set the column enable. False otherwise. */ function setColumnEnabled(columnId, newChecked) { commands.setUpdateColumn(columnId, newChecked); diff --git a/chrome/browser/resources/test_presubmit.py b/chrome/browser/resources/test_presubmit.py index 610c8751..10e4292d 100755 --- a/chrome/browser/resources/test_presubmit.py +++ b/chrome/browser/resources/test_presubmit.py @@ -173,7 +173,7 @@ class JsStyleGuideTest(SuperMoxTestBase): """Checks that the '@inheritDoc' checker flags |line| as a style error.""" error = self.checker.InheritDocCheck(1, line) self.assertNotEqual('', error, - 'Should be flagged as style error: ' + line) + msg='Should be flagged as style error: ' + line) self.assertEqual(self.GetHighlight(line, error), '@inheritDoc') def ShouldPassInheritDocCheck(self, line): @@ -181,12 +181,12 @@ class JsStyleGuideTest(SuperMoxTestBase): error. """ self.assertEqual('', self.checker.InheritDocCheck(1, line), - 'Should not be flagged as style error: ' + line) + msg='Should not be flagged as style error: ' + line) def testInheritDocFails(self): lines = [ - "/** @inheritDoc */", - "* @inheritDoc", + " /** @inheritDoc */", + " * @inheritDoc", ] for line in lines: self.ShouldFailInheritDocCheck(line) @@ -194,13 +194,57 @@ class JsStyleGuideTest(SuperMoxTestBase): def testInheritDocPasses(self): lines = [ "And then I said, but I won't @inheritDoc! Hahaha!", - "If your dad's a doctor, do you inheritDoc?", - "What's up, inherit doc?", - "this.inheritDoc(someDoc)", + " If your dad's a doctor, do you inheritDoc?", + " What's up, inherit doc?", + " this.inheritDoc(someDoc)", ] for line in lines: self.ShouldPassInheritDocCheck(line) + def ShouldFailWrapperTypeCheck(self, line): + """Checks that the use of wrapper types (i.e. new Number(), @type {Number}) + is a style error. + """ + error = self.checker.WrapperTypeCheck(1, line) + self.assertNotEqual('', error, + msg='Should be flagged as style error: ' + line) + highlight = self.GetHighlight(line, error) + self.assertTrue(highlight in ('Boolean', 'Number', 'String')) + + def ShouldPassWrapperTypeCheck(self, line): + """Checks that the wrapper type checker doesn't flag |line| as a style + error. + """ + self.assertEqual('', self.checker.WrapperTypeCheck(1, line), + msg='Should not be flagged as style error: ' + line) + + def testWrapperTypePasses(self): + lines = [ + "/** @param {!ComplexType} */", + " * @type {Object}", + " * @param {Function=} opt_callback", + " * @param {} num Number of things to add to {blah}.", + " * @return {!print_preview.PageNumberSet}", + " /* @returns {Number} */", # Should be /** @return {Number} */ + "* @param {!LocalStrings}" + " Your type of Boolean is false!", + " Then I parameterized her Number from her friend!", + " A String of Pearls", + " types.params.aBoolean.typeString(someNumber)", + ] + for line in lines: + self.ShouldPassWrapperTypeCheck(line) + + def testWrapperTypeFails(self): + lines = [ + " /**@type {String}*/(string)", + " * @param{Number=} opt_blah A number", + "/** @private @return {!Boolean} */", + " * @param {number|String}", + ] + for line in lines: + self.ShouldFailWrapperTypeCheck(line) + class CssStyleGuideTest(SuperMoxTestBase): def setUp(self): diff --git a/chrome/browser/resources/uber/uber.js b/chrome/browser/resources/uber/uber.js index ea84916..e0e225b 100644 --- a/chrome/browser/resources/uber/uber.js +++ b/chrome/browser/resources/uber/uber.js @@ -240,10 +240,10 @@ cr.define('uber', function() { /** * Selects a subpage. This is called from uber-frame. - * @param {String} pageId Should matche an id of one of the iframe containers. + * @param {string} pageId Should matche an id of one of the iframe containers. * @param {integer} historyOption Indicates whether we should push or replace * browser history. - * @param {String} path A sub-page path. + * @param {string} path A sub-page path. */ function showPage(pageId, historyOption, path) { var container = $(pageId); diff --git a/chrome/browser/resources/uber/uber_frame.js b/chrome/browser/resources/uber/uber_frame.js index 47f9504..c9f9195 100644 --- a/chrome/browser/resources/uber/uber_frame.js +++ b/chrome/browser/resources/uber/uber_frame.js @@ -80,7 +80,7 @@ cr.define('uber_frame', function() { /** * Sets selection on the given nav item. - * @param {Boolean} newSelection The item to be selected. + * @param {boolean} newSelection The item to be selected. */ function setSelection(newSelection) { var lastSelectedNavItem = document.querySelector('li.selected'); diff --git a/chrome/browser/resources/uber/uber_utils.js b/chrome/browser/resources/uber/uber_utils.js index 1903c8d..0727a89 100644 --- a/chrome/browser/resources/uber/uber_utils.js +++ b/chrome/browser/resources/uber/uber_utils.js @@ -79,7 +79,7 @@ cr.define('uber', function() { /** * Invokes a method on the parent window (UberPage). This is a convenience * method for API calls into the uber page. - * @param {String} method The name of the method to invoke. + * @param {string} method The name of the method to invoke. * @param {Object=} opt_params Optional property bag of parameters to pass to * the invoked method. * @private @@ -93,10 +93,10 @@ cr.define('uber', function() { /** * Invokes a method on the target window. - * @param {String} method The name of the method to invoke. + * @param {string} method The name of the method to invoke. * @param {Object=} opt_params Optional property bag of parameters to pass to * the invoked method. - * @param {String=} opt_url The origin of the target window. + * @param {string=} opt_url The origin of the target window. * @private */ function invokeMethodOnWindow(targetWindow, method, opt_params, opt_url) { diff --git a/chrome/browser/resources/web_dev_style/js_checker.py b/chrome/browser/resources/web_dev_style/js_checker.py index 02be4cc..adca62b 100644 --- a/chrome/browser/resources/web_dev_style/js_checker.py +++ b/chrome/browser/resources/web_dev_style/js_checker.py @@ -61,6 +61,13 @@ class JSChecker(object): return self.RegexCheck(i, line, r"\* (@inheritDoc)", "@inheritDoc is deprecated, use @override instead.") + def WrapperTypeCheck(self, i, line): + """Check for wrappers (new String()) instead of builtins (string).""" + return self.RegexCheck(i, line, + r"(?:/\*)?\*.*?@(?:param|return|type) ?" # /** @param/@return/@type + r"{[^}]*\b(String|Boolean|Number)\b[^}]*}", # {(Boolean|Number|String)} + "Don't use wrapper types (i.e. new String() or @type {String}).") + def error_highlight(self, start, length): """Takes a start position and a length, and produces a row of '^'s to highlight the corresponding part of a string. @@ -217,6 +224,7 @@ class JSChecker(object): 'See the JavaScript style guide at ' 'http://www.chromium.org/developers/web-development-style-guide' '#TOC-JavaScript and if you have any feedback about the JavaScript ' - 'PRESUBMIT check, contact tbreisacher@chromium.org')) + 'PRESUBMIT check, contact tbreisacher@chromium.org or ' + 'dbeam@chromium.org')) return results |