Index: chrome/browser/resources/chromeos/chromevox/cvox2/background/cursors.js |
diff --git a/chrome/browser/resources/chromeos/chromevox/cvox2/background/cursors.js b/chrome/browser/resources/chromeos/chromevox/cvox2/background/cursors.js |
index 480b444c698145795f5bd4540066957649fa0563..b19fb53548fa3932d691b4df9002be96e59215cc 100644 |
--- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/cursors.js |
+++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/cursors.js |
@@ -142,7 +142,7 @@ cursors.Cursor.prototype = { |
for (var i = 0; i < this.ancestry_.length; i++) { |
var firstValidNode = this.ancestry_[i]; |
if (firstValidNode != null && firstValidNode.role !== undefined && |
- firstValidNode.root !== undefined) { |
+ firstValidNode.root != undefined) { |
return firstValidNode; |
} |
// If we have to walk up to an ancestor, reset the index to NODE_INDEX. |
@@ -176,9 +176,9 @@ cursors.Cursor.prototype = { |
// Selections over line break nodes are broken. |
var parent = adjustedNode.parent; |
var grandparent = parent && parent.parent; |
- if (parent.role == RoleType.LINE_BREAK) { |
+ if (parent && parent.role == RoleType.LINE_BREAK) { |
adjustedNode = grandparent; |
- } else if (grandparent.role == RoleType.LINE_BREAK) { |
+ } else if (grandparent && grandparent.role == RoleType.LINE_BREAK) { |
adjustedNode = grandparent.parent; |
} else if (this.index_ == cursors.NODE_INDEX || |
adjustedNode.role == RoleType.INLINE_TEXT_BOX || |