From 7e6c84296dc550c51c6980a8e5cf9257c38242f1 Mon Sep 17 00:00:00 2001 From: Eduardo Speroni Date: Wed, 27 May 2026 21:01:19 -0300 Subject: [PATCH] fix: enable interruption of V8 execution on Debugger.pause command --- NativeScript/inspector/JsV8InspectorClient.mm | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/NativeScript/inspector/JsV8InspectorClient.mm b/NativeScript/inspector/JsV8InspectorClient.mm index fafe0c68..e8b4a1e6 100644 --- a/NativeScript/inspector/JsV8InspectorClient.mm +++ b/NativeScript/inspector/JsV8InspectorClient.mm @@ -128,6 +128,18 @@ dispatch_semaphore_signal(messageArrived_); }); + // Debugger.pause needs to interrupt V8 even if the main thread is busy + // executing JS. RequestInterrupt fires at the next safe bytecode boundary. + auto parsed = json::parse(message, nullptr, false); + if (!parsed.is_discarded() && parsed.contains("method") && parsed["method"] == "Debugger.pause") { + isolate_->RequestInterrupt( + [](Isolate* isolate, void* data) { + auto client = static_cast(data); + client->session_->schedulePauseOnNextStatement({}, {}); + }, + this); + } + tns::ExecuteOnMainThread([this, message]() { dispatch_sync(this->messageLoopQueue_, ^{ // prevent execution if we're already pumping messages