Chromium Code Reviews| Index: third_party/WebKit/Source/platform/v8_inspector/V8DebuggerAgentImpl.cpp |
| diff --git a/third_party/WebKit/Source/platform/v8_inspector/V8DebuggerAgentImpl.cpp b/third_party/WebKit/Source/platform/v8_inspector/V8DebuggerAgentImpl.cpp |
| index 8fa34af91c603d2797b984e90a01f4b62129582d..f81ad72ec552ef2e93333e8e9398df1cd4b145e7 100644 |
| --- a/third_party/WebKit/Source/platform/v8_inspector/V8DebuggerAgentImpl.cpp |
| +++ b/third_party/WebKit/Source/platform/v8_inspector/V8DebuggerAgentImpl.cpp |
| @@ -720,7 +720,7 @@ void V8DebuggerAgentImpl::getGeneratorObjectDetails(ErrorString* errorString, co |
| } |
| String16 groupName = injectedScript->objectGroupName(*remoteId); |
| - if (!injectedScript->wrapObjectProperty(errorString, detailsObject, toV8String(m_isolate, "function"), groupName, false)) |
| + if (!injectedScript->wrapObjectProperty(errorString, detailsObject, toV8String(m_isolate, "function"), groupName, false, true)) |
|
dgozman
2016/03/17 19:16:12
true -> false
kozy
2016/03/17 20:48:56
Done.
|
| return; |
| protocol::ErrorSupport errors; |
| @@ -926,11 +926,44 @@ void V8DebuggerAgentImpl::evaluateOnCallFrame(ErrorString* errorString, |
| if (!injectedScript) |
| return; |
| - v8::HandleScope scope(m_isolate); |
| - v8::Local<v8::Object> callStack = m_currentCallStack.Get(m_isolate); |
| + v8::HandleScope scope(injectedScript->isolate()); |
| + |
| + if (!injectedScript->canAccessInspectedWindow()) { |
| + *errorString = "Can not access given context"; |
| + return; |
| + } |
| + |
| + OwnPtr<JavaScriptCallFrame> javaScriptCallFrame = debugger().callFrameNoScopes(remoteId->frameOrdinal()); |
| + if (!javaScriptCallFrame) { |
| + *errorString = "Could not find call frame with given id"; |
| + return; |
| + } |
| - IgnoreExceptionsScope ignoreExceptionsScope(doNotPauseOnExceptionsAndMuteConsole.fromMaybe(false) ? m_debugger : nullptr); |
| - injectedScript->evaluateOnCallFrame(errorString, callStack, callFrameId, expression, objectGroup.fromMaybe(""), includeCommandLineAPI.fromMaybe(false), returnByValue.fromMaybe(false), generatePreview.fromMaybe(false), result, wasThrown, exceptionDetails); |
| + InjectedScriptManager::InjectScopeExtensionByName scopeExtension(errorString, injectedScript, true, includeCommandLineAPI.fromMaybe(false) ? "commandLineAPI" : String16()); |
| + if (scopeExtension.hasError()) |
| + return; |
| + |
| + v8::TryCatch tryCatch(injectedScript->isolate()); |
| + |
| + v8::Local<v8::Value> resultValue; |
| + bool success = javaScriptCallFrame->evaluateWithExceptionDetails(toV8String(injectedScript->isolate(), expression)).ToLocal(&resultValue); |
|
dgozman
2016/03/17 19:16:12
Let's pass Maybe further and forget about ToLocal
kozy
2016/03/17 20:48:56
Done.
|
| + ALLOW_UNUSED_LOCAL(success); |
| + |
| + injectedScript = m_injectedScriptManager->findInjectedScript(errorString, remoteId.get()); |
|
dgozman
2016/03/17 19:16:12
// InjectedScript may be gone after any evaluate c
kozy
2016/03/17 20:48:56
Done.
|
| + if (!injectedScript) |
| + return; |
| + |
| + V8RuntimeAgentImpl::wrapEvaluateResult(errorString, |
|
dgozman
2016/03/17 19:16:12
Let's make this an instance method on InjectedScri
kozy
2016/03/17 20:48:56
Done.
|
| + m_debugger, |
| + injectedScript, |
| + resultValue, |
| + tryCatch, |
| + objectGroup.fromMaybe(""), |
| + returnByValue.fromMaybe(false), |
| + generatePreview.fromMaybe(false), |
| + result, |
| + wasThrown, |
| + exceptionDetails); |
| } |
| void V8DebuggerAgentImpl::setVariableValue(ErrorString* errorString, |
| @@ -1012,7 +1045,10 @@ void V8DebuggerAgentImpl::getPromiseById(ErrorString* errorString, int promiseId |
| return; |
| } |
| InjectedScript* injectedScript = m_injectedScriptManager->injectedScriptFor(value->CreationContext()); |
| - *promise = injectedScript->wrapObject(value, objectGroup.fromMaybe("")); |
| + OwnPtr<RemoteObject> promiseObject = injectedScript->wrapObject(errorString, value, objectGroup.fromMaybe("")); |
|
dgozman
2016/03/17 19:16:12
Revert.
kozy
2016/03/17 20:48:56
Done.
|
| + if (!promiseObject) |
| + return; |
| + *promise = promiseObject.release(); |
| } |
| void V8DebuggerAgentImpl::didUpdatePromise(const String16& eventType, PassOwnPtr<protocol::Debugger::PromiseDetails> promise) |
| @@ -1422,7 +1458,8 @@ V8DebuggerAgentImpl::SkipPauseRequest V8DebuggerAgentImpl::didPause(v8::Local<v8 |
| InjectedScript* injectedScript = m_injectedScriptManager->injectedScriptFor(context); |
| if (injectedScript) { |
| m_breakReason = isPromiseRejection ? protocol::Debugger::Paused::ReasonEnum::PromiseRejection : protocol::Debugger::Paused::ReasonEnum::Exception; |
| - auto obj = injectedScript->wrapObject(exception, V8DebuggerAgentImpl::backtraceObjectGroup); |
| + ErrorString errorString; |
| + auto obj = injectedScript->wrapObject(&errorString, exception, V8DebuggerAgentImpl::backtraceObjectGroup); |
| m_breakAuxData = obj ? obj->serialize() : nullptr; |
| // m_breakAuxData might be null after this. |
| } |