| Index: Source/bindings/dart/custom/DartInjectedScriptHostCustom.cpp
|
| diff --git a/Source/bindings/dart/custom/DartInjectedScriptHostCustom.cpp b/Source/bindings/dart/custom/DartInjectedScriptHostCustom.cpp
|
| index fc6441ee8df5fbcf956db7a318a965f7148179f9..054d718db78b4e8043bb5b8add01d50db480b130 100644
|
| --- a/Source/bindings/dart/custom/DartInjectedScriptHostCustom.cpp
|
| +++ b/Source/bindings/dart/custom/DartInjectedScriptHostCustom.cpp
|
| @@ -28,17 +28,62 @@
|
| // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
| #include "config.h"
|
| -
|
| #include "DartInjectedScriptHost.h"
|
|
|
| +#include "DartNode.h"
|
| +
|
| +#include "bindings/dart/DartDOMWrapper.h"
|
| +#include "bindings/dart/DartHandleProxy.h"
|
| +#include "bindings/dart/DartInjectedScript.h"
|
| +#include "bindings/dart/V8Converter.h"
|
| +#include "core/events/EventTarget.h"
|
| +#include "core/frame/DOMWindow.h"
|
| +#include "core/inspector/InjectedScript.h"
|
| +#include "core/inspector/InjectedScriptHost.h"
|
| +#include "core/inspector/InspectorDOMAgent.h"
|
| +#include "modules/webdatabase/Database.h"
|
| +#include "platform/JSONValues.h"
|
| +
|
| namespace WebCore {
|
|
|
| namespace DartInjectedScriptHostInternal {
|
|
|
| void inspectCallback(Dart_NativeArguments args)
|
| {
|
| - // FIXME: proper implementation.
|
| - DART_UNIMPLEMENTED();
|
| + Dart_Handle exception = 0;
|
| + {
|
| + InjectedScriptHost* receiver = DartDOMWrapper::receiver< InjectedScriptHost >(args);
|
| + Dart_Handle receiverHandle = Dart_GetNativeArgument(args, 0);
|
| + ASSERT(!Dart_IsError(receiverHandle));
|
| + DartInjectedScript* injectedScript = 0;
|
| + // FIXME: this is a hack. For convenience we store the
|
| + // DartInjectedScript as the Dart_Peer of the InjectedScriptHost object
|
| + // and use it to generate JSON from the Dart_Handle. This differs from
|
| + // the behavior of V8InjectedScriptHost which assumes the argument
|
| + // passed as an argument is already JSON. To handle things in the same
|
| + // way as JavaScript we would need to generate a DartInjectedScript
|
| + // Dart class. I have put off implementing the correct solution as the
|
| + // way native binding classes are done for Dartium is in flux at the
|
| + // moment.
|
| + Dart_Handle ALLOW_UNUSED result = Dart_GetPeer(receiverHandle, reinterpret_cast<void**>(&injectedScript));
|
| + if (Dart_IsError(result)) {
|
| + exception = result;
|
| + goto fail;
|
| + }
|
| + ASSERT(injectedScript);
|
| + Dart_Handle object = Dart_GetNativeArgument(args, 1);
|
| + // FIXME: read in the hint argument as well.
|
| + ASSERT(!Dart_IsError(object));
|
| + receiver->inspectImpl(injectedScript->wrapDartObject(object, "", false),
|
| + JSONObject::create());
|
| +
|
| + if (exception)
|
| + goto fail;
|
| + return;
|
| + }
|
| +
|
| +fail:
|
| + Dart_ThrowException(exception);
|
| }
|
|
|
| void inspectedObjectCallback(Dart_NativeArguments args)
|
| @@ -127,4 +172,4 @@ void setFunctionVariableValueCallback(Dart_NativeArguments args)
|
|
|
| }
|
|
|
| -}
|
| +} // namespace WebCore
|
|
|