Skip to content

Commit be0285f

Browse files
committed
In line debugger - can't connect through websocket
1 parent 6601d7d commit be0285f

File tree

2 files changed

+30
-16
lines changed

2 files changed

+30
-16
lines changed

test-app/runtime/src/main/cpp/JsV8InspectorClient.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,13 @@ void JsV8InspectorClient::connect(jobject connection) {
4444
this->isConnected = true;
4545
}
4646

47+
//NOTE: dev4s - changed for now
4748
void JsV8InspectorClient::scheduleBreak() {
49+
v8::Locker locker(isolate_);
4850
Isolate::Scope isolate_scope(isolate_);
4951
v8::HandleScope handleScope(isolate_);
52+
auto context = Runtime::GetRuntime(isolate_)->GetContext();
53+
Context::Scope context_scope(context);
5054

5155
this->session_->schedulePauseOnNextStatement(v8_inspector::StringView(), v8_inspector::StringView());
5256
}

test-app/runtime/src/main/cpp/v8_inspector/src/inspector/protocol/DOM.cpp

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1923,6 +1923,7 @@ void DomainDispatcherImpl::getContentQuads(const v8_crdtp::Dispatchable& dispatc
19231923
return;
19241924
}
19251925

1926+
//NOTE: dev4s - changed for now
19261927
void DomainDispatcherImpl::getDocument(const v8_crdtp::Dispatchable& dispatchable, DictionaryValue* params, ErrorSupport* errors)
19271928
{
19281929
// Prepare input parameters.
@@ -1932,34 +1933,43 @@ void DomainDispatcherImpl::getDocument(const v8_crdtp::Dispatchable& dispatchabl
19321933
errors->SetName("depth");
19331934
in_depth = ValueConversions<int>::fromValue(depthValue, errors);
19341935
}
1936+
19351937
protocol::Value* pierceValue = params ? params->get("pierce") : nullptr;
19361938
Maybe<bool> in_pierce;
19371939
if (pierceValue) {
19381940
errors->SetName("pierce");
19391941
in_pierce = ValueConversions<bool>::fromValue(pierceValue, errors);
19401942
}
1943+
19411944
if (MaybeReportInvalidParams(dispatchable, *errors)) return;
19421945
// Declare output parameters.
19431946
std::unique_ptr<protocol::DOM::Node> out_root;
19441947

19451948
std::unique_ptr<DomainDispatcher::WeakPtr> weak = weakPtr();
1946-
DispatchResponse response = m_backend->getDocument(std::move(in_depth), std::move(in_pierce), &out_root);
1947-
if (response.IsFallThrough()) {
1948-
channel()->FallThrough(dispatchable.CallId(), v8_crdtp::SpanFrom("DOM.getDocument"), dispatchable.Serialized());
1949-
return;
1950-
}
1951-
if (weak->get()) {
1952-
std::vector<uint8_t> result;
1953-
if (response.IsSuccess()) {
1954-
v8_crdtp::cbor::EnvelopeEncoder envelope_encoder;
1955-
envelope_encoder.EncodeStart(&result);
1956-
result.push_back(v8_crdtp::cbor::EncodeIndefiniteLengthMapStart());
1957-
v8_crdtp::SerializeField(v8_crdtp::SpanFrom("root"), out_root, &result);
1958-
result.push_back(v8_crdtp::cbor::EncodeStop());
1959-
envelope_encoder.EncodeStop(&result);
1949+
1950+
if (depthValue && pierceValue) {
1951+
//NOTE: in_depth & in_pierce are not used in the method getDocument, see in v8-dom-agent-impl.cpp:63
1952+
DispatchResponse response = m_backend->getDocument(std::move(in_depth),
1953+
std::move(in_pierce), &out_root);
1954+
if (response.IsFallThrough()) {
1955+
channel()->FallThrough(dispatchable.CallId(), v8_crdtp::SpanFrom("DOM.getDocument"),
1956+
dispatchable.Serialized());
1957+
return;
19601958
}
1961-
weak->get()->sendResponse(dispatchable.CallId(), response, v8_crdtp::Serializable::From(std::move(result)));
1962-
}
1959+
if (weak->get()) {
1960+
std::vector<uint8_t> result;
1961+
if (response.IsSuccess()) {
1962+
v8_crdtp::cbor::EnvelopeEncoder envelope_encoder;
1963+
envelope_encoder.EncodeStart(&result);
1964+
result.push_back(v8_crdtp::cbor::EncodeIndefiniteLengthMapStart());
1965+
v8_crdtp::SerializeField(v8_crdtp::SpanFrom("root"), out_root, &result);
1966+
result.push_back(v8_crdtp::cbor::EncodeStop());
1967+
envelope_encoder.EncodeStop(&result);
1968+
}
1969+
weak->get()->sendResponse(dispatchable.CallId(), response,
1970+
v8_crdtp::Serializable::From(std::move(result)));
1971+
}
1972+
}
19631973
return;
19641974
}
19651975

0 commit comments

Comments
 (0)