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

Unified Diff: chrome/browser/resources/chromeos/chromevox/cvox2/background/output.js

Issue 1371483003: cvox2: Avoid uncaught exception on invalid input type. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/chromeos/chromevox/cvox2/background/output.js
diff --git a/chrome/browser/resources/chromeos/chromevox/cvox2/background/output.js b/chrome/browser/resources/chromeos/chromevox/cvox2/background/output.js
index 9108388a94647db24d56fa242dd1de33d335ebb9..7c9ee8e6c40c1c52f44345412a7ffd33de1c0220 100644
--- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/output.js
+++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/output.js
@@ -357,6 +357,22 @@ Output.STATE_INFO_ = {
};
/**
+ * Maps input types to message IDs.
+ * @const {Object<string>}
+ * @private
+ */
+Output.INPUT_TYPE_MESSAGE_IDS_ = {
+ 'email': 'input_type_email',
+ 'file': 'input_type_file',
+ 'number': 'input_type_number',
+ 'password': 'input_type_password',
+ 'search': 'input_type_search',
+ 'tel': 'input_type_tel',
+ 'text': 'input_type_text',
+ 'url': 'input_type_url',
+};
+
+/**
* Rules specifying format of AutomationNodes for output.
* @type {!Object<Object<Object<string>>>}
*/
@@ -458,7 +474,7 @@ Output.RULES = {
},
textField: {
speak: '$name $value $if(' +
- '$inputType, @input_type_+$inputType, @input_type_text)',
+ '$inputType, $inputType, $role)',
braille: ''
},
toolbar: {
@@ -886,6 +902,15 @@ Output.prototype = {
console.error('Missing role info for ' + node.role);
}
this.append_(buff, msg, options);
+ } else if (token == 'inputType') {
+ if (!node.inputType)
+ return;
+ options.annotation.push(token);
+ var msgId = Output.INPUT_TYPE_MESSAGE_IDS_[node.inputType] ||
+ 'input_type_text';
+ if (this.formatOptions_.braille)
+ msgId = msgId + '_brl';
+ this.append_(buff, cvox.ChromeVox.msgs.getMsg(msgId), options);
} else if (token == 'tableRowIndex' ||
token == 'tableCellColumnIndex') {
var value = node[token];

Powered by Google App Engine
This is Rietveld 408576698