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