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

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

Issue 2236033002: [DevTools] Simplify evaluation callbacks on frontend (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@remove-was-thrown
Patch Set: addressed comments Created 4 years, 4 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 597 matching lines...) Expand 10 before | Expand all | Expand 10 after
608 return this._selectedCallFrame; 608 return this._selectedCallFrame;
609 }, 609 },
610 610
611 /** 611 /**
612 * @param {string} code 612 * @param {string} code
613 * @param {string} objectGroup 613 * @param {string} objectGroup
614 * @param {boolean} includeCommandLineAPI 614 * @param {boolean} includeCommandLineAPI
615 * @param {boolean} doNotPauseOnExceptionsAndMuteConsole 615 * @param {boolean} doNotPauseOnExceptionsAndMuteConsole
616 * @param {boolean} returnByValue 616 * @param {boolean} returnByValue
617 * @param {boolean} generatePreview 617 * @param {boolean} generatePreview
618 * @param {function(?WebInspector.RemoteObject, boolean, ?RuntimeAgent.Remot eObject=, ?RuntimeAgent.ExceptionDetails=)} callback 618 * @param {function(?WebInspector.RemoteObject, !RuntimeAgent.ExceptionDetai ls=)} callback
619 */ 619 */
620 evaluateOnSelectedCallFrame: function(code, objectGroup, includeCommandLineA PI, doNotPauseOnExceptionsAndMuteConsole, returnByValue, generatePreview, callba ck) 620 evaluateOnSelectedCallFrame: function(code, objectGroup, includeCommandLineA PI, doNotPauseOnExceptionsAndMuteConsole, returnByValue, generatePreview, callba ck)
621 { 621 {
622 /** 622 /**
623 * @param {?RuntimeAgent.RemoteObject} result 623 * @param {?RuntimeAgent.RemoteObject} result
624 * @param {boolean=} wasThrown 624 * @param {!RuntimeAgent.ExceptionDetails=} exceptionDetails
625 * @param {?RuntimeAgent.ExceptionDetails=} exceptionDetails
626 * @this {WebInspector.DebuggerModel} 625 * @this {WebInspector.DebuggerModel}
627 */ 626 */
628 function didEvaluate(result, wasThrown, exceptionDetails) 627 function didEvaluate(result, exceptionDetails)
629 { 628 {
630 if (!result) 629 if (!result)
631 callback(null, false); 630 callback(null);
632 else if (returnByValue)
633 callback(null, !!wasThrown, wasThrown ? null : result, exception Details);
634 else 631 else
635 callback(this.target().runtimeModel.createRemoteObject(result), !!wasThrown, undefined, exceptionDetails); 632 callback(this.target().runtimeModel.createRemoteObject(result), exceptionDetails);
636 } 633 }
637 634
638 this.selectedCallFrame().evaluate(code, objectGroup, includeCommandLineA PI, doNotPauseOnExceptionsAndMuteConsole, returnByValue, generatePreview, didEva luate.bind(this)); 635 this.selectedCallFrame().evaluate(code, objectGroup, includeCommandLineA PI, doNotPauseOnExceptionsAndMuteConsole, returnByValue, generatePreview, didEva luate.bind(this));
639 }, 636 },
640 637
641 /** 638 /**
642 * @param {!WebInspector.RemoteObject} remoteObject 639 * @param {!WebInspector.RemoteObject} remoteObject
643 * @return {!Promise<?WebInspector.DebuggerModel.FunctionDetails>} 640 * @return {!Promise<?WebInspector.DebuggerModel.FunctionDetails>}
644 */ 641 */
645 functionDetailsPromise: function(remoteObject) 642 functionDetailsPromise: function(remoteObject)
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after
1063 return this._functionLocation || null; 1060 return this._functionLocation || null;
1064 }, 1061 },
1065 1062
1066 /** 1063 /**
1067 * @param {string} code 1064 * @param {string} code
1068 * @param {string} objectGroup 1065 * @param {string} objectGroup
1069 * @param {boolean} includeCommandLineAPI 1066 * @param {boolean} includeCommandLineAPI
1070 * @param {boolean} doNotPauseOnExceptionsAndMuteConsole 1067 * @param {boolean} doNotPauseOnExceptionsAndMuteConsole
1071 * @param {boolean} returnByValue 1068 * @param {boolean} returnByValue
1072 * @param {boolean} generatePreview 1069 * @param {boolean} generatePreview
1073 * @param {function(?RuntimeAgent.RemoteObject, boolean=, ?RuntimeAgent.Exce ptionDetails=)} callback 1070 * @param {function(?RuntimeAgent.RemoteObject, !RuntimeAgent.ExceptionDetai ls=)} callback
1074 */ 1071 */
1075 evaluate: function(code, objectGroup, includeCommandLineAPI, doNotPauseOnExc eptionsAndMuteConsole, returnByValue, generatePreview, callback) 1072 evaluate: function(code, objectGroup, includeCommandLineAPI, doNotPauseOnExc eptionsAndMuteConsole, returnByValue, generatePreview, callback)
1076 { 1073 {
1077 /** 1074 /**
1078 * @param {?Protocol.Error} error 1075 * @param {?Protocol.Error} error
1079 * @param {!RuntimeAgent.RemoteObject} result 1076 * @param {!RuntimeAgent.RemoteObject} result
1080 * @param {!RuntimeAgent.ExceptionDetails=} exceptionDetails 1077 * @param {!RuntimeAgent.ExceptionDetails=} exceptionDetails
1081 */ 1078 */
1082 function didEvaluateOnCallFrame(error, result, exceptionDetails) 1079 function didEvaluateOnCallFrame(error, result, exceptionDetails)
1083 { 1080 {
1084 if (error) { 1081 if (error) {
1085 console.error(error); 1082 console.error(error);
1086 callback(null, false); 1083 callback(null);
1087 return; 1084 return;
1088 } 1085 }
1089 callback(result, !!exceptionDetails, exceptionDetails); 1086 callback(result, exceptionDetails);
1090 } 1087 }
1091 this._debuggerAgent.evaluateOnCallFrame(this._payload.callFrameId, code, objectGroup, includeCommandLineAPI, doNotPauseOnExceptionsAndMuteConsole, retur nByValue, generatePreview, didEvaluateOnCallFrame); 1088 this._debuggerAgent.evaluateOnCallFrame(this._payload.callFrameId, code, objectGroup, includeCommandLineAPI, doNotPauseOnExceptionsAndMuteConsole, retur nByValue, generatePreview, didEvaluateOnCallFrame);
1092 }, 1089 },
1093 1090
1094 /** 1091 /**
1095 * @param {function(?Protocol.Error=)=} callback 1092 * @param {function(?Protocol.Error=)=} callback
1096 */ 1093 */
1097 restart: function(callback) 1094 restart: function(callback)
1098 { 1095 {
1099 /** 1096 /**
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
1276 /** 1273 /**
1277 * @param {?WebInspector.Target} target 1274 * @param {?WebInspector.Target} target
1278 * @return {?WebInspector.DebuggerModel} 1275 * @return {?WebInspector.DebuggerModel}
1279 */ 1276 */
1280 WebInspector.DebuggerModel.fromTarget = function(target) 1277 WebInspector.DebuggerModel.fromTarget = function(target)
1281 { 1278 {
1282 if (!target || !target.hasJSCapability()) 1279 if (!target || !target.hasJSCapability())
1283 return null; 1280 return null;
1284 return /** @type {?WebInspector.DebuggerModel} */ (target.model(WebInspector .DebuggerModel)); 1281 return /** @type {?WebInspector.DebuggerModel} */ (target.model(WebInspector .DebuggerModel));
1285 } 1282 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698