Commit 4e32419b authored by neis's avatar neis Committed by Commit bot

[debug] Extend a test and fix some typos.

R=jgruber@chromium.org
BUG=

Review-Url: https://codereview.chromium.org/2493533003
Cr-Commit-Position: refs/heads/master@{#40966}
parent be9b820c
...@@ -1912,7 +1912,7 @@ void Debug::CallEventCallback(v8::DebugEvent event, ...@@ -1912,7 +1912,7 @@ void Debug::CallEventCallback(v8::DebugEvent event,
MaybeHandle<Object> result = MaybeHandle<Object> result =
Execution::Call(isolate_, Handle<JSFunction>::cast(event_listener_), Execution::Call(isolate_, Handle<JSFunction>::cast(event_listener_),
global, arraysize(argv), argv); global, arraysize(argv), argv);
CHECK(!result.is_null()); // Listeners may not throw. CHECK(!result.is_null()); // Listeners must not throw.
} }
in_debug_event_listener_ = previous; in_debug_event_listener_ = previous;
} }
......
...@@ -63,7 +63,7 @@ function RunPauseTest(scope_number, expected_old_result, variable_name, ...@@ -63,7 +63,7 @@ function RunPauseTest(scope_number, expected_old_result, variable_name,
// Add the debug event listener. // Add the debug event listener.
Debug.setListener(listener); Debug.setListener(listener);
var actual_new_value; var actual_new_result;
try { try {
actual_new_result = fun(); actual_new_result = fun();
} finally { } finally {
...@@ -78,7 +78,7 @@ function RunPauseTest(scope_number, expected_old_result, variable_name, ...@@ -78,7 +78,7 @@ function RunPauseTest(scope_number, expected_old_result, variable_name,
assertEquals(expected_new_result, actual_new_result); assertEquals(expected_new_result, actual_new_result);
} }
// Accepts a closure 'fun' that returns a variable from it's outer scope. // Accepts a closure 'fun' that returns a variable from its outer scope.
// The test changes the value of variable via the handle to function and checks // The test changes the value of variable via the handle to function and checks
// that the return value changed accordingly. // that the return value changed accordingly.
function RunClosureTest(scope_number, expected_old_result, variable_name, function RunClosureTest(scope_number, expected_old_result, variable_name,
...@@ -307,3 +307,32 @@ assertSame(Number, DebugCommandProcessor.resolveValue_( ...@@ -307,3 +307,32 @@ assertSame(Number, DebugCommandProcessor.resolveValue_(
{handle: Debug.MakeMirror(Number).handle()})); {handle: Debug.MakeMirror(Number).handle()}));
assertSame(RunClosureTest, DebugCommandProcessor.resolveValue_( assertSame(RunClosureTest, DebugCommandProcessor.resolveValue_(
{handle: Debug.MakeMirror(RunClosureTest).handle()})); {handle: Debug.MakeMirror(RunClosureTest).handle()}));
// Test script-scope variable.
let abc = 12;
{
let exception;
function listener(event, exec_state) {
try {
if (event == Debug.DebugEvent.Break) {
let scope_count = exec_state.frame().scopeCount();
let script_scope = exec_state.frame().scope(scope_count - 2);
assertTrue(script_scope.isScope());
assertEquals(debug.ScopeType.Script, script_scope.scopeType());
script_scope.setVariableValue('abc', 42);
}
} catch(e) { exception = e }
}
Debug.setListener(listener);
assertEquals(12, abc);
debugger;
assertEquals(42, abc);
if (exception != null) {
assertUnreachable("Exception in listener\n" + exception.stack);
}
}
Debug.setListener(null);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment