JSGlobalObjectDebuggerAgent.cpp [plain text]
#include "config.h"
#include "JSGlobalObjectDebuggerAgent.h"
#include "ConsoleMessage.h"
#include "InjectedScriptManager.h"
#include "InspectorConsoleAgent.h"
#include "JSGlobalObject.h"
#include "ScriptArguments.h"
#include "ScriptCallStack.h"
#include "ScriptCallStackFactory.h"
using namespace JSC;
namespace Inspector {
JSGlobalObjectDebuggerAgent::JSGlobalObjectDebuggerAgent(JSAgentContext& context, InspectorConsoleAgent* consoleAgent)
: InspectorDebuggerAgent(context)
, m_consoleAgent(consoleAgent)
{
}
InjectedScript JSGlobalObjectDebuggerAgent::injectedScriptForEval(ErrorString& error, const int* executionContextId)
{
if (executionContextId) {
error = ASCIILiteral("Execution context id is not supported for JSContext inspection as there is only one execution context.");
return InjectedScript();
}
ExecState* exec = static_cast<JSGlobalObjectScriptDebugServer&>(scriptDebugServer()).globalObject().globalExec();
return injectedScriptManager().injectedScriptFor(exec);
}
void JSGlobalObjectDebuggerAgent::breakpointActionLog(JSC::ExecState& state, const String& message)
{
m_consoleAgent->addMessageToConsole(std::make_unique<ConsoleMessage>(MessageSource::JS, MessageType::Log, MessageLevel::Log, message, createScriptCallStack(&state, ScriptCallStack::maxCallStackSizeToCapture), 0));
}
}