Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(744)

Unified Diff: Source/core/inspector/InjectedScript.cpp

Issue 1689873002: Enable inspector tests disabled when dart:html was switched to JS interop. (Closed) Base URL: svn://svn.chromium.org/blink/branches/dart/2454_1
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/inspector/InjectedScript.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/inspector/InjectedScript.cpp
diff --git a/Source/core/inspector/InjectedScript.cpp b/Source/core/inspector/InjectedScript.cpp
index 363be6a0266303ebfc6ba7fd9c0a69bce6f46960..e11798ec5d1ad5fa18e9f58e9b1f6063f29f738f 100644
--- a/Source/core/inspector/InjectedScript.cpp
+++ b/Source/core/inspector/InjectedScript.cpp
@@ -42,6 +42,17 @@
#include "platform/JSONValues.h"
#include "wtf/text/WTFString.h"
+// Includes added for Dart
+#include "bindings/core/dart/DartHandleProxy.h"
+#include "bindings/core/dart/DartInjectedScript.h"
+#include "bindings/core/dart/DartInjectedScriptManager.h"
+#include "bindings/core/dart/DartPersistentValue.h"
+#include "bindings/core/dart/DartScriptDebugServer.h"
+#include "bindings/core/v8/V8RecursionScope.h"
+
+#include <dart_api.h>
+// End of includes added for Dart
+
using blink::TypeBuilder::Array;
using blink::TypeBuilder::Debugger::CallFrame;
using blink::TypeBuilder::Debugger::CollectionEntry;
@@ -375,6 +386,31 @@ PassRefPtr<Array<CallFrame> > InjectedScript::wrapCallFrames(const ScriptValue&
PassRefPtr<TypeBuilder::Runtime::RemoteObject> InjectedScript::wrapObject(const ScriptValue& value, const String& groupName, bool generatePreview) const
{
ASSERT(!isEmpty());
+
+ {
+ // Start of Dart specific code.
+ // This code is required to make objects logged to the console show up with a Dart view.
+ // This hack should go away once custom formatter code is available in Chrome 47.
+
+ ScriptState* state = value.scriptState();
+ v8::Context::Scope v8Scope(state->context());
+
+ v8::Handle<v8::Value> v8Handle = value.v8Value();
+ if (v8Handle->IsObject()) {
+ if (DartHandleProxy::isDartProxy(v8Handle, state->isolate())) {
+ DartPersistentValue* dartPersistentValue = DartHandleProxy::readPointerFromProxy(v8Handle);
+ // If the isolate is dead we fall back to the default JS view of the Dart object.
+ if (dartPersistentValue->isIsolateAlive()) {
+ DartScopes scopes(v8Handle.As<v8::Object>());
+ DartScriptState* scriptState = DartUtilities::currentDartScriptState();
+ DartInjectedScript* dartInjectedScript = DartScriptDebugServer::shared().injectedScriptManager()->injectedScriptFor(scriptState);
+ return dartInjectedScript->wrapDartObject(dartPersistentValue->value(), groupName, generatePreview);
+ }
+ }
+ }
+ }
+ // End of Dart specific code.
+
ScriptFunctionCall wrapFunction(injectedScriptObject(), "wrapObject");
wrapFunction.appendArgument(value);
wrapFunction.appendArgument(groupName);
« no previous file with comments | « Source/core/inspector/InjectedScript.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698