Add JS agent support

Summary:
Adds the possibility to define agents in Javascript. Javascript agents are simple classes that extend `InspectorAgent` and pass down the
given `EventSender` to the super constructor. The library will then call methods on the object for each received method call over the protocol.

Reviewed By: davidaurelio

Differential Revision: D4021508

fbshipit-source-id: bbe609e92ea726cbbbec833df81705ebd3346c77
This commit is contained in:
Alexander Blom
2016-11-02 12:18:16 -07:00
committed by Facebook Github Bot
parent 27f504e9e3
commit 6a1783210b
5 changed files with 244 additions and 0 deletions

View File

@@ -8,6 +8,7 @@
#include "InspectorAgent.h"
#include "PageAgent.h"
#include "ConsoleAgent.h"
#include "JSDispatcher.h"
#include "LegacyAgents.h"
#include <folly/Memory.h>
@@ -142,6 +143,7 @@ InspectorController::InspectorController(JSC::JSGlobalObject& globalObject)
dispatchers_.push_back(std::move(inspectorAgent));
dispatchers_.push_back(folly::make_unique<SchemaAgent>());
dispatchers_.push_back(folly::make_unique<PageAgent>());
dispatchers_.push_back(folly::make_unique<JSDispatcher>(globalObject));
auto consoleAgent = folly::make_unique<ConsoleAgent>(globalObject, environment->injectedScriptManager());
auto legacyAgents = folly::make_unique<LegacyAgents>(globalObject, std::move(environment), consoleAgent.get());