Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 /** | 31 /** |
| 32 * @constructor | 32 * @constructor |
| 33 * @extends {WebInspector.Object} | 33 * @extends {WebInspector.Object} |
| 34 */ | 34 */ |
| 35 WebInspector.DebuggerModel = function() | 35 WebInspector.DebuggerModel = function() |
| 36 { | 36 { |
| 37 InspectorBackend.registerDebuggerDispatcher(new WebInspector.DebuggerDispatc her(this)); | 37 InspectorBackend.registerDebuggerDispatcher(new WebInspector.DebuggerDispatc her(this)); |
| 38 | 38 |
| 39 /** @type {?WebInspector.DebuggerPausedDetails} */ | |
| 39 this._debuggerPausedDetails = null; | 40 this._debuggerPausedDetails = null; |
| 40 /** | 41 /** @type {!Object.<string, !WebInspector.Script>} */ |
| 41 * @type {!Object.<string, !WebInspector.Script>} | |
| 42 */ | |
| 43 this._scripts = {}; | 42 this._scripts = {}; |
| 44 /** @type {!Object.<!string, !Array.<!WebInspector.Script>>} */ | 43 /** @type {!Object.<!string, !Array.<!WebInspector.Script>>} */ |
| 45 this._scriptsBySourceURL = {}; | 44 this._scriptsBySourceURL = {}; |
| 46 | 45 |
| 47 this._canSetScriptSource = false; | 46 this._canSetScriptSource = false; |
| 48 this._breakpointsActive = true; | 47 this._breakpointsActive = true; |
| 49 | 48 |
| 50 WebInspector.settings.pauseOnExceptionStateString = WebInspector.settings.cr eateSetting("pauseOnExceptionStateString", WebInspector.DebuggerModel.PauseOnExc eptionsState.DontPauseOnExceptions); | 49 WebInspector.settings.pauseOnExceptionStateString = WebInspector.settings.cr eateSetting("pauseOnExceptionStateString", WebInspector.DebuggerModel.PauseOnExc eptionsState.DontPauseOnExceptions); |
| 51 WebInspector.settings.pauseOnExceptionStateString.addChangeListener(this._pa useOnExceptionStateChanged, this); | 50 WebInspector.settings.pauseOnExceptionStateString.addChangeListener(this._pa useOnExceptionStateChanged, this); |
| 52 | 51 |
| 52 WebInspector.settings.enableAsyncStackTraces.addChangeListener(this._asyncSt ackTracesStateChanged, this); | |
| 53 WebInspector.settings.maxAsyncStackTraceDepth.addChangeListener(this._asyncS tackTracesStateChanged, this); | |
| 54 | |
| 53 this.enableDebugger(); | 55 this.enableDebugger(); |
| 54 | 56 |
| 55 WebInspector.DebuggerModel.applySkipStackFrameSettings(); | 57 WebInspector.DebuggerModel.applySkipStackFrameSettings(); |
| 56 } | 58 } |
| 57 | 59 |
| 58 // Keep these in sync with WebCore::ScriptDebugServer | 60 // Keep these in sync with WebCore::ScriptDebugServer |
| 59 WebInspector.DebuggerModel.PauseOnExceptionsState = { | 61 WebInspector.DebuggerModel.PauseOnExceptionsState = { |
| 60 DontPauseOnExceptions : "none", | 62 DontPauseOnExceptions : "none", |
| 61 PauseOnAllExceptions : "all", | 63 PauseOnAllExceptions : "all", |
| 62 PauseOnUncaughtExceptions: "uncaught" | 64 PauseOnUncaughtExceptions: "uncaught" |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 160 */ | 162 */ |
| 161 canSetScriptSource: function() | 163 canSetScriptSource: function() |
| 162 { | 164 { |
| 163 return this._canSetScriptSource; | 165 return this._canSetScriptSource; |
| 164 }, | 166 }, |
| 165 | 167 |
| 166 _debuggerWasEnabled: function() | 168 _debuggerWasEnabled: function() |
| 167 { | 169 { |
| 168 this._debuggerEnabled = true; | 170 this._debuggerEnabled = true; |
| 169 this._pauseOnExceptionStateChanged(); | 171 this._pauseOnExceptionStateChanged(); |
| 172 this._asyncStackTracesStateChanged(); | |
| 170 this.dispatchEventToListeners(WebInspector.DebuggerModel.Events.Debugger WasEnabled); | 173 this.dispatchEventToListeners(WebInspector.DebuggerModel.Events.Debugger WasEnabled); |
| 171 }, | 174 }, |
| 172 | 175 |
| 173 _pauseOnExceptionStateChanged: function() | 176 _pauseOnExceptionStateChanged: function() |
| 174 { | 177 { |
| 175 DebuggerAgent.setPauseOnExceptions(WebInspector.settings.pauseOnExceptio nStateString.get()); | 178 DebuggerAgent.setPauseOnExceptions(WebInspector.settings.pauseOnExceptio nStateString.get()); |
| 176 }, | 179 }, |
| 177 | 180 |
| 181 _asyncStackTracesStateChanged: function() | |
| 182 { | |
| 183 var enabled = WebInspector.settings.enableAsyncStackTraces.get(); | |
| 184 var depth = enabled ? Number(WebInspector.settings.maxAsyncStackTraceDep th.get()) : 0; | |
| 185 DebuggerAgent.setAsyncCallStackDepth(depth); | |
| 186 }, | |
| 187 | |
| 178 _debuggerWasDisabled: function() | 188 _debuggerWasDisabled: function() |
| 179 { | 189 { |
| 180 this._debuggerEnabled = false; | 190 this._debuggerEnabled = false; |
| 181 this.dispatchEventToListeners(WebInspector.DebuggerModel.Events.Debugger WasDisabled); | 191 this.dispatchEventToListeners(WebInspector.DebuggerModel.Events.Debugger WasDisabled); |
| 182 }, | 192 }, |
| 183 | 193 |
| 184 /** | 194 /** |
| 185 * @param {!WebInspector.DebuggerModel.Location} rawLocation | 195 * @param {!WebInspector.DebuggerModel.Location} rawLocation |
| 186 */ | 196 */ |
| 187 continueToLocation: function(rawLocation) | 197 continueToLocation: function(rawLocation) |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 437 this.setSelectedCallFrame(null); | 447 this.setSelectedCallFrame(null); |
| 438 DebuggerAgent.setOverlayMessage(); | 448 DebuggerAgent.setOverlayMessage(); |
| 439 } | 449 } |
| 440 }, | 450 }, |
| 441 | 451 |
| 442 /** | 452 /** |
| 443 * @param {!Array.<!DebuggerAgent.CallFrame>} callFrames | 453 * @param {!Array.<!DebuggerAgent.CallFrame>} callFrames |
| 444 * @param {string} reason | 454 * @param {string} reason |
| 445 * @param {Object|undefined} auxData | 455 * @param {Object|undefined} auxData |
| 446 * @param {!Array.<string>} breakpointIds | 456 * @param {!Array.<string>} breakpointIds |
| 447 * @param {DebuggerAgent.StackTrace=} asyncStackTrace | 457 * @param {!DebuggerAgent.StackTrace=} asyncStackTrace |
| 448 */ | 458 */ |
| 449 _pausedScript: function(callFrames, reason, auxData, breakpointIds, asyncSta ckTrace) | 459 _pausedScript: function(callFrames, reason, auxData, breakpointIds, asyncSta ckTrace) |
| 450 { | 460 { |
| 451 if (this._pendingStepIntoLocation) { | 461 if (this._pendingStepIntoLocation) { |
| 452 var requestedLocation = this._pendingStepIntoLocation; | 462 var requestedLocation = this._pendingStepIntoLocation; |
| 453 delete this._pendingStepIntoLocation; | 463 delete this._pendingStepIntoLocation; |
| 454 | 464 |
| 455 if (callFrames.length > 0) { | 465 if (callFrames.length > 0) { |
| 456 var topLocation = callFrames[0].location; | 466 var topLocation = callFrames[0].location; |
| 457 if (topLocation.lineNumber == requestedLocation.lineNumber && to pLocation.columnNumber == requestedLocation.columnNumber && topLocation.scriptId == requestedLocation.scriptId) { | 467 if (topLocation.lineNumber == requestedLocation.lineNumber && to pLocation.columnNumber == requestedLocation.columnNumber && topLocation.scriptId == requestedLocation.scriptId) { |
| 458 this.stepInto(); | 468 this.stepInto(); |
| 459 return; | 469 return; |
| 460 } | 470 } |
| 461 } | 471 } |
| 462 } | 472 } |
| 463 | 473 |
| 464 this._setDebuggerPausedDetails(new WebInspector.DebuggerPausedDetails(th is, callFrames, reason, auxData, breakpointIds, asyncStackTrace)); | 474 this._setDebuggerPausedDetails(new WebInspector.DebuggerPausedDetails(ca llFrames, reason, auxData, breakpointIds, asyncStackTrace)); |
| 465 }, | 475 }, |
| 466 | 476 |
| 467 _resumedScript: function() | 477 _resumedScript: function() |
| 468 { | 478 { |
| 469 this._setDebuggerPausedDetails(null); | 479 this._setDebuggerPausedDetails(null); |
| 470 this.dispatchEventToListeners(WebInspector.DebuggerModel.Events.Debugger Resumed); | 480 this.dispatchEventToListeners(WebInspector.DebuggerModel.Events.Debugger Resumed); |
| 471 }, | 481 }, |
| 472 | 482 |
| 473 /** | 483 /** |
| 474 * @param {DebuggerAgent.ScriptId} scriptId | 484 * @param {DebuggerAgent.ScriptId} scriptId |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 680 if (!script) | 690 if (!script) |
| 681 return null; | 691 return null; |
| 682 return script.rawLocationToUILocation(rawLocation.lineNumber, rawLocatio n.columnNumber); | 692 return script.rawLocationToUILocation(rawLocation.lineNumber, rawLocatio n.columnNumber); |
| 683 }, | 693 }, |
| 684 | 694 |
| 685 /** | 695 /** |
| 686 * Handles notification from JavaScript VM about updated stack (liveedit or frame restart action). | 696 * Handles notification from JavaScript VM about updated stack (liveedit or frame restart action). |
| 687 * @this {WebInspector.DebuggerModel} | 697 * @this {WebInspector.DebuggerModel} |
| 688 * @param {!Array.<!DebuggerAgent.CallFrame>=} newCallFrames | 698 * @param {!Array.<!DebuggerAgent.CallFrame>=} newCallFrames |
| 689 * @param {Object=} details | 699 * @param {Object=} details |
| 690 * @param {DebuggerAgent.StackTrace=} asyncStackTrace | 700 * @param {!DebuggerAgent.StackTrace=} asyncStackTrace |
| 691 */ | 701 */ |
| 692 callStackModified: function(newCallFrames, details, asyncStackTrace) | 702 callStackModified: function(newCallFrames, details, asyncStackTrace) |
| 693 { | 703 { |
| 694 // FIXME: declare this property in protocol and in JavaScript. | 704 // FIXME: declare this property in protocol and in JavaScript. |
| 695 if (details && details["stack_update_needs_step_in"]) | 705 if (details && details["stack_update_needs_step_in"]) |
| 696 this.stepInto(); | 706 this.stepInto(); |
| 697 else if (newCallFrames && newCallFrames.length) | 707 else if (newCallFrames && newCallFrames.length) |
| 698 this._pausedScript(newCallFrames, this._debuggerPausedDetails.reason , this._debuggerPausedDetails.auxData, this._debuggerPausedDetails.breakpointIds , asyncStackTrace); | 708 this._pausedScript(newCallFrames, this._debuggerPausedDetails.reason , this._debuggerPausedDetails.auxData, this._debuggerPausedDetails.breakpointIds , asyncStackTrace); |
| 699 }, | 709 }, |
| 700 | 710 |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 725 { | 735 { |
| 726 this._debuggerModel = debuggerModel; | 736 this._debuggerModel = debuggerModel; |
| 727 } | 737 } |
| 728 | 738 |
| 729 WebInspector.DebuggerDispatcher.prototype = { | 739 WebInspector.DebuggerDispatcher.prototype = { |
| 730 /** | 740 /** |
| 731 * @param {!Array.<!DebuggerAgent.CallFrame>} callFrames | 741 * @param {!Array.<!DebuggerAgent.CallFrame>} callFrames |
| 732 * @param {string} reason | 742 * @param {string} reason |
| 733 * @param {Object=} auxData | 743 * @param {Object=} auxData |
| 734 * @param {!Array.<string>=} breakpointIds | 744 * @param {!Array.<string>=} breakpointIds |
| 735 * @param {DebuggerAgent.StackTrace=} asyncStackTrace | 745 * @param {!DebuggerAgent.StackTrace=} asyncStackTrace |
| 736 */ | 746 */ |
| 737 paused: function(callFrames, reason, auxData, breakpointIds, asyncStackTrace ) | 747 paused: function(callFrames, reason, auxData, breakpointIds, asyncStackTrace ) |
| 738 { | 748 { |
| 739 this._debuggerModel._pausedScript(callFrames, reason, auxData, breakpoin tIds || [], asyncStackTrace); | 749 this._debuggerModel._pausedScript(callFrames, reason, auxData, breakpoin tIds || [], asyncStackTrace); |
| 740 }, | 750 }, |
| 741 | 751 |
| 742 resumed: function() | 752 resumed: function() |
| 743 { | 753 { |
| 744 this._debuggerModel._resumedScript(); | 754 this._debuggerModel._resumedScript(); |
| 745 }, | 755 }, |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 783 breakpointResolved: function(breakpointId, location) | 793 breakpointResolved: function(breakpointId, location) |
| 784 { | 794 { |
| 785 this._debuggerModel._breakpointResolved(breakpointId, location); | 795 this._debuggerModel._breakpointResolved(breakpointId, location); |
| 786 } | 796 } |
| 787 } | 797 } |
| 788 | 798 |
| 789 /** | 799 /** |
| 790 * @constructor | 800 * @constructor |
| 791 * @param {!WebInspector.Script} script | 801 * @param {!WebInspector.Script} script |
| 792 * @param {!DebuggerAgent.CallFrame} payload | 802 * @param {!DebuggerAgent.CallFrame} payload |
| 803 * @param {boolean=} isAsync | |
| 793 */ | 804 */ |
| 794 WebInspector.DebuggerModel.CallFrame = function(script, payload) | 805 WebInspector.DebuggerModel.CallFrame = function(script, payload, isAsync) |
| 795 { | 806 { |
| 796 this._script = script; | 807 this._script = script; |
| 797 this._payload = payload; | 808 this._payload = payload; |
| 809 /** @type {!Array.<!WebInspector.Script.Location>} */ | |
| 798 this._locations = []; | 810 this._locations = []; |
| 811 this._isAsync = isAsync; | |
| 812 } | |
| 813 | |
| 814 /** | |
| 815 * @param {!Array.<!DebuggerAgent.CallFrame>} callFrames | |
| 816 * @param {boolean=} isAsync | |
| 817 * @return {!Array.<!WebInspector.DebuggerModel.CallFrame>} | |
| 818 */ | |
| 819 WebInspector.DebuggerModel.CallFrame.fromPayloadArray = function(callFrames, isA sync) | |
| 820 { | |
| 821 var result = []; | |
| 822 for (var i = 0; i < callFrames.length; ++i) { | |
| 823 var callFrame = callFrames[i]; | |
| 824 var script = WebInspector.debuggerModel.scriptForId(callFrame.location.s criptId); | |
| 825 if (script) | |
|
yurys
2013/12/06 12:36:54
Why do we hide such frames?
aandrey
2013/12/06 16:09:24
Not sure. This is how it was before, I didn't chan
| |
| 826 result.push(new WebInspector.DebuggerModel.CallFrame(script, callFra me, isAsync)); | |
| 827 } | |
| 828 return result; | |
| 799 } | 829 } |
| 800 | 830 |
| 801 WebInspector.DebuggerModel.CallFrame.prototype = { | 831 WebInspector.DebuggerModel.CallFrame.prototype = { |
| 802 /** | 832 /** |
| 803 * @return {!WebInspector.Script} | 833 * @return {!WebInspector.Script} |
| 804 */ | 834 */ |
| 805 get script() | 835 get script() |
| 806 { | 836 { |
| 807 return this._script; | 837 return this._script; |
| 808 }, | 838 }, |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 858 /** | 888 /** |
| 859 * @return {!WebInspector.DebuggerModel.Location} | 889 * @return {!WebInspector.DebuggerModel.Location} |
| 860 */ | 890 */ |
| 861 get location() | 891 get location() |
| 862 { | 892 { |
| 863 var rawLocation = /** @type {!WebInspector.DebuggerModel.Location} */ (t his._payload.location); | 893 var rawLocation = /** @type {!WebInspector.DebuggerModel.Location} */ (t his._payload.location); |
| 864 return rawLocation; | 894 return rawLocation; |
| 865 }, | 895 }, |
| 866 | 896 |
| 867 /** | 897 /** |
| 898 * @return {boolean} | |
| 899 */ | |
| 900 isAsync: function() | |
| 901 { | |
| 902 return !!this._isAsync; | |
| 903 }, | |
| 904 | |
| 905 /** | |
| 868 * @param {string} code | 906 * @param {string} code |
| 869 * @param {string} objectGroup | 907 * @param {string} objectGroup |
| 870 * @param {boolean} includeCommandLineAPI | 908 * @param {boolean} includeCommandLineAPI |
| 871 * @param {boolean} doNotPauseOnExceptionsAndMuteConsole | 909 * @param {boolean} doNotPauseOnExceptionsAndMuteConsole |
| 872 * @param {boolean} returnByValue | 910 * @param {boolean} returnByValue |
| 873 * @param {boolean} generatePreview | 911 * @param {boolean} generatePreview |
| 874 * @param {function(?RuntimeAgent.RemoteObject, boolean=)=} callback | 912 * @param {function(?RuntimeAgent.RemoteObject, boolean=)=} callback |
| 875 */ | 913 */ |
| 876 evaluate: function(code, objectGroup, includeCommandLineAPI, doNotPauseOnExc eptionsAndMuteConsole, returnByValue, generatePreview, callback) | 914 evaluate: function(code, objectGroup, includeCommandLineAPI, doNotPauseOnExc eptionsAndMuteConsole, returnByValue, generatePreview, callback) |
| 877 { | 915 { |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 896 /** | 934 /** |
| 897 * @param {function(?Protocol.Error=)=} callback | 935 * @param {function(?Protocol.Error=)=} callback |
| 898 */ | 936 */ |
| 899 restart: function(callback) | 937 restart: function(callback) |
| 900 { | 938 { |
| 901 /** | 939 /** |
| 902 * @this {WebInspector.DebuggerModel.CallFrame} | 940 * @this {WebInspector.DebuggerModel.CallFrame} |
| 903 * @param {?Protocol.Error} error | 941 * @param {?Protocol.Error} error |
| 904 * @param {!Array.<!DebuggerAgent.CallFrame>=} callFrames | 942 * @param {!Array.<!DebuggerAgent.CallFrame>=} callFrames |
| 905 * @param {Object=} details | 943 * @param {Object=} details |
| 906 * @param {DebuggerAgent.StackTrace=} asyncStackTrace | 944 * @param {!DebuggerAgent.StackTrace=} asyncStackTrace |
| 907 */ | 945 */ |
| 908 function protocolCallback(error, callFrames, details, asyncStackTrace) | 946 function protocolCallback(error, callFrames, details, asyncStackTrace) |
| 909 { | 947 { |
| 910 if (!error) | 948 if (!error) |
| 911 WebInspector.debuggerModel.callStackModified(callFrames, details , asyncStackTrace); | 949 WebInspector.debuggerModel.callStackModified(callFrames, details , asyncStackTrace); |
| 912 if (callback) | 950 if (callback) |
| 913 callback(error); | 951 callback(error); |
| 914 } | 952 } |
| 915 DebuggerAgent.restartFrame(this._payload.callFrameId, protocolCallback); | 953 DebuggerAgent.restartFrame(this._payload.callFrameId, protocolCallback); |
| 916 }, | 954 }, |
| 917 | 955 |
| 918 /** | 956 /** |
| 919 * @param {function(!Array.<!DebuggerAgent.Location>)} callback | 957 * @param {function(!Array.<!DebuggerAgent.Location>)} callback |
| 920 */ | 958 */ |
| 921 getStepIntoLocations: function(callback) | 959 getStepIntoLocations: function(callback) |
| 922 { | 960 { |
| 923 if (this._stepInLocations) { | 961 if (this._stepInLocations) { |
| 924 callback(this._stepInLocations.slice(0)); | 962 callback(this._stepInLocations.slice(0)); |
| 925 return; | 963 return; |
| 926 } | 964 } |
| 927 /** | 965 /** |
| 928 * @param {?string} error | 966 * @param {?string} error |
| 929 * @param {!Array.<!DebuggerAgent.Location>=} stepInPositions | 967 * @param {!Array.<!DebuggerAgent.Location>=} stepInPositions |
| 930 */ | 968 */ |
| 931 function getStepInPositionsCallback(error, stepInPositions) { | 969 function getStepInPositionsCallback(error, stepInPositions) |
| 932 if (error) { | 970 { |
| 971 if (error) | |
| 933 return; | 972 return; |
| 934 } | |
| 935 this._stepInLocations = stepInPositions; | 973 this._stepInLocations = stepInPositions; |
| 936 callback(this._stepInLocations.slice(0)); | 974 callback(this._stepInLocations.slice(0)); |
| 937 } | 975 } |
| 938 DebuggerAgent.getStepInPositions(this.id, getStepInPositionsCallback.bin d(this)); | 976 DebuggerAgent.getStepInPositions(this.id, getStepInPositionsCallback.bin d(this)); |
| 939 }, | 977 }, |
| 940 | 978 |
| 941 /** | 979 /** |
| 942 * @param {function(!WebInspector.UILocation):(boolean|undefined)} updateDel egate | 980 * @param {function(!WebInspector.UILocation):(boolean|undefined)} updateDel egate |
| 943 */ | 981 */ |
| 944 createLiveLocation: function(updateDelegate) | 982 createLiveLocation: function(updateDelegate) |
| 945 { | 983 { |
| 946 var location = this._script.createLiveLocation(this.location, updateDele gate); | 984 var location = this._script.createLiveLocation(this.location, updateDele gate); |
| 947 this._locations.push(location); | 985 this._locations.push(location); |
| 948 return location; | 986 return location; |
| 949 }, | 987 }, |
| 950 | 988 |
| 951 dispose: function(updateDelegate) | 989 dispose: function() |
| 952 { | 990 { |
| 953 for (var i = 0; i < this._locations.length; ++i) | 991 for (var i = 0; i < this._locations.length; ++i) |
| 954 this._locations[i].dispose(); | 992 this._locations[i].dispose(); |
| 955 this._locations = []; | 993 this._locations = []; |
| 956 } | 994 } |
| 957 } | 995 } |
| 958 | 996 |
| 959 /** | 997 /** |
| 960 * @constructor | 998 * @constructor |
| 961 * @param {WebInspector.DebuggerModel} model | 999 * @param {!Array.<!WebInspector.DebuggerModel.CallFrame>} callFrames |
| 1000 * @param {?WebInspector.DebuggerModel.StackTrace} asyncStackTrace | |
| 1001 */ | |
| 1002 WebInspector.DebuggerModel.StackTrace = function(callFrames, asyncStackTrace) | |
| 1003 { | |
| 1004 this._callFrames = callFrames; | |
| 1005 this._asyncStackTrace = asyncStackTrace; | |
| 1006 } | |
| 1007 | |
| 1008 /** | |
| 1009 * @param {!DebuggerAgent.StackTrace=} payload | |
| 1010 * @param {boolean=} isAsync | |
| 1011 * @return {?WebInspector.DebuggerModel.StackTrace} | |
| 1012 */ | |
| 1013 WebInspector.DebuggerModel.StackTrace.fromPayload = function(payload, isAsync) | |
| 1014 { | |
| 1015 if (!payload) | |
| 1016 return null; | |
| 1017 var callFrames = WebInspector.DebuggerModel.CallFrame.fromPayloadArray(paylo ad.callFrames, isAsync); | |
| 1018 if (!callFrames.length) | |
| 1019 return null; | |
| 1020 var asyncStackTrace = WebInspector.DebuggerModel.StackTrace.fromPayload(payl oad.asyncStackTrace, true); | |
| 1021 return new WebInspector.DebuggerModel.StackTrace(callFrames, asyncStackTrace ); | |
| 1022 } | |
| 1023 | |
| 1024 WebInspector.DebuggerModel.StackTrace.prototype = { | |
| 1025 /** | |
| 1026 * @return {!Array.<!WebInspector.DebuggerModel.CallFrame>} | |
| 1027 */ | |
| 1028 get callFrames() | |
|
yurys
2013/12/06 12:36:54
style: please use functions.
aandrey
2013/12/06 16:09:24
renamed _callFrames -> callFrames
| |
| 1029 { | |
| 1030 return this._callFrames; | |
| 1031 }, | |
| 1032 | |
| 1033 /** | |
| 1034 * @return {?WebInspector.DebuggerModel.StackTrace} | |
| 1035 */ | |
| 1036 get asyncStackTrace() | |
| 1037 { | |
| 1038 return this._asyncStackTrace; | |
| 1039 }, | |
| 1040 | |
| 1041 dispose: function() | |
| 1042 { | |
| 1043 for (var i = 0; i < this._callFrames.length; ++i) | |
| 1044 this._callFrames[i].dispose(); | |
| 1045 if (this._asyncStackTrace) | |
| 1046 this._asyncStackTrace.dispose(); | |
| 1047 } | |
| 1048 } | |
| 1049 | |
| 1050 /** | |
| 1051 * @constructor | |
| 962 * @param {!Array.<!DebuggerAgent.CallFrame>} callFrames | 1052 * @param {!Array.<!DebuggerAgent.CallFrame>} callFrames |
| 963 * @param {string} reason | 1053 * @param {string} reason |
| 964 * @param {Object|undefined} auxData | 1054 * @param {Object|undefined} auxData |
| 965 * @param {!Array.<string>} breakpointIds | 1055 * @param {!Array.<string>} breakpointIds |
| 966 * @param {DebuggerAgent.StackTrace=} asyncStackTrace | 1056 * @param {!DebuggerAgent.StackTrace=} asyncStackTrace |
| 967 */ | 1057 */ |
| 968 WebInspector.DebuggerPausedDetails = function(model, callFrames, reason, auxData , breakpointIds, asyncStackTrace) | 1058 WebInspector.DebuggerPausedDetails = function(callFrames, reason, auxData, break pointIds, asyncStackTrace) |
| 969 { | 1059 { |
| 970 this.callFrames = []; | 1060 this.callFrames = WebInspector.DebuggerModel.CallFrame.fromPayloadArray(call Frames); |
| 971 for (var i = 0; i < callFrames.length; ++i) { | |
| 972 var callFrame = callFrames[i]; | |
| 973 var script = model.scriptForId(callFrame.location.scriptId); | |
| 974 if (script) | |
| 975 this.callFrames.push(new WebInspector.DebuggerModel.CallFrame(script , callFrame)); | |
| 976 } | |
| 977 this.reason = reason; | 1061 this.reason = reason; |
| 978 this.auxData = auxData; | 1062 this.auxData = auxData; |
| 979 this.breakpointIds = breakpointIds; | 1063 this.breakpointIds = breakpointIds; |
| 980 this.asyncStackTrace = asyncStackTrace; | 1064 this.asyncStackTrace = WebInspector.DebuggerModel.StackTrace.fromPayload(asy ncStackTrace, true); |
| 981 } | 1065 } |
| 982 | 1066 |
| 983 WebInspector.DebuggerPausedDetails.prototype = { | 1067 WebInspector.DebuggerPausedDetails.prototype = { |
| 984 dispose: function() | 1068 dispose: function() |
| 985 { | 1069 { |
| 986 for (var i = 0; i < this.callFrames.length; ++i) { | 1070 for (var i = 0; i < this.callFrames.length; ++i) |
| 987 var callFrame = this.callFrames[i]; | 1071 this.callFrames[i].dispose(); |
| 988 callFrame.dispose(); | 1072 if (this.asyncStackTrace) |
| 989 } | 1073 this.asyncStackTrace.dispose(); |
| 990 } | 1074 } |
| 991 } | 1075 } |
| 992 | 1076 |
| 993 /** | 1077 /** |
| 994 * @type {?WebInspector.DebuggerModel} | 1078 * @type {?WebInspector.DebuggerModel} |
| 995 */ | 1079 */ |
| 996 WebInspector.debuggerModel = null; | 1080 WebInspector.debuggerModel = null; |
| OLD | NEW |