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

Unified Diff: Source/bindings/core/v8/custom/V8InjectedScriptHostCustom.cpp

Issue 289423002: DevTools: added injectedScript.evaluateWithDetails, that return exception details if it occured (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 5 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
Index: Source/bindings/core/v8/custom/V8InjectedScriptHostCustom.cpp
diff --git a/Source/bindings/core/v8/custom/V8InjectedScriptHostCustom.cpp b/Source/bindings/core/v8/custom/V8InjectedScriptHostCustom.cpp
index 24dd7ba466baecd4f333a263c779a8bda801851d..9dcac6862150fb2b248b48c7bbb5bd3546203e3a 100644
--- a/Source/bindings/core/v8/custom/V8InjectedScriptHostCustom.cpp
+++ b/Source/bindings/core/v8/custom/V8InjectedScriptHostCustom.cpp
@@ -32,6 +32,7 @@
#include "bindings/core/v8/V8InjectedScriptHost.h"
#include "bindings/core/v8/BindingSecurity.h"
+#include "bindings/core/v8/EvaluateExceptionDetailsFactory.h"
#include "bindings/core/v8/ExceptionState.h"
#include "bindings/core/v8/ScriptDebugServer.h"
#include "bindings/core/v8/ScriptValue.h"
@@ -330,11 +331,16 @@ void V8InjectedScriptHost::evaluateMethodCustom(const v8::FunctionCallbackInfo<v
ASSERT(isolate->InContext());
v8::TryCatch tryCatch;
v8::Handle<v8::Value> result = V8ScriptRunner::compileAndRunInternalScript(expression, info.GetIsolate());
+
+ v8::Local<v8::Object> wrappedResult = v8::Object::New(isolate);
if (tryCatch.HasCaught()) {
- v8SetReturnValue(info, tryCatch.ReThrow());
- return;
+ wrappedResult->Set(v8::String::NewFromUtf8(isolate, "result"), tryCatch.Exception());
+ wrappedResult->Set(v8::String::NewFromUtf8(isolate, "exceptionDetails"), createEvaluateExceptionDetails(tryCatch.Message(), isolate));
+ } else {
+ wrappedResult->Set(v8::String::NewFromUtf8(isolate, "result"), result);
+ wrappedResult->Set(v8::String::NewFromUtf8(isolate, "exceptionDetails"), v8::Undefined(isolate));
}
- v8SetReturnValue(info, result);
+ v8SetReturnValue(info, wrappedResult);
}
void V8InjectedScriptHost::setFunctionVariableValueMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& info)

Powered by Google App Engine
This is Rietveld 408576698