WorkerDebuggerAgent.cpp [plain text]
#include "config.h"
#include "WorkerDebuggerAgent.h"
#include "ScriptState.h"
#include "WorkerGlobalScope.h"
#include <inspector/ConsoleMessage.h>
#include <inspector/InjectedScript.h>
#include <inspector/InjectedScriptManager.h>
#include <inspector/ScriptCallStack.h>
#include <inspector/ScriptCallStackFactory.h>
using namespace JSC;
using namespace Inspector;
namespace WebCore {
WorkerDebuggerAgent::WorkerDebuggerAgent(WorkerAgentContext& context)
: WebDebuggerAgent(context)
, m_workerGlobalScope(context.workerGlobalScope)
{
}
WorkerDebuggerAgent::~WorkerDebuggerAgent()
{
}
void WorkerDebuggerAgent::breakpointActionLog(ExecState& state, const String& message)
{
m_workerGlobalScope.addConsoleMessage(std::make_unique<ConsoleMessage>(MessageSource::JS, MessageType::Log, MessageLevel::Log, message, createScriptCallStack(&state, ScriptCallStack::maxCallStackSizeToCapture)));
}
InjectedScript WorkerDebuggerAgent::injectedScriptForEval(ErrorString& errorString, const int* executionContextId)
{
if (executionContextId) {
errorString = ASCIILiteral("Execution context id is not supported for workers as there is only one execution context.");
return InjectedScript();
}
JSC::ExecState* scriptState = execStateFromWorkerGlobalScope(&m_workerGlobalScope);
return injectedScriptManager().injectedScriptFor(scriptState);
}
}