37#include "../../third_party/inspector_protocol/crdtp/json.h"
47#include "src/inspector/protocol/Protocol.h"
48#include "src/inspector/protocol/Runtime.h"
61namespace V8RuntimeAgentImplState {
63 "customObjectFormatterEnabled";
70using protocol::Runtime::RemoteObject;
74template <
typename ProtocolCallback>
77 static std::shared_ptr<EvaluateCallback> wrap(
78 std::unique_ptr<ProtocolCallback>
callback) {
79 return std::shared_ptr<EvaluateCallback>(
80 new EvaluateCallbackWrapper(std::move(
callback)));
82 void sendSuccess(std::unique_ptr<protocol::Runtime::RemoteObject>
result,
83 std::unique_ptr<protocol::Runtime::ExceptionDetails>
84 exceptionDetails)
override {
86 std::move(exceptionDetails));
88 void sendFailure(
const protocol::DispatchResponse& response)
override {
93 explicit EvaluateCallbackWrapper(std::unique_ptr<ProtocolCallback>
callback)
99template <
typename ProtocolCallback>
100bool wrapEvaluateResultAsync(InjectedScript* injectedScript,
103 const String16& objectGroup,
104 const WrapOptions& wrapOptions,
105 bool throwOnSideEffect,
107 std::unique_ptr<RemoteObject>
result;
108 std::unique_ptr<protocol::Runtime::ExceptionDetails> exceptionDetails;
110 Response response = injectedScript->wrapEvaluateResult(
111 maybeResultValue, tryCatch, objectGroup, wrapOptions, throwOnSideEffect,
112 &
result, &exceptionDetails);
113 if (response.IsSuccess()) {
114 callback->sendSuccess(std::move(
result), std::move(exceptionDetails));
121void innerCallFunctionOn(
122 V8InspectorSessionImpl* session, InjectedScript::Scope& scope,
124 std::unique_ptr<protocol::Array<protocol::Runtime::CallArgument>>
126 bool silent, std::unique_ptr<WrapOptions> wrapOptions,
bool userGesture,
127 bool awaitPromise,
const String16& objectGroup,
bool throwOnSideEffect,
128 std::unique_ptr<V8RuntimeAgentImpl::CallFunctionOnCallback>
callback) {
129 V8InspectorImpl* inspector = session->inspector();
132 if (optionalArguments) {
133 protocol::Array<protocol::Runtime::CallArgument>& arguments =
135 int argc =
static_cast<int>(arguments.size());
137 for (
int i = 0;
i < argc; ++
i) {
138 Response response = scope.injectedScript()->resolveCallArgument(
139 arguments[
i].get(), &
args[
i]);
140 if (!response.IsSuccess()) {
147 if (silent) scope.ignoreExceptionsAndMuteConsole();
148 if (userGesture) scope.pretendUserGesture();
151 scope.allowCodeGenerationFromStrings();
156 ->compileScript(scope.context(),
"(" + expression +
")", String16())
160 maybeFunctionValue = functionScript->Run(scope.context());
164 Response response = scope.initialize();
165 if (!response.IsSuccess()) {
170 if (scope.tryCatch().HasCaught()) {
171 wrapEvaluateResultAsync(scope.injectedScript(), maybeFunctionValue,
172 scope.tryCatch(), objectGroup,
179 if (!maybeFunctionValue.
ToLocal(&functionValue) ||
180 !functionValue->IsFunction()) {
181 callback->sendFailure(Response::ServerError(
182 "Given expression does not evaluate to a function"));
196 response = scope.initialize();
197 if (!response.IsSuccess()) {
202 if (!awaitPromise || scope.tryCatch().HasCaught()) {
203 wrapEvaluateResultAsync(scope.injectedScript(), maybeResultValue,
204 scope.tryCatch(), objectGroup, *wrapOptions,
209 scope.injectedScript()->addPromiseCallback(
210 session, maybeResultValue, objectGroup, std::move(wrapOptions),
211 false , throwOnSideEffect,
212 EvaluateCallbackWrapper<V8RuntimeAgentImpl::CallFunctionOnCallback>::wrap(
216Response ensureContext(V8InspectorImpl* inspector,
int contextGroupId,
217 std::optional<int> executionContextId,
218 std::optional<String16> uniqueContextId,
220 if (executionContextId.has_value()) {
221 if (uniqueContextId.has_value()) {
222 return Response::InvalidParams(
223 "contextId and uniqueContextId are mutually exclusive");
225 *contextId = executionContextId.value();
226 }
else if (uniqueContextId.has_value()) {
227 internal::V8DebuggerId uniqueId(uniqueContextId.value());
228 if (!uniqueId.isValid())
229 return Response::InvalidParams(
"invalid uniqueContextId");
230 int id = inspector->resolveUniqueContextId(uniqueId);
231 if (!
id)
return Response::InvalidParams(
"uniqueContextId not found");
236 inspector->client()->ensureDefaultContextInGroup(contextGroupId);
238 return Response::ServerError(
"Cannot find default execution context");
242 return Response::Success();
245Response parseAdditionalSerializationParameters(
246 protocol::DictionaryValue* additionalParameters,
v8::Isolate* isolate,
251 if (additionalParameters !=
nullptr) {
252 for (
size_t i = 0;
i < additionalParameters->
size(); ++
i) {
253 String16
key = (*additionalParameters).at(
i).first;
256 protocol::Value* value = (*additionalParameters).at(
i).second;
257 String16 stringValue;
258 if (value->asString(&stringValue)) {
259 values.push_back(
toV8String(isolate, stringValue));
263 if (value->asInteger(&intValue)) {
267 return Response::InvalidParams(
268 "Values of serializationOptions.additionalParameters can be only of "
269 "type string or integer.");
272 CHECK(keys.size() == values.size());
274 values.data(), keys.size());
276 return Response::Success();
279Response getWrapOptions(std::optional<bool> returnByValue,
280 std::optional<bool> generatePreview,
281 std::unique_ptr<protocol::Runtime::SerializationOptions>
282 maybeSerializationOptions,
284 std::unique_ptr<WrapOptions>*
result) {
285 if (maybeSerializationOptions) {
286 String16 serializationModeStr =
287 maybeSerializationOptions->getSerialization();
288 if (serializationModeStr ==
289 protocol::Runtime::SerializationOptions::SerializationEnum::Deep) {
291 Response response = parseAdditionalSerializationParameters(
292 maybeSerializationOptions->getAdditionalParameters(
nullptr), isolate,
293 &additionalParameters);
294 if (!response.IsSuccess()) {
297 *
result = std::make_unique<WrapOptions>(WrapOptions{
301 return Response::Success();
303 if (serializationModeStr ==
304 protocol::Runtime::SerializationOptions::SerializationEnum::Json) {
306 return Response::Success();
308 if (serializationModeStr ==
309 protocol::Runtime::SerializationOptions::SerializationEnum::IdOnly) {
311 return Response::Success();
313 return Response::InvalidParams(
314 "Unknown serializationOptions.serialization value " +
315 serializationModeStr.utf8());
318 if (returnByValue.value_or(
false)) {
320 return Response::Success();
322 if (generatePreview.value_or(
false)) {
324 return Response::Success();
327 return Response::Success();
330Response getWrapOptions(std::optional<bool> returnByValue,
331 std::optional<bool> generatePreview,
333 std::unique_ptr<WrapOptions>*
result) {
334 return getWrapOptions(std::move(returnByValue), std::move(generatePreview),
343 protocol::DictionaryValue* state,
344 std::shared_ptr<V8DebuggerBarrier> debuggerBarrier)
349 m_debuggerBarrier(debuggerBarrier),
355 const String16& expression, std::optional<String16> objectGroup,
356 std::optional<bool> includeCommandLineAPI, std::optional<bool> silent,
357 std::optional<int> executionContextId, std::optional<bool> returnByValue,
358 std::optional<bool> generatePreview, std::optional<bool> userGesture,
359 std::optional<bool> maybeAwaitPromise,
360 std::optional<bool> throwOnSideEffect, std::optional<double> timeout,
361 std::optional<bool> disableBreaks, std::optional<bool> maybeReplMode,
362 std::optional<bool> allowUnsafeEvalBlockedByCSP,
363 std::optional<String16> uniqueContextId,
364 std::unique_ptr<protocol::Runtime::SerializationOptions>
365 serializationOptions,
366 std::unique_ptr<EvaluateCallback>
callback) {
371 std::move(executionContextId),
372 std::move(uniqueContextId), &contextId);
373 if (!response.IsSuccess()) {
380 if (!response.IsSuccess()) {
390 const bool replMode = maybeReplMode.value_or(
false);
392 if (allowUnsafeEvalBlockedByCSP.value_or(
true)) {
399 if (timeout.has_value()) {
400 response = evaluateScope.
setTimeout(timeout.value() / 1000.0);
401 if (!response.IsSuccess()) {
410 if (throwOnSideEffect.value_or(
false)) {
412 }
else if (disableBreaks.value_or(
false)) {
424 if (!response.IsSuccess()) {
429 std::unique_ptr<WrapOptions> wrapOptions;
430 response = getWrapOptions(
431 std::move(returnByValue), std::move(generatePreview),
433 if (!response.IsSuccess()) {
439 const bool await = replMode || maybeAwaitPromise.value_or(
false);
440 if (!await || scope.
tryCatch().HasCaught()) {
442 scope.
tryCatch(), objectGroup.value_or(
""),
443 *wrapOptions, throwOnSideEffect.value_or(
false),
448 m_session, maybeResultValue, objectGroup.value_or(
""),
449 std::move(wrapOptions), replMode, throwOnSideEffect.value_or(
false),
450 EvaluateCallbackWrapper<EvaluateCallback>::wrap(std::move(
callback)));
454 const String16& promiseObjectId, std::optional<bool> returnByValue,
455 std::optional<bool> generatePreview,
456 std::unique_ptr<AwaitPromiseCallback>
callback) {
459 if (!response.IsSuccess()) {
465 Response::ServerError(
"Could not find promise with given id"));
469 std::unique_ptr<WrapOptions> wrapOptions;
471 getWrapOptions(std::move(returnByValue), std::move(generatePreview),
473 if (!response.IsSuccess()) {
480 std::move(wrapOptions),
false ,
482 EvaluateCallbackWrapper<AwaitPromiseCallback>::wrap(std::move(
callback)));
486 const String16& expression, std::optional<String16> objectId,
487 std::unique_ptr<protocol::Array<protocol::Runtime::CallArgument>>
489 std::optional<bool> silent, std::optional<bool> returnByValue,
490 std::optional<bool> generatePreview, std::optional<bool> userGesture,
491 std::optional<bool> awaitPromise, std::optional<int> executionContextId,
492 std::optional<String16> objectGroup, std::optional<bool> throwOnSideEffect,
493 std::optional<String16> uniqueContextId,
494 std::unique_ptr<protocol::Runtime::SerializationOptions>
495 serializationOptions,
496 std::unique_ptr<CallFunctionOnCallback>
callback) {
497 int justCount = (objectId.has_value() ? 1 : 0) +
498 (executionContextId.has_value() ? 1 : 0) +
499 (uniqueContextId.has_value() ? 1 : 0);
501 callback->sendFailure(Response::InvalidParams(
502 "ObjectId, executionContextId and uniqueContextId must mutually "
503 "exclude each other"));
508 Response::InvalidParams(
"Either objectId or executionContextId or "
509 "uniqueContextId must be specified"));
513 if (objectId.has_value()) {
516 if (!response.IsSuccess()) {
521 std::unique_ptr<WrapOptions> wrapOptions;
522 response = getWrapOptions(
523 std::move(returnByValue), std::move(generatePreview),
525 if (!response.IsSuccess()) {
531 std::move(optionalArguments), silent.value_or(
false),
532 std::move(wrapOptions), userGesture.value_or(
false),
535 throwOnSideEffect.value_or(
false), std::move(
callback));
539 std::move(executionContextId),
540 std::move(uniqueContextId), &contextId);
541 if (!response.IsSuccess()) {
547 if (!response.IsSuccess()) {
552 std::unique_ptr<WrapOptions> wrapOptions;
553 response = getWrapOptions(
554 std::move(returnByValue), std::move(generatePreview),
556 if (!response.IsSuccess()) {
562 std::move(optionalArguments), silent.value_or(
false),
563 std::move(wrapOptions), userGesture.value_or(
false),
565 throwOnSideEffect.value_or(
false), std::move(
callback));
570 const String16& objectId, std::optional<bool> ownProperties,
571 std::optional<bool> accessorPropertiesOnly,
572 std::optional<bool> generatePreview,
573 std::optional<bool> nonIndexedPropertiesOnly,
574 std::unique_ptr<protocol::Array<protocol::Runtime::PropertyDescriptor>>*
577 protocol::Array<protocol::Runtime::InternalPropertyDescriptor>>*
580 protocol::Array<protocol::Runtime::PrivatePropertyDescriptor>>*
582 std::unique_ptr<protocol::Runtime::ExceptionDetails>* exceptionDetails) {
583 using protocol::Runtime::InternalPropertyDescriptor;
584 using protocol::Runtime::PrivatePropertyDescriptor;
588 if (!response.IsSuccess())
return response;
594 return Response::ServerError(
"Value with given id is not an object");
598 std::unique_ptr<WrapOptions> wrapOptions;
600 getWrapOptions(
false , std::move(generatePreview),
602 if (!response.IsSuccess())
return response;
606 accessorPropertiesOnly.value_or(
false),
607 nonIndexedPropertiesOnly.value_or(
false), *wrapOptions,
result,
609 if (!response.IsSuccess())
return response;
610 if (*exceptionDetails)
return Response::Success();
611 std::unique_ptr<protocol::Array<InternalPropertyDescriptor>>
612 internalPropertiesProtocolArray;
613 std::unique_ptr<protocol::Array<PrivatePropertyDescriptor>>
614 privatePropertiesProtocolArray;
616 object, scope.
objectGroupName(), accessorPropertiesOnly.value_or(
false),
617 &internalPropertiesProtocolArray, &privatePropertiesProtocolArray);
618 if (!response.IsSuccess())
return response;
619 if (!internalPropertiesProtocolArray->empty())
620 *internalProperties = std::move(internalPropertiesProtocolArray);
621 if (!privatePropertiesProtocolArray->empty())
622 *privateProperties = std::move(privatePropertiesProtocolArray);
623 return Response::Success();
629 if (!response.IsSuccess())
return response;
631 return Response::Success();
636 return Response::Success();
642 return Response::Success();
648 return Response::Success();
654 if (!
m_enabled)
return Response::ServerError(
"Runtime agent is not enabled");
656 return Response::Success();
661 return Response::ServerError(
662 "maxCallStackSizeToCapture should be non-negative");
666 "V8RuntimeAgentImpl::setMaxCallStackSizeToCapture",
this,
668 if (!
m_enabled)
return Response::ServerError(
"Runtime agent is not enabled");
671 return Response::Success();
678 return Response::Success();
683 std::optional<int> executionContextId, std::optional<String16>* scriptId,
684 std::unique_ptr<protocol::Runtime::ExceptionDetails>* exceptionDetails) {
685 if (!
m_enabled)
return Response::ServerError(
"Runtime agent is not enabled");
689 std::move(executionContextId),
691 if (!response.IsSuccess())
return response;
694 if (!response.IsSuccess())
return response;
705 if (!response.IsSuccess())
return response;
706 return Response::Success();
708 return Response::ServerError(
"Script compilation failed");
712 if (!persistScript)
return Response::Success();
716 std::unique_ptr<v8::Global<v8::Script>> global(
719 *scriptId = scriptValueId;
720 return Response::Success();
724 const String16& scriptId, std::optional<int> executionContextId,
725 std::optional<String16> objectGroup, std::optional<bool> silent,
726 std::optional<bool> includeCommandLineAPI,
727 std::optional<bool> returnByValue, std::optional<bool> generatePreview,
728 std::optional<bool> awaitPromise,
729 std::unique_ptr<RunScriptCallback>
callback) {
732 Response::ServerError(
"Runtime agent is not enabled"));
738 callback->sendFailure(Response::ServerError(
"No script with given id"));
744 std::move(executionContextId),
746 if (!response.IsSuccess()) {
753 if (!response.IsSuccess()) {
760 std::unique_ptr<v8::Global<v8::Script>> scriptWrapper = std::move(it->second);
763 if (script.IsEmpty()) {
764 callback->sendFailure(Response::ServerError(
"Script execution failed"));
774 maybeResultValue = script->Run(scope.
context());
780 if (!response.IsSuccess()) {
785 std::unique_ptr<WrapOptions> wrapOptions;
787 getWrapOptions(std::move(returnByValue), std::move(generatePreview),
789 if (!response.IsSuccess()) {
796 scope.
tryCatch(), objectGroup.value_or(
""),
797 *wrapOptions,
false ,
803 std::move(wrapOptions),
false ,
805 EvaluateCallbackWrapper<RunScriptCallback>::wrap(std::move(
callback)));
809 const String16& prototypeObjectId, std::optional<String16> objectGroup,
810 std::unique_ptr<protocol::Runtime::RemoteObject>* objects) {
813 if (!response.IsSuccess())
return response;
815 return Response::ServerError(
"Prototype should be instance of Object");
825 std::optional<int> executionContextId,
826 std::unique_ptr<protocol::Array<String16>>* outNames) {
829 std::move(executionContextId),
831 if (!response.IsSuccess())
return response;
835 if (!response.IsSuccess())
return response;
837 std::vector<v8::Global<v8::String>> names;
839 *outNames = std::make_unique<protocol::Array<String16>>();
840 for (
size_t i = 0;
i < names.
size(); ++
i) {
844 return Response::Success();
851 return Response::Success();
855 double* out_totalSize,
856 double* out_embedderHeapUsedSize,
857 double* out_backingStorageSize) {
860 *out_usedSize = stats.used_heap_size();
861 *out_totalSize = stats.total_heap_size();
862 *out_backingStorageSize = stats.external_memory();
868 *out_embedderHeapUsedSize = 0;
870 return Response::Success();
874 std::unique_ptr<TerminateExecutionCallback>
callback) {
885protocol::DictionaryValue* getOrCreateDictionary(
886 protocol::DictionaryValue* dict,
const String16&
key) {
887 if (protocol::DictionaryValue* bindings = dict->getObject(
key))
889 dict->setObject(
key, protocol::DictionaryValue::create());
890 return dict->getObject(
key);
895 const String16& name, std::optional<int> executionContextId,
896 std::optional<String16> executionContextName) {
897 if (executionContextId.has_value()) {
898 if (executionContextName.has_value()) {
899 return Response::InvalidParams(
900 "executionContextName is mutually exclusive with executionContextId");
902 int contextId = executionContextId.value();
906 return Response::InvalidParams(
907 "Cannot find execution context with given executionContextId");
910 return Response::Success();
916 if (executionContextName.has_value()) {
917 contextKey = executionContextName.value();
919 return Response::InvalidParams(
"Invalid executionContextName");
924 protocol::DictionaryValue* bindings =
926 protocol::DictionaryValue* contextBindings =
927 getOrCreateDictionary(bindings, contextKey);
928 contextBindings->setBoolean(name,
true);
933 if (executionContextName.has_value() &&
934 executionContextName.value() != context->humanReadableName())
936 addBinding(context, name);
938 return Response::Success();
944 if (info.Length() != 1 || !info[0]->IsString()) {
945 info.GetIsolate()->ThrowError(
946 "Invalid arguments: should be exactly one string.");
967 if (it !=
m_activeBindings.end() && it->second.count(context->contextId())) {
978 .ToLocal(&functionValue)) {
979 v8::Maybe<bool> success = global->Set(localContext, v8Name, functionValue);
983 std::unordered_set<int>(context->contextId()));
991 protocol::DictionaryValue* bindings =
993 if (bindings) bindings->remove(name);
995 return Response::Success();
1000 std::unique_ptr<protocol::Runtime::ExceptionDetails>*
1001 out_exceptionDetails) {
1004 if (!response.IsSuccess())
return response;
1007 if (!error->IsNativeError())
1008 return Response::ServerError(
"errorObjectId is not a JS error object");
1015 if (!response.IsSuccess())
return response;
1017 CHECK(*out_exceptionDetails);
1022 (*out_exceptionDetails)
1027 std::unique_ptr<protocol::DictionaryValue> data =
1030 (*out_exceptionDetails)->setExceptionMetaData(std::move(data));
1032 return Response::Success();
1037 int executionContextId) {
1039 m_frontend.bindingCalled(name, payload, executionContextId);
1044 const String16 contextName = context->humanReadableName();
1046 protocol::DictionaryValue* bindings =
1048 if (!bindings)
return;
1049 protocol::DictionaryValue* globalBindings =
1051 if (globalBindings) {
1052 for (
size_t i = 0;
i < globalBindings->
size(); ++
i)
1055 protocol::DictionaryValue* contextBindings =
1056 contextName.
isEmpty() ?
nullptr : bindings->getObject(contextName);
1057 if (contextBindings) {
1058 for (
size_t i = 0;
i < contextBindings->
size(); ++
i)
1059 addBinding(context, contextBindings->at(
i).first);
1083 if (
m_enabled)
return Response::Success();
1085 "V8RuntimeAgentImpl::enable",
this,
1096 for (
const auto& message : storage->
messages()) {
1099 return Response::Success();
1103 if (!
m_enabled)
return Response::Success();
1105 "V8RuntimeAgentImpl::disable",
this,
1118 return Response::Success();
1127 context->setReported(sessionId, false);
1137 std::unique_ptr<protocol::Runtime::ExecutionContextDescription> description =
1138 protocol::Runtime::ExecutionContextDescription::create()
1139 .setId(context->contextId())
1140 .setName(context->humanReadableName())
1141 .setOrigin(context->origin())
1142 .setUniqueId(context->uniqueId().toString())
1144 const String16& aux = context->auxData();
1146 std::vector<uint8_t> cbor;
1147 v8_crdtp::json::ConvertJSONToCBOR(
1149 description->setAuxData(protocol::DictionaryValue::cast(
1150 protocol::Value::parseBinary(cbor.data(), cbor.size())));
1152 m_frontend.executionContextCreated(std::move(description));
1159 m_frontend.executionContextDestroyed(context->contextId(),
1160 context->uniqueId().toString());
1165 std::unique_ptr<protocol::Runtime::RemoteObject> objectToInspect,
1166 std::unique_ptr<protocol::DictionaryValue> hints,
int executionContextId) {
1168 m_frontend.inspectRequested(std::move(objectToInspect), std::move(hints),
1169 executionContextId);
1177 bool generatePreview) {
static MaybeLocal< Function > New(Local< Context > context, FunctionCallback callback, Local< Value > data=Local< Value >(), int length=0, ConstructorBehavior behavior=ConstructorBehavior::kAllow, SideEffectType side_effect_type=SideEffectType::kHasSideEffect)
CppHeap * GetCppHeap() const
void GetHeapStatistics(HeapStatistics *heap_statistics)
V8_INLINE Local< S > As() const
V8_WARN_UNUSED_RESULT V8_INLINE bool ToLocal(Local< S > *out) const
V8_INLINE Local< T > ToLocalChecked()
static Local< Number > New(Isolate *isolate, double value)
static Local< Object > New(Isolate *isolate)
V8_INLINE bool IsEmpty() const
v8::Local< v8::Value > object() const
const String16 & objectGroupName() const
v8::Local< v8::Context > context() const
InjectedScript * injectedScript() const
const v8::TryCatch & tryCatch() const
void pretendUserGesture()
void ignoreExceptionsAndMuteConsole()
void installCommandLineAPI()
void allowCodeGenerationFromStrings()
Response wrapObject(v8::Local< v8::Value >, const String16 &groupName, const WrapOptions &wrapOptions, std::unique_ptr< protocol::Runtime::RemoteObject > *result)
Response getProperties(v8::Local< v8::Object >, const String16 &groupName, bool ownProperties, bool accessorPropertiesOnly, bool nonIndexedPropertiesOnly, const WrapOptions &wrapOptions, std::unique_ptr< protocol::Array< protocol::Runtime::PropertyDescriptor > > *result, std::unique_ptr< protocol::Runtime::ExceptionDetails > *)
void addPromiseCallback(V8InspectorSessionImpl *session, v8::MaybeLocal< v8::Value > value, const String16 &objectGroup, std::unique_ptr< WrapOptions > wrapOptions, bool replMode, bool throwOnSideEffect, std::shared_ptr< EvaluateCallback > callback)
Response getInternalAndPrivateProperties(v8::Local< v8::Value >, const String16 &groupName, bool accessorPropertiesOnly, std::unique_ptr< protocol::Array< protocol::Runtime::InternalPropertyDescriptor > > *internalProperties, std::unique_ptr< protocol::Array< protocol::Runtime::PrivatePropertyDescriptor > > *privateProperties)
void releaseObject(const String16 &objectId)
Response createExceptionDetails(const v8::TryCatch &, const String16 &groupName, std::unique_ptr< protocol::Runtime::ExceptionDetails > *result)
static String16 fromInteger(int)
const uint16_t * characters16() const
const std::deque< std::unique_ptr< V8ConsoleMessage > > & messages() const
Response setAsyncCallStackDepth(int depth) override
void terminateExecution(v8::Local< v8::Context > context, std::unique_ptr< TerminateExecutionCallback > callback)
v8::Local< v8::Array > queryObjects(v8::Local< v8::Context > context, v8::Local< v8::Object > prototype)
void unmuteScriptParsedEvents()
void setMaxCallStackSizeToCapture(V8RuntimeAgentImpl *, int)
void muteScriptParsedEvents()
virtual void beginEnsureAllContextsInGroup(int contextGroupId)
virtual v8::Local< v8::Context > ensureDefaultContextInGroup(int contextGroupId)
virtual void runIfWaitingForDebugger(int contextGroupId)
virtual void endEnsureAllContextsInGroup(int contextGroupId)
protocol::Response setTimeout(double timeout)
V8ConsoleMessageStorage * ensureConsoleMessageStorage(int contextGroupId)
std::unique_ptr< protocol::DictionaryValue > getAssociatedExceptionDataForProtocol(v8::Local< v8::Value > exception)
v8::MaybeLocal< v8::Script > compileScript(v8::Local< v8::Context >, const String16 &code, const String16 &fileName)
v8::Isolate * isolate() const
InspectedContext * getContext(int groupId, int contextId) const
bool hasConsoleMessageStorage(int contextGroupId)
uint64_t isolateId() override
V8InspectorClient * client()
void forEachSession(int contextGroupId, const std::function< void(V8InspectorSessionImpl *)> &callback)
int contextGroupId(v8::Local< v8::Context >) const
void forEachContext(int contextGroupId, const std::function< void(InspectedContext *)> &callback)
void releaseObjectGroup(const String16 &objectGroup)
void setCustomObjectFormatterEnabled(bool)
V8DebuggerAgentImpl * debuggerAgent()
void reportAllContexts(V8RuntimeAgentImpl *)
V8RuntimeAgentImpl * runtimeAgent()
int contextGroupId() const
Response disable() override
std::unordered_map< String16, std::unique_ptr< v8::Global< v8::Script > > > m_compiledScripts
protocol::Runtime::Frontend m_frontend
void bindingCalled(const String16 &name, const String16 &payload, int executionContextId)
std::unordered_map< String16, std::unordered_set< int > > m_activeBindings
void reportExecutionContextDestroyed(InspectedContext *)
Response getProperties(const String16 &objectId, std::optional< bool > ownProperties, std::optional< bool > accessorPropertiesOnly, std::optional< bool > generatePreview, std::optional< bool > nonIndexedPropertiesOnly, std::unique_ptr< protocol::Array< protocol::Runtime::PropertyDescriptor > > *result, std::unique_ptr< protocol::Array< protocol::Runtime::InternalPropertyDescriptor > > *internalProperties, std::unique_ptr< protocol::Array< protocol::Runtime::PrivatePropertyDescriptor > > *privateProperties, std::unique_ptr< protocol::Runtime::ExceptionDetails > *) override
bool reportMessage(V8ConsoleMessage *, bool generatePreview)
static void bindingCallback(const v8::FunctionCallbackInfo< v8::Value > &info)
void messageAdded(V8ConsoleMessage *)
Response discardConsoleEntries() override
void addBindings(InspectedContext *context)
V8InspectorSessionImpl * m_session
Response setMaxCallStackSizeToCapture(int) override
Response addBinding(const String16 &name, std::optional< int > executionContextId, std::optional< String16 > executionContextName) override
void runScript(const String16 &, std::optional< int > executionContextId, std::optional< String16 > objectGroup, std::optional< bool > silent, std::optional< bool > includeCommandLineAPI, std::optional< bool > returnByValue, std::optional< bool > generatePreview, std::optional< bool > awaitPromise, std::unique_ptr< RunScriptCallback >) override
Response globalLexicalScopeNames(std::optional< int > executionContextId, std::unique_ptr< protocol::Array< String16 > > *outNames) override
Response getHeapUsage(double *out_usedSize, double *out_totalSize, double *out_embedderHeapUsedSize, double *out_backingStorageSize) override
Response queryObjects(const String16 &prototypeObjectId, std::optional< String16 > objectGroup, std::unique_ptr< protocol::Runtime::RemoteObject > *objects) override
Response compileScript(const String16 &expression, const String16 &sourceURL, bool persistScript, std::optional< int > executionContextId, std::optional< String16 > *, std::unique_ptr< protocol::Runtime::ExceptionDetails > *) override
Response runIfWaitingForDebugger() override
std::shared_ptr< V8DebuggerBarrier > m_debuggerBarrier
void awaitPromise(const String16 &promiseObjectId, std::optional< bool > returnByValue, std::optional< bool > generatePreview, std::unique_ptr< AwaitPromiseCallback >) override
~V8RuntimeAgentImpl() override
Response enable() override
void reportExecutionContextCreated(InspectedContext *)
Response releaseObjectGroup(const String16 &objectGroup) override
Response setCustomObjectFormatterEnabled(bool) override
V8RuntimeAgentImpl(V8InspectorSessionImpl *, protocol::FrontendChannel *, protocol::DictionaryValue *state, std::shared_ptr< V8DebuggerBarrier >)
void terminateExecution(std::unique_ptr< TerminateExecutionCallback > callback) override
protocol::DictionaryValue * m_state
void evaluate(const String16 &expression, std::optional< String16 > objectGroup, std::optional< bool > includeCommandLineAPI, std::optional< bool > silent, std::optional< int > executionContextId, std::optional< bool > returnByValue, std::optional< bool > generatePreview, std::optional< bool > userGesture, std::optional< bool > awaitPromise, std::optional< bool > throwOnSideEffect, std::optional< double > timeout, std::optional< bool > disableBreaks, std::optional< bool > replMode, std::optional< bool > allowUnsafeEvalBlockedByCSP, std::optional< String16 > uniqueContextId, std::unique_ptr< protocol::Runtime::SerializationOptions > serializationOptions, std::unique_ptr< EvaluateCallback >) override
void callFunctionOn(const String16 &expression, std::optional< String16 > objectId, std::unique_ptr< protocol::Array< protocol::Runtime::CallArgument > > optionalArguments, std::optional< bool > silent, std::optional< bool > returnByValue, std::optional< bool > generatePreview, std::optional< bool > userGesture, std::optional< bool > awaitPromise, std::optional< int > executionContextId, std::optional< String16 > objectGroup, std::optional< bool > throwOnSideEffect, std::optional< String16 > uniqueContextId, std::unique_ptr< protocol::Runtime::SerializationOptions > serializationOptions, std::unique_ptr< CallFunctionOnCallback >) override
V8InspectorImpl * m_inspector
Response getExceptionDetails(const String16 &errorObjectId, std::unique_ptr< protocol::Runtime::ExceptionDetails > *out_exceptionDetails) override
Response getIsolateId(String16 *outIsolateId) override
void inspect(std::unique_ptr< protocol::Runtime::RemoteObject > objectToInspect, std::unique_ptr< protocol::DictionaryValue > hints, int executionContextId)
Response releaseObject(const String16 &objectId) override
Response removeBinding(const String16 &name) override
static constexpr int kDefaultMaxCallStackSizeToCapture
base::Vector< const DirectHandle< Object > > args
refactor address components for immediate indexing make OptimizeMaglevOnNextCall optimize to turbofan instead of maglev filter for tracing turbofan compilation nullptr
ZoneVector< RpoNumber > & result
constexpr Vector< T > VectorOf(T *start, size_t size)
MaybeLocal< Value > CallFunctionOn(Local< Context > context, Local< Function > function, Local< Value > recv, base::Vector< Local< Value > > args, bool throw_on_side_effect)
@ kDisableBreaksAndThrowOnSideEffect
void GlobalLexicalScopeNames(v8::Local< v8::Context > v8_context, std::vector< v8::Global< v8::String > > *names)
MaybeLocal< v8::Value > EvaluateGlobal(v8::Isolate *isolate, v8::Local< v8::String > source, EvaluateGlobalMode mode, bool repl)
v8_inspector::V8Inspector * GetInspector(Isolate *isolate)
v8::Local< v8::Message > CreateMessageFromException(Isolate *v8_isolate, v8::Local< v8::Value > v8_error)
static const char runtimeEnabled[]
static const char globalBindingsKey[]
static const char customObjectFormatterEnabled[]
static const char bindings[]
static const char maxCallStackSizeToCapture[]
String16 toProtocolString(v8::Isolate *isolate, v8::Local< v8::String > value)
v8::Local< v8::String > toV8String(v8::Isolate *isolate, const String16 &string)
V8_INLINE Local< Primitive > Null(Isolate *isolate)
bool ToLocal(v8::internal::MaybeDirectHandle< v8::internal::Object > maybe, Local< T > *local)
#define TRACE_EVENT0(category_group, name)
#define TRACE_DISABLED_BY_DEFAULT(name)
#define TRACE_EVENT_WITH_FLOW0(category_group, name, bind_id, flow_flags)
#define TRACE_EVENT_WITH_FLOW1(category_group, name, bind_id, flow_flags, arg1_name, arg1_val)
#define TRACE_EVENT_FLAG_FLOW_OUT
#define TRACE_EVENT_FLAG_FLOW_IN
V8InspectorImpl * m_inspector
V8InspectorSessionImpl * m_session
protocol::HeapProfiler::Frontend * m_frontend
std::unique_ptr< ProtocolCallback > m_callback
std::unique_ptr< ValueMirror > key