summaryrefslogtreecommitdiff
path: root/deps/v8/test/cctest/test-inspector.cc
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/test/cctest/test-inspector.cc')
-rw-r--r--deps/v8/test/cctest/test-inspector.cc36
1 files changed, 36 insertions, 0 deletions
diff --git a/deps/v8/test/cctest/test-inspector.cc b/deps/v8/test/cctest/test-inspector.cc
index c1651eaceb..49a08bc42e 100644
--- a/deps/v8/test/cctest/test-inspector.cc
+++ b/deps/v8/test/cctest/test-inspector.cc
@@ -9,6 +9,7 @@
#include "include/v8-primitive.h"
#include "src/inspector/protocol/Runtime.h"
#include "src/inspector/string-util.h"
+#include "src/inspector/v8-inspector-impl.h"
#include "test/cctest/cctest.h"
using v8_inspector::StringBuffer;
@@ -169,3 +170,38 @@ TEST(BinaryBase64RoundTrip) {
CHECK_EQ(values[i], roundtrip_binary.data()[i]);
}
}
+
+TEST(NoInterruptOnGetAssociatedData) {
+ LocalContext env;
+ v8::Isolate* isolate = env->GetIsolate();
+ v8::HandleScope handle_scope(isolate);
+
+ v8_inspector::V8InspectorClient default_client;
+ std::unique_ptr<v8_inspector::V8InspectorImpl> inspector(
+ new v8_inspector::V8InspectorImpl(isolate, &default_client));
+
+ v8::Local<v8::Context> context = env->GetIsolate()->GetCurrentContext();
+ v8::Local<v8::Value> error = v8::Exception::Error(v8_str("custom error"));
+ v8::Local<v8::Name> key = v8_str("key");
+ v8::Local<v8::Value> value = v8_str("value");
+ inspector->associateExceptionData(context, error, key, value);
+
+ struct InterruptRecorder {
+ static void handler(v8::Isolate* isolate, void* data) {
+ reinterpret_cast<InterruptRecorder*>(data)->WasInvoked = true;
+ }
+
+ bool WasInvoked = false;
+ } recorder;
+
+ isolate->RequestInterrupt(&InterruptRecorder::handler, &recorder);
+
+ v8::Local<v8::Object> data =
+ inspector->getAssociatedExceptionData(error).ToLocalChecked();
+ CHECK(!recorder.WasInvoked);
+
+ CHECK_EQ(data->Get(context, key).ToLocalChecked(), value);
+
+ CompileRun("0");
+ CHECK(recorder.WasInvoked);
+}