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

Unified Diff: third_party/WebKit/LayoutTests/inspector-protocol/debugger/setScriptSource.html

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: a 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/inspector-protocol/debugger/setScriptSource.html
diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/setScriptSource.html b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/setScriptSource.html
index ff34b440fd75dab748ec686375adb1123b2b5867..3bec1c92b9e2e6f88fbe82f05f70aa777e2d3852 100644
--- a/third_party/WebKit/LayoutTests/inspector-protocol/debugger/setScriptSource.html
+++ b/third_party/WebKit/LayoutTests/inspector-protocol/debugger/setScriptSource.html
@@ -9,7 +9,7 @@ function test()
// A general-purpose engine for sending a sequence of protocol commands.
// The clients provide requests and response handlers, while the engine catches
// errors and makes sure that once there's nothing to do completeTest() is called.
- // @param step is an object with command, params and callback fields
+ // @param step is an object with command, params and callback fields
function runRequestSeries(step) {
processStep(step);
@@ -21,7 +21,7 @@ function test()
InspectorTest.completeTest();
}
}
-
+
function processStepOrFail(currentStep) {
if (!currentStep) {
InspectorTest.completeTest();
@@ -64,7 +64,7 @@ function test()
InspectorTest.sendCommand(currentStep.command, currentStep.params, innerCallback);
}
}
-
+
function logEqualsCheck(actual, expected)
{
if (actual == expected) {
@@ -77,57 +77,63 @@ function test()
{
InspectorTest.log(description + ": " + (success ? "PASS" : "FAIL"));
}
-
+
var firstStep = { callback: enableDebugger };
runRequestSeries(firstStep);
-
+
function enableDebugger() {
return { command: "Debugger.enable", params: {}, callback: evalFunction };
}
-
+
function evalFunction(response) {
var expression = "TestExpression(2, 4)";
return { command: "Runtime.evaluate", params: { expression: expression }, callback: callbackEvalFunction };
}
-
+
function callbackEvalFunction(result) {
InspectorTest.log("Function evaluate: " + JSON.stringify(result.result));
logEqualsCheck(result.result.value, 6);
return { command: "Runtime.evaluate", params: { expression: "TestExpression" }, callback: callbackEvalFunctionObject };
}
-
+
function callbackEvalFunctionObject(result) {
- return { command: "Debugger.getFunctionDetails", params: { functionId: result.result.objectId }, callback: callbackFunctionDetails };
+ return { command: "Runtime.getProperties", params: { objectId: result.result.objectId }, callback: callbackFunctionDetails };
}
-
- function callbackFunctionDetails(result) {
- return createScriptManipulationArc(result.details.location.scriptId, null);
+
+ function callbackFunctionDetails(result)
+ {
+ var scriptId;
+ for (var prop of result.internalProperties) {
+ if (prop.name === "[[FunctionLocation]]")
+ scriptId = prop.value.value.scriptId;
+ }
+ return createScriptManipulationArc(scriptId, null);
}
- // Several steps with scriptId in context.
+ // Several steps with scriptId in context.
function createScriptManipulationArc(scriptId, next) {
return { command: "Debugger.getScriptSource", params: { scriptId: scriptId }, callback: callbackGetScriptSource };
-
+
var originalText;
-
+
function callbackGetScriptSource(result) {
originalText = result.scriptSource;
var patched = originalText.replace("a + b", "a * b");
return { command: "Debugger.setScriptSource", params: { scriptId: scriptId, scriptSource: patched }, callback: callbackSetScriptSource };
}
-
+
function callbackSetScriptSource(result) {
var expression = "TestExpression(2, 4)";
return { command: "Runtime.evaluate", params: { expression: expression }, callback: callbackEvalFunction2 };
}
-
+
function callbackEvalFunction2(result) {
InspectorTest.log("Function evaluate: " + JSON.stringify(result.result));
logEqualsCheck(result.result.value, 8);
-
+
var patched = originalText.replace("a + b", "a # b");
return { command: "Debugger.setScriptSource", params: { scriptId: scriptId, scriptSource: patched }, callback: errorCallbackSetScriptSource2 };

Powered by Google App Engine
This is Rietveld 408576698