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

Unified Diff: third_party/WebKit/Source/devtools/front_end/sdk/RuntimeModel.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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/devtools/front_end/sdk/RuntimeModel.js
diff --git a/third_party/WebKit/Source/devtools/front_end/sdk/RuntimeModel.js b/third_party/WebKit/Source/devtools/front_end/sdk/RuntimeModel.js
index b5d42b7fc9e85b68bb512d5d0ec7d1a32c2baf35..86b44cd03d6fefee530ef125c3e41e63553f0041 100644
--- a/third_party/WebKit/Source/devtools/front_end/sdk/RuntimeModel.js
+++ b/third_party/WebKit/Source/devtools/front_end/sdk/RuntimeModel.js
@@ -551,7 +551,7 @@ WebInspector.ExecutionContext.prototype = {
* @param {boolean} returnByValue
* @param {boolean} generatePreview
* @param {boolean} userGesture
- * @param {function(?WebInspector.RemoteObject, boolean, ?RuntimeAgent.RemoteObject=, ?RuntimeAgent.ExceptionDetails=)} callback
+ * @param {function(?WebInspector.RemoteObject, !RuntimeAgent.ExceptionDetails=)} callback
*/
evaluate: function(expression, objectGroup, includeCommandLineAPI, doNotPauseOnExceptionsAndMuteConsole, returnByValue, generatePreview, userGesture, callback)
{
@@ -565,13 +565,12 @@ WebInspector.ExecutionContext.prototype = {
/**
* @param {string} objectGroup
- * @param {boolean} returnByValue
* @param {boolean} generatePreview
- * @param {function(?WebInspector.RemoteObject, boolean, ?RuntimeAgent.RemoteObject=, ?RuntimeAgent.ExceptionDetails=)} callback
+ * @param {function(?WebInspector.RemoteObject, !RuntimeAgent.ExceptionDetails=)} callback
*/
- globalObject: function(objectGroup, returnByValue, generatePreview, callback)
+ globalObject: function(objectGroup, generatePreview, callback)
{
- this._evaluateGlobal("this", objectGroup, false, true, returnByValue, generatePreview, false, callback);
+ this._evaluateGlobal("this", objectGroup, false, true, false, generatePreview, false, callback);
},
/**
@@ -582,7 +581,7 @@ WebInspector.ExecutionContext.prototype = {
* @param {boolean} returnByValue
* @param {boolean} generatePreview
* @param {boolean} userGesture
- * @param {function(?WebInspector.RemoteObject, boolean, ?RuntimeAgent.RemoteObject=, ?RuntimeAgent.ExceptionDetails=)} callback
+ * @param {function(?WebInspector.RemoteObject, !RuntimeAgent.ExceptionDetails=)} callback
*/
_evaluateGlobal: function(expression, objectGroup, includeCommandLineAPI, doNotPauseOnExceptionsAndMuteConsole, returnByValue, generatePreview, userGesture, callback)
{
@@ -601,15 +600,10 @@ WebInspector.ExecutionContext.prototype = {
{
if (error) {
console.error(error);
- callback(null, false);
+ callback(null);
return;
}
-
- var wasThrown = !!exceptionDetails;
- if (returnByValue)
- callback(null, !!wasThrown, wasThrown ? null : result, exceptionDetails);
- else
- callback(this.runtimeModel.createRemoteObject(result), !!wasThrown, undefined, exceptionDetails);
+ callback(this.runtimeModel.createRemoteObject(result), exceptionDetails);
}
this.target().runtimeAgent().evaluate(expression, objectGroup, includeCommandLineAPI, doNotPauseOnExceptionsAndMuteConsole, this.id, returnByValue, generatePreview, userGesture, false, evalCallback.bind(this));
},
@@ -647,11 +641,13 @@ WebInspector.ExecutionContext.prototype = {
this.evaluate(expressionString, "completion", true, true, false, false, false, evaluated.bind(this));
/**
+ * @param {?WebInspector.RemoteObject} result
+ * @param {!RuntimeAgent.ExceptionDetails=} exceptionDetails
* @this {WebInspector.ExecutionContext}
*/
- function evaluated(result, wasThrown)
+ function evaluated(result, exceptionDetails)
{
- if (!result || wasThrown) {
+ if (!result || !!exceptionDetails) {
completionsReadyCallback([]);
return;
}
@@ -735,15 +731,14 @@ WebInspector.ExecutionContext.prototype = {
}
/**
- * @param {?WebInspector.RemoteObject} notRelevant
- * @param {boolean} wasThrown
- * @param {?RuntimeAgent.RemoteObject=} result
+ * @param {?WebInspector.RemoteObject} result
+ * @param {!RuntimeAgent.ExceptionDetails=} exceptionDetails
* @this {WebInspector.ExecutionContext}
*/
- function receivedPropertyNamesFromEval(notRelevant, wasThrown, result)
+ function receivedPropertyNamesFromEval(result, exceptionDetails)
{
this.target().runtimeAgent().releaseObjectGroup("completion");
- if (result && !wasThrown)
+ if (result && !exceptionDetails)
receivedPropertyNames.call(this, /** @type {!Object} */(result.value));
else
completionsReadyCallback([]);

Powered by Google App Engine
This is Rietveld 408576698