#include "src/inspector/injected-script.h"
#include <cmath>
#include <memory>
#include <unordered_set>
#include "../../third_party/inspector_protocol/crdtp/json.h"
#include "include/v8-container.h"
#include "include/v8-context.h"
#include "include/v8-function.h"
#include "include/v8-inspector.h"
#include "include/v8-microtask-queue.h"
#include "src/debug/debug-interface.h"
#include "src/inspector/custom-preview.h"
#include "src/inspector/inspected-context.h"
#include "src/inspector/protocol/Protocol.h"
#include "src/inspector/remote-object-id.h"
#include "src/inspector/string-util.h"
#include "src/inspector/v8-console.h"
#include "src/inspector/v8-debugger.h"
#include "src/inspector/v8-inspector-impl.h"
#include "src/inspector/v8-inspector-session-impl.h"
#include "src/inspector/v8-serialization-duplicate-tracker.h"
#include "src/inspector/v8-stack-trace-impl.h"
#include "src/inspector/v8-value-utils.h"
#include "src/inspector/value-mirror.h"
namespace v8_inspector {
namespace {
const char kGlobalHandleLabel[] = …;
bool isResolvableNumberLike(String16 query) { … }
}
Array;
Maybe;
InternalPropertyDescriptor;
PrivatePropertyDescriptor;
PropertyDescriptor;
RemoteObject;
void EvaluateCallback::sendSuccess(
std::weak_ptr<EvaluateCallback> callback, InjectedScript* injectedScript,
std::unique_ptr<protocol::Runtime::RemoteObject> result,
protocol::Maybe<protocol::Runtime::ExceptionDetails> exceptionDetails) { … }
void EvaluateCallback::sendFailure(std::weak_ptr<EvaluateCallback> callback,
InjectedScript* injectedScript,
const protocol::DispatchResponse& response) { … }
class InjectedScript::ProtocolPromiseHandler { … };
InjectedScript::InjectedScript(InspectedContext* context, int sessionId)
: … { … }
InjectedScript::~InjectedScript() { … }
namespace {
class PropertyAccumulator : public ValueMirror::PropertyAccumulator { … };
}
Response InjectedScript::getProperties(
v8::Local<v8::Object> object, const String16& groupName, bool ownProperties,
bool accessorPropertiesOnly, bool nonIndexedPropertiesOnly,
const WrapOptions& wrapOptions,
std::unique_ptr<Array<PropertyDescriptor>>* properties,
Maybe<protocol::Runtime::ExceptionDetails>* exceptionDetails) { … }
Response InjectedScript::getInternalAndPrivateProperties(
v8::Local<v8::Value> value, const String16& groupName,
bool accessorPropertiesOnly,
std::unique_ptr<protocol::Array<InternalPropertyDescriptor>>*
internalProperties,
std::unique_ptr<protocol::Array<PrivatePropertyDescriptor>>*
privateProperties) { … }
void InjectedScript::releaseObject(const String16& objectId) { … }
Response InjectedScript::wrapObject(
v8::Local<v8::Value> value, const String16& groupName,
const WrapOptions& wrapOptions,
std::unique_ptr<protocol::Runtime::RemoteObject>* result) { … }
Response InjectedScript::wrapObject(
v8::Local<v8::Value> value, const String16& groupName,
const WrapOptions& wrapOptions,
v8::MaybeLocal<v8::Value> customPreviewConfig, int maxCustomPreviewDepth,
std::unique_ptr<protocol::Runtime::RemoteObject>* result) { … }
Response InjectedScript::wrapObjectMirror(
const ValueMirror& mirror, const String16& groupName,
const WrapOptions& wrapOptions,
v8::MaybeLocal<v8::Value> customPreviewConfig, int maxCustomPreviewDepth,
std::unique_ptr<protocol::Runtime::RemoteObject>* result) { … }
std::unique_ptr<protocol::Runtime::RemoteObject> InjectedScript::wrapTable(
v8::Local<v8::Object> table, v8::MaybeLocal<v8::Array> maybeColumns) { … }
void InjectedScript::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) { … }
void InjectedScript::discardEvaluateCallbacks() { … }
void InjectedScript::deleteEvaluateCallback(
std::shared_ptr<EvaluateCallback> callback) { … }
Response InjectedScript::findObject(const RemoteObjectId& objectId,
v8::Local<v8::Value>* outObject) const { … }
String16 InjectedScript::objectGroupName(const RemoteObjectId& objectId) const { … }
void InjectedScript::releaseObjectGroup(const String16& objectGroup) { … }
void InjectedScript::setCustomObjectFormatterEnabled(bool enabled) { … }
v8::Local<v8::Value> InjectedScript::lastEvaluationResult() const { … }
void InjectedScript::setLastEvaluationResult(v8::Local<v8::Value> result) { … }
Response InjectedScript::resolveCallArgument(
protocol::Runtime::CallArgument* callArgument,
v8::Local<v8::Value>* result) { … }
Response InjectedScript::addExceptionToDetails(
v8::Local<v8::Value> exception,
protocol::Runtime::ExceptionDetails* exceptionDetails,
const String16& objectGroup) { … }
Response InjectedScript::createExceptionDetails(
const v8::TryCatch& tryCatch, const String16& objectGroup,
Maybe<protocol::Runtime::ExceptionDetails>* result) { … }
Response InjectedScript::createExceptionDetails(
v8::Local<v8::Message> message, v8::Local<v8::Value> exception,
const String16& objectGroup,
Maybe<protocol::Runtime::ExceptionDetails>* result) { … }
Response InjectedScript::wrapEvaluateResult(
v8::MaybeLocal<v8::Value> maybeResultValue, const v8::TryCatch& tryCatch,
const String16& objectGroup, const WrapOptions& wrapOptions,
bool throwOnSideEffect,
std::unique_ptr<protocol::Runtime::RemoteObject>* result,
Maybe<protocol::Runtime::ExceptionDetails>* exceptionDetails) { … }
v8::Local<v8::Object> InjectedScript::commandLineAPI() { … }
InjectedScript::Scope::Scope(V8InspectorSessionImpl* session)
: … { … }
Response InjectedScript::Scope::initialize() { … }
void InjectedScript::Scope::installCommandLineAPI() { … }
void InjectedScript::Scope::ignoreExceptionsAndMuteConsole() { … }
v8::debug::ExceptionBreakState InjectedScript::Scope::setPauseOnExceptionsState(
v8::debug::ExceptionBreakState newState) { … }
void InjectedScript::Scope::pretendUserGesture() { … }
void InjectedScript::Scope::allowCodeGenerationFromStrings() { … }
void InjectedScript::Scope::setTryCatchVerbose() { … }
void InjectedScript::Scope::cleanup() { … }
InjectedScript::Scope::~Scope() { … }
InjectedScript::ContextScope::ContextScope(V8InspectorSessionImpl* session,
int executionContextId)
: … { … }
InjectedScript::ContextScope::~ContextScope() = default;
Response InjectedScript::ContextScope::findInjectedScript(
V8InspectorSessionImpl* session) { … }
InjectedScript::ObjectScope::ObjectScope(V8InspectorSessionImpl* session,
const String16& remoteObjectId)
: … { … }
InjectedScript::ObjectScope::~ObjectScope() = default;
Response InjectedScript::ObjectScope::findInjectedScript(
V8InspectorSessionImpl* session) { … }
InjectedScript::CallFrameScope::CallFrameScope(V8InspectorSessionImpl* session,
const String16& remoteObjectId)
: … { … }
InjectedScript::CallFrameScope::~CallFrameScope() = default;
Response InjectedScript::CallFrameScope::findInjectedScript(
V8InspectorSessionImpl* session) { … }
String16 InjectedScript::bindObject(v8::Local<v8::Value> value,
const String16& groupName) { … }
Response InjectedScript::bindRemoteObjectIfNeeded(
int sessionId, v8::Local<v8::Context> context, v8::Local<v8::Value> value,
const String16& groupName, protocol::Runtime::RemoteObject* remoteObject) { … }
void InjectedScript::unbindObject(int id) { … }
PromiseHandlerTracker::PromiseHandlerTracker() = default;
PromiseHandlerTracker::~PromiseHandlerTracker() { … }
template <typename... Args>
PromiseHandlerTracker::Id PromiseHandlerTracker::create(Args&&... args) { … }
void PromiseHandlerTracker::discard(Id id, DiscardReason reason) { … }
InjectedScript::ProtocolPromiseHandler* PromiseHandlerTracker::get(
Id id) const { … }
void PromiseHandlerTracker::sendFailure(
InjectedScript::ProtocolPromiseHandler* handler,
const protocol::DispatchResponse& response) const { … }
void PromiseHandlerTracker::discardAll() { … }
}