Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 71 { | 71 { |
| 72 if (typeof obj === "number" && obj === 0 && 1 / obj < 0) | 72 if (typeof obj === "number" && obj === 0 && 1 / obj < 0) |
| 73 return "-0"; // Negative zero. | 73 return "-0"; // Negative zero. |
| 74 return "" + obj; | 74 return "" + obj; |
| 75 } | 75 } |
| 76 | 76 |
| 77 /** | 77 /** |
| 78 * Please use this bind, not the one from Function.prototype | 78 * Please use this bind, not the one from Function.prototype |
| 79 * @param {function(...)} func | 79 * @param {function(...)} func |
| 80 * @param {Object} thisObject | 80 * @param {Object} thisObject |
| 81 * @param {...number} var_args | 81 * @param {...} var_args |
| 82 */ | 82 */ |
| 83 function bind(func, thisObject, var_args) | 83 function bind(func, thisObject, var_args) |
| 84 { | 84 { |
| 85 var args = slice(arguments, 2); | 85 var args = slice(arguments, 2); |
| 86 | 86 |
| 87 /** | 87 /** |
| 88 * @param {...number} var_args | 88 * @param {...} var_args |
| 89 */ | 89 */ |
| 90 function bound(var_args) | 90 function bound(var_args) |
| 91 { | 91 { |
| 92 return func.apply(thisObject, args.concat(slice(arguments))); | 92 return func.apply(thisObject, args.concat(slice(arguments))); |
| 93 } | 93 } |
| 94 bound.toString = function() { | 94 bound.toString = function() |
| 95 { | |
| 95 return "bound: " + func; | 96 return "bound: " + func; |
| 96 }; | 97 }; |
| 97 return bound; | 98 return bound; |
| 98 } | 99 } |
| 99 | 100 |
| 100 /** | 101 /** |
| 101 * @param {T} obj | 102 * @param {T} obj |
| 102 * @return {T} | 103 * @return {T} |
| 103 * @template T | 104 * @template T |
| 104 */ | 105 */ |
| (...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 546 return this._createThrownValue(e, objectGroup); | 547 return this._createThrownValue(e, objectGroup); |
| 547 } | 548 } |
| 548 }, | 549 }, |
| 549 | 550 |
| 550 /** | 551 /** |
| 551 * Resolves a value from CallArgument description. | 552 * Resolves a value from CallArgument description. |
| 552 * @param {RuntimeAgent.CallArgument} callArgumentJson | 553 * @param {RuntimeAgent.CallArgument} callArgumentJson |
| 553 * @return {*} resolved value | 554 * @return {*} resolved value |
| 554 * @throws {string} error message | 555 * @throws {string} error message |
| 555 */ | 556 */ |
| 556 _resolveCallArgument: function(callArgumentJson) { | 557 _resolveCallArgument: function(callArgumentJson) |
| 558 { | |
| 557 callArgumentJson = nullifyObjectProto(callArgumentJson); | 559 callArgumentJson = nullifyObjectProto(callArgumentJson); |
| 558 var objectId = callArgumentJson.objectId; | 560 var objectId = callArgumentJson.objectId; |
| 559 if (objectId) { | 561 if (objectId) { |
| 560 var parsedArgId = this._parseObjectId(objectId); | 562 var parsedArgId = this._parseObjectId(objectId); |
| 561 if (!parsedArgId || parsedArgId["injectedScriptId"] !== injectedScri ptId) | 563 if (!parsedArgId || parsedArgId["injectedScriptId"] !== injectedScri ptId) |
| 562 throw "Arguments should belong to the same JavaScript world as t he target object."; | 564 throw "Arguments should belong to the same JavaScript world as t he target object."; |
| 563 | 565 |
| 564 var resolvedArg = this._objectForId(parsedArgId); | 566 var resolvedArg = this._objectForId(parsedArgId); |
| 565 if (!this._isDefined(resolvedArg)) | 567 if (!this._isDefined(resolvedArg)) |
| 566 throw "Could not find object with given id"; | 568 throw "Could not find object with given id"; |
| 567 | 569 |
| 568 return resolvedArg; | 570 return resolvedArg; |
| 569 } else if ("value" in callArgumentJson) { | 571 } else if ("value" in callArgumentJson) { |
| 570 return callArgumentJson.value; | 572 return callArgumentJson.value; |
| 571 } | 573 } |
| 572 return undefined; | 574 return undefined; |
| 573 }, | 575 }, |
| 574 | 576 |
| 575 /** | 577 /** |
| 576 * @param {Function} evalFunction | 578 * @param {Function} evalFunction |
| 577 * @param {Object} object | 579 * @param {Object} object |
| 578 * @param {string} objectGroup | 580 * @param {string} objectGroup |
| 579 * @param {boolean} isEvalOnCallFrame | 581 * @param {boolean} isEvalOnCallFrame |
| 580 * @param {boolean} injectCommandLineAPI | 582 * @param {boolean} injectCommandLineAPI |
| 581 * @param {boolean} returnByValue | 583 * @param {boolean} returnByValue |
| 582 * @param {boolean} generatePreview | 584 * @param {boolean} generatePreview |
| 585 * @param {!Array.<!Object>=} scopeChain | |
| 583 * @return {!Object} | 586 * @return {!Object} |
| 584 */ | 587 */ |
| 585 _evaluateAndWrap: function(evalFunction, object, expression, objectGroup, is EvalOnCallFrame, injectCommandLineAPI, returnByValue, generatePreview) | 588 _evaluateAndWrap: function(evalFunction, object, expression, objectGroup, is EvalOnCallFrame, injectCommandLineAPI, returnByValue, generatePreview, scopeChai n) |
| 586 { | 589 { |
| 587 try { | 590 try { |
| 588 return { wasThrown: false, | 591 return { wasThrown: false, |
| 589 result: this._wrapObject(this._evaluateOn(evalFunction, obj ect, objectGroup, expression, isEvalOnCallFrame, injectCommandLineAPI), objectGr oup, returnByValue, generatePreview), | 592 result: this._wrapObject(this._evaluateOn(evalFunction, obj ect, objectGroup, expression, isEvalOnCallFrame, injectCommandLineAPI, scopeChai n), objectGroup, returnByValue, generatePreview), |
| 590 __proto__: null }; | 593 __proto__: null }; |
| 591 } catch (e) { | 594 } catch (e) { |
| 592 return this._createThrownValue(e, objectGroup); | 595 return this._createThrownValue(e, objectGroup); |
| 593 } | 596 } |
| 594 }, | 597 }, |
| 595 | 598 |
| 596 /** | 599 /** |
| 597 * @param {*} value | 600 * @param {*} value |
| 598 * @param {string} objectGroup | 601 * @param {string} objectGroup |
| 599 * @return {!Object} | 602 * @return {!Object} |
| 600 */ | 603 */ |
| 601 _createThrownValue: function(value, objectGroup) | 604 _createThrownValue: function(value, objectGroup) |
| 602 { | 605 { |
| 603 var remoteObject = this._wrapObject(value, objectGroup); | 606 var remoteObject = this._wrapObject(value, objectGroup); |
| 604 try { | 607 try { |
| 605 remoteObject.description = toStringDescription(value); | 608 remoteObject.description = toStringDescription(value); |
| 606 } catch (e) {} | 609 } catch (e) {} |
| 607 return { wasThrown: true, result: remoteObject, __proto__: null }; | 610 return { wasThrown: true, result: remoteObject, __proto__: null }; |
| 608 }, | 611 }, |
| 609 | 612 |
| 610 /** | 613 /** |
| 611 * @param {Function} evalFunction | 614 * @param {Function} evalFunction |
| 612 * @param {Object} object | 615 * @param {Object} object |
| 613 * @param {string} objectGroup | 616 * @param {string} objectGroup |
| 614 * @param {string} expression | 617 * @param {string} expression |
| 615 * @param {boolean} isEvalOnCallFrame | 618 * @param {boolean} isEvalOnCallFrame |
| 616 * @param {boolean} injectCommandLineAPI | 619 * @param {boolean} injectCommandLineAPI |
| 620 * @param {!Array.<!Object>=} scopeChain | |
| 617 * @return {*} | 621 * @return {*} |
| 618 */ | 622 */ |
| 619 _evaluateOn: function(evalFunction, object, objectGroup, expression, isEvalO nCallFrame, injectCommandLineAPI) | 623 _evaluateOn: function(evalFunction, object, objectGroup, expression, isEvalO nCallFrame, injectCommandLineAPI, scopeChain) |
| 620 { | 624 { |
| 621 // Only install command line api object for the time of evaluation. | 625 // Only install command line api object for the time of evaluation. |
| 622 // Surround the expression in with statements to inject our command line API so that | 626 // Surround the expression in with statements to inject our command line API so that |
| 623 // the window object properties still take more precedent than our API f unctions. | 627 // the window object properties still take more precedent than our API f unctions. |
| 624 | 628 |
| 629 var injectScopeChain = scopeChain && scopeChain.length; | |
| 630 | |
| 625 try { | 631 try { |
| 632 var prefix = ""; | |
| 633 var suffix = ""; | |
| 626 if (injectCommandLineAPI && inspectedWindow.console) { | 634 if (injectCommandLineAPI && inspectedWindow.console) { |
| 627 inspectedWindow.console._commandLineAPI = new CommandLineAPI(thi s._commandLineAPIImpl, isEvalOnCallFrame ? object : null); | 635 inspectedWindow.console._commandLineAPI = new CommandLineAPI(thi s._commandLineAPIImpl, isEvalOnCallFrame ? object : null); |
| 628 expression = "with ((console && console._commandLineAPI) || { __ proto__: null }) {\n" + expression + "\n}"; | 636 prefix = "with ((console && console._commandLineAPI) || { __prot o__: null }) {"; |
| 637 suffix = "}"; | |
| 629 } | 638 } |
| 639 if (injectScopeChain) { | |
| 640 inspectedWindow._scopeChainForEval = scopeChain; | |
|
yurys
2014/01/23 15:32:26
Please put this into inspectedWindow.console._scop
aandrey
2014/01/23 15:40:43
Done.
| |
| 641 for (var i = 0; i < scopeChain.length; ++i) { | |
| 642 prefix = "with (window._scopeChainForEval[" + i + "] || { __ proto__: null }) {" + (suffix ? " " : "") + prefix; | |
| 643 if (suffix) | |
| 644 suffix += " }"; | |
| 645 else | |
| 646 suffix = "}"; | |
| 647 } | |
| 648 } | |
| 649 | |
| 650 if (prefix) | |
| 651 expression = prefix + "\n" + expression + "\n" + suffix; | |
| 630 var result = evalFunction.call(object, expression); | 652 var result = evalFunction.call(object, expression); |
| 631 if (objectGroup === "console") | 653 if (objectGroup === "console") |
| 632 this._lastResult = result; | 654 this._lastResult = result; |
| 633 return result; | 655 return result; |
| 634 } finally { | 656 } finally { |
| 635 if (injectCommandLineAPI && inspectedWindow.console) | 657 if (injectCommandLineAPI && inspectedWindow.console) |
| 636 delete inspectedWindow.console._commandLineAPI; | 658 delete inspectedWindow.console._commandLineAPI; |
| 659 if (injectScopeChain) | |
| 660 delete inspectedWindow._scopeChainForEval; | |
| 637 } | 661 } |
| 638 }, | 662 }, |
| 639 | 663 |
| 640 /** | 664 /** |
| 641 * @param {Object} callFrame | 665 * @param {?Object} callFrame |
| 642 * @return {!Array.<InjectedScript.CallFrameProxy>|boolean} | 666 * @param {number} asyncOrdinal |
| 667 * @return {!Array.<!InjectedScript.CallFrameProxy>|boolean} | |
| 643 */ | 668 */ |
| 644 wrapCallFrames: function(callFrame) | 669 wrapCallFrames: function(callFrame, asyncOrdinal) |
| 645 { | 670 { |
| 646 if (!callFrame) | 671 if (!callFrame) |
| 647 return false; | 672 return false; |
| 648 | 673 |
| 649 var result = []; | 674 var result = []; |
| 650 var depth = 0; | 675 var depth = 0; |
| 651 do { | 676 do { |
| 652 result.push(new InjectedScript.CallFrameProxy(depth++, callFrame)); | 677 result.push(new InjectedScript.CallFrameProxy(depth++, callFrame, as yncOrdinal)); |
| 653 callFrame = callFrame.caller; | 678 callFrame = callFrame.caller; |
| 654 } while (callFrame); | 679 } while (callFrame); |
| 655 return result; | 680 return result; |
| 656 }, | 681 }, |
| 657 | 682 |
| 658 /** | 683 /** |
| 659 * @param {Object} topCallFrame | 684 * @param {!Object} topCallFrame |
| 685 * @param {!Array.<!Object>} asyncCallStacks | |
| 660 * @param {string} callFrameId | 686 * @param {string} callFrameId |
| 661 * @param {string} expression | 687 * @param {string} expression |
| 662 * @param {string} objectGroup | 688 * @param {string} objectGroup |
| 663 * @param {boolean} injectCommandLineAPI | 689 * @param {boolean} injectCommandLineAPI |
| 664 * @param {boolean} returnByValue | 690 * @param {boolean} returnByValue |
| 665 * @param {boolean} generatePreview | 691 * @param {boolean} generatePreview |
| 666 * @return {*} | 692 * @return {*} |
| 667 */ | 693 */ |
| 668 evaluateOnCallFrame: function(topCallFrame, callFrameId, expression, objectG roup, injectCommandLineAPI, returnByValue, generatePreview) | 694 evaluateOnCallFrame: function(topCallFrame, asyncCallStacks, callFrameId, ex pression, objectGroup, injectCommandLineAPI, returnByValue, generatePreview) |
| 669 { | 695 { |
| 670 var callFrame = this.callFrameForId(topCallFrame, callFrameId); | 696 var parsedCallFrameId = nullifyObjectProto(InjectedScriptHost.evaluate(" (" + callFrameId + ")")); |
| 697 var callFrame = this._callFrameForParsedId(topCallFrame, parsedCallFrame Id, asyncCallStacks); | |
| 671 if (!callFrame) | 698 if (!callFrame) |
| 672 return "Could not find call frame with given id"; | 699 return "Could not find call frame with given id"; |
| 700 if (parsedCallFrameId["asyncOrdinal"]) | |
| 701 return this._evaluateAndWrap(InjectedScriptHost.evaluate, InjectedSc riptHost, expression, objectGroup, false, injectCommandLineAPI, returnByValue, g eneratePreview, callFrame.scopeChain); | |
| 673 return this._evaluateAndWrap(callFrame.evaluate, callFrame, expression, objectGroup, true, injectCommandLineAPI, returnByValue, generatePreview); | 702 return this._evaluateAndWrap(callFrame.evaluate, callFrame, expression, objectGroup, true, injectCommandLineAPI, returnByValue, generatePreview); |
| 674 }, | 703 }, |
| 675 | 704 |
| 676 /** | 705 /** |
| 677 * @param {Object} topCallFrame | 706 * @param {!Object} topCallFrame |
| 678 * @param {string} callFrameId | 707 * @param {string} callFrameId |
| 679 * @return {*} | 708 * @return {*} |
| 680 */ | 709 */ |
| 681 restartFrame: function(topCallFrame, callFrameId) | 710 restartFrame: function(topCallFrame, callFrameId) |
| 682 { | 711 { |
| 683 var callFrame = this.callFrameForId(topCallFrame, callFrameId); | 712 var callFrame = this.callFrameForId(topCallFrame, callFrameId); |
| 684 if (!callFrame) | 713 if (!callFrame) |
| 685 return "Could not find call frame with given id"; | 714 return "Could not find call frame with given id"; |
| 686 var result = callFrame.restart(); | 715 var result = callFrame.restart(); |
| 687 if (result === false) | 716 if (result === false) |
| 688 result = "Restart frame is not supported"; | 717 result = "Restart frame is not supported"; |
| 689 return result; | 718 return result; |
| 690 }, | 719 }, |
| 691 | 720 |
| 692 /** | 721 /** |
| 693 * @param {Object} topCallFrame | 722 * @param {!Object} topCallFrame |
| 694 * @param {string} callFrameId | 723 * @param {string} callFrameId |
| 695 * @return {*} a stepIn position array ready for protocol JSON or a string e rror | 724 * @return {*} a stepIn position array ready for protocol JSON or a string e rror |
| 696 */ | 725 */ |
| 697 getStepInPositions: function(topCallFrame, callFrameId) | 726 getStepInPositions: function(topCallFrame, callFrameId) |
| 698 { | 727 { |
| 699 var callFrame = this.callFrameForId(topCallFrame, callFrameId); | 728 var callFrame = this.callFrameForId(topCallFrame, callFrameId); |
| 700 if (!callFrame) | 729 if (!callFrame) |
| 701 return "Could not find call frame with given id"; | 730 return "Could not find call frame with given id"; |
| 702 var stepInPositionsUnpacked = JSON.parse(callFrame.stepInPositions); | 731 var stepInPositionsUnpacked = JSON.parse(callFrame.stepInPositions); |
| 703 if (typeof stepInPositionsUnpacked !== "object") | 732 if (typeof stepInPositionsUnpacked !== "object") |
| 704 return "Step in positions not available"; | 733 return "Step in positions not available"; |
| 705 return stepInPositionsUnpacked; | 734 return stepInPositionsUnpacked; |
| 706 }, | 735 }, |
| 707 | 736 |
| 708 /** | 737 /** |
| 709 * Either callFrameId or functionObjectId must be specified. | 738 * Either callFrameId or functionObjectId must be specified. |
| 710 * @param {Object} topCallFrame | 739 * @param {!Object} topCallFrame |
| 711 * @param {string|boolean} callFrameId or false | 740 * @param {string|boolean} callFrameId or false |
| 712 * @param {string|boolean} functionObjectId or false | 741 * @param {string|boolean} functionObjectId or false |
| 713 * @param {number} scopeNumber | 742 * @param {number} scopeNumber |
| 714 * @param {string} variableName | 743 * @param {string} variableName |
| 715 * @param {string} newValueJsonString RuntimeAgent.CallArgument structure se rialized as string | 744 * @param {string} newValueJsonString RuntimeAgent.CallArgument structure se rialized as string |
| 716 * @return {string|undefined} undefined if success or an error message | 745 * @return {string|undefined} undefined if success or an error message |
| 717 */ | 746 */ |
| 718 setVariableValue: function(topCallFrame, callFrameId, functionObjectId, scop eNumber, variableName, newValueJsonString) | 747 setVariableValue: function(topCallFrame, callFrameId, functionObjectId, scop eNumber, variableName, newValueJsonString) |
| 719 { | 748 { |
| 720 var setter; | 749 var setter; |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 744 } | 773 } |
| 745 try { | 774 try { |
| 746 setter(scopeNumber, variableName, resolvedValue); | 775 setter(scopeNumber, variableName, resolvedValue); |
| 747 } catch (e) { | 776 } catch (e) { |
| 748 return "Failed to change variable value: " + e; | 777 return "Failed to change variable value: " + e; |
| 749 } | 778 } |
| 750 return undefined; | 779 return undefined; |
| 751 }, | 780 }, |
| 752 | 781 |
| 753 /** | 782 /** |
| 754 * @param {Object} topCallFrame | 783 * @param {!Object} topCallFrame |
| 755 * @param {string} callFrameId | 784 * @param {string} callFrameId |
| 756 * @return {Object} | 785 * @return {?Object} |
| 757 */ | 786 */ |
| 758 callFrameForId: function(topCallFrame, callFrameId) | 787 callFrameForId: function(topCallFrame, callFrameId) |
| 759 { | 788 { |
| 760 var parsedCallFrameId = nullifyObjectProto(InjectedScriptHost.evaluate(" (" + callFrameId + ")")); | 789 var parsedCallFrameId = nullifyObjectProto(InjectedScriptHost.evaluate(" (" + callFrameId + ")")); |
| 790 return this._callFrameForParsedId(topCallFrame, parsedCallFrameId, []); | |
| 791 }, | |
| 792 | |
| 793 /** | |
| 794 * @param {!Object} topCallFrame | |
| 795 * @param {!Object} parsedCallFrameId | |
| 796 * @param {!Array.<!Object>} asyncCallStacks | |
| 797 * @return {?Object} | |
| 798 */ | |
| 799 _callFrameForParsedId: function(topCallFrame, parsedCallFrameId, asyncCallSt acks) | |
| 800 { | |
| 801 var asyncOrdinal = parsedCallFrameId["asyncOrdinal"]; // 1-based index | |
| 802 if (asyncOrdinal) | |
| 803 topCallFrame = asyncCallStacks[asyncOrdinal - 1]; | |
| 761 var ordinal = parsedCallFrameId["ordinal"]; | 804 var ordinal = parsedCallFrameId["ordinal"]; |
| 762 var callFrame = topCallFrame; | 805 var callFrame = topCallFrame; |
| 763 while (--ordinal >= 0 && callFrame) | 806 while (--ordinal >= 0 && callFrame) |
| 764 callFrame = callFrame.caller; | 807 callFrame = callFrame.caller; |
| 765 return callFrame; | 808 return callFrame; |
| 766 }, | 809 }, |
| 767 | 810 |
| 768 /** | 811 /** |
| 769 * @param {Object} objectId | 812 * @param {Object} objectId |
| 770 * @return {Object} | 813 * @return {Object} |
| (...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1126 } | 1169 } |
| 1127 return string.substr(0, maxLength) + "\u2026"; | 1170 return string.substr(0, maxLength) + "\u2026"; |
| 1128 }, | 1171 }, |
| 1129 | 1172 |
| 1130 __proto__: null | 1173 __proto__: null |
| 1131 } | 1174 } |
| 1132 /** | 1175 /** |
| 1133 * @constructor | 1176 * @constructor |
| 1134 * @param {number} ordinal | 1177 * @param {number} ordinal |
| 1135 * @param {!Object} callFrame | 1178 * @param {!Object} callFrame |
| 1179 * @param {number} asyncOrdinal | |
| 1136 */ | 1180 */ |
| 1137 InjectedScript.CallFrameProxy = function(ordinal, callFrame) | 1181 InjectedScript.CallFrameProxy = function(ordinal, callFrame, asyncOrdinal) |
| 1138 { | 1182 { |
| 1139 this.callFrameId = "{\"ordinal\":" + ordinal + ",\"injectedScriptId\":" + in jectedScriptId + "}"; | 1183 this.callFrameId = "{\"ordinal\":" + ordinal + ",\"injectedScriptId\":" + in jectedScriptId + (asyncOrdinal ? ",\"asyncOrdinal\":" + asyncOrdinal : "") + "}" ; |
| 1140 this.functionName = (callFrame.type === "function" ? callFrame.functionName : ""); | 1184 this.functionName = (callFrame.type === "function" ? callFrame.functionName : ""); |
| 1141 this.location = { scriptId: toString(callFrame.sourceID), lineNumber: callFr ame.line, columnNumber: callFrame.column, __proto__: null }; | 1185 this.location = { scriptId: toString(callFrame.sourceID), lineNumber: callFr ame.line, columnNumber: callFrame.column, __proto__: null }; |
| 1142 this.scopeChain = this._wrapScopeChain(callFrame); | 1186 this.scopeChain = this._wrapScopeChain(callFrame); |
| 1143 this.this = injectedScript._wrapObject(callFrame.thisObject, "backtrace"); | 1187 this.this = injectedScript._wrapObject(callFrame.thisObject, "backtrace"); |
| 1144 if (callFrame.isAtReturn) | 1188 if (callFrame.isAtReturn) |
| 1145 this.returnValue = injectedScript._wrapObject(callFrame.returnValue, "ba cktrace"); | 1189 this.returnValue = injectedScript._wrapObject(callFrame.returnValue, "ba cktrace"); |
| 1146 } | 1190 } |
| 1147 | 1191 |
| 1148 InjectedScript.CallFrameProxy.prototype = { | 1192 InjectedScript.CallFrameProxy.prototype = { |
| 1149 /** | 1193 /** |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 1163 | 1207 |
| 1164 __proto__: null | 1208 __proto__: null |
| 1165 } | 1209 } |
| 1166 | 1210 |
| 1167 /** | 1211 /** |
| 1168 * @param {number} scopeTypeCode | 1212 * @param {number} scopeTypeCode |
| 1169 * @param {*} scopeObject | 1213 * @param {*} scopeObject |
| 1170 * @param {string} groupId | 1214 * @param {string} groupId |
| 1171 * @return {!DebuggerAgent.Scope} | 1215 * @return {!DebuggerAgent.Scope} |
| 1172 */ | 1216 */ |
| 1173 InjectedScript.CallFrameProxy._createScopeJson = function(scopeTypeCode, scopeOb ject, groupId) { | 1217 InjectedScript.CallFrameProxy._createScopeJson = function(scopeTypeCode, scopeOb ject, groupId) |
| 1218 { | |
| 1174 const GLOBAL_SCOPE = 0; | 1219 const GLOBAL_SCOPE = 0; |
| 1175 const LOCAL_SCOPE = 1; | 1220 const LOCAL_SCOPE = 1; |
| 1176 const WITH_SCOPE = 2; | 1221 const WITH_SCOPE = 2; |
| 1177 const CLOSURE_SCOPE = 3; | 1222 const CLOSURE_SCOPE = 3; |
| 1178 const CATCH_SCOPE = 4; | 1223 const CATCH_SCOPE = 4; |
| 1179 | 1224 |
| 1180 /** @type {!Object.<number, string>} */ | 1225 /** @type {!Object.<number, string>} */ |
| 1181 var scopeTypeNames = { __proto__: null }; | 1226 var scopeTypeNames = { __proto__: null }; |
| 1182 scopeTypeNames[GLOBAL_SCOPE] = "global"; | 1227 scopeTypeNames[GLOBAL_SCOPE] = "global"; |
| 1183 scopeTypeNames[LOCAL_SCOPE] = "local"; | 1228 scopeTypeNames[LOCAL_SCOPE] = "local"; |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1463 undebug: function(fn) | 1508 undebug: function(fn) |
| 1464 { | 1509 { |
| 1465 InjectedScriptHost.undebugFunction(fn); | 1510 InjectedScriptHost.undebugFunction(fn); |
| 1466 }, | 1511 }, |
| 1467 | 1512 |
| 1468 monitor: function(fn) | 1513 monitor: function(fn) |
| 1469 { | 1514 { |
| 1470 InjectedScriptHost.monitorFunction(fn); | 1515 InjectedScriptHost.monitorFunction(fn); |
| 1471 }, | 1516 }, |
| 1472 | 1517 |
| 1473 unmonitor: function(fn) { | 1518 unmonitor: function(fn) |
| 1519 { | |
| 1474 InjectedScriptHost.unmonitorFunction(fn); | 1520 InjectedScriptHost.unmonitorFunction(fn); |
| 1475 }, | 1521 }, |
| 1476 | 1522 |
| 1477 table: function(data, opt_columns) | 1523 table: function(data, opt_columns) |
| 1478 { | 1524 { |
| 1479 inspectedWindow.console.table.apply(inspectedWindow.console, arguments); | 1525 inspectedWindow.console.table.apply(inspectedWindow.console, arguments); |
| 1480 }, | 1526 }, |
| 1481 | 1527 |
| 1482 /** | 1528 /** |
| 1483 * @param {number} num | 1529 * @param {number} num |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1519 */ | 1565 */ |
| 1520 _logEvent: function(event) | 1566 _logEvent: function(event) |
| 1521 { | 1567 { |
| 1522 inspectedWindow.console.log(event.type, event); | 1568 inspectedWindow.console.log(event.type, event); |
| 1523 } | 1569 } |
| 1524 } | 1570 } |
| 1525 | 1571 |
| 1526 injectedScript._commandLineAPIImpl = new CommandLineAPIImpl(); | 1572 injectedScript._commandLineAPIImpl = new CommandLineAPIImpl(); |
| 1527 return injectedScript; | 1573 return injectedScript; |
| 1528 }) | 1574 }) |
| OLD | NEW |