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

Side by Side 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, 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 var AutomationEvent = require('automationEvent').AutomationEvent; 5 var AutomationEvent = require('automationEvent').AutomationEvent;
6 var automationInternal = 6 var automationInternal =
7 require('binding').Binding.create('automationInternal').generate(); 7 require('binding').Binding.create('automationInternal').generate();
8 var IsInteractPermitted = 8 var IsInteractPermitted =
9 requireNative('automationInternal').IsInteractPermitted; 9 requireNative('automationInternal').IsInteractPermitted;
10 10
(...skipping 739 matching lines...) Expand 10 before | Expand all | Expand 10 after
750 hostNode_: null, 750 hostNode_: null,
751 751
752 /** 752 /**
753 * A map from id to AutomationNode. 753 * A map from id to AutomationNode.
754 * @type {Object.<number, AutomationNode>} 754 * @type {Object.<number, AutomationNode>}
755 * @private 755 * @private
756 */ 756 */
757 axNodeDataCache_: null, 757 axNodeDataCache_: null,
758 758
759 get id() { 759 get id() {
760 return GetRootID(this.treeID); 760 var result = GetRootID(this.treeID);
761
762 // Don't return undefined, because the id is often passed directly
763 // as an argument to a native binding that expects only a valid number.
764 if (result === undefined)
765 return -1;
766
767 return result;
761 }, 768 },
762 769
763 get: function(id) { 770 get: function(id) {
764 if (id == undefined) 771 if (id == undefined)
765 return undefined; 772 return undefined;
766 773
767 if (id == this.id) 774 if (id == this.id)
768 return this.wrapper; 775 return this.wrapper;
769 776
770 var obj = this.axNodeDataCache_[id]; 777 var obj = this.axNodeDataCache_[id];
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
860 AutomationRootNode.getOrCreate = function(treeID) { 867 AutomationRootNode.getOrCreate = function(treeID) {
861 return AutomationRootNodeImpl.getOrCreate(treeID); 868 return AutomationRootNodeImpl.getOrCreate(treeID);
862 } 869 }
863 870
864 AutomationRootNode.destroy = function(treeID) { 871 AutomationRootNode.destroy = function(treeID) {
865 AutomationRootNodeImpl.destroy(treeID); 872 AutomationRootNodeImpl.destroy(treeID);
866 } 873 }
867 874
868 exports.AutomationNode = AutomationNode; 875 exports.AutomationNode = AutomationNode;
869 exports.AutomationRootNode = AutomationRootNode; 876 exports.AutomationRootNode = AutomationRootNode;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698