| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 *errorString = "Couldn't parse value object in call argument"; | 300 *errorString = "Couldn't parse value object in call argument"; |
| 301 return v8::MaybeLocal<v8::Value>(); | 301 return v8::MaybeLocal<v8::Value>(); |
| 302 } | 302 } |
| 303 return object; | 303 return object; |
| 304 } | 304 } |
| 305 return v8::Undefined(m_context->isolate()); | 305 return v8::Undefined(m_context->isolate()); |
| 306 } | 306 } |
| 307 | 307 |
| 308 std::unique_ptr<protocol::Runtime::ExceptionDetails> InjectedScript::createExcep
tionDetails(v8::Local<v8::Message> message) | 308 std::unique_ptr<protocol::Runtime::ExceptionDetails> InjectedScript::createExcep
tionDetails(v8::Local<v8::Message> message) |
| 309 { | 309 { |
| 310 std::unique_ptr<protocol::Runtime::ExceptionDetails> exceptionDetailsObject
= protocol::Runtime::ExceptionDetails::create().setText(toProtocolString(message
->Get())).build(); | 310 std::unique_ptr<protocol::Runtime::ExceptionDetails> exceptionDetailsObject
= protocol::Runtime::ExceptionDetails::create() |
| 311 exceptionDetailsObject->setUrl(toProtocolStringWithTypeCheck(message->GetScr
iptResourceName())); | 311 .setText(toProtocolString(message->Get())) |
| 312 exceptionDetailsObject->setScriptId(String16::fromInteger(message->GetScript
Origin().ScriptID()->Value())); | 312 .setScriptId(String16::fromInteger(message->GetScriptOrigin().ScriptID()
->Value())) |
| 313 | 313 .setLineNumber(message->GetLineNumber(m_context->context()).FromMaybe(1)
- 1) |
| 314 v8::Maybe<int> lineNumber = message->GetLineNumber(m_context->context()); | 314 .setColumnNumber(message->GetStartColumn(m_context->context()).FromMaybe
(0)) |
| 315 if (lineNumber.IsJust()) | 315 .build(); |
| 316 exceptionDetailsObject->setLineNumber(lineNumber.FromJust() - 1); | |
| 317 v8::Maybe<int> columnNumber = message->GetStartColumn(m_context->context()); | |
| 318 if (columnNumber.IsJust()) | |
| 319 exceptionDetailsObject->setColumnNumber(columnNumber.FromJust()); | |
| 320 | 316 |
| 321 v8::Local<v8::StackTrace> stackTrace = message->GetStackTrace(); | 317 v8::Local<v8::StackTrace> stackTrace = message->GetStackTrace(); |
| 322 if (!stackTrace.IsEmpty() && stackTrace->GetFrameCount() > 0) | 318 if (!stackTrace.IsEmpty() && stackTrace->GetFrameCount() > 0) |
| 323 exceptionDetailsObject->setStack(m_context->debugger()->createStackTrace
(stackTrace)->buildInspectorObject()); | 319 exceptionDetailsObject->setStackTrace(m_context->debugger()->createStack
Trace(stackTrace)->buildInspectorObject()); |
| 324 return exceptionDetailsObject; | 320 return exceptionDetailsObject; |
| 325 } | 321 } |
| 326 | 322 |
| 327 void InjectedScript::wrapEvaluateResult(ErrorString* errorString, v8::MaybeLocal
<v8::Value> maybeResultValue, const v8::TryCatch& tryCatch, const String16& obje
ctGroup, bool returnByValue, bool generatePreview, std::unique_ptr<protocol::Run
time::RemoteObject>* result, Maybe<bool>* wasThrown, Maybe<protocol::Runtime::Ex
ceptionDetails>* exceptionDetails) | 323 void InjectedScript::wrapEvaluateResult(ErrorString* errorString, v8::MaybeLocal
<v8::Value> maybeResultValue, const v8::TryCatch& tryCatch, const String16& obje
ctGroup, bool returnByValue, bool generatePreview, std::unique_ptr<protocol::Run
time::RemoteObject>* result, Maybe<bool>* wasThrown, Maybe<protocol::Runtime::Ex
ceptionDetails>* exceptionDetails) |
| 328 { | 324 { |
| 329 v8::Local<v8::Value> resultValue; | 325 v8::Local<v8::Value> resultValue; |
| 330 if (!tryCatch.HasCaught()) { | 326 if (!tryCatch.HasCaught()) { |
| 331 if (hasInternalError(errorString, !maybeResultValue.ToLocal(&resultValue
))) | 327 if (hasInternalError(errorString, !maybeResultValue.ToLocal(&resultValue
))) |
| 332 return; | 328 return; |
| 333 std::unique_ptr<RemoteObject> remoteObject = wrapObject(errorString, res
ultValue, objectGroup, returnByValue, generatePreview); | 329 std::unique_ptr<RemoteObject> remoteObject = wrapObject(errorString, res
ultValue, objectGroup, returnByValue, generatePreview); |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 492 void InjectedScript::CallFrameScope::findInjectedScript(V8InspectorSessionImpl*
session) | 488 void InjectedScript::CallFrameScope::findInjectedScript(V8InspectorSessionImpl*
session) |
| 493 { | 489 { |
| 494 std::unique_ptr<RemoteCallFrameId> remoteId = RemoteCallFrameId::parse(m_err
orString, m_remoteCallFrameId); | 490 std::unique_ptr<RemoteCallFrameId> remoteId = RemoteCallFrameId::parse(m_err
orString, m_remoteCallFrameId); |
| 495 if (!remoteId) | 491 if (!remoteId) |
| 496 return; | 492 return; |
| 497 m_frameOrdinal = static_cast<size_t>(remoteId->frameOrdinal()); | 493 m_frameOrdinal = static_cast<size_t>(remoteId->frameOrdinal()); |
| 498 m_injectedScript = session->findInjectedScript(m_errorString, remoteId.get()
); | 494 m_injectedScript = session->findInjectedScript(m_errorString, remoteId.get()
); |
| 499 } | 495 } |
| 500 | 496 |
| 501 } // namespace blink | 497 } // namespace blink |
| OLD | NEW |