Chromium Code Reviews| Index: src/inspector/injected-script.cc |
| diff --git a/src/inspector/injected-script.cc b/src/inspector/injected-script.cc |
| index d966d60bc6c1acb3590e3750fe8b7981f62ef9e9..16d42ebf9c85354596fa61be189874173751ff0b 100644 |
| --- a/src/inspector/injected-script.cc |
| +++ b/src/inspector/injected-script.cc |
| @@ -54,11 +54,6 @@ using protocol::Runtime::InternalPropertyDescriptor; |
| using protocol::Runtime::RemoteObject; |
| using protocol::Maybe; |
| -static bool hasInternalError(ErrorString* errorString, bool hasError) { |
| - if (hasError) *errorString = "Internal error"; |
| - return hasError; |
| -} |
| - |
| std::unique_ptr<InjectedScript> InjectedScript::create( |
| InspectedContext* inspectedContext) { |
| v8::Isolate* isolate = inspectedContext->isolate(); |
| @@ -124,10 +119,9 @@ InjectedScript::InjectedScript( |
| InjectedScript::~InjectedScript() {} |
| -void InjectedScript::getProperties( |
| - ErrorString* errorString, v8::Local<v8::Object> object, |
| - const String16& groupName, bool ownProperties, bool accessorPropertiesOnly, |
| - bool generatePreview, |
| +Response InjectedScript::getProperties( |
| + v8::Local<v8::Object> object, const String16& groupName, bool ownProperties, |
| + bool accessorPropertiesOnly, bool generatePreview, |
| std::unique_ptr<Array<PropertyDescriptor>>* properties, |
| Maybe<protocol::Runtime::ExceptionDetails>* exceptionDetails) { |
| v8::HandleScope handles(m_context->isolate()); |
| @@ -143,21 +137,24 @@ void InjectedScript::getProperties( |
| v8::TryCatch tryCatch(m_context->isolate()); |
| v8::Local<v8::Value> resultValue = function.callWithoutExceptionHandling(); |
| if (tryCatch.HasCaught()) { |
| - *exceptionDetails = createExceptionDetails(errorString, tryCatch, groupName, |
| - generatePreview); |
| + Response response = createExceptionDetails( |
| + tryCatch, groupName, generatePreview, *exceptionDetails); |
| + if (!response.isSuccess()) return response; |
| // FIXME: make properties optional |
| *properties = Array<PropertyDescriptor>::create(); |
| - return; |
| + return Response::OK(); |
| } |
| - if (hasInternalError(errorString, resultValue.IsEmpty())) return; |
| - std::unique_ptr<protocol::Value> protocolValue = |
| - toProtocolValue(errorString, context, resultValue); |
| - if (!protocolValue) return; |
| - protocol::ErrorSupport errors(errorString); |
| + if (resultValue.IsEmpty()) return Response::InternalError(); |
| + std::unique_ptr<protocol::Value> protocolValue; |
| + Response response = |
| + toProtocolValue(context, resultValue, 1000, protocolValue); |
|
dgozman
2016/11/02 19:54:00
&protocolValue
kozy
2016/11/02 22:45:13
Done.
|
| + if (!response.isSuccess()) return response; |
| + protocol::ErrorSupport errors; |
| std::unique_ptr<Array<PropertyDescriptor>> result = |
| Array<PropertyDescriptor>::parse(protocolValue.get(), &errors); |
| - if (!hasInternalError(errorString, errors.hasErrors())) |
| - *properties = std::move(result); |
| + if (errors.hasErrors()) return Response::Error(errors.errors()); |
| + *properties = std::move(result); |
| + return Response::OK(); |
| } |
| void InjectedScript::releaseObject(const String16& objectId) { |
| @@ -172,55 +169,53 @@ void InjectedScript::releaseObject(const String16& objectId) { |
| m_native->unbind(boundId); |
| } |
| -std::unique_ptr<protocol::Runtime::RemoteObject> InjectedScript::wrapObject( |
| - ErrorString* errorString, v8::Local<v8::Value> value, |
| - const String16& groupName, bool forceValueType, |
| - bool generatePreview) const { |
| +Response InjectedScript::wrapObject( |
| + v8::Local<v8::Value> value, const String16& groupName, bool forceValueType, |
| + bool generatePreview, |
| + std::unique_ptr<protocol::Runtime::RemoteObject>& result) const { |
| v8::HandleScope handles(m_context->isolate()); |
| v8::Local<v8::Value> wrappedObject; |
| v8::Local<v8::Context> context = m_context->context(); |
| - if (!wrapValue(errorString, value, groupName, forceValueType, generatePreview) |
| - .ToLocal(&wrappedObject)) |
| - return nullptr; |
| + Response response = wrapValue(value, groupName, forceValueType, |
| + generatePreview, wrappedObject); |
| + if (!response.isSuccess()) return response; |
| protocol::ErrorSupport errors; |
| - std::unique_ptr<protocol::Value> protocolValue = |
| - toProtocolValue(errorString, context, wrappedObject); |
| - if (!protocolValue) return nullptr; |
| + std::unique_ptr<protocol::Value> protocolValue; |
| + response = toProtocolValue(context, wrappedObject, 1000, protocolValue); |
| + if (!response.isSuccess()) return response; |
| + |
| std::unique_ptr<protocol::Runtime::RemoteObject> remoteObject = |
|
dgozman
2016/11/02 19:53:59
*result = ....
kozy
2016/11/02 22:45:12
Done.
|
| protocol::Runtime::RemoteObject::parse(protocolValue.get(), &errors); |
| - if (!remoteObject) *errorString = errors.errors(); |
| - return remoteObject; |
| + if (!remoteObject) return Response::Error(errors.errors()); |
| + result = std::move(remoteObject); |
| + return Response::OK(); |
| } |
| -bool InjectedScript::wrapObjectProperty(ErrorString* errorString, |
| - v8::Local<v8::Object> object, |
| - v8::Local<v8::Name> key, |
| - const String16& groupName, |
| - bool forceValueType, |
| - bool generatePreview) const { |
| +Response InjectedScript::wrapObjectProperty(v8::Local<v8::Object> object, |
| + v8::Local<v8::Name> key, |
| + const String16& groupName, |
| + bool forceValueType, |
| + bool generatePreview) const { |
| v8::Local<v8::Value> property; |
| v8::Local<v8::Context> context = m_context->context(); |
| - if (hasInternalError(errorString, |
| - !object->Get(context, key).ToLocal(&property))) |
| - return false; |
| + if (!object->Get(context, key).ToLocal(&property)) |
| + return Response::InternalError(); |
| v8::Local<v8::Value> wrappedProperty; |
| - if (!wrapValue(errorString, property, groupName, forceValueType, |
| - generatePreview) |
| - .ToLocal(&wrappedProperty)) |
| - return false; |
| + Response response = wrapValue(property, groupName, forceValueType, |
| + generatePreview, wrappedProperty); |
| + if (!response.isSuccess()) return response; |
| v8::Maybe<bool> success = |
| createDataProperty(context, object, key, wrappedProperty); |
| - if (hasInternalError(errorString, success.IsNothing() || !success.FromJust())) |
| - return false; |
| - return true; |
| + if (success.IsNothing() || !success.FromJust()) |
| + return Response::InternalError(); |
| + return Response::OK(); |
| } |
| -bool InjectedScript::wrapPropertyInArray(ErrorString* errorString, |
| - v8::Local<v8::Array> array, |
| - v8::Local<v8::String> property, |
| - const String16& groupName, |
| - bool forceValueType, |
| - bool generatePreview) const { |
| +Response InjectedScript::wrapPropertyInArray(v8::Local<v8::Array> array, |
| + v8::Local<v8::String> property, |
| + const String16& groupName, |
| + bool forceValueType, |
| + bool generatePreview) const { |
| V8FunctionCall function(m_context->inspector(), m_context->context(), |
| v8Value(), "wrapPropertyInArray"); |
| function.appendArgument(array); |
| @@ -230,29 +225,14 @@ bool InjectedScript::wrapPropertyInArray(ErrorString* errorString, |
| function.appendArgument(generatePreview); |
| bool hadException = false; |
| function.call(hadException); |
| - return !hasInternalError(errorString, hadException); |
| -} |
| - |
| -bool InjectedScript::wrapObjectsInArray(ErrorString* errorString, |
| - v8::Local<v8::Array> array, |
| - const String16& groupName, |
| - bool forceValueType, |
| - bool generatePreview) const { |
| - V8FunctionCall function(m_context->inspector(), m_context->context(), |
| - v8Value(), "wrapObjectsInArray"); |
| - function.appendArgument(array); |
| - function.appendArgument(groupName); |
| - function.appendArgument(forceValueType); |
| - function.appendArgument(generatePreview); |
| - bool hadException = false; |
| - function.call(hadException); |
| - return !hasInternalError(errorString, hadException); |
| + return hadException ? Response::InternalError() : Response::OK(); |
| } |
| -v8::MaybeLocal<v8::Value> InjectedScript::wrapValue( |
| - ErrorString* errorString, v8::Local<v8::Value> value, |
| - const String16& groupName, bool forceValueType, |
| - bool generatePreview) const { |
| +Response InjectedScript::wrapValue(v8::Local<v8::Value> value, |
| + const String16& groupName, |
| + bool forceValueType, bool generatePreview, |
| + v8::Local<v8::Value>& result) const { |
| + result = v8::Local<v8::Value>(); |
|
dgozman
2016/11/02 19:53:59
remove
kozy
2016/11/02 22:45:13
Done.
|
| V8FunctionCall function(m_context->inspector(), m_context->context(), |
| v8Value(), "wrapObject"); |
| function.appendArgument(value); |
| @@ -261,9 +241,9 @@ v8::MaybeLocal<v8::Value> InjectedScript::wrapValue( |
| function.appendArgument(generatePreview); |
| bool hadException = false; |
| v8::Local<v8::Value> r = function.call(hadException); |
|
dgozman
2016/11/02 19:53:59
*result =
kozy
2016/11/02 22:45:13
Done.
|
| - if (hasInternalError(errorString, hadException || r.IsEmpty())) |
| - return v8::MaybeLocal<v8::Value>(); |
| - return r; |
| + if (hadException || r.IsEmpty()) return Response::InternalError(); |
| + result = r; |
| + return Response::OK(); |
| } |
| std::unique_ptr<protocol::Runtime::RemoteObject> InjectedScript::wrapTable( |
| @@ -280,21 +260,19 @@ std::unique_ptr<protocol::Runtime::RemoteObject> InjectedScript::wrapTable( |
| bool hadException = false; |
| v8::Local<v8::Value> r = function.call(hadException); |
| if (hadException || r.IsEmpty()) return nullptr; |
| - protocol::ErrorString errorString; |
| - std::unique_ptr<protocol::Value> protocolValue = |
| - toProtocolValue(&errorString, context, r); |
| - if (!protocolValue) return nullptr; |
| + std::unique_ptr<protocol::Value> protocolValue; |
| + Response response = toProtocolValue(context, r, 1000, protocolValue); |
| + if (!response.isSuccess()) return nullptr; |
| protocol::ErrorSupport errors; |
| return protocol::Runtime::RemoteObject::parse(protocolValue.get(), &errors); |
| } |
| -bool InjectedScript::findObject(ErrorString* errorString, |
| - const RemoteObjectId& objectId, |
| - v8::Local<v8::Value>* outObject) const { |
| +Response InjectedScript::findObject(const RemoteObjectId& objectId, |
| + v8::Local<v8::Value>* outObject) const { |
| *outObject = m_native->objectForId(objectId.id()); |
| if (outObject->IsEmpty()) |
| - *errorString = "Could not find object with given id"; |
| - return !outObject->IsEmpty(); |
| + return Response::Error("Could not find object with given id"); |
| + return Response::OK(); |
| } |
| String16 InjectedScript::objectGroupName(const RemoteObjectId& objectId) const { |
| @@ -326,22 +304,24 @@ v8::Local<v8::Value> InjectedScript::lastEvaluationResult() const { |
| return m_lastEvaluationResult.Get(m_context->isolate()); |
| } |
| -v8::MaybeLocal<v8::Value> InjectedScript::resolveCallArgument( |
| - ErrorString* errorString, protocol::Runtime::CallArgument* callArgument) { |
| +Response InjectedScript::resolveCallArgument( |
| + protocol::Runtime::CallArgument* callArgument, |
| + v8::Local<v8::Value>& result) { |
|
dgozman
2016/11/02 19:54:00
v8::Local<>*
kozy
2016/11/02 22:45:12
Done.
|
| + result = v8::Local<v8::Value>(); |
| if (callArgument->hasObjectId()) { |
| - std::unique_ptr<RemoteObjectId> remoteObjectId = |
| - RemoteObjectId::parse(errorString, callArgument->getObjectId("")); |
| - if (!remoteObjectId) return v8::MaybeLocal<v8::Value>(); |
| - if (remoteObjectId->contextId() != m_context->contextId()) { |
| - *errorString = |
| + std::unique_ptr<RemoteObjectId> remoteObjectId; |
| + Response response = |
| + RemoteObjectId::parse(callArgument->getObjectId(""), remoteObjectId); |
| + if (!response.isSuccess()) return response; |
| + if (remoteObjectId->contextId() != m_context->contextId()) |
| + return Response::Error( |
| "Argument should belong to the same JavaScript world as target " |
| - "object"; |
| - return v8::MaybeLocal<v8::Value>(); |
| - } |
| + "object"); |
| v8::Local<v8::Value> object; |
| - if (!findObject(errorString, *remoteObjectId, &object)) |
| - return v8::MaybeLocal<v8::Value>(); |
| - return object; |
| + response = findObject(*remoteObjectId, &object); |
|
dgozman
2016/11/02 19:53:59
&object -> result
kozy
2016/11/02 22:45:13
Done.
|
| + if (!response.isSuccess()) return response; |
| + result = object; |
| + return Response::OK(); |
| } |
| if (callArgument->hasValue() || callArgument->hasUnserializableValue()) { |
| String16 value = |
| @@ -353,20 +333,19 @@ v8::MaybeLocal<v8::Value> InjectedScript::resolveCallArgument( |
| ->compileAndRunInternalScript( |
| m_context->context(), toV8String(m_context->isolate(), value)) |
| .ToLocal(&object)) { |
|
dgozman
2016/11/02 19:53:59
.ToLocal(result)
kozy
2016/11/02 22:45:13
Done.
|
| - *errorString = "Couldn't parse value object in call argument"; |
| - return v8::MaybeLocal<v8::Value>(); |
| + return Response::Error("Couldn't parse value object in call argument"); |
| } |
| - return object; |
| + result = object; |
| + return Response::OK(); |
| } |
| - return v8::Undefined(m_context->isolate()); |
| + result = v8::Undefined(m_context->isolate()); |
| + return Response::OK(); |
| } |
| -std::unique_ptr<protocol::Runtime::ExceptionDetails> |
| -InjectedScript::createExceptionDetails(ErrorString* errorString, |
| - const v8::TryCatch& tryCatch, |
| - const String16& objectGroup, |
| - bool generatePreview) { |
| - if (!tryCatch.HasCaught()) return nullptr; |
| +Response InjectedScript::createExceptionDetails( |
| + const v8::TryCatch& tryCatch, const String16& objectGroup, |
| + bool generatePreview, Maybe<protocol::Runtime::ExceptionDetails>& result) { |
| + if (!tryCatch.HasCaught()) return Response::InternalError(); |
| v8::Local<v8::Message> message = tryCatch.Message(); |
| v8::Local<v8::Value> exception = tryCatch.Exception(); |
| String16 messageText = |
| @@ -396,43 +375,48 @@ InjectedScript::createExceptionDetails(ErrorString* errorString, |
| ->buildInspectorObjectImpl()); |
| } |
| if (!exception.IsEmpty()) { |
| - std::unique_ptr<protocol::Runtime::RemoteObject> wrapped = wrapObject( |
| - errorString, exception, objectGroup, false /* forceValueType */, |
| - generatePreview && !exception->IsNativeError()); |
| - if (!wrapped) return nullptr; |
| + std::unique_ptr<protocol::Runtime::RemoteObject> wrapped; |
| + Response response = |
| + wrapObject(exception, objectGroup, false /* forceValueType */, |
| + generatePreview && !exception->IsNativeError(), wrapped); |
| + if (!response.isSuccess()) return response; |
| exceptionDetails->setException(std::move(wrapped)); |
| } |
| - return exceptionDetails; |
| + result = std::move(exceptionDetails); |
| + return Response::OK(); |
| } |
| -void InjectedScript::wrapEvaluateResult( |
| - ErrorString* errorString, v8::MaybeLocal<v8::Value> maybeResultValue, |
| - const v8::TryCatch& tryCatch, const String16& objectGroup, |
| - bool returnByValue, bool generatePreview, |
| +Response InjectedScript::wrapEvaluateResult( |
| + v8::MaybeLocal<v8::Value> maybeResultValue, const v8::TryCatch& tryCatch, |
| + const String16& objectGroup, bool returnByValue, bool generatePreview, |
| std::unique_ptr<protocol::Runtime::RemoteObject>* result, |
| Maybe<protocol::Runtime::ExceptionDetails>* exceptionDetails) { |
| v8::Local<v8::Value> resultValue; |
| if (!tryCatch.HasCaught()) { |
| - if (hasInternalError(errorString, !maybeResultValue.ToLocal(&resultValue))) |
| - return; |
| - std::unique_ptr<RemoteObject> remoteObject = wrapObject( |
| - errorString, resultValue, objectGroup, returnByValue, generatePreview); |
| - if (!remoteObject) return; |
| + if (!maybeResultValue.ToLocal(&resultValue)) |
| + return Response::InternalError(); |
| + std::unique_ptr<RemoteObject> remoteObject; |
| + Response response = wrapObject(resultValue, objectGroup, returnByValue, |
| + generatePreview, remoteObject); |
|
dgozman
2016/11/02 19:53:59
remoteObject -> result
kozy
2016/11/02 22:45:12
Done.
|
| + if (!response.isSuccess()) return response; |
| if (objectGroup == "console") |
| m_lastEvaluationResult.Reset(m_context->isolate(), resultValue); |
| *result = std::move(remoteObject); |
| } else { |
| v8::Local<v8::Value> exception = tryCatch.Exception(); |
| - std::unique_ptr<RemoteObject> remoteObject = |
| - wrapObject(errorString, exception, objectGroup, false, |
| - generatePreview && !exception->IsNativeError()); |
| - if (!remoteObject) return; |
| + std::unique_ptr<RemoteObject> remoteObject; |
| + Response response = wrapObject( |
| + exception, objectGroup, false, |
| + generatePreview && !exception->IsNativeError(), remoteObject); |
|
dgozman
2016/11/02 19:53:59
ditto
kozy
2016/11/02 22:45:12
Done.
|
| + if (!response.isSuccess()) return response; |
| // We send exception in result for compatibility reasons, even though it's |
| // accessible through exceptionDetails.exception. |
| *result = std::move(remoteObject); |
| - *exceptionDetails = createExceptionDetails(errorString, tryCatch, |
| - objectGroup, generatePreview); |
| + response = createExceptionDetails(tryCatch, objectGroup, generatePreview, |
| + *exceptionDetails); |
| + if (!response.isSuccess()) return response; |
| } |
| + return Response::OK(); |
| } |
| v8::Local<v8::Object> InjectedScript::commandLineAPI() { |
| @@ -442,10 +426,8 @@ v8::Local<v8::Object> InjectedScript::commandLineAPI() { |
| return m_commandLineAPI.Get(m_context->isolate()); |
| } |
| -InjectedScript::Scope::Scope(ErrorString* errorString, |
| - V8InspectorImpl* inspector, int contextGroupId) |
| - : m_errorString(errorString), |
| - m_inspector(inspector), |
| +InjectedScript::Scope::Scope(V8InspectorImpl* inspector, int contextGroupId) |
| + : m_inspector(inspector), |
| m_contextGroupId(contextGroupId), |
| m_injectedScript(nullptr), |
| m_handleScope(inspector->isolate()), |
| @@ -454,29 +436,25 @@ InjectedScript::Scope::Scope(ErrorString* errorString, |
| m_previousPauseOnExceptionsState(v8::DebugInterface::NoBreakOnException), |
| m_userGesture(false) {} |
| -bool InjectedScript::Scope::initialize() { |
| +Response InjectedScript::Scope::initialize() { |
| cleanup(); |
| // TODO(dgozman): what if we reattach to the same context group during |
| // evaluate? Introduce a session id? |
| V8InspectorSessionImpl* session = |
| m_inspector->sessionForContextGroup(m_contextGroupId); |
| - if (!session) { |
| - *m_errorString = "Internal error"; |
| - return false; |
| - } |
| - findInjectedScript(session); |
| - if (!m_injectedScript) return false; |
| + if (!session) return Response::InternalError(); |
| + Response response = findInjectedScript(session); |
| + if (!response.isSuccess()) return response; |
| m_context = m_injectedScript->context()->context(); |
| m_context->Enter(); |
| - return true; |
| + return Response::OK(); |
| } |
| -bool InjectedScript::Scope::installCommandLineAPI() { |
| +void InjectedScript::Scope::installCommandLineAPI() { |
| DCHECK(m_injectedScript && !m_context.IsEmpty() && |
| !m_commandLineAPIScope.get()); |
| m_commandLineAPIScope.reset(new V8Console::CommandLineAPIScope( |
| m_context, m_injectedScript->commandLineAPI(), m_context->Global())); |
| - return true; |
| } |
| void InjectedScript::Scope::ignoreExceptionsAndMuteConsole() { |
| @@ -523,59 +501,57 @@ InjectedScript::Scope::~Scope() { |
| cleanup(); |
| } |
| -InjectedScript::ContextScope::ContextScope(ErrorString* errorString, |
| - V8InspectorImpl* inspector, |
| +InjectedScript::ContextScope::ContextScope(V8InspectorImpl* inspector, |
| int contextGroupId, |
| int executionContextId) |
| - : InjectedScript::Scope(errorString, inspector, contextGroupId), |
| + : InjectedScript::Scope(inspector, contextGroupId), |
| m_executionContextId(executionContextId) {} |
| InjectedScript::ContextScope::~ContextScope() {} |
| -void InjectedScript::ContextScope::findInjectedScript( |
| +Response InjectedScript::ContextScope::findInjectedScript( |
| V8InspectorSessionImpl* session) { |
| - m_injectedScript = |
| - session->findInjectedScript(m_errorString, m_executionContextId); |
| + return session->findInjectedScript(m_executionContextId, m_injectedScript); |
| } |
| -InjectedScript::ObjectScope::ObjectScope(ErrorString* errorString, |
| - V8InspectorImpl* inspector, |
| +InjectedScript::ObjectScope::ObjectScope(V8InspectorImpl* inspector, |
| int contextGroupId, |
| const String16& remoteObjectId) |
| - : InjectedScript::Scope(errorString, inspector, contextGroupId), |
| + : InjectedScript::Scope(inspector, contextGroupId), |
| m_remoteObjectId(remoteObjectId) {} |
| InjectedScript::ObjectScope::~ObjectScope() {} |
| -void InjectedScript::ObjectScope::findInjectedScript( |
| +Response InjectedScript::ObjectScope::findInjectedScript( |
| V8InspectorSessionImpl* session) { |
| - std::unique_ptr<RemoteObjectId> remoteId = |
| - RemoteObjectId::parse(m_errorString, m_remoteObjectId); |
| - if (!remoteId) return; |
| - InjectedScript* injectedScript = |
| - session->findInjectedScript(m_errorString, remoteId.get()); |
| - if (!injectedScript) return; |
| + std::unique_ptr<RemoteObjectId> remoteId; |
| + Response response = RemoteObjectId::parse(m_remoteObjectId, remoteId); |
| + if (!response.isSuccess()) return response; |
| + InjectedScript* injectedScript = nullptr; |
| + response = session->findInjectedScript(remoteId.get(), injectedScript); |
| + if (!response.isSuccess()) return response; |
| m_objectGroupName = injectedScript->objectGroupName(*remoteId); |
| - if (!injectedScript->findObject(m_errorString, *remoteId, &m_object)) return; |
| + response = injectedScript->findObject(*remoteId, &m_object); |
| + if (!response.isSuccess()) return response; |
| m_injectedScript = injectedScript; |
| + return Response::OK(); |
| } |
| -InjectedScript::CallFrameScope::CallFrameScope(ErrorString* errorString, |
| - V8InspectorImpl* inspector, |
| +InjectedScript::CallFrameScope::CallFrameScope(V8InspectorImpl* inspector, |
| int contextGroupId, |
| const String16& remoteObjectId) |
| - : InjectedScript::Scope(errorString, inspector, contextGroupId), |
| + : InjectedScript::Scope(inspector, contextGroupId), |
| m_remoteCallFrameId(remoteObjectId) {} |
| InjectedScript::CallFrameScope::~CallFrameScope() {} |
| -void InjectedScript::CallFrameScope::findInjectedScript( |
| +Response InjectedScript::CallFrameScope::findInjectedScript( |
| V8InspectorSessionImpl* session) { |
| - std::unique_ptr<RemoteCallFrameId> remoteId = |
| - RemoteCallFrameId::parse(m_errorString, m_remoteCallFrameId); |
| - if (!remoteId) return; |
| + std::unique_ptr<RemoteCallFrameId> remoteId; |
| + Response response = RemoteCallFrameId::parse(m_remoteCallFrameId, remoteId); |
| + if (!response.isSuccess()) return response; |
| m_frameOrdinal = static_cast<size_t>(remoteId->frameOrdinal()); |
| - m_injectedScript = session->findInjectedScript(m_errorString, remoteId.get()); |
| + return session->findInjectedScript(remoteId.get(), m_injectedScript); |
| } |
| } // namespace v8_inspector |