#include "src/inspector/v8-console.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/base/lazy-instance.h"
#include "src/base/macros.h"
#include "src/debug/debug-interface.h"
#include "src/inspector/injected-script.h"
#include "src/inspector/inspected-context.h"
#include "src/inspector/string-util.h"
#include "src/inspector/v8-console-message.h"
#include "src/inspector/v8-debugger-agent-impl.h"
#include "src/inspector/v8-inspector-impl.h"
#include "src/inspector/v8-inspector-session-impl.h"
#include "src/inspector/v8-profiler-agent-impl.h"
#include "src/inspector/v8-runtime-agent-impl.h"
#include "src/inspector/v8-stack-trace-impl.h"
#include "src/inspector/v8-value-utils.h"
#include "src/tracing/trace-event.h"
namespace v8_inspector {
namespace {
String16 consoleContextToString(
v8::Isolate* isolate, const v8::debug::ConsoleContext& consoleContext) { … }
class ConsoleHelper { … };
void createBoundFunctionProperty(
v8::Local<v8::Context> context, v8::Local<v8::Object> console,
v8::Local<v8::Value> data, const char* name, v8::FunctionCallback callback,
v8::SideEffectType side_effect_type = v8::SideEffectType::kHasSideEffect) { … }
enum InspectRequest { … };
}
V8Console::V8Console(V8InspectorImpl* inspector) : … { … }
void V8Console::Debug(const v8::debug::ConsoleCallArguments& info,
const v8::debug::ConsoleContext& consoleContext) { … }
void V8Console::Error(const v8::debug::ConsoleCallArguments& info,
const v8::debug::ConsoleContext& consoleContext) { … }
void V8Console::Info(const v8::debug::ConsoleCallArguments& info,
const v8::debug::ConsoleContext& consoleContext) { … }
void V8Console::Log(const v8::debug::ConsoleCallArguments& info,
const v8::debug::ConsoleContext& consoleContext) { … }
void V8Console::Warn(const v8::debug::ConsoleCallArguments& info,
const v8::debug::ConsoleContext& consoleContext) { … }
void V8Console::Dir(const v8::debug::ConsoleCallArguments& info,
const v8::debug::ConsoleContext& consoleContext) { … }
void V8Console::DirXml(const v8::debug::ConsoleCallArguments& info,
const v8::debug::ConsoleContext& consoleContext) { … }
void V8Console::Table(const v8::debug::ConsoleCallArguments& info,
const v8::debug::ConsoleContext& consoleContext) { … }
void V8Console::Trace(const v8::debug::ConsoleCallArguments& info,
const v8::debug::ConsoleContext& consoleContext) { … }
void V8Console::Group(const v8::debug::ConsoleCallArguments& info,
const v8::debug::ConsoleContext& consoleContext) { … }
void V8Console::GroupCollapsed(
const v8::debug::ConsoleCallArguments& info,
const v8::debug::ConsoleContext& consoleContext) { … }
void V8Console::GroupEnd(const v8::debug::ConsoleCallArguments& info,
const v8::debug::ConsoleContext& consoleContext) { … }
void V8Console::Clear(const v8::debug::ConsoleCallArguments& info,
const v8::debug::ConsoleContext& consoleContext) { … }
void V8Console::Count(const v8::debug::ConsoleCallArguments& info,
const v8::debug::ConsoleContext& consoleContext) { … }
void V8Console::CountReset(const v8::debug::ConsoleCallArguments& info,
const v8::debug::ConsoleContext& consoleContext) { … }
void V8Console::Assert(const v8::debug::ConsoleCallArguments& info,
const v8::debug::ConsoleContext& consoleContext) { … }
void V8Console::Profile(const v8::debug::ConsoleCallArguments& info,
const v8::debug::ConsoleContext& consoleContext) { … }
void V8Console::ProfileEnd(const v8::debug::ConsoleCallArguments& info,
const v8::debug::ConsoleContext& consoleContext) { … }
void V8Console::Time(const v8::debug::ConsoleCallArguments& info,
const v8::debug::ConsoleContext& consoleContext) { … }
void V8Console::TimeLog(const v8::debug::ConsoleCallArguments& info,
const v8::debug::ConsoleContext& consoleContext) { … }
void V8Console::TimeEnd(const v8::debug::ConsoleCallArguments& info,
const v8::debug::ConsoleContext& consoleContext) { … }
void V8Console::TimeStamp(const v8::debug::ConsoleCallArguments& info,
const v8::debug::ConsoleContext& consoleContext) { … }
void V8Console::memoryGetterCallback(
const v8::FunctionCallbackInfo<v8::Value>& info) { … }
void V8Console::memorySetterCallback(
const v8::FunctionCallbackInfo<v8::Value>& info) { … }
void V8Console::createTask(const v8::FunctionCallbackInfo<v8::Value>& info) { … }
void V8Console::runTask(const v8::FunctionCallbackInfo<v8::Value>& info) { … }
v8::Local<v8::Private> V8Console::taskInfoKey() { … }
v8::Local<v8::ObjectTemplate> V8Console::taskTemplate() { … }
void V8Console::cancelConsoleTask(TaskInfo* taskInfo) { … }
namespace {
void cleanupTaskInfo(const v8::WeakCallbackInfo<TaskInfo>& info) { … }
}
TaskInfo::TaskInfo(v8::Isolate* isolate, V8Console* console,
v8::Local<v8::Object> task)
: … { … }
void V8Console::keysCallback(const v8::FunctionCallbackInfo<v8::Value>& info,
int sessionId) { … }
void V8Console::valuesCallback(const v8::FunctionCallbackInfo<v8::Value>& info,
int sessionId) { … }
static void setFunctionBreakpoint(ConsoleHelper& helper, int sessionId,
v8::Local<v8::Function> function,
V8DebuggerAgentImpl::BreakpointSource source,
v8::Local<v8::String> condition,
bool enable) { … }
void V8Console::debugFunctionCallback(
const v8::FunctionCallbackInfo<v8::Value>& info, int sessionId) { … }
void V8Console::undebugFunctionCallback(
const v8::FunctionCallbackInfo<v8::Value>& info, int sessionId) { … }
void V8Console::monitorFunctionCallback(
const v8::FunctionCallbackInfo<v8::Value>& info, int sessionId) { … }
void V8Console::unmonitorFunctionCallback(
const v8::FunctionCallbackInfo<v8::Value>& info, int sessionId) { … }
void V8Console::lastEvaluationResultCallback(
const v8::FunctionCallbackInfo<v8::Value>& info, int sessionId) { … }
static void inspectImpl(const v8::FunctionCallbackInfo<v8::Value>& info,
v8::Local<v8::Value> value, int sessionId,
InspectRequest request, V8InspectorImpl* inspector) { … }
void V8Console::inspectCallback(const v8::FunctionCallbackInfo<v8::Value>& info,
int sessionId) { … }
void V8Console::copyCallback(const v8::FunctionCallbackInfo<v8::Value>& info,
int sessionId) { … }
void V8Console::queryObjectsCallback(
const v8::FunctionCallbackInfo<v8::Value>& info, int sessionId) { … }
void V8Console::inspectedObject(const v8::FunctionCallbackInfo<v8::Value>& info,
int sessionId, unsigned num) { … }
void V8Console::installMemoryGetter(v8::Local<v8::Context> context,
v8::Local<v8::Object> console) { … }
void V8Console::installAsyncStackTaggingAPI(v8::Local<v8::Context> context,
v8::Local<v8::Object> console) { … }
v8::Local<v8::Object> V8Console::createCommandLineAPI(
v8::Local<v8::Context> context, int sessionId) { … }
static bool isCommandLineAPIGetter(const String16& name) { … }
void V8Console::CommandLineAPIScope::accessorGetterCallback(
v8::Local<v8::Name> name, const v8::PropertyCallbackInfo<v8::Value>& info) { … }
void V8Console::CommandLineAPIScope::accessorSetterCallback(
v8::Local<v8::Name> name, v8::Local<v8::Value> value,
const v8::PropertyCallbackInfo<void>& info) { … }
namespace {
DEFINE_LAZY_LEAKY_OBJECT_GETTER(…)
bool IsUnsafeCommandLineAPIFn(v8::Local<v8::Value> name, v8::Isolate* isolate) { … }
}
V8Console::CommandLineAPIScope::CommandLineAPIScope(
v8::Local<v8::Context> context, v8::Local<v8::Object> commandLineAPI,
v8::Local<v8::Object> global)
: … { … }
V8Console::CommandLineAPIScope::~CommandLineAPIScope() { … }
}