| Index: test/cctest/test-debug.cc
|
| diff --git a/test/cctest/test-debug.cc b/test/cctest/test-debug.cc
|
| index 9d63e7b3a6d47eb7e59a9ff2a0f490a2f557e8a4..3b43d9d11fb73ba89905a394d277db285d5ec1b4 100644
|
| --- a/test/cctest/test-debug.cc
|
| +++ b/test/cctest/test-debug.cc
|
| @@ -33,13 +33,13 @@
|
| #include "src/base/platform/condition-variable.h"
|
| #include "src/base/platform/platform.h"
|
| #include "src/compilation-cache.h"
|
| +#include "src/debug/debug-interface.h"
|
| #include "src/debug/debug.h"
|
| #include "src/deoptimizer.h"
|
| #include "src/frames.h"
|
| #include "src/utils.h"
|
| #include "test/cctest/cctest.h"
|
|
|
| -
|
| using ::v8::base::Mutex;
|
| using ::v8::base::LockGuard;
|
| using ::v8::base::ConditionVariable;
|
| @@ -319,6 +319,11 @@ static void ChangeBreakOnExceptionFromJS(v8::Isolate* isolate, bool caught,
|
| }
|
| }
|
|
|
| +// Change break on exception using the native API call.
|
| +static void ChangeBreakOnExceptionFromAPI(
|
| + v8::Isolate* isolate, v8::DebugInterface::ExceptionBreakState state) {
|
| + v8::DebugInterface::ChangeBreakOnException(isolate, state);
|
| +}
|
|
|
| // Prepare to step to next break location.
|
| static void PrepareStep(StepAction step_action) {
|
| @@ -3986,6 +3991,48 @@ TEST(BreakOnException) {
|
| edgeCaseFinally->Call(context, env->Global(), 0, NULL).ToLocalChecked();
|
| DebugEventCounterCheck(4, 3, 2);
|
|
|
| + // No break on exception using native API
|
| + DebugEventCounterClear();
|
| + MessageCallbackCountClear();
|
| + ChangeBreakOnExceptionFromAPI(env->GetIsolate(),
|
| + v8::DebugInterface::NoBreakOnException);
|
| + caught->Call(context, env->Global(), 0, NULL).ToLocalChecked();
|
| + DebugEventCounterCheck(0, 0, 0);
|
| + CHECK(notCaught->Call(context, env->Global(), 0, NULL).IsEmpty());
|
| + DebugEventCounterCheck(0, 0, 1);
|
| + CHECK(notCaughtFinally->Call(context, env->Global(), 0, NULL).IsEmpty());
|
| + DebugEventCounterCheck(0, 0, 2);
|
| + edgeCaseFinally->Call(context, env->Global(), 0, NULL).ToLocalChecked();
|
| + DebugEventCounterCheck(0, 0, 2);
|
| +
|
| + // // Break on uncaught exception using native API
|
| + DebugEventCounterClear();
|
| + MessageCallbackCountClear();
|
| + ChangeBreakOnExceptionFromAPI(env->GetIsolate(),
|
| + v8::DebugInterface::BreakOnUncaughtException);
|
| + caught->Call(context, env->Global(), 0, NULL).ToLocalChecked();
|
| + DebugEventCounterCheck(0, 0, 0);
|
| + CHECK(notCaught->Call(context, env->Global(), 0, NULL).IsEmpty());
|
| + DebugEventCounterCheck(1, 1, 1);
|
| + CHECK(notCaughtFinally->Call(context, env->Global(), 0, NULL).IsEmpty());
|
| + DebugEventCounterCheck(2, 2, 2);
|
| + edgeCaseFinally->Call(context, env->Global(), 0, NULL).ToLocalChecked();
|
| + DebugEventCounterCheck(3, 3, 2);
|
| +
|
| + // // Break on exception and uncaught exception using native API
|
| + DebugEventCounterClear();
|
| + MessageCallbackCountClear();
|
| + ChangeBreakOnExceptionFromAPI(env->GetIsolate(),
|
| + v8::DebugInterface::BreakOnAnyException);
|
| + caught->Call(context, env->Global(), 0, NULL).ToLocalChecked();
|
| + DebugEventCounterCheck(1, 0, 0);
|
| + CHECK(notCaught->Call(context, env->Global(), 0, NULL).IsEmpty());
|
| + DebugEventCounterCheck(2, 1, 1);
|
| + CHECK(notCaughtFinally->Call(context, env->Global(), 0, NULL).IsEmpty());
|
| + DebugEventCounterCheck(3, 2, 2);
|
| + edgeCaseFinally->Call(context, env->Global(), 0, NULL).ToLocalChecked();
|
| + DebugEventCounterCheck(4, 3, 2);
|
| +
|
| v8::Debug::SetDebugEventListener(env->GetIsolate(), nullptr);
|
| CheckDebuggerUnloaded(env->GetIsolate());
|
| env->GetIsolate()->RemoveMessageListeners(MessageCallbackCount);
|
|
|