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

Unified Diff: third_party/WebKit/Source/core/inspector/v8/V8InjectedScriptHost.cpp

Issue 1617393002: [DevTools] Not use with statement for evaluated console command (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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: third_party/WebKit/Source/core/inspector/v8/V8InjectedScriptHost.cpp
diff --git a/third_party/WebKit/Source/core/inspector/v8/V8InjectedScriptHost.cpp b/third_party/WebKit/Source/core/inspector/v8/V8InjectedScriptHost.cpp
index 163107daa64ffda6d2f7d589f48af2c4580ce0ee..1f965f008476f4630b8d85854eb52479c2201c83 100644
--- a/third_party/WebKit/Source/core/inspector/v8/V8InjectedScriptHost.cpp
+++ b/third_party/WebKit/Source/core/inspector/v8/V8InjectedScriptHost.cpp
@@ -344,6 +344,7 @@ void V8InjectedScriptHost::evaluateWithExceptionDetailsCallback(const v8::Functi
v8::Local<v8::Object> wrappedResult = v8::Object::New(isolate);
if (wrappedResult.IsEmpty())
return;
+
v8::TryCatch tryCatch(isolate);
v8::Local<v8::Script> script;
v8::Local<v8::Value> result;
@@ -351,11 +352,21 @@ void V8InjectedScriptHost::evaluateWithExceptionDetailsCallback(const v8::Functi
setExceptionAsReturnValue(info, wrappedResult, tryCatch);
return;
}
+
+ v8::Local<v8::Symbol> commandLineAPISymbol = v8::Symbol::ForApi(isolate, v8AtomicString(isolate, "commandLineAPISymbol"));
pfeldman 2016/01/22 18:26:30 This should be a shared constant or you should dec
kozy 2016/01/22 19:48:23 Done.
+ v8::Local<v8::Object> global = isolate->GetCurrentContext()->Global();
+ if (info.Length() >= 2 && info[1]->IsObject()) {
+ v8::Local<v8::Object> commandLineAPI = info[1]->ToObject(isolate);
+ global->Set(commandLineAPISymbol, commandLineAPI);
+ }
+
if (!v8Call(V8ScriptRunner::runCompiledScript(isolate, script, currentExecutionContext(isolate)), result, tryCatch)) {
+ global->Delete(isolate->GetCurrentContext(), commandLineAPISymbol);
setExceptionAsReturnValue(info, wrappedResult, tryCatch);
return;
}
+ global->Delete(isolate->GetCurrentContext(), commandLineAPISymbol);
wrappedResult->Set(v8::String::NewFromUtf8(isolate, "result"), result);
wrappedResult->Set(v8::String::NewFromUtf8(isolate, "exceptionDetails"), v8::Undefined(isolate));
v8SetReturnValue(info, wrappedResult);

Powered by Google App Engine
This is Rietveld 408576698