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

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: 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 606 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 return this._selectedCallFrame; 617 return this._selectedCallFrame;
618 }, 618 },
619 619
620 /** 620 /**
621 * @param {string} code 621 * @param {string} code
622 * @param {string} objectGroup 622 * @param {string} objectGroup
623 * @param {boolean} includeCommandLineAPI 623 * @param {boolean} includeCommandLineAPI
624 * @param {boolean} doNotPauseOnExceptionsAndMuteConsole 624 * @param {boolean} doNotPauseOnExceptionsAndMuteConsole
625 * @param {boolean} returnByValue 625 * @param {boolean} returnByValue
626 * @param {boolean} generatePreview 626 * @param {boolean} generatePreview
627 * @param {function(?WebInspector.RemoteObject, boolean, ?RuntimeAgent.Remot eObject=, ?RuntimeAgent.ExceptionDetails=)} callback 627 * @param {function(?WebInspector.RemoteObject, !RuntimeAgent.ExceptionDetai ls=)} callback
628 */ 628 */
629 evaluateOnSelectedCallFrame: function(code, objectGroup, includeCommandLineA PI, doNotPauseOnExceptionsAndMuteConsole, returnByValue, generatePreview, callba ck) 629 evaluateOnSelectedCallFrame: function(code, objectGroup, includeCommandLineA PI, doNotPauseOnExceptionsAndMuteConsole, returnByValue, generatePreview, callba ck)
630 { 630 {
631 /** 631 /**
632 * @param {?RuntimeAgent.RemoteObject} result 632 * @param {?RuntimeAgent.RemoteObject} result
633 * @param {boolean=} wasThrown 633 * @param {!RuntimeAgent.ExceptionDetails=} exceptionDetails
634 * @param {?RuntimeAgent.ExceptionDetails=} exceptionDetails
635 * @this {WebInspector.DebuggerModel} 634 * @this {WebInspector.DebuggerModel}
636 */ 635 */
637 function didEvaluate(result, wasThrown, exceptionDetails) 636 function didEvaluate(result, exceptionDetails)
638 { 637 {
639 if (!result) 638 if (!result)
640 callback(null, false); 639 callback(null);
641 else if (returnByValue)
642 callback(null, !!wasThrown, wasThrown ? null : result, exception Details);
643 else 640 else
644 callback(this.target().runtimeModel.createRemoteObject(result), !!wasThrown, undefined, exceptionDetails); 641 callback(this.target().runtimeModel.createRemoteObject(result), exceptionDetails);
645 642
646 if (objectGroup === "console") 643 if (objectGroup === "console")
647 this.dispatchEventToListeners(WebInspector.DebuggerModel.Events. ConsoleCommandEvaluatedInSelectedCallFrame); 644 this.dispatchEventToListeners(WebInspector.DebuggerModel.Events. ConsoleCommandEvaluatedInSelectedCallFrame);
648 } 645 }
649 646
650 this.selectedCallFrame().evaluate(code, objectGroup, includeCommandLineA PI, doNotPauseOnExceptionsAndMuteConsole, returnByValue, generatePreview, didEva luate.bind(this)); 647 this.selectedCallFrame().evaluate(code, objectGroup, includeCommandLineA PI, doNotPauseOnExceptionsAndMuteConsole, returnByValue, generatePreview, didEva luate.bind(this));
651 }, 648 },
652 649
653 /** 650 /**
654 * @param {!WebInspector.RemoteObject} remoteObject 651 * @param {!WebInspector.RemoteObject} remoteObject
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after
1077 return this._functionLocation || null; 1074 return this._functionLocation || null;
1078 }, 1075 },
1079 1076
1080 /** 1077 /**
1081 * @param {string} code 1078 * @param {string} code
1082 * @param {string} objectGroup 1079 * @param {string} objectGroup
1083 * @param {boolean} includeCommandLineAPI 1080 * @param {boolean} includeCommandLineAPI
1084 * @param {boolean} doNotPauseOnExceptionsAndMuteConsole 1081 * @param {boolean} doNotPauseOnExceptionsAndMuteConsole
1085 * @param {boolean} returnByValue 1082 * @param {boolean} returnByValue
1086 * @param {boolean} generatePreview 1083 * @param {boolean} generatePreview
1087 * @param {function(?RuntimeAgent.RemoteObject, boolean=, ?RuntimeAgent.Exce ptionDetails=)} callback 1084 * @param {function(?RuntimeAgent.RemoteObject, !RuntimeAgent.ExceptionDetai ls=)} callback
1088 */ 1085 */
1089 evaluate: function(code, objectGroup, includeCommandLineAPI, doNotPauseOnExc eptionsAndMuteConsole, returnByValue, generatePreview, callback) 1086 evaluate: function(code, objectGroup, includeCommandLineAPI, doNotPauseOnExc eptionsAndMuteConsole, returnByValue, generatePreview, callback)
1090 { 1087 {
1091 /** 1088 /**
1092 * @param {?Protocol.Error} error 1089 * @param {?Protocol.Error} error
1093 * @param {!RuntimeAgent.RemoteObject} result 1090 * @param {!RuntimeAgent.RemoteObject} result
1094 * @param {!RuntimeAgent.ExceptionDetails=} exceptionDetails 1091 * @param {!RuntimeAgent.ExceptionDetails=} exceptionDetails
1095 */ 1092 */
1096 function didEvaluateOnCallFrame(error, result, exceptionDetails) 1093 function didEvaluateOnCallFrame(error, result, exceptionDetails)
1097 { 1094 {
1098 if (error) { 1095 if (error) {
1099 console.error(error); 1096 console.error(error);
1100 callback(null, false); 1097 callback(null);
1101 return; 1098 return;
1102 } 1099 }
1103 callback(result, !!exceptionDetails, exceptionDetails); 1100 callback(result, exceptionDetails);
1104 } 1101 }
1105 this._debuggerAgent.evaluateOnCallFrame(this._payload.callFrameId, code, objectGroup, includeCommandLineAPI, doNotPauseOnExceptionsAndMuteConsole, retur nByValue, generatePreview, didEvaluateOnCallFrame); 1102 this._debuggerAgent.evaluateOnCallFrame(this._payload.callFrameId, code, objectGroup, includeCommandLineAPI, doNotPauseOnExceptionsAndMuteConsole, retur nByValue, generatePreview, didEvaluateOnCallFrame);
1106 }, 1103 },
1107 1104
1108 /** 1105 /**
1109 * @param {function(?Protocol.Error=)=} callback 1106 * @param {function(?Protocol.Error=)=} callback
1110 */ 1107 */
1111 restart: function(callback) 1108 restart: function(callback)
1112 { 1109 {
1113 /** 1110 /**
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
1290 /** 1287 /**
1291 * @param {?WebInspector.Target} target 1288 * @param {?WebInspector.Target} target
1292 * @return {?WebInspector.DebuggerModel} 1289 * @return {?WebInspector.DebuggerModel}
1293 */ 1290 */
1294 WebInspector.DebuggerModel.fromTarget = function(target) 1291 WebInspector.DebuggerModel.fromTarget = function(target)
1295 { 1292 {
1296 if (!target || !target.hasJSCapability()) 1293 if (!target || !target.hasJSCapability())
1297 return null; 1294 return null;
1298 return /** @type {?WebInspector.DebuggerModel} */ (target.model(WebInspector .DebuggerModel)); 1295 return /** @type {?WebInspector.DebuggerModel} */ (target.model(WebInspector .DebuggerModel));
1299 } 1296 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698