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 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, sourceURL: ?strin g, functionName: string}} */ |
| 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 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 655 this.dispatchEventToListeners(WebInspector.DebuggerModel.Events. ConsoleCommandEvaluatedInSelectedCallFrame); | 655 this.dispatchEventToListeners(WebInspector.DebuggerModel.Events. ConsoleCommandEvaluatedInSelectedCallFrame); |
| 656 } | 656 } |
| 657 | 657 |
| 658 this.selectedCallFrame().evaluate(code, objectGroup, includeCommandLineA PI, doNotPauseOnExceptionsAndMuteConsole, returnByValue, generatePreview, didEva luate.bind(this)); | 658 this.selectedCallFrame().evaluate(code, objectGroup, includeCommandLineA PI, doNotPauseOnExceptionsAndMuteConsole, returnByValue, generatePreview, didEva luate.bind(this)); |
| 659 }, | 659 }, |
| 660 | 660 |
| 661 /** | 661 /** |
| 662 * @param {!WebInspector.RemoteObject} remoteObject | 662 * @param {!WebInspector.RemoteObject} remoteObject |
| 663 * @param {function(?WebInspector.DebuggerModel.FunctionDetails)} callback | 663 * @param {function(?WebInspector.DebuggerModel.FunctionDetails)} callback |
| 664 */ | 664 */ |
| 665 functionDetails: function(remoteObject, callback) | 665 functionDetails: function(remoteObject, callback) |
|
dgozman
2016/07/07 19:59:23
Should we migrate to promise while we are here?
kozy
2016/07/07 22:59:07
Done.
| |
| 666 { | 666 { |
| 667 this._agent.getFunctionDetails(remoteObject.objectId, didGetDetails.bind (this)); | 667 remoteObject.getOwnPropertiesPromise().then(buildDetails.bind(this)); |
| 668 | 668 |
| 669 /** | 669 /** |
| 670 * @param {?Protocol.Error} error | 670 * @param {!{properties: ?Array.<!WebInspector.RemoteObjectProperty>, in ternalProperties: ?Array.<!WebInspector.RemoteObjectProperty>}} response |
| 671 * @param {!DebuggerAgent.FunctionDetails} response | 671 * @this {!WebInspector.DebuggerModel} |
| 672 * @this {WebInspector.DebuggerModel} | |
| 673 */ | 672 */ |
| 674 function didGetDetails(error, response) | 673 function buildDetails(response) |
| 675 { | 674 { |
| 676 if (error) { | 675 if (!response || !response.internalProperties) { |
| 677 callback(null); | 676 callback(null); |
| 678 return; | 677 return; |
| 679 } | 678 } |
| 680 var location = response.location; | 679 var location = null; |
| 681 var script = this.scriptForId(location.scriptId); | 680 var functionName = null; |
| 682 var rawLocation = script ? this.createRawLocation(script, location.l ineNumber, location.columnNumber || 0) : null; | 681 for (var prop of response.internalProperties) { |
| 683 var sourceURL = script ? script.contentURL() : null; | 682 if (prop.name === "[[FunctionLocation]]") |
| 684 callback({location: rawLocation, sourceURL: sourceURL, functionName: response.functionName, scopeChain: response.scopeChain || null}); | 683 location = prop.value; |
| 684 if (prop.name === "[[FunctionName]]") | |
| 685 functionName = prop.value; | |
| 686 } | |
| 687 | |
| 688 var debuggerLocation = null; | |
| 689 if (location) | |
| 690 debuggerLocation = this.createRawLocationByScriptId(location.val ue.scriptId, location.value.lineNumber, location.value.columnNumber); | |
| 691 callback({ location: debuggerLocation, sourceURL: null, functionName : functionName ? functionName.value : "" }); | |
| 692 return; | |
|
dgozman
2016/07/07 19:59:23
useless return
kozy
2016/07/07 22:59:07
Done.
| |
| 685 } | 693 } |
| 686 }, | 694 }, |
| 687 | 695 |
| 688 /** | 696 /** |
| 689 * @param {number} scopeNumber | 697 * @param {number} scopeNumber |
| 690 * @param {string} variableName | 698 * @param {string} variableName |
| 691 * @param {!RuntimeAgent.CallArgument} newValue | 699 * @param {!RuntimeAgent.CallArgument} newValue |
| 692 * @param {string} callFrameId | 700 * @param {string} callFrameId |
| 693 * @param {function(string=)=} callback | 701 * @param {function(string=)=} callback |
| 694 */ | 702 */ |
| (...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1284 /** | 1292 /** |
| 1285 * @param {?WebInspector.Target} target | 1293 * @param {?WebInspector.Target} target |
| 1286 * @return {?WebInspector.DebuggerModel} | 1294 * @return {?WebInspector.DebuggerModel} |
| 1287 */ | 1295 */ |
| 1288 WebInspector.DebuggerModel.fromTarget = function(target) | 1296 WebInspector.DebuggerModel.fromTarget = function(target) |
| 1289 { | 1297 { |
| 1290 if (!target || !target.hasJSContext()) | 1298 if (!target || !target.hasJSContext()) |
| 1291 return null; | 1299 return null; |
| 1292 return /** @type {?WebInspector.DebuggerModel} */ (target.model(WebInspector .DebuggerModel)); | 1300 return /** @type {?WebInspector.DebuggerModel} */ (target.model(WebInspector .DebuggerModel)); |
| 1293 } | 1301 } |
| OLD | NEW |