| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 this._breakpointResolvedEventTarget = new WebInspector.Object(); | 51 this._breakpointResolvedEventTarget = new WebInspector.Object(); |
| 52 | 52 |
| 53 this._isPausing = false; | 53 this._isPausing = false; |
| 54 WebInspector.moduleSetting("pauseOnExceptionEnabled").addChangeListener(this
._pauseOnExceptionStateChanged, this); | 54 WebInspector.moduleSetting("pauseOnExceptionEnabled").addChangeListener(this
._pauseOnExceptionStateChanged, this); |
| 55 WebInspector.moduleSetting("pauseOnCaughtException").addChangeListener(this.
_pauseOnExceptionStateChanged, this); | 55 WebInspector.moduleSetting("pauseOnCaughtException").addChangeListener(this.
_pauseOnExceptionStateChanged, this); |
| 56 WebInspector.moduleSetting("enableAsyncStackTraces").addChangeListener(this.
asyncStackTracesStateChanged, this); | 56 WebInspector.moduleSetting("enableAsyncStackTraces").addChangeListener(this.
asyncStackTracesStateChanged, this); |
| 57 | 57 |
| 58 this.enableDebugger(); | 58 this.enableDebugger(); |
| 59 } | 59 } |
| 60 | 60 |
| 61 /** @typedef {{location: ?WebInspector.DebuggerModel.Location, sourceURL: ?strin
g, functionName: string, scopeChain: (Array.<!DebuggerAgent.Scope>|null)}} */ | 61 /** @typedef {{location: ?WebInspector.DebuggerModel.Location, functionName: str
ing}} */ |
| 62 WebInspector.DebuggerModel.FunctionDetails; | 62 WebInspector.DebuggerModel.FunctionDetails; |
| 63 | 63 |
| 64 /** | 64 /** |
| 65 * Keep these in sync with WebCore::V8Debugger | 65 * Keep these in sync with WebCore::V8Debugger |
| 66 * | 66 * |
| 67 * @enum {string} | 67 * @enum {string} |
| 68 */ | 68 */ |
| 69 WebInspector.DebuggerModel.PauseOnExceptionsState = { | 69 WebInspector.DebuggerModel.PauseOnExceptionsState = { |
| 70 DontPauseOnExceptions : "none", | 70 DontPauseOnExceptions : "none", |
| 71 PauseOnAllExceptions : "all", | 71 PauseOnAllExceptions : "all", |
| (...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 652 | 652 |
| 653 if (objectGroup === "console") | 653 if (objectGroup === "console") |
| 654 this.dispatchEventToListeners(WebInspector.DebuggerModel.Events.
ConsoleCommandEvaluatedInSelectedCallFrame); | 654 this.dispatchEventToListeners(WebInspector.DebuggerModel.Events.
ConsoleCommandEvaluatedInSelectedCallFrame); |
| 655 } | 655 } |
| 656 | 656 |
| 657 this.selectedCallFrame().evaluate(code, objectGroup, includeCommandLineA
PI, doNotPauseOnExceptionsAndMuteConsole, returnByValue, generatePreview, didEva
luate.bind(this)); | 657 this.selectedCallFrame().evaluate(code, objectGroup, includeCommandLineA
PI, doNotPauseOnExceptionsAndMuteConsole, returnByValue, generatePreview, didEva
luate.bind(this)); |
| 658 }, | 658 }, |
| 659 | 659 |
| 660 /** | 660 /** |
| 661 * @param {!WebInspector.RemoteObject} remoteObject | 661 * @param {!WebInspector.RemoteObject} remoteObject |
| 662 * @param {function(?WebInspector.DebuggerModel.FunctionDetails)} callback | 662 * @return {!Promise<?WebInspector.DebuggerModel.FunctionDetails>} |
| 663 */ | 663 */ |
| 664 functionDetails: function(remoteObject, callback) | 664 functionDetailsPromise: function(remoteObject) |
| 665 { | 665 { |
| 666 this._agent.getFunctionDetails(remoteObject.objectId, didGetDetails.bind
(this)); | 666 return remoteObject.getAllPropertiesPromise(/* accessorPropertiesOnly */
false).then(buildDetails.bind(this)); |
| 667 | 667 |
| 668 /** | 668 /** |
| 669 * @param {?Protocol.Error} error | 669 * @param {!{properties: ?Array.<!WebInspector.RemoteObjectProperty>, in
ternalProperties: ?Array.<!WebInspector.RemoteObjectProperty>}} response |
| 670 * @param {!DebuggerAgent.FunctionDetails} response | 670 * @return {?WebInspector.DebuggerModel.FunctionDetails} |
| 671 * @this {WebInspector.DebuggerModel} | 671 * @this {!WebInspector.DebuggerModel} |
| 672 */ | 672 */ |
| 673 function didGetDetails(error, response) | 673 function buildDetails(response) |
| 674 { | 674 { |
| 675 if (error) { | 675 if (!response || !response.internalProperties) |
| 676 callback(null); | 676 return null; |
| 677 return; | 677 var location = null; |
| 678 for (var prop of response.internalProperties) { |
| 679 if (prop.name === "[[FunctionLocation]]") |
| 680 location = prop.value; |
| 678 } | 681 } |
| 679 var location = response.location; | 682 var functionName = null; |
| 680 var script = this.scriptForId(location.scriptId); | 683 if (response.properties) { |
| 681 var rawLocation = script ? this.createRawLocation(script, location.l
ineNumber, location.columnNumber || 0) : null; | 684 for (var prop of response.properties) { |
| 682 var sourceURL = script ? script.contentURL() : null; | 685 if (prop.name === "name" && prop.value && prop.value.type ==
= "string") |
| 683 callback({location: rawLocation, sourceURL: sourceURL, functionName:
response.functionName, scopeChain: response.scopeChain || null}); | 686 functionName = prop.value; |
| 687 if (prop.name === "displayName" && prop.value && prop.value.
type === "string") { |
| 688 functionName = prop.value; |
| 689 break; |
| 690 } |
| 691 } |
| 692 } |
| 693 var debuggerLocation = null; |
| 694 if (location) |
| 695 debuggerLocation = this.createRawLocationByScriptId(location.val
ue.scriptId, location.value.lineNumber, location.value.columnNumber); |
| 696 return { location: debuggerLocation, functionName: functionName ? fu
nctionName.value : "" }; |
| 684 } | 697 } |
| 685 }, | 698 }, |
| 686 | 699 |
| 687 /** | 700 /** |
| 688 * @param {number} scopeNumber | 701 * @param {number} scopeNumber |
| 689 * @param {string} variableName | 702 * @param {string} variableName |
| 690 * @param {!RuntimeAgent.CallArgument} newValue | 703 * @param {!RuntimeAgent.CallArgument} newValue |
| 691 * @param {string} callFrameId | 704 * @param {string} callFrameId |
| 692 * @param {function(string=)=} callback | 705 * @param {function(string=)=} callback |
| 693 */ | 706 */ |
| (...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1283 /** | 1296 /** |
| 1284 * @param {?WebInspector.Target} target | 1297 * @param {?WebInspector.Target} target |
| 1285 * @return {?WebInspector.DebuggerModel} | 1298 * @return {?WebInspector.DebuggerModel} |
| 1286 */ | 1299 */ |
| 1287 WebInspector.DebuggerModel.fromTarget = function(target) | 1300 WebInspector.DebuggerModel.fromTarget = function(target) |
| 1288 { | 1301 { |
| 1289 if (!target || !target.hasJSContext()) | 1302 if (!target || !target.hasJSContext()) |
| 1290 return null; | 1303 return null; |
| 1291 return /** @type {?WebInspector.DebuggerModel} */ (target.model(WebInspector
.DebuggerModel)); | 1304 return /** @type {?WebInspector.DebuggerModel} */ (target.model(WebInspector
.DebuggerModel)); |
| 1292 } | 1305 } |
| OLD | NEW |