JSGlobalObjectDebuggerAgent.cpp [plain text]
#include "config.h"
#include "JSGlobalObjectDebuggerAgent.h"
#include "ConsoleMessage.h"
#include "InjectedScriptManager.h"
#include "InspectorConsoleAgent.h"
#include "JSGlobalObjectDebugger.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(Protocol::ErrorString& errorString, Optional<Protocol::Runtime::ExecutionContextId>&& executionContextId)
{
if (executionContextId) {
errorString = "executionContextId is not supported for JSContexts as there is only one execution context"_s;
return InjectedScript();
}
JSGlobalObject& globalObject = static_cast<JSGlobalObjectDebugger&>(debugger()).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));
}
}