| 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 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 .setLineNumber(message->GetLineNumber(m_context->context()).FromMaybe(1)
- 1) | 311 .setLineNumber(message->GetLineNumber(m_context->context()).FromMaybe(1)
- 1) |
| 312 .setColumnNumber(message->GetStartColumn(m_context->context()).FromMaybe
(0)) | 312 .setColumnNumber(message->GetStartColumn(m_context->context()).FromMaybe
(0)) |
| 313 .build(); | 313 .build(); |
| 314 | 314 |
| 315 v8::Local<v8::StackTrace> stackTrace = message->GetStackTrace(); | 315 v8::Local<v8::StackTrace> stackTrace = message->GetStackTrace(); |
| 316 if (!stackTrace.IsEmpty() && stackTrace->GetFrameCount() > 0) | 316 if (!stackTrace.IsEmpty() && stackTrace->GetFrameCount() > 0) |
| 317 exceptionDetailsObject->setStackTrace(m_context->inspector()->debugger()
->createStackTrace(stackTrace)->buildInspectorObjectImpl()); | 317 exceptionDetailsObject->setStackTrace(m_context->inspector()->debugger()
->createStackTrace(stackTrace)->buildInspectorObjectImpl()); |
| 318 return exceptionDetailsObject; | 318 return exceptionDetailsObject; |
| 319 } | 319 } |
| 320 | 320 |
| 321 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) | 321 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<protocol::Runtime::ExceptionDetails>* excepti
onDetails) |
| 322 { | 322 { |
| 323 v8::Local<v8::Value> resultValue; | 323 v8::Local<v8::Value> resultValue; |
| 324 if (!tryCatch.HasCaught()) { | 324 if (!tryCatch.HasCaught()) { |
| 325 if (hasInternalError(errorString, !maybeResultValue.ToLocal(&resultValue
))) | 325 if (hasInternalError(errorString, !maybeResultValue.ToLocal(&resultValue
))) |
| 326 return; | 326 return; |
| 327 std::unique_ptr<RemoteObject> remoteObject = wrapObject(errorString, res
ultValue, objectGroup, returnByValue, generatePreview); | 327 std::unique_ptr<RemoteObject> remoteObject = wrapObject(errorString, res
ultValue, objectGroup, returnByValue, generatePreview); |
| 328 if (!remoteObject) | 328 if (!remoteObject) |
| 329 return; | 329 return; |
| 330 if (objectGroup == "console") | 330 if (objectGroup == "console") |
| 331 m_lastEvaluationResult.Reset(m_context->isolate(), resultValue); | 331 m_lastEvaluationResult.Reset(m_context->isolate(), resultValue); |
| 332 *result = std::move(remoteObject); | 332 *result = std::move(remoteObject); |
| 333 if (wasThrown) | |
| 334 *wasThrown = false; | |
| 335 } else { | 333 } else { |
| 336 v8::Local<v8::Value> exception = tryCatch.Exception(); | 334 v8::Local<v8::Value> exception = tryCatch.Exception(); |
| 337 std::unique_ptr<RemoteObject> remoteObject = wrapObject(errorString, exc
eption, objectGroup, false, generatePreview && !exception->IsNativeError()); | 335 std::unique_ptr<RemoteObject> remoteObject = wrapObject(errorString, exc
eption, objectGroup, false, generatePreview && !exception->IsNativeError()); |
| 338 if (!remoteObject) | 336 if (!remoteObject) |
| 339 return; | 337 return; |
| 340 *result = std::move(remoteObject); | 338 *result = std::move(remoteObject); |
| 341 if (exceptionDetails) | 339 *exceptionDetails = createExceptionDetails(tryCatch.Message()); |
| 342 *exceptionDetails = createExceptionDetails(tryCatch.Message()); | |
| 343 if (wasThrown) | |
| 344 *wasThrown = true; | |
| 345 } | 340 } |
| 346 } | 341 } |
| 347 | 342 |
| 348 v8::Local<v8::Object> InjectedScript::commandLineAPI() | 343 v8::Local<v8::Object> InjectedScript::commandLineAPI() |
| 349 { | 344 { |
| 350 if (m_commandLineAPI.IsEmpty()) | 345 if (m_commandLineAPI.IsEmpty()) |
| 351 m_commandLineAPI.Reset(m_context->isolate(), V8Console::createCommandLin
eAPI(m_context)); | 346 m_commandLineAPI.Reset(m_context->isolate(), V8Console::createCommandLin
eAPI(m_context)); |
| 352 return m_commandLineAPI.Get(m_context->isolate()); | 347 return m_commandLineAPI.Get(m_context->isolate()); |
| 353 } | 348 } |
| 354 | 349 |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 488 void InjectedScript::CallFrameScope::findInjectedScript(V8InspectorSessionImpl*
session) | 483 void InjectedScript::CallFrameScope::findInjectedScript(V8InspectorSessionImpl*
session) |
| 489 { | 484 { |
| 490 std::unique_ptr<RemoteCallFrameId> remoteId = RemoteCallFrameId::parse(m_err
orString, m_remoteCallFrameId); | 485 std::unique_ptr<RemoteCallFrameId> remoteId = RemoteCallFrameId::parse(m_err
orString, m_remoteCallFrameId); |
| 491 if (!remoteId) | 486 if (!remoteId) |
| 492 return; | 487 return; |
| 493 m_frameOrdinal = static_cast<size_t>(remoteId->frameOrdinal()); | 488 m_frameOrdinal = static_cast<size_t>(remoteId->frameOrdinal()); |
| 494 m_injectedScript = session->findInjectedScript(m_errorString, remoteId.get()
); | 489 m_injectedScript = session->findInjectedScript(m_errorString, remoteId.get()
); |
| 495 } | 490 } |
| 496 | 491 |
| 497 } // namespace blink | 492 } // namespace blink |
| OLD | NEW |