| Index: test/mjsunit/modules-debug-scopes1.js
|
| diff --git a/test/mjsunit/modules-debug-scopes1.js b/test/mjsunit/modules-debug-scopes1.js
|
| index 02de75510e65f6f51fac6e33e838a9a690a10cae..6973e19cb962de0f2a457874b66f095a4009460f 100644
|
| --- a/test/mjsunit/modules-debug-scopes1.js
|
| +++ b/test/mjsunit/modules-debug-scopes1.js
|
| @@ -59,7 +59,8 @@ function assertScopeMirrorEquals(scope1, scope2) {
|
| assertEquals(scope1.scopeType(), scope2.scopeType());
|
| assertEquals(scope1.frameIndex(), scope2.frameIndex());
|
| assertEquals(scope1.scopeIndex(), scope2.scopeIndex());
|
| - assertPropertiesEqual(scope1.scopeObject().value(), scope2.scopeObject().value());
|
| + assertPropertiesEqual(scope1.scopeObject().value(),
|
| + scope2.scopeObject().value());
|
| }
|
|
|
| function CheckFastAllScopes(scopes, exec_state)
|
| @@ -79,7 +80,8 @@ function CheckFastAllScopes(scopes, exec_state)
|
| function CheckScopeChain(scopes, exec_state) {
|
| var all_scopes = exec_state.frame().allScopes();
|
| assertEquals(scopes.length, exec_state.frame().scopeCount());
|
| - assertEquals(scopes.length, all_scopes.length, "FrameMirror.allScopes length");
|
| + assertEquals(scopes.length, all_scopes.length,
|
| + "FrameMirror.allScopes length");
|
| for (var i = 0; i < scopes.length; i++) {
|
| var scope = exec_state.frame().scope(i);
|
| assertTrue(scope.isScope());
|
| @@ -87,32 +89,6 @@ function CheckScopeChain(scopes, exec_state) {
|
| assertScopeMirrorEquals(all_scopes[i], scope);
|
| }
|
| CheckFastAllScopes(scopes, exec_state);
|
| -
|
| - // Get the debug command processor.
|
| - var dcp = exec_state.debugCommandProcessor("unspecified_running_state");
|
| -
|
| - // Send a scopes request and check the result.
|
| - var json;
|
| - var request_json = '{"seq":0,"type":"request","command":"scopes"}';
|
| - var response_json = dcp.processDebugJSONRequest(request_json);
|
| - var response = JSON.parse(response_json);
|
| - assertEquals(scopes.length, response.body.scopes.length);
|
| - for (var i = 0; i < scopes.length; i++) {
|
| - assertEquals(i, response.body.scopes[i].index);
|
| - assertEquals(scopes[i], response.body.scopes[i].type);
|
| - if (scopes[i] == debug.ScopeType.Local ||
|
| - scopes[i] == debug.ScopeType.Script ||
|
| - scopes[i] == debug.ScopeType.Closure) {
|
| - assertTrue(response.body.scopes[i].object.ref < 0);
|
| - } else {
|
| - assertTrue(response.body.scopes[i].object.ref >= 0);
|
| - }
|
| - var found = false;
|
| - for (var j = 0; j < response.refs.length && !found; j++) {
|
| - found = response.refs[j].handle == response.body.scopes[i].object.ref;
|
| - }
|
| - assertTrue(found, "Scope object " + response.body.scopes[i].object.ref + " not found");
|
| - }
|
| }
|
|
|
|
|
| @@ -135,11 +111,13 @@ function CheckScopeContent(minimum_content, number, exec_state) {
|
| var minimum_count = 0;
|
| for (var p in minimum_content) {
|
| var property_mirror = scope.scopeObject().property(p);
|
| - assertFalse(property_mirror.isUndefined(), 'property ' + p + ' not found in scope');
|
| + assertFalse(property_mirror.isUndefined(),
|
| + 'property ' + p + ' not found in scope');
|
| if (typeof(minimum_content[p]) === 'function') {
|
| assertTrue(property_mirror.value().isFunction());
|
| } else {
|
| - assertEquals(minimum_content[p], property_mirror.value().value(), 'property ' + p + ' has unexpected value');
|
| + assertEquals(minimum_content[p], property_mirror.value().value(),
|
| + 'property ' + p + ' has unexpected value');
|
| }
|
| minimum_count++;
|
| }
|
| @@ -165,37 +143,13 @@ function CheckScopeContent(minimum_content, number, exec_state) {
|
| }
|
| }
|
| assertTrue(scope_size >= minimum_count);
|
| -
|
| - // Get the debug command processor.
|
| - var dcp = exec_state.debugCommandProcessor("unspecified_running_state");
|
| -
|
| - // Send a scope request for information on a single scope and check the
|
| - // result.
|
| - var request_json = '{"seq":0,"type":"request","command":"scope","arguments":{"number":';
|
| - request_json += scope.scopeIndex();
|
| - request_json += '}}';
|
| - var response_json = dcp.processDebugJSONRequest(request_json);
|
| - var response = JSON.parse(response_json);
|
| - assertEquals(scope.scopeType(), response.body.type);
|
| - assertEquals(number, response.body.index);
|
| - if (scope.scopeType() == debug.ScopeType.Local ||
|
| - scope.scopeType() == debug.ScopeType.Script ||
|
| - scope.scopeType() == debug.ScopeType.Closure) {
|
| - assertTrue(response.body.object.ref < 0);
|
| - } else {
|
| - assertTrue(response.body.object.ref >= 0);
|
| - }
|
| - var found = false;
|
| - for (var i = 0; i < response.refs.length && !found; i++) {
|
| - found = response.refs[i].handle == response.body.object.ref;
|
| - }
|
| - assertTrue(found, "Scope object " + response.body.object.ref + " not found");
|
| }
|
|
|
| // Check that the scopes have positions as expected.
|
| function CheckScopeChainPositions(positions, exec_state) {
|
| var all_scopes = exec_state.frame().allScopes();
|
| - assertTrue(positions.length <= all_scopes.length, "FrameMirror.allScopes length");
|
| + assertTrue(positions.length <= all_scopes.length,
|
| + "FrameMirror.allScopes length");
|
| for (var i = 0; i < positions.length; i++) {
|
| var scope = exec_state.frame().scope(i);
|
| assertTrue(scope.isScope());
|
| @@ -203,7 +157,8 @@ function CheckScopeChainPositions(positions, exec_state) {
|
| if (!position)
|
| continue;
|
|
|
| - print(`Checking position.start = ${position.start}, .end = ${position.end}`);
|
| + print(
|
| + `Checking position.start = ${position.start}, .end = ${position.end}`);
|
| assertEquals(position.start, scope.details().startPosition())
|
| assertEquals(position.end, scope.details().endPosition())
|
| }
|
| @@ -391,7 +346,8 @@ listener_delegate = function(exec_state) {
|
| debug.ScopeType.Script,
|
| debug.ScopeType.Global], exec_state);
|
| CheckScopeContent({a:1,x:3}, 1, exec_state);
|
| - CheckScopeChainNames(["f", "closure_2", undefined, undefined, undefined], exec_state)
|
| + CheckScopeChainNames(["f", "closure_2", undefined, undefined, undefined],
|
| + exec_state)
|
| };
|
| closure_2(1, 2)();
|
| EndTest();
|
| @@ -420,7 +376,8 @@ listener_delegate = function(exec_state) {
|
| debug.ScopeType.Script,
|
| debug.ScopeType.Global], exec_state);
|
| CheckScopeContent({a:1,b:2,x:3,y:4}, 1, exec_state);
|
| - CheckScopeChainNames(["f", "closure_3", undefined, undefined, undefined], exec_state)
|
| + CheckScopeChainNames(["f", "closure_3", undefined, undefined, undefined],
|
| + exec_state)
|
| };
|
| closure_3(1, 2)();
|
| EndTest();
|
| @@ -452,7 +409,8 @@ listener_delegate = function(exec_state) {
|
| debug.ScopeType.Script,
|
| debug.ScopeType.Global], exec_state);
|
| CheckScopeContent({a:1,b:2,x:3,y:4,f:function(){}}, 1, exec_state);
|
| - CheckScopeChainNames(["f", "closure_4", undefined, undefined, undefined], exec_state)
|
| + CheckScopeChainNames(["f", "closure_4", undefined, undefined, undefined],
|
| + exec_state)
|
| };
|
| closure_4(1, 2)();
|
| EndTest();
|
| @@ -483,7 +441,8 @@ listener_delegate = function(exec_state) {
|
| debug.ScopeType.Script,
|
| debug.ScopeType.Global], exec_state);
|
| CheckScopeContent({a:1,b:2,x:3,y:4,f:function(){}}, 1, exec_state);
|
| - CheckScopeChainNames(["f", "closure_5", undefined, undefined, undefined], exec_state)
|
| + CheckScopeChainNames(["f", "closure_5", undefined, undefined, undefined],
|
| + exec_state)
|
| };
|
| closure_5(1, 2)();
|
| EndTest();
|
| @@ -517,7 +476,9 @@ listener_delegate = function(exec_state) {
|
| debug.ScopeType.Global], exec_state);
|
| CheckScopeContent({a:1}, 1, exec_state);
|
| CheckScopeContent({f:function(){}}, 2, exec_state);
|
| - CheckScopeChainNames([undefined, "f", "closure_6", undefined, undefined, undefined], exec_state)
|
| + CheckScopeChainNames(
|
| + [undefined, "f", "closure_6", undefined, undefined, undefined],
|
| + exec_state);
|
| };
|
| closure_6(1, 2)();
|
| EndTest();
|
| @@ -555,7 +516,9 @@ listener_delegate = function(exec_state) {
|
| CheckScopeContent({}, 0, exec_state);
|
| CheckScopeContent({a:1,b:2,x:3,y:4}, 1, exec_state);
|
| CheckScopeContent({a:1,b:2,x:3,y:4,f:function(){}}, 2, exec_state);
|
| - CheckScopeChainNames([undefined, "f", "closure_7", undefined, undefined, undefined], exec_state)
|
| + CheckScopeChainNames(
|
| + [undefined, "f", "closure_7", undefined, undefined, undefined],
|
| + exec_state);
|
| };
|
| closure_7(1, 2)();
|
| EndTest();
|
| @@ -575,7 +538,7 @@ listener_delegate = function(exec_state) {
|
| debug.ScopeType.Script,
|
| debug.ScopeType.Global], exec_state);
|
| CheckScopeContent({x: 2}, 0, exec_state);
|
| - CheckScopeChainNames(["inner", undefined, undefined, undefined], exec_state)
|
| + CheckScopeChainNames(["inner", undefined, undefined, undefined], exec_state);
|
| };
|
| closure_8();
|
| EndTest();
|
| @@ -597,7 +560,7 @@ listener_delegate = function(exec_state) {
|
| debug.ScopeType.Closure,
|
| debug.ScopeType.Script,
|
| debug.ScopeType.Global], exec_state);
|
| - CheckScopeChainNames(["inner", undefined, undefined, undefined], exec_state)
|
| + CheckScopeChainNames(["inner", undefined, undefined, undefined], exec_state);
|
| };
|
| closure_9();
|
| EndTest();
|
| @@ -606,8 +569,10 @@ EndTest();
|
| // Test global scope.
|
| BeginTest("Global");
|
| listener_delegate = function(exec_state) {
|
| - CheckScopeChain([debug.ScopeType.Module, debug.ScopeType.Script, debug.ScopeType.Global], exec_state);
|
| - CheckScopeChainNames([undefined, undefined, undefined], exec_state)
|
| + CheckScopeChain(
|
| + [debug.ScopeType.Module, debug.ScopeType.Script, debug.ScopeType.Global],
|
| + exec_state);
|
| + CheckScopeChainNames([undefined, undefined, undefined], exec_state);
|
| };
|
| debugger;
|
| EndTest();
|
| @@ -630,7 +595,9 @@ listener_delegate = function(exec_state) {
|
| debug.ScopeType.Script,
|
| debug.ScopeType.Global], exec_state);
|
| CheckScopeContent({e:'Exception'}, 0, exec_state);
|
| - CheckScopeChainNames(["catch_block_1", "catch_block_1", undefined, undefined, undefined], exec_state)
|
| + CheckScopeChainNames(
|
| + ["catch_block_1", "catch_block_1", undefined, undefined, undefined],
|
| + exec_state);
|
| };
|
| catch_block_1();
|
| EndTest();
|
| @@ -655,7 +622,9 @@ listener_delegate = function(exec_state) {
|
| debug.ScopeType.Global], exec_state);
|
| CheckScopeContent({e:'Exception'}, 0, exec_state);
|
| CheckScopeContent({}, 1, exec_state);
|
| - CheckScopeChainNames(["catch_block_3", "catch_block_3", undefined, undefined, undefined], exec_state)
|
| + CheckScopeChainNames(
|
| + ["catch_block_3", "catch_block_3", undefined, undefined, undefined],
|
| + exec_state);
|
| };
|
| catch_block_3();
|
| EndTest();
|
| @@ -669,7 +638,8 @@ listener_delegate = function(exec_state) {
|
| debug.ScopeType.Script,
|
| debug.ScopeType.Global], exec_state);
|
| CheckScopeContent({e:'Exception'}, 0, exec_state);
|
| - CheckScopeChainNames([undefined, undefined, undefined, undefined], exec_state)
|
| + CheckScopeChainNames([undefined, undefined, undefined, undefined],
|
| + exec_state);
|
| };
|
|
|
| try {
|
| @@ -691,7 +661,8 @@ listener_delegate = function(exec_state) {
|
| debug.ScopeType.Global], exec_state);
|
| CheckScopeContent({x: 2}, 0, exec_state);
|
| CheckScopeContent({e:'Exception'}, 1, exec_state);
|
| - CheckScopeChainNames([undefined, undefined, undefined, undefined, undefined], exec_state)
|
| + CheckScopeChainNames([undefined, undefined, undefined, undefined, undefined],
|
| + exec_state);
|
| };
|
|
|
| try {
|
| @@ -723,7 +694,9 @@ listener_delegate = function(exec_state) {
|
| debug.ScopeType.Script,
|
| debug.ScopeType.Global], exec_state);
|
| CheckScopeContent({e:'Exception'}, 0, exec_state);
|
| - CheckScopeChainNames(["catch_block_7", "catch_block_7", undefined, undefined, undefined], exec_state)
|
| + CheckScopeChainNames(
|
| + ["catch_block_7", "catch_block_7", undefined, undefined, undefined],
|
| + exec_state);
|
| };
|
| catch_block_7();
|
| EndTest();
|
| @@ -738,7 +711,7 @@ listener_delegate = function(exec_state) {
|
| debug.ScopeType.Script,
|
| debug.ScopeType.Global], exec_state);
|
| CheckScopeContent({}, 1, exec_state);
|
| - CheckScopeChainNames(["m", undefined, undefined, undefined], exec_state)
|
| + CheckScopeChainNames(["m", undefined, undefined, undefined], exec_state);
|
| };
|
|
|
| (function() {
|
| @@ -765,7 +738,8 @@ var code1 = "function f() { \n" +
|
| "f(); \n";
|
|
|
| listener_delegate = function(exec_state) {
|
| - CheckScopeChainPositions([{start: 58, end: 118}, {start: 10, end: 162}], exec_state);
|
| + CheckScopeChainPositions([{start: 58, end: 118}, {start: 10, end: 162}],
|
| + exec_state);
|
| }
|
| eval(code1);
|
| EndTest();
|
| @@ -785,7 +759,8 @@ listener_delegate = function(exec_state) {
|
| debug.ScopeType.Module,
|
| debug.ScopeType.Script,
|
| debug.ScopeType.Global], exec_state);
|
| - CheckScopeChainPositions([{start: 52, end: 111}, {start: 22, end: 145}], exec_state);
|
| + CheckScopeChainPositions([{start: 52, end: 111}, {start: 22, end: 145}],
|
| + exec_state);
|
| }
|
| eval(code3);
|
| EndTest();
|
| @@ -806,7 +781,9 @@ listener_delegate = function(exec_state) {
|
| debug.ScopeType.Module,
|
| debug.ScopeType.Script,
|
| debug.ScopeType.Global], exec_state);
|
| - CheckScopeChainPositions([{start: 66, end: 147}, {start: 52, end: 147}, {start: 22, end: 181}], exec_state);
|
| + CheckScopeChainPositions([{start: 66, end: 147},
|
| + {start: 52, end: 147},
|
| + {start: 22, end: 181}], exec_state);
|
| }
|
| eval(code4);
|
| EndTest();
|
| @@ -825,7 +802,8 @@ listener_delegate = function(exec_state) {
|
| debug.ScopeType.Module,
|
| debug.ScopeType.Script,
|
| debug.ScopeType.Global], exec_state);
|
| - CheckScopeChainPositions([{start: 55, end: 111}, {start: 27, end: 145}], exec_state);
|
| + CheckScopeChainPositions([{start: 55, end: 111}, {start: 27, end: 145}],
|
| + exec_state);
|
| }
|
| eval(code5);
|
| EndTest();
|
| @@ -846,7 +824,9 @@ listener_delegate = function(exec_state) {
|
| debug.ScopeType.Module,
|
| debug.ScopeType.Script,
|
| debug.ScopeType.Global], exec_state);
|
| - CheckScopeChainPositions([{start: 57, end: 147}, {start: 55, end: 147}, {start: 27, end: 181}], exec_state);
|
| + CheckScopeChainPositions([{start: 57, end: 147},
|
| + {start: 55, end: 147},
|
| + {start: 27, end: 181}], exec_state);
|
| }
|
| eval(code6);
|
| EndTest();
|
| @@ -870,7 +850,8 @@ listener_delegate = function(exec_state) {
|
| eval(code7);
|
| EndTest();
|
|
|
| -BeginTest("Scope positions in non-lexical for each statement with lexical block");
|
| +BeginTest(
|
| + "Scope positions in non-lexical for each statement with lexical block");
|
| var code8 = "function for_each_statement() { \n" +
|
| " var i; \n" +
|
| " for (i of [0]) { \n" +
|
| @@ -886,7 +867,8 @@ listener_delegate = function(exec_state) {
|
| debug.ScopeType.Module,
|
| debug.ScopeType.Script,
|
| debug.ScopeType.Global], exec_state);
|
| - CheckScopeChainPositions([{start: 89, end: 183}, {start: 27, end: 217}], exec_state);
|
| + CheckScopeChainPositions([{start: 89, end: 183}, {start: 27, end: 217}],
|
| + exec_state);
|
| }
|
| eval(code8);
|
| EndTest();
|
|
|