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

Side by Side Diff: Source/core/inspector/InjectedScriptSource.js

Issue 644403003: DevTools: Fix __commandLineAPI is not defined error and remove the with- hack for eval on call fram… (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 2 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2007 Apple Inc. All rights reserved.
3 * Copyright (C) 2013 Google Inc. All rights reserved. 3 * Copyright (C) 2013 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after
609 /** 609 /**
610 * @param {string} expression 610 * @param {string} expression
611 * @param {string} objectGroup 611 * @param {string} objectGroup
612 * @param {boolean} injectCommandLineAPI 612 * @param {boolean} injectCommandLineAPI
613 * @param {boolean} returnByValue 613 * @param {boolean} returnByValue
614 * @param {boolean} generatePreview 614 * @param {boolean} generatePreview
615 * @return {*} 615 * @return {*}
616 */ 616 */
617 evaluate: function(expression, objectGroup, injectCommandLineAPI, returnByVa lue, generatePreview) 617 evaluate: function(expression, objectGroup, injectCommandLineAPI, returnByVa lue, generatePreview)
618 { 618 {
619 return this._evaluateAndWrap(null, null, expression, objectGroup, false, injectCommandLineAPI, returnByValue, generatePreview); 619 return this._evaluateAndWrap(null, expression, objectGroup, injectComman dLineAPI, returnByValue, generatePreview);
620 }, 620 },
621 621
622 /** 622 /**
623 * @param {string} objectId 623 * @param {string} objectId
624 * @param {string} expression 624 * @param {string} expression
625 * @param {string} args 625 * @param {string} args
626 * @param {boolean} returnByValue 626 * @param {boolean} returnByValue
627 * @return {!Object|string} 627 * @return {!Object|string}
628 */ 628 */
629 callFunctionOn: function(objectId, expression, args, returnByValue) 629 callFunctionOn: function(objectId, expression, args, returnByValue)
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
682 } else if ("value" in callArgumentJson) { 682 } else if ("value" in callArgumentJson) {
683 var value = callArgumentJson.value; 683 var value = callArgumentJson.value;
684 if (callArgumentJson.type === "number" && typeof value !== "number") 684 if (callArgumentJson.type === "number" && typeof value !== "number")
685 value = Number(value); 685 value = Number(value);
686 return value; 686 return value;
687 } 687 }
688 return undefined; 688 return undefined;
689 }, 689 },
690 690
691 /** 691 /**
692 * @param {?function(string):*} evalFunction 692 * @param {?JavaScriptCallFrame} callFrame
693 * @param {?Object} object
694 * @param {string} expression 693 * @param {string} expression
695 * @param {string} objectGroup 694 * @param {string} objectGroup
696 * @param {boolean} isEvalOnCallFrame
697 * @param {boolean} injectCommandLineAPI 695 * @param {boolean} injectCommandLineAPI
698 * @param {boolean} returnByValue 696 * @param {boolean} returnByValue
699 * @param {boolean} generatePreview 697 * @param {boolean} generatePreview
700 * @param {!Array.<!Object>=} scopeChain 698 * @param {!Array.<!Object>=} scopeChain
701 * @return {!Object} 699 * @return {!Object}
702 */ 700 */
703 _evaluateAndWrap: function(evalFunction, object, expression, objectGroup, is EvalOnCallFrame, injectCommandLineAPI, returnByValue, generatePreview, scopeChai n) 701 _evaluateAndWrap: function(callFrame, expression, objectGroup, injectCommand LineAPI, returnByValue, generatePreview, scopeChain)
704 { 702 {
705 var wrappedResult = this._evaluateOn(evalFunction, object, objectGroup, expression, isEvalOnCallFrame, injectCommandLineAPI, scopeChain); 703 var wrappedResult = this._evaluateOn(callFrame, objectGroup, expression, injectCommandLineAPI, scopeChain);
706 if (!wrappedResult.exceptionDetails) { 704 if (!wrappedResult.exceptionDetails) {
707 return { wasThrown: false, 705 return { wasThrown: false,
708 result: this._wrapObject(wrappedResult.result, objectGroup, returnByValue, generatePreview), 706 result: this._wrapObject(wrappedResult.result, objectGroup, returnByValue, generatePreview),
709 __proto__: null }; 707 __proto__: null };
710 } 708 }
711 return this._createThrownValue(wrappedResult.result, objectGroup, genera tePreview, wrappedResult.exceptionDetails); 709 return this._createThrownValue(wrappedResult.result, objectGroup, genera tePreview, wrappedResult.exceptionDetails);
712 }, 710 },
713 711
714 /** 712 /**
715 * @param {*} value 713 * @param {*} value
716 * @param {string} objectGroup 714 * @param {string} objectGroup
717 * @param {boolean} generatePreview 715 * @param {boolean} generatePreview
718 * @param {!DebuggerAgent.ExceptionDetails=} exceptionDetails 716 * @param {!DebuggerAgent.ExceptionDetails=} exceptionDetails
719 * @return {!Object} 717 * @return {!Object}
720 */ 718 */
721 _createThrownValue: function(value, objectGroup, generatePreview, exceptionD etails) 719 _createThrownValue: function(value, objectGroup, generatePreview, exceptionD etails)
722 { 720 {
723 var remoteObject = this._wrapObject(value, objectGroup, false, generateP review && !(value instanceof Error)); 721 var remoteObject = this._wrapObject(value, objectGroup, false, generateP review && !(value instanceof Error));
724 if (!remoteObject.description){ 722 if (!remoteObject.description){
725 try { 723 try {
726 remoteObject.description = toStringDescription(value); 724 remoteObject.description = toStringDescription(value);
727 } catch (e) {} 725 } catch (e) {}
728 } 726 }
729 return { wasThrown: true, result: remoteObject, exceptionDetails: except ionDetails, __proto__: null }; 727 return { wasThrown: true, result: remoteObject, exceptionDetails: except ionDetails, __proto__: null };
730 }, 728 },
731 729
732 /** 730 /**
733 * @param {?function(string):*} evalFunction 731 * @param {?JavaScriptCallFrame} callFrame
734 * @param {?Object} object
735 * @param {string} objectGroup 732 * @param {string} objectGroup
736 * @param {string} expression 733 * @param {string} expression
737 * @param {boolean} isEvalOnCallFrame
738 * @param {boolean} injectCommandLineAPI 734 * @param {boolean} injectCommandLineAPI
739 * @param {!Array.<!Object>=} scopeChain 735 * @param {!Array.<!Object>=} scopeChain
740 * @return {*} 736 * @return {*}
741 */ 737 */
742 _evaluateOn: function(evalFunction, object, objectGroup, expression, isEvalO nCallFrame, injectCommandLineAPI, scopeChain) 738 _evaluateOn: function(callFrame, objectGroup, expression, injectCommandLineA PI, scopeChain)
743 { 739 {
744 // Only install command line api object for the time of evaluation. 740 // Only install command line api object for the time of evaluation.
745 // Surround the expression in with statements to inject our command line API so that 741 // Surround the expression in with statements to inject our command line API so that
746 // the window object properties still take more precedent than our API f unctions. 742 // the window object properties still take more precedent than our API f unctions.
747 743
748 injectCommandLineAPI = injectCommandLineAPI && !("__commandLineAPI" in i nspectedWindow); 744 var scopeExtensionForEval = (callFrame && injectCommandLineAPI) ? new Co mmandLineAPI(this._commandLineAPIImpl, callFrame) : undefined;
745
746 injectCommandLineAPI = !scopeExtensionForEval && !callFrame && injectCom mandLineAPI && !("__commandLineAPI" in inspectedWindow);
749 var injectScopeChain = scopeChain && scopeChain.length && !("__scopeChai nForEval" in inspectedWindow); 747 var injectScopeChain = scopeChain && scopeChain.length && !("__scopeChai nForEval" in inspectedWindow);
750 748
751 try { 749 try {
752 var prefix = ""; 750 var prefix = "";
753 var suffix = ""; 751 var suffix = "";
754 if (injectCommandLineAPI) { 752 if (injectCommandLineAPI) {
755 InjectedScriptHost.setNonEnumProperty(inspectedWindow, "__comman dLineAPI", new CommandLineAPI(this._commandLineAPIImpl, isEvalOnCallFrame ? obje ct : null)); 753 InjectedScriptHost.setNonEnumProperty(inspectedWindow, "__comman dLineAPI", new CommandLineAPI(this._commandLineAPIImpl, callFrame));
756 prefix = "with (__commandLineAPI || { __proto__: null }) {"; 754 prefix = "with (typeof __commandLineAPI !== 'undefined' ? __comm andLineAPI : { __proto__: null }) {";
757 suffix = "}"; 755 suffix = "}";
758 } 756 }
759 if (injectScopeChain) { 757 if (injectScopeChain) {
760 InjectedScriptHost.setNonEnumProperty(inspectedWindow, "__scopeC hainForEval", scopeChain); 758 InjectedScriptHost.setNonEnumProperty(inspectedWindow, "__scopeC hainForEval", scopeChain);
761 for (var i = 0; i < scopeChain.length; ++i) { 759 for (var i = 0; i < scopeChain.length; ++i) {
762 prefix = "with (__scopeChainForEval[" + i + "] || { __proto_ _: null }) {" + (suffix ? " " : "") + prefix; 760 prefix = "with (typeof __scopeChainForEval !== 'undefined' ? __scopeChainForEval[" + i + "] : { __proto__: null }) {" + (suffix ? " " : "") + prefix;
763 if (suffix) 761 if (suffix)
764 suffix += " }"; 762 suffix += " }";
765 else 763 else
766 suffix = "}"; 764 suffix = "}";
767 } 765 }
768 } 766 }
769 767
770 if (prefix) 768 if (prefix)
771 expression = prefix + "\n" + expression + "\n" + suffix; 769 expression = prefix + "\n" + expression + "\n" + suffix;
772 var wrappedResult = evalFunction ? InjectedScriptHost.callFunction(e valFunction, object, [expression]) : InjectedScriptHost.evaluateWithExceptionDet ails(expression); 770 var wrappedResult = callFrame ? callFrame.evaluateWithExceptionDetai ls(expression, scopeExtensionForEval) : InjectedScriptHost.evaluateWithException Details(expression);
773 if (objectGroup === "console" && !wrappedResult.exceptionDetails) 771 if (objectGroup === "console" && !wrappedResult.exceptionDetails)
774 this._lastResult = wrappedResult.result; 772 this._lastResult = wrappedResult.result;
775 return wrappedResult; 773 return wrappedResult;
776 } finally { 774 } finally {
777 if (injectCommandLineAPI) 775 if (injectCommandLineAPI)
778 delete inspectedWindow["__commandLineAPI"]; 776 delete inspectedWindow["__commandLineAPI"];
779 if (injectScopeChain) 777 if (injectScopeChain)
780 delete inspectedWindow["__scopeChainForEval"]; 778 delete inspectedWindow["__scopeChainForEval"];
781 } 779 }
782 }, 780 },
(...skipping 12 matching lines...) Expand all
795 var depth = 0; 793 var depth = 0;
796 do { 794 do {
797 result[depth] = new InjectedScript.CallFrameProxy(depth, callFrame, asyncOrdinal); 795 result[depth] = new InjectedScript.CallFrameProxy(depth, callFrame, asyncOrdinal);
798 callFrame = callFrame.caller; 796 callFrame = callFrame.caller;
799 ++depth; 797 ++depth;
800 } while (callFrame); 798 } while (callFrame);
801 return result; 799 return result;
802 }, 800 },
803 801
804 /** 802 /**
805 * @param {!Object} topCallFrame 803 * @param {!JavaScriptCallFrame} topCallFrame
806 * @param {!Array.<!Object>} asyncCallStacks 804 * @param {!Array.<!JavaScriptCallFrame>} asyncCallStacks
807 * @param {string} callFrameId 805 * @param {string} callFrameId
808 * @param {string} expression 806 * @param {string} expression
809 * @param {string} objectGroup 807 * @param {string} objectGroup
810 * @param {boolean} injectCommandLineAPI 808 * @param {boolean} injectCommandLineAPI
811 * @param {boolean} returnByValue 809 * @param {boolean} returnByValue
812 * @param {boolean} generatePreview 810 * @param {boolean} generatePreview
813 * @return {*} 811 * @return {*}
814 */ 812 */
815 evaluateOnCallFrame: function(topCallFrame, asyncCallStacks, callFrameId, ex pression, objectGroup, injectCommandLineAPI, returnByValue, generatePreview) 813 evaluateOnCallFrame: function(topCallFrame, asyncCallStacks, callFrameId, ex pression, objectGroup, injectCommandLineAPI, returnByValue, generatePreview)
816 { 814 {
817 var parsedCallFrameId = nullifyObjectProto(/** @type {!Object} */ (Injec tedScriptHost.eval("(" + callFrameId + ")"))); 815 var parsedCallFrameId = nullifyObjectProto(/** @type {!Object} */ (Injec tedScriptHost.eval("(" + callFrameId + ")")));
818 var callFrame = this._callFrameForParsedId(topCallFrame, parsedCallFrame Id, asyncCallStacks); 816 var callFrame = this._callFrameForParsedId(topCallFrame, parsedCallFrame Id, asyncCallStacks);
819 if (!callFrame) 817 if (!callFrame)
820 return "Could not find call frame with given id"; 818 return "Could not find call frame with given id";
821 if (parsedCallFrameId["asyncOrdinal"]) 819 if (parsedCallFrameId["asyncOrdinal"])
822 return this._evaluateAndWrap(null, null, expression, objectGroup, fa lse, injectCommandLineAPI, returnByValue, generatePreview, callFrame.scopeChain) ; 820 return this._evaluateAndWrap(null, expression, objectGroup, injectCo mmandLineAPI, returnByValue, generatePreview, callFrame.scopeChain);
823 return this._evaluateAndWrap(callFrame.evaluateWithExceptionDetails, cal lFrame, expression, objectGroup, true, injectCommandLineAPI, returnByValue, gene ratePreview); 821 return this._evaluateAndWrap(callFrame, expression, objectGroup, injectC ommandLineAPI, returnByValue, generatePreview);
824 }, 822 },
825 823
826 /** 824 /**
827 * @param {!Object} topCallFrame 825 * @param {!JavaScriptCallFrame} topCallFrame
828 * @param {string} callFrameId 826 * @param {string} callFrameId
829 * @return {*} 827 * @return {*}
830 */ 828 */
831 restartFrame: function(topCallFrame, callFrameId) 829 restartFrame: function(topCallFrame, callFrameId)
832 { 830 {
833 var callFrame = this._callFrameForId(topCallFrame, callFrameId); 831 var callFrame = this._callFrameForId(topCallFrame, callFrameId);
834 if (!callFrame) 832 if (!callFrame)
835 return "Could not find call frame with given id"; 833 return "Could not find call frame with given id";
836 var result = callFrame.restart(); 834 var result = callFrame.restart();
837 if (result === false) 835 if (result === false)
838 result = "Restart frame is not supported"; 836 result = "Restart frame is not supported";
839 return result; 837 return result;
840 }, 838 },
841 839
842 /** 840 /**
843 * @param {!Object} topCallFrame 841 * @param {!JavaScriptCallFrame} topCallFrame
844 * @param {string} callFrameId 842 * @param {string} callFrameId
845 * @return {*} a stepIn position array ready for protocol JSON or a string e rror 843 * @return {*} a stepIn position array ready for protocol JSON or a string e rror
846 */ 844 */
847 getStepInPositions: function(topCallFrame, callFrameId) 845 getStepInPositions: function(topCallFrame, callFrameId)
848 { 846 {
849 var callFrame = this._callFrameForId(topCallFrame, callFrameId); 847 var callFrame = this._callFrameForId(topCallFrame, callFrameId);
850 if (!callFrame) 848 if (!callFrame)
851 return "Could not find call frame with given id"; 849 return "Could not find call frame with given id";
852 var stepInPositionsUnpacked = JSON.parse(callFrame.stepInPositions); 850 var stepInPositionsUnpacked = JSON.parse(callFrame.stepInPositions);
853 if (typeof stepInPositionsUnpacked !== "object") 851 if (typeof stepInPositionsUnpacked !== "object")
854 return "Step in positions not available"; 852 return "Step in positions not available";
855 return stepInPositionsUnpacked; 853 return stepInPositionsUnpacked;
856 }, 854 },
857 855
858 /** 856 /**
859 * Either callFrameId or functionObjectId must be specified. 857 * Either callFrameId or functionObjectId must be specified.
860 * @param {!Object} topCallFrame 858 * @param {!JavaScriptCallFrame} topCallFrame
861 * @param {string|boolean} callFrameId or false 859 * @param {string|boolean} callFrameId or false
862 * @param {string|boolean} functionObjectId or false 860 * @param {string|boolean} functionObjectId or false
863 * @param {number} scopeNumber 861 * @param {number} scopeNumber
864 * @param {string} variableName 862 * @param {string} variableName
865 * @param {string} newValueJsonString RuntimeAgent.CallArgument structure se rialized as string 863 * @param {string} newValueJsonString RuntimeAgent.CallArgument structure se rialized as string
866 * @return {string|undefined} undefined if success or an error message 864 * @return {string|undefined} undefined if success or an error message
867 */ 865 */
868 setVariableValue: function(topCallFrame, callFrameId, functionObjectId, scop eNumber, variableName, newValueJsonString) 866 setVariableValue: function(topCallFrame, callFrameId, functionObjectId, scop eNumber, variableName, newValueJsonString)
869 { 867 {
870 try { 868 try {
(...skipping 11 matching lines...) Expand all
882 return "Could not resolve function by id"; 880 return "Could not resolve function by id";
883 InjectedScriptHost.setFunctionVariableValue(func, scopeNumber, v ariableName, resolvedValue); 881 InjectedScriptHost.setFunctionVariableValue(func, scopeNumber, v ariableName, resolvedValue);
884 } 882 }
885 } catch (e) { 883 } catch (e) {
886 return toString(e); 884 return toString(e);
887 } 885 }
888 return undefined; 886 return undefined;
889 }, 887 },
890 888
891 /** 889 /**
892 * @param {!Object} topCallFrame 890 * @param {!JavaScriptCallFrame} topCallFrame
893 * @param {string} callFrameId 891 * @param {string} callFrameId
894 * @return {?Object} 892 * @return {?JavaScriptCallFrame}
895 */ 893 */
896 _callFrameForId: function(topCallFrame, callFrameId) 894 _callFrameForId: function(topCallFrame, callFrameId)
897 { 895 {
898 var parsedCallFrameId = nullifyObjectProto(/** @type {!Object} */ (Injec tedScriptHost.eval("(" + callFrameId + ")"))); 896 var parsedCallFrameId = nullifyObjectProto(/** @type {!Object} */ (Injec tedScriptHost.eval("(" + callFrameId + ")")));
899 return this._callFrameForParsedId(topCallFrame, parsedCallFrameId, []); 897 return this._callFrameForParsedId(topCallFrame, parsedCallFrameId, []);
900 }, 898 },
901 899
902 /** 900 /**
903 * @param {!Object} topCallFrame 901 * @param {!JavaScriptCallFrame} topCallFrame
904 * @param {!Object} parsedCallFrameId 902 * @param {!Object} parsedCallFrameId
905 * @param {!Array.<!Object>} asyncCallStacks 903 * @param {!Array.<!JavaScriptCallFrame>} asyncCallStacks
906 * @return {?Object} 904 * @return {?JavaScriptCallFrame}
907 */ 905 */
908 _callFrameForParsedId: function(topCallFrame, parsedCallFrameId, asyncCallSt acks) 906 _callFrameForParsedId: function(topCallFrame, parsedCallFrameId, asyncCallSt acks)
909 { 907 {
910 var asyncOrdinal = parsedCallFrameId["asyncOrdinal"]; // 1-based index 908 var asyncOrdinal = parsedCallFrameId["asyncOrdinal"]; // 1-based index
911 if (asyncOrdinal) 909 if (asyncOrdinal)
912 topCallFrame = asyncCallStacks[asyncOrdinal - 1]; 910 topCallFrame = asyncCallStacks[asyncOrdinal - 1];
913 var ordinal = parsedCallFrameId["ordinal"]; 911 var ordinal = parsedCallFrameId["ordinal"];
914 var callFrame = topCallFrame; 912 var callFrame = topCallFrame;
915 while (--ordinal >= 0 && callFrame) 913 while (--ordinal >= 0 && callFrame)
916 callFrame = callFrame.caller; 914 callFrame = callFrame.caller;
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after
1441 return { 1439 return {
1442 object: injectedScript._wrapObject(scopeObject, groupId), 1440 object: injectedScript._wrapObject(scopeObject, groupId),
1443 type: /** @type {!DebuggerAgent.ScopeType} */ (scopeTypeNames[scopeTypeC ode]), 1441 type: /** @type {!DebuggerAgent.ScopeType} */ (scopeTypeNames[scopeTypeC ode]),
1444 __proto__: null 1442 __proto__: null
1445 }; 1443 };
1446 } 1444 }
1447 1445
1448 /** 1446 /**
1449 * @constructor 1447 * @constructor
1450 * @param {!CommandLineAPIImpl} commandLineAPIImpl 1448 * @param {!CommandLineAPIImpl} commandLineAPIImpl
1451 * @param {?Object} callFrame 1449 * @param {?JavaScriptCallFrame} callFrame
1452 */ 1450 */
1453 function CommandLineAPI(commandLineAPIImpl, callFrame) 1451 function CommandLineAPI(commandLineAPIImpl, callFrame)
1454 { 1452 {
1455 /** 1453 /**
1456 * @param {string} member 1454 * @param {string} member
1457 * @return {boolean} 1455 * @return {boolean}
1458 */ 1456 */
1459 function inScopeVariables(member) 1457 function inScopeVariables(member)
1460 { 1458 {
1461 if (!callFrame) 1459 if (!callFrame)
1462 return false; 1460 return (member in inspectedWindow);
1463 1461
1464 var scopeChain = callFrame.scopeChain; 1462 var scopeChain = callFrame.scopeChain;
1465 for (var i = 0; i < scopeChain.length; ++i) { 1463 for (var i = 0; i < scopeChain.length; ++i) {
1466 if (member in scopeChain[i]) 1464 if (member in scopeChain[i])
1467 return true; 1465 return true;
1468 } 1466 }
1469 return false; 1467 return false;
1470 } 1468 }
1471 1469
1472 /** 1470 /**
(...skipping 13 matching lines...) Expand all
1486 funcSyntax = funcSyntax.replace(/\bopt_(\w+)\b/g, "[$1]"); 1484 funcSyntax = funcSyntax.replace(/\bopt_(\w+)\b/g, "[$1]");
1487 funcArgsSyntax = funcSyntax.trim(); 1485 funcArgsSyntax = funcSyntax.trim();
1488 } catch (e) { 1486 } catch (e) {
1489 } 1487 }
1490 return "function " + name + "(" + funcArgsSyntax + ") { [Command Lin e API] }"; 1488 return "function " + name + "(" + funcArgsSyntax + ") { [Command Lin e API] }";
1491 }; 1489 };
1492 } 1490 }
1493 1491
1494 for (var i = 0; i < CommandLineAPI.members_.length; ++i) { 1492 for (var i = 0; i < CommandLineAPI.members_.length; ++i) {
1495 var member = CommandLineAPI.members_[i]; 1493 var member = CommandLineAPI.members_[i];
1496 if (member in inspectedWindow || inScopeVariables(member)) 1494 if (inScopeVariables(member))
1497 continue; 1495 continue;
1498 1496
1499 this[member] = bind(commandLineAPIImpl[member], commandLineAPIImpl); 1497 this[member] = bind(commandLineAPIImpl[member], commandLineAPIImpl);
1500 this[member].toString = customToStringMethod(member); 1498 this[member].toString = customToStringMethod(member);
1501 } 1499 }
1502 1500
1503 for (var i = 0; i < 5; ++i) { 1501 for (var i = 0; i < 5; ++i) {
1504 var member = "$" + i; 1502 var member = "$" + i;
1505 if (member in inspectedWindow || inScopeVariables(member)) 1503 if (inScopeVariables(member))
1506 continue; 1504 continue;
1507 1505
1508 this.__defineGetter__("$" + i, bind(commandLineAPIImpl._inspectedObject, commandLineAPIImpl, i)); 1506 this.__defineGetter__("$" + i, bind(commandLineAPIImpl._inspectedObject, commandLineAPIImpl, i));
1509 } 1507 }
1510 1508
1511 this.$_ = injectedScript._lastResult; 1509 this.$_ = injectedScript._lastResult;
1512 1510
1513 this.__proto__ = null; 1511 this.__proto__ = null;
1514 } 1512 }
1515 1513
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
1794 */ 1792 */
1795 _logEvent: function(event) 1793 _logEvent: function(event)
1796 { 1794 {
1797 inspectedWindow.console.log(event.type, event); 1795 inspectedWindow.console.log(event.type, event);
1798 } 1796 }
1799 } 1797 }
1800 1798
1801 injectedScript._commandLineAPIImpl = new CommandLineAPIImpl(); 1799 injectedScript._commandLineAPIImpl = new CommandLineAPIImpl();
1802 return injectedScript; 1800 return injectedScript;
1803 }) 1801 })
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698