OLD | NEW |
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 Loading... |
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 Loading... |
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; |
OLD | NEW |