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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/sdk/DebuggerModel.js

Issue 2122423002: [DevTools] Remove functionDetails from protocol.json (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@remove-generator-details-from-protocol
Patch Set: addressed comments Created 4 years, 5 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
OLDNEW
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
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 581 matching lines...) Expand 10 before | Expand all | Expand 10 after
653 653
654 if (objectGroup === "console") 654 if (objectGroup === "console")
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 * @return {!Promise<?WebInspector.DebuggerModel.FunctionDetails>}
664 */ 664 */
665 functionDetails: function(remoteObject, callback) 665 functionDetailsPromise: function(remoteObject)
666 { 666 {
667 this._agent.getFunctionDetails(remoteObject.objectId, didGetDetails.bind (this)); 667 return remoteObject.getAllPropertiesPromise(/* accessorPropertiesOnly */ false).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 * @return {?WebInspector.DebuggerModel.FunctionDetails}
672 * @this {WebInspector.DebuggerModel} 672 * @this {!WebInspector.DebuggerModel}
673 */ 673 */
674 function didGetDetails(error, response) 674 function buildDetails(response)
675 { 675 {
676 if (error) { 676 if (!response || !response.internalProperties)
677 callback(null); 677 return null;
678 return; 678 var location = null;
679 var functionName = null;
680 for (var prop of response.internalProperties) {
681 if (prop.name === "[[FunctionLocation]]")
682 location = prop.value;
679 } 683 }
680 var location = response.location; 684 if (!functionName && response.properties) {
dgozman 2016/07/09 01:47:29 functionName is always null here.
kozy 2016/07/11 17:50:39 Done.
681 var script = this.scriptForId(location.scriptId); 685 for (var prop of response.properties) {
682 var rawLocation = script ? this.createRawLocation(script, location.l ineNumber, location.columnNumber || 0) : null; 686 if (prop.name === "name" && prop.value && prop.value.type == = "string")
683 var sourceURL = script ? script.contentURL() : null; 687 functionName = prop.value;
684 callback({location: rawLocation, sourceURL: sourceURL, functionName: response.functionName, scopeChain: response.scopeChain || null}); 688 if (prop.name === "displayName" && prop.value && prop.value. type === "string") {
689 functionName = prop.value;
690 break;
691 }
692 }
693 }
694 var debuggerLocation = null;
695 if (location)
696 debuggerLocation = this.createRawLocationByScriptId(location.val ue.scriptId, location.value.lineNumber, location.value.columnNumber);
697 return { location: debuggerLocation, sourceURL: null, functionName: functionName ? functionName.value : "" };
dgozman 2016/07/09 01:47:29 Why null sourceURL? Either remove it or get it fro
kozy 2016/07/11 17:50:39 Done.
685 } 698 }
686 }, 699 },
687 700
688 /** 701 /**
689 * @param {number} scopeNumber 702 * @param {number} scopeNumber
690 * @param {string} variableName 703 * @param {string} variableName
691 * @param {!RuntimeAgent.CallArgument} newValue 704 * @param {!RuntimeAgent.CallArgument} newValue
692 * @param {string} callFrameId 705 * @param {string} callFrameId
693 * @param {function(string=)=} callback 706 * @param {function(string=)=} callback
694 */ 707 */
(...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after
1284 /** 1297 /**
1285 * @param {?WebInspector.Target} target 1298 * @param {?WebInspector.Target} target
1286 * @return {?WebInspector.DebuggerModel} 1299 * @return {?WebInspector.DebuggerModel}
1287 */ 1300 */
1288 WebInspector.DebuggerModel.fromTarget = function(target) 1301 WebInspector.DebuggerModel.fromTarget = function(target)
1289 { 1302 {
1290 if (!target || !target.hasJSContext()) 1303 if (!target || !target.hasJSContext())
1291 return null; 1304 return null;
1292 return /** @type {?WebInspector.DebuggerModel} */ (target.model(WebInspector .DebuggerModel)); 1305 return /** @type {?WebInspector.DebuggerModel} */ (target.model(WebInspector .DebuggerModel));
1293 } 1306 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698