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

Unified Diff: chrome/browser/resources/chromeos/chromevox/common/braille_util.js

Issue 302063005: Fix crash when calling getMsg with no options. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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
« no previous file with comments | « no previous file | chrome/third_party/chromevox/chromeVoxChromePageScript.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/chromeos/chromevox/common/braille_util.js
diff --git a/chrome/browser/resources/chromeos/chromevox/common/braille_util.js b/chrome/browser/resources/chromeos/chromevox/common/braille_util.js
index b20eeb601c54883dcb8508e937d362e23b0931d2..10541078a434333738e04df018a7c0d4fe1eec35 100644
--- a/chrome/browser/resources/chromeos/chromevox/common/braille_util.js
+++ b/chrome/browser/resources/chromeos/chromevox/common/braille_util.js
@@ -192,7 +192,15 @@ cvox.BrailleUtil.getState = function(node) {
}
return cvox.NodeStateUtil.expand(
cvox.DomUtil.getStateMsgs(node, true).map(function(state) {
- if (cvox.ChromeVox.msgs.getMsg(state[0] + '_brl')) {
+ // Check to see if a variant of the message with '_brl' exists,
+ // and use it if so.
+ //
+ // Note: many messages are templatized, and if we don't pass any
+ // argument to substitute, getMsg might throw an error if the
+ // resulting string is empty. To avoid this, we pass a dummy
+ // substitution string array here.
+ var dummySubs = ['dummy', 'dummy', 'dummy'];
+ if (cvox.ChromeVox.msgs.getMsg(state[0] + '_brl', dummySubs)) {
state[0] += '_brl';
}
return state;
« no previous file with comments | « no previous file | chrome/third_party/chromevox/chromeVoxChromePageScript.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698