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

Side by Side Diff: chrome/renderer/resources/extensions/automation/automation_node.js

Issue 1915753002: Sanitize inheritance in callers of utils.expose (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nit: space after ':' Created 4 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 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 exceptionHandler = require('uncaught_exception_handler'); 8 var exceptionHandler = require('uncaught_exception_handler');
9 var IsInteractPermitted = 9 var IsInteractPermitted =
10 requireNative('automationInternal').IsInteractPermitted; 10 requireNative('automationInternal').IsInteractPermitted;
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 var schema = requireNative('automationInternal').GetSchemaAdditions(); 192 var schema = requireNative('automationInternal').GetSchemaAdditions();
193 var utils = require('utils'); 193 var utils = require('utils');
194 194
195 /** 195 /**
196 * A single node in the Automation tree. 196 * A single node in the Automation tree.
197 * @param {AutomationRootNodeImpl} root The root of the tree. 197 * @param {AutomationRootNodeImpl} root The root of the tree.
198 * @constructor 198 * @constructor
199 */ 199 */
200 function AutomationNodeImpl(root) { 200 function AutomationNodeImpl(root) {
201 this.rootImpl = root; 201 this.rootImpl = root;
202 // Public attributes. No actual data gets set on this object. 202 this.listeners = {__proto__: null};
203 this.listeners = {};
204 } 203 }
205 204
206 AutomationNodeImpl.prototype = { 205 AutomationNodeImpl.prototype = {
206 __proto__: null,
207 treeID: -1, 207 treeID: -1,
208 id: -1, 208 id: -1,
209 role: '',
210 state: { busy: true },
211 isRootNode: false, 209 isRootNode: false,
212 210
213 get root() { 211 get root() {
214 return this.rootImpl.wrapper; 212 return this.rootImpl.wrapper;
215 }, 213 },
216 214
217 get parent() { 215 get parent() {
218 if (this.hostNode_) 216 if (this.hostNode_)
219 return this.hostNode_; 217 return this.hostNode_;
220 var parentID = GetParentID(this.treeID, this.id); 218 var parentID = GetParentID(this.treeID, this.id);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 266
269 get children() { 267 get children() {
270 if (this.childTree) 268 if (this.childTree)
271 return [this.childTree]; 269 return [this.childTree];
272 270
273 var children = []; 271 var children = [];
274 var count = GetChildCount(this.treeID, this.id); 272 var count = GetChildCount(this.treeID, this.id);
275 for (var i = 0; i < count; ++i) { 273 for (var i = 0; i < count; ++i) {
276 var childID = GetChildIDAtIndex(this.treeID, this.id, i); 274 var childID = GetChildIDAtIndex(this.treeID, this.id, i);
277 var child = this.rootImpl.get(childID); 275 var child = this.rootImpl.get(childID);
278 children.push(child); 276 $Array.push(children, child);
279 } 277 }
280 return children; 278 return children;
281 }, 279 },
282 280
283 get previousSibling() { 281 get previousSibling() {
284 var parent = this.parent; 282 var parent = this.parent;
285 var indexInParent = GetIndexInParent(this.treeID, this.id); 283 var indexInParent = GetIndexInParent(this.treeID, this.id);
286 if (parent && indexInParent > 0) 284 if (parent && indexInParent > 0)
287 return parent.children[indexInParent - 1]; 285 return parent.children[indexInParent - 1];
288 return undefined; 286 return undefined;
(...skipping 30 matching lines...) Expand all
319 317
320 showContextMenu: function() { 318 showContextMenu: function() {
321 this.performAction_('showContextMenu'); 319 this.performAction_('showContextMenu');
322 }, 320 },
323 321
324 domQuerySelector: function(selector, callback) { 322 domQuerySelector: function(selector, callback) {
325 automationInternal.querySelector( 323 automationInternal.querySelector(
326 { treeID: this.rootImpl.treeID, 324 { treeID: this.rootImpl.treeID,
327 automationNodeID: this.id, 325 automationNodeID: this.id,
328 selector: selector }, 326 selector: selector },
329 this.domQuerySelectorCallback_.bind(this, callback)); 327 $Function.bind(this.domQuerySelectorCallback_, this, callback));
330 }, 328 },
331 329
332 find: function(params) { 330 find: function(params) {
333 return this.findInternal_(params); 331 return this.findInternal_(params);
334 }, 332 },
335 333
336 findAll: function(params) { 334 findAll: function(params) {
337 return this.findInternal_(params, []); 335 return this.findInternal_(params, []);
338 }, 336 },
339 337
340 matches: function(params) { 338 matches: function(params) {
341 return this.matchInternal_(params); 339 return this.matchInternal_(params);
342 }, 340 },
343 341
344 addEventListener: function(eventType, callback, capture) { 342 addEventListener: function(eventType, callback, capture) {
345 this.removeEventListener(eventType, callback); 343 this.removeEventListener(eventType, callback);
346 if (!this.listeners[eventType]) 344 if (!this.listeners[eventType])
347 this.listeners[eventType] = []; 345 this.listeners[eventType] = [];
348 this.listeners[eventType].push({callback: callback, capture: !!capture}); 346 $Array.push(this.listeners[eventType], {
347 __proto__: null,
348 callback: callback,
349 capture: !!capture,
350 });
349 }, 351 },
350 352
351 // TODO(dtseng/aboxhall): Check this impl against spec. 353 // TODO(dtseng/aboxhall): Check this impl against spec.
352 removeEventListener: function(eventType, callback) { 354 removeEventListener: function(eventType, callback) {
353 if (this.listeners[eventType]) { 355 if (this.listeners[eventType]) {
354 var listeners = this.listeners[eventType]; 356 var listeners = this.listeners[eventType];
355 for (var i = 0; i < listeners.length; i++) { 357 for (var i = 0; i < listeners.length; i++) {
356 if (callback === listeners[i].callback) 358 if (callback === listeners[i].callback)
357 listeners.splice(i, 1); 359 $Array.splice(listeners, i, 1);
358 } 360 }
359 } 361 }
360 }, 362 },
361 363
362 toJSON: function() { 364 toJSON: function() {
363 return { treeID: this.treeID, 365 return { treeID: this.treeID,
364 id: this.id, 366 id: this.id,
365 role: this.role, 367 role: this.role,
366 attributes: this.attributes }; 368 attributes: this.attributes };
367 }, 369 },
368 370
369 dispatchEvent: function(eventType) { 371 dispatchEvent: function(eventType) {
370 var path = []; 372 var path = [];
371 var parent = this.parent; 373 var parent = this.parent;
372 while (parent) { 374 while (parent) {
373 path.push(parent); 375 $Array.push(path, parent);
374 parent = parent.parent; 376 parent = parent.parent;
375 } 377 }
376 var event = new AutomationEvent(eventType, this.wrapper); 378 var event = new AutomationEvent(eventType, this.wrapper);
377 379
378 // Dispatch the event through the propagation path in three phases: 380 // Dispatch the event through the propagation path in three phases:
379 // - capturing: starting from the root and going down to the target's parent 381 // - capturing: starting from the root and going down to the target's parent
380 // - targeting: dispatching the event on the target itself 382 // - targeting: dispatching the event on the target itself
381 // - bubbling: starting from the target's parent, going back up to the root. 383 // - bubbling: starting from the target's parent, going back up to the root.
382 // At any stage, a listener may call stopPropagation() on the event, which 384 // At any stage, a listener may call stopPropagation() on the event, which
383 // will immediately stop event propagation through this path. 385 // will immediately stop event propagation through this path.
384 if (this.dispatchEventAtCapturing_(event, path)) { 386 if (this.dispatchEventAtCapturing_(event, path)) {
385 if (this.dispatchEventAtTargeting_(event, path)) 387 if (this.dispatchEventAtTargeting_(event, path))
386 this.dispatchEventAtBubbling_(event, path); 388 this.dispatchEventAtBubbling_(event, path);
387 } 389 }
388 }, 390 },
389 391
390 toString: function() { 392 toString: function() {
391 var parentID = GetParentID(this.treeID, this.id); 393 var parentID = GetParentID(this.treeID, this.id);
392 var childTreeID = GetIntAttribute(this.treeID, this.id, 'childTreeId'); 394 var childTreeID = GetIntAttribute(this.treeID, this.id, 'childTreeId');
393 var count = GetChildCount(this.treeID, this.id); 395 var count = GetChildCount(this.treeID, this.id);
394 var childIDs = []; 396 var childIDs = [];
395 for (var i = 0; i < count; ++i) { 397 for (var i = 0; i < count; ++i) {
396 var childID = GetChildIDAtIndex(this.treeID, this.id, i); 398 var childID = GetChildIDAtIndex(this.treeID, this.id, i);
397 childIDs.push(childID); 399 $Array.push(childIDs, childID);
398 } 400 }
399 401
400 var result = 'node id=' + this.id + 402 var result = 'node id=' + this.id +
401 ' role=' + this.role + 403 ' role=' + this.role +
402 ' state=' + $JSON.stringify(this.state) + 404 ' state=' + $JSON.stringify(this.state) +
403 ' parentID=' + parentID + 405 ' parentID=' + parentID +
404 ' childIds=' + $JSON.stringify(childIDs); 406 ' childIds=' + $JSON.stringify(childIDs);
405 if (this.hostNode_) { 407 if (this.hostNode_) {
406 var hostNodeImpl = privates(this.hostNode_).impl; 408 var hostNodeImpl = privates(this.hostNode_).impl;
407 result += ' host treeID=' + hostNodeImpl.treeID + 409 result += ' host treeID=' + hostNodeImpl.treeID +
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 userCallback(null); 495 userCallback(null);
494 } 496 }
495 userCallback(resultNode); 497 userCallback(resultNode);
496 }, 498 },
497 499
498 findInternal_: function(params, opt_results) { 500 findInternal_: function(params, opt_results) {
499 var result = null; 501 var result = null;
500 this.forAllDescendants_(function(node) { 502 this.forAllDescendants_(function(node) {
501 if (privates(node).impl.matchInternal_(params)) { 503 if (privates(node).impl.matchInternal_(params)) {
502 if (opt_results) 504 if (opt_results)
503 opt_results.push(node); 505 $Array.push(opt_results, node);
504 else 506 else
505 result = node; 507 result = node;
506 return !opt_results; 508 return !opt_results;
507 } 509 }
508 }); 510 });
509 if (opt_results) 511 if (opt_results)
510 return opt_results; 512 return opt_results;
511 return result; 513 return result;
512 }, 514 },
513 515
514 /** 516 /**
515 * Executes a closure for all of this node's descendants, in pre-order. 517 * Executes a closure for all of this node's descendants, in pre-order.
516 * Early-outs if the closure returns true. 518 * Early-outs if the closure returns true.
517 * @param {Function(AutomationNode):boolean} closure Closure to be executed 519 * @param {Function(AutomationNode):boolean} closure Closure to be executed
518 * for each node. Return true to early-out the traversal. 520 * for each node. Return true to early-out the traversal.
519 */ 521 */
520 forAllDescendants_: function(closure) { 522 forAllDescendants_: function(closure) {
521 var stack = this.wrapper.children.reverse(); 523 var stack = $Array.reverse(this.wrapper.children);
522 while (stack.length > 0) { 524 while (stack.length > 0) {
523 var node = stack.pop(); 525 var node = $Array.pop(stack);
524 if (closure(node)) 526 if (closure(node))
525 return; 527 return;
526 528
527 var children = node.children; 529 var children = node.children;
528 for (var i = children.length - 1; i >= 0; i--) 530 for (var i = children.length - 1; i >= 0; i--)
529 stack.push(children[i]); 531 $Array.push(stack, children[i]);
530 } 532 }
531 }, 533 },
532 534
533 matchInternal_: function(params) { 535 matchInternal_: function(params) {
534 if (Object.keys(params).length == 0) 536 if ($Object.keys(params).length === 0)
535 return false; 537 return false;
536 538
537 if ('role' in params && this.role != params.role) 539 if ('role' in params && this.role != params.role)
538 return false; 540 return false;
539 541
540 if ('state' in params) { 542 if ('state' in params) {
541 for (var state in params.state) { 543 for (var state in params.state) {
542 if (params.state[state] != (state in this.state)) 544 if (params.state[state] != (state in this.state))
543 return false; 545 return false;
544 } 546 }
545 } 547 }
546 if ('attributes' in params) { 548 if ('attributes' in params) {
547 for (var attribute in params.attributes) { 549 for (var attribute in params.attributes) {
548 var attrValue = params.attributes[attribute]; 550 var attrValue = params.attributes[attribute];
549 if (typeof attrValue != 'object') { 551 if (typeof attrValue != 'object') {
550 if (this[attribute] !== attrValue) 552 if (this[attribute] !== attrValue)
551 return false; 553 return false;
552 } else if (attrValue instanceof RegExp) { 554 } else if (attrValue instanceof $RegExp.self) {
553 if (typeof this[attribute] != 'string') 555 if (typeof this[attribute] != 'string')
554 return false; 556 return false;
555 if (!attrValue.test(this[attribute])) 557 if (!attrValue.test(this[attribute]))
556 return false; 558 return false;
557 } else { 559 } else {
558 // TODO(aboxhall): handle intlist case. 560 // TODO(aboxhall): handle intlist case.
559 return false; 561 return false;
560 } 562 }
561 } 563 }
562 } 564 }
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
653 'valueForRange', 655 'valueForRange',
654 'minValueForRange', 656 'minValueForRange',
655 'maxValueForRange', 657 'maxValueForRange',
656 'fontSize']; 658 'fontSize'];
657 659
658 var htmlAttributes = [ 660 var htmlAttributes = [
659 ['type', 'inputType']]; 661 ['type', 'inputType']];
660 662
661 var publicAttributes = []; 663 var publicAttributes = [];
662 664
663 stringAttributes.forEach(function (attributeName) { 665 $Array.forEach(stringAttributes, function(attributeName) {
664 publicAttributes.push(attributeName); 666 $Array.push(publicAttributes, attributeName);
665 Object.defineProperty(AutomationNodeImpl.prototype, attributeName, { 667 $Object.defineProperty(AutomationNodeImpl.prototype, attributeName, {
668 __proto__: null,
666 get: function() { 669 get: function() {
667 return GetStringAttribute(this.treeID, this.id, attributeName); 670 return GetStringAttribute(this.treeID, this.id, attributeName);
668 } 671 }
669 }); 672 });
670 }); 673 });
671 674
672 boolAttributes.forEach(function (attributeName) { 675 $Array.forEach(boolAttributes, function(attributeName) {
673 publicAttributes.push(attributeName); 676 $Array.push(publicAttributes, attributeName);
674 Object.defineProperty(AutomationNodeImpl.prototype, attributeName, { 677 $Object.defineProperty(AutomationNodeImpl.prototype, attributeName, {
678 __proto__: null,
675 get: function() { 679 get: function() {
676 return GetBoolAttribute(this.treeID, this.id, attributeName); 680 return GetBoolAttribute(this.treeID, this.id, attributeName);
677 } 681 }
678 }); 682 });
679 }); 683 });
680 684
681 intAttributes.forEach(function (attributeName) { 685 $Array.forEach(intAttributes, function(attributeName) {
682 publicAttributes.push(attributeName); 686 $Array.push(publicAttributes, attributeName);
683 Object.defineProperty(AutomationNodeImpl.prototype, attributeName, { 687 $Object.defineProperty(AutomationNodeImpl.prototype, attributeName, {
688 __proto__: null,
684 get: function() { 689 get: function() {
685 return GetIntAttribute(this.treeID, this.id, attributeName); 690 return GetIntAttribute(this.treeID, this.id, attributeName);
686 } 691 }
687 }); 692 });
688 }); 693 });
689 694
690 nodeRefAttributes.forEach(function (params) { 695 $Array.forEach(nodeRefAttributes, function(params) {
691 var srcAttributeName = params[0]; 696 var srcAttributeName = params[0];
692 var dstAttributeName = params[1]; 697 var dstAttributeName = params[1];
693 publicAttributes.push(dstAttributeName); 698 $Array.push(publicAttributes, dstAttributeName);
694 Object.defineProperty(AutomationNodeImpl.prototype, dstAttributeName, { 699 $Object.defineProperty(AutomationNodeImpl.prototype, dstAttributeName, {
700 __proto__: null,
695 get: function() { 701 get: function() {
696 var id = GetIntAttribute(this.treeID, this.id, srcAttributeName); 702 var id = GetIntAttribute(this.treeID, this.id, srcAttributeName);
697 if (id) 703 if (id)
698 return this.rootImpl.get(id); 704 return this.rootImpl.get(id);
699 else 705 else
700 return undefined; 706 return undefined;
701 } 707 }
702 }); 708 });
703 }); 709 });
704 710
705 intListAttributes.forEach(function (attributeName) { 711 $Array.forEach(intListAttributes, function(attributeName) {
706 publicAttributes.push(attributeName); 712 $Array.push(publicAttributes, attributeName);
707 Object.defineProperty(AutomationNodeImpl.prototype, attributeName, { 713 $Object.defineProperty(AutomationNodeImpl.prototype, attributeName, {
714 __proto__: null,
708 get: function() { 715 get: function() {
709 return GetIntListAttribute(this.treeID, this.id, attributeName); 716 return GetIntListAttribute(this.treeID, this.id, attributeName);
710 } 717 }
711 }); 718 });
712 }); 719 });
713 720
714 nodeRefListAttributes.forEach(function (params) { 721 $Array.forEach(nodeRefListAttributes, function(params) {
715 var srcAttributeName = params[0]; 722 var srcAttributeName = params[0];
716 var dstAttributeName = params[1]; 723 var dstAttributeName = params[1];
717 publicAttributes.push(dstAttributeName); 724 $Array.push(publicAttributes, dstAttributeName);
718 Object.defineProperty(AutomationNodeImpl.prototype, dstAttributeName, { 725 $Object.defineProperty(AutomationNodeImpl.prototype, dstAttributeName, {
726 __proto__: null,
719 get: function() { 727 get: function() {
720 var ids = GetIntListAttribute(this.treeID, this.id, srcAttributeName); 728 var ids = GetIntListAttribute(this.treeID, this.id, srcAttributeName);
721 if (!ids) 729 if (!ids)
722 return undefined; 730 return undefined;
723 var result = []; 731 var result = [];
724 for (var i = 0; i < ids.length; ++i) { 732 for (var i = 0; i < ids.length; ++i) {
725 var node = this.rootImpl.get(ids[i]); 733 var node = this.rootImpl.get(ids[i]);
726 if (node) 734 if (node)
727 result.push(node); 735 $Array.push(result, node);
728 } 736 }
729 return result; 737 return result;
730 } 738 }
731 }); 739 });
732 }); 740 });
733 741
734 floatAttributes.forEach(function (attributeName) { 742 $Array.forEach(floatAttributes, function(attributeName) {
735 publicAttributes.push(attributeName); 743 $Array.push(publicAttributes, attributeName);
736 Object.defineProperty(AutomationNodeImpl.prototype, attributeName, { 744 $Object.defineProperty(AutomationNodeImpl.prototype, attributeName, {
745 __proto__: null,
737 get: function() { 746 get: function() {
738 return GetFloatAttribute(this.treeID, this.id, attributeName); 747 return GetFloatAttribute(this.treeID, this.id, attributeName);
739 } 748 }
740 }); 749 });
741 }); 750 });
742 751
743 htmlAttributes.forEach(function (params) { 752 $Array.forEach(htmlAttributes, function(params) {
744 var srcAttributeName = params[0]; 753 var srcAttributeName = params[0];
745 var dstAttributeName = params[1]; 754 var dstAttributeName = params[1];
746 publicAttributes.push(dstAttributeName); 755 $Array.push(publicAttributes, dstAttributeName);
747 Object.defineProperty(AutomationNodeImpl.prototype, dstAttributeName, { 756 $Object.defineProperty(AutomationNodeImpl.prototype, dstAttributeName, {
757 __proto__: null,
748 get: function() { 758 get: function() {
749 return GetHtmlAttribute(this.treeID, this.id, srcAttributeName); 759 return GetHtmlAttribute(this.treeID, this.id, srcAttributeName);
750 } 760 }
751 }); 761 });
752 }); 762 });
753 763
754 /** 764 /**
755 * AutomationRootNode. 765 * AutomationRootNode.
756 * 766 *
757 * An AutomationRootNode is the javascript end of an AXTree living in the 767 * An AutomationRootNode is the javascript end of an AXTree living in the
758 * browser. AutomationRootNode handles unserializing incremental updates from 768 * browser. AutomationRootNode handles unserializing incremental updates from
759 * the source AXTree. Each update contains node data that form a complete tree 769 * the source AXTree. Each update contains node data that form a complete tree
760 * after applying the update. 770 * after applying the update.
761 * 771 *
762 * A brief note about ids used through this class. The source AXTree assigns 772 * A brief note about ids used through this class. The source AXTree assigns
763 * unique ids per node and we use these ids to build a hash to the actual 773 * unique ids per node and we use these ids to build a hash to the actual
764 * AutomationNode object. 774 * AutomationNode object.
765 * Thus, tree traversals amount to a lookup in our hash. 775 * Thus, tree traversals amount to a lookup in our hash.
766 * 776 *
767 * The tree itself is identified by the accessibility tree id of the 777 * The tree itself is identified by the accessibility tree id of the
768 * renderer widget host. 778 * renderer widget host.
769 * @constructor 779 * @constructor
770 */ 780 */
771 function AutomationRootNodeImpl(treeID) { 781 function AutomationRootNodeImpl(treeID) {
772 AutomationNodeImpl.call(this, this); 782 $Function.call(AutomationNodeImpl, this, this);
773 this.treeID = treeID; 783 this.treeID = treeID;
774 this.axNodeDataCache_ = {}; 784 this.axNodeDataCache_ = {__proto__: null};
775 } 785 }
776 786
777 AutomationRootNodeImpl.idToAutomationRootNode_ = {}; 787 utils.defineProperty(AutomationRootNodeImpl, 'idToAutomationRootNode_',
788 {__proto__: null});
778 789
779 AutomationRootNodeImpl.get = function(treeID) { 790 utils.defineProperty(AutomationRootNodeImpl, 'get', function(treeID) {
780 var result = AutomationRootNodeImpl.idToAutomationRootNode_[treeID]; 791 var result = AutomationRootNodeImpl.idToAutomationRootNode_[treeID];
781 return result || undefined; 792 return result || undefined;
782 } 793 });
783 794
784 AutomationRootNodeImpl.getOrCreate = function(treeID) { 795 utils.defineProperty(AutomationRootNodeImpl, 'getOrCreate', function(treeID) {
785 if (AutomationRootNodeImpl.idToAutomationRootNode_[treeID]) 796 if (AutomationRootNodeImpl.idToAutomationRootNode_[treeID])
786 return AutomationRootNodeImpl.idToAutomationRootNode_[treeID]; 797 return AutomationRootNodeImpl.idToAutomationRootNode_[treeID];
787 var result = new AutomationRootNode(treeID); 798 var result = new AutomationRootNode(treeID);
788 AutomationRootNodeImpl.idToAutomationRootNode_[treeID] = result; 799 AutomationRootNodeImpl.idToAutomationRootNode_[treeID] = result;
789 return result; 800 return result;
790 } 801 });
791 802
792 AutomationRootNodeImpl.destroy = function(treeID) { 803 utils.defineProperty(AutomationRootNodeImpl, 'destroy', function(treeID) {
793 delete AutomationRootNodeImpl.idToAutomationRootNode_[treeID]; 804 delete AutomationRootNodeImpl.idToAutomationRootNode_[treeID];
794 } 805 });
795 806
796 AutomationRootNodeImpl.prototype = { 807 AutomationRootNodeImpl.prototype = {
797 __proto__: AutomationNodeImpl.prototype, 808 __proto__: AutomationNodeImpl.prototype,
798 809
799 /** 810 /**
800 * @type {boolean} 811 * @type {boolean}
801 */ 812 */
802 isRootNode: true, 813 isRootNode: true,
803 814
804 /** 815 /**
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
920 }, 931 },
921 932
922 toString: function() { 933 toString: function() {
923 function toStringInternal(nodeImpl, indent) { 934 function toStringInternal(nodeImpl, indent) {
924 if (!nodeImpl) 935 if (!nodeImpl)
925 return ''; 936 return '';
926 var output = ''; 937 var output = '';
927 if (nodeImpl.isRootNode) 938 if (nodeImpl.isRootNode)
928 output += indent + 'tree id=' + nodeImpl.treeID + '\n'; 939 output += indent + 'tree id=' + nodeImpl.treeID + '\n';
929 output += indent + 940 output += indent +
930 AutomationNodeImpl.prototype.toString.call(nodeImpl) + 941 $Function.call(AutomationNodeImpl.prototype.toString, nodeImpl) + '\n';
931 '\n';
932 indent += ' '; 942 indent += ' ';
933 var children = nodeImpl.children; 943 var children = nodeImpl.children;
934 for (var i = 0; i < children.length; ++i) 944 for (var i = 0; i < children.length; ++i)
935 output += toStringInternal(privates(children[i]).impl, indent); 945 output += toStringInternal(privates(children[i]).impl, indent);
936 return output; 946 return output;
937 } 947 }
938 return toStringInternal(this, ''); 948 return toStringInternal(this, '');
939 }, 949 },
940 }; 950 };
941 951
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
984 'docUrl', 994 'docUrl',
985 'docLoaded', 995 'docLoaded',
986 'docLoadingProgress', 996 'docLoadingProgress',
987 'anchorObject', 997 'anchorObject',
988 'anchorOffset', 998 'anchorOffset',
989 'focusObject', 999 'focusObject',
990 'focusOffset', 1000 'focusOffset',
991 ], 1001 ],
992 }); 1002 });
993 1003
994 AutomationRootNode.get = function(treeID) { 1004 utils.defineProperty(AutomationRootNode, 'get', function(treeID) {
995 return AutomationRootNodeImpl.get(treeID); 1005 return AutomationRootNodeImpl.get(treeID);
996 } 1006 });
997 1007
998 AutomationRootNode.getOrCreate = function(treeID) { 1008 utils.defineProperty(AutomationRootNode, 'getOrCreate', function(treeID) {
999 return AutomationRootNodeImpl.getOrCreate(treeID); 1009 return AutomationRootNodeImpl.getOrCreate(treeID);
1000 } 1010 });
1001 1011
1002 AutomationRootNode.destroy = function(treeID) { 1012 utils.defineProperty(AutomationRootNode, 'destroy', function(treeID) {
1003 AutomationRootNodeImpl.destroy(treeID); 1013 AutomationRootNodeImpl.destroy(treeID);
1004 } 1014 });
1005 1015
1006 exports.$set('AutomationNode', AutomationNode); 1016 exports.$set('AutomationNode', AutomationNode);
1007 exports.$set('AutomationRootNode', AutomationRootNode); 1017 exports.$set('AutomationRootNode', AutomationRootNode);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698