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

Unified Diff: chrome/renderer/resources/extensions/automation/automation_node.js

Issue 1308813008: Fix crash when accessing automation node from stale AX tree (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Put setTimeout in else to be more clear Created 5 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 side-by-side diff with in-line comments
Download patch
Index: chrome/renderer/resources/extensions/automation/automation_node.js
diff --git a/chrome/renderer/resources/extensions/automation/automation_node.js b/chrome/renderer/resources/extensions/automation/automation_node.js
index 1598c6f9b0b8add00d770d08aaf8fed9d923008b..5e96405fd1cb408f2cc7fccc639c229a7b995ff0 100644
--- a/chrome/renderer/resources/extensions/automation/automation_node.js
+++ b/chrome/renderer/resources/extensions/automation/automation_node.js
@@ -757,7 +757,14 @@ AutomationRootNodeImpl.prototype = {
axNodeDataCache_: null,
get id() {
- return GetRootID(this.treeID);
+ var result = GetRootID(this.treeID);
+
+ // Don't return undefined, because the id is often passed directly
+ // as an argument to a native binding that expects only a valid number.
+ if (result === undefined)
+ return -1;
+
+ return result;
},
get: function(id) {

Powered by Google App Engine
This is Rietveld 408576698