@@ -1923,6 +1923,7 @@ void DomainDispatcherImpl::getContentQuads(const v8_crdtp::Dispatchable& dispatc
1923
1923
return ;
1924
1924
}
1925
1925
1926
+ // NOTE: dev4s - changed for now
1926
1927
void DomainDispatcherImpl::getDocument (const v8_crdtp::Dispatchable& dispatchable, DictionaryValue* params, ErrorSupport* errors)
1927
1928
{
1928
1929
// Prepare input parameters.
@@ -1932,34 +1933,43 @@ void DomainDispatcherImpl::getDocument(const v8_crdtp::Dispatchable& dispatchabl
1932
1933
errors->SetName (" depth" );
1933
1934
in_depth = ValueConversions<int >::fromValue (depthValue, errors);
1934
1935
}
1936
+
1935
1937
protocol::Value* pierceValue = params ? params->get (" pierce" ) : nullptr ;
1936
1938
Maybe<bool > in_pierce;
1937
1939
if (pierceValue) {
1938
1940
errors->SetName (" pierce" );
1939
1941
in_pierce = ValueConversions<bool >::fromValue (pierceValue, errors);
1940
1942
}
1943
+
1941
1944
if (MaybeReportInvalidParams (dispatchable, *errors)) return ;
1942
1945
// Declare output parameters.
1943
1946
std::unique_ptr<protocol::DOM::Node> out_root;
1944
1947
1945
1948
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 ;
1960
1958
}
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
+ }
1963
1973
return ;
1964
1974
}
1965
1975
0 commit comments