summaryrefslogtreecommitdiff
path: root/deps/v8/test/cctest/test-inspector.cc
diff options
context:
space:
mode:
authorMichaël Zasso <targos@protonmail.com>2021-10-12 20:22:20 +0200
committerMichaël Zasso <targos@protonmail.com>2021-10-14 16:46:03 +0200
commitbf82dcd5bad2e2014f02df34795dc34633db1f90 (patch)
tree4d7c3afdd0c7556e5dcc3dca00562532120d6bf4 /deps/v8/test/cctest/test-inspector.cc
parentb80b85e130a2a04a69c8fc846e27236a86107a80 (diff)
downloadnode-new-bf82dcd5bad2e2014f02df34795dc34633db1f90.tar.gz
deps: patch V8 to 9.5.172.21
Refs: https://github.com/v8/v8/compare/9.5.172.19...9.5.172.21 PR-URL: https://github.com/nodejs/node/pull/40432 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: Beth Griggs <bgriggs@redhat.com>
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);
+}