InspectorAuditAgent.h [plain text]
#pragma once
#include "InspectorAgentBase.h"
#include "InspectorBackendDispatchers.h"
#include "JSCInlines.h"
#include <wtf/FastMalloc.h>
#include <wtf/Forward.h>
#include <wtf/Noncopyable.h>
namespace JSC {
class Debugger;
}
namespace Inspector {
class InjectedScript;
class InjectedScriptManager;
class JS_EXPORT_PRIVATE InspectorAuditAgent : public InspectorAgentBase, public AuditBackendDispatcherHandler {
WTF_MAKE_NONCOPYABLE(InspectorAuditAgent);
WTF_MAKE_FAST_ALLOCATED;
public:
~InspectorAuditAgent() override;
void didCreateFrontendAndBackend(FrontendRouter*, BackendDispatcher*) final;
void willDestroyFrontendAndBackend(DisconnectReason) final;
Protocol::ErrorStringOr<void> setup(Optional<Protocol::Runtime::ExecutionContextId>&&) final;
Protocol::ErrorStringOr<std::tuple<Ref<Protocol::Runtime::RemoteObject>, Optional<bool> >> run(const String& test, Optional<Protocol::Runtime::ExecutionContextId>&&) final;
Protocol::ErrorStringOr<void> teardown() final;
bool hasActiveAudit() const;
protected:
InspectorAuditAgent(AgentContext&);
InjectedScriptManager& injectedScriptManager() { return m_injectedScriptManager; }
virtual InjectedScript injectedScriptForEval(Protocol::ErrorString&, Optional<Protocol::Runtime::ExecutionContextId>&&) = 0;
virtual void populateAuditObject(JSC::JSGlobalObject*, JSC::Strong<JSC::JSObject>& auditObject);
virtual void muteConsole() { };
virtual void unmuteConsole() { };
private:
RefPtr<AuditBackendDispatcher> m_backendDispatcher;
InjectedScriptManager& m_injectedScriptManager;
JSC::Debugger& m_debugger;
JSC::Strong<JSC::JSObject> m_injectedWebInspectorAuditValue;
};
}