| 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 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 { | 307 { |
| 308 std::unique_ptr<protocol::Runtime::ExceptionDetails> exceptionDetailsObject
= protocol::Runtime::ExceptionDetails::create() | 308 std::unique_ptr<protocol::Runtime::ExceptionDetails> exceptionDetailsObject
= protocol::Runtime::ExceptionDetails::create() |
| 309 .setText(toProtocolString(message->Get())) | 309 .setText(toProtocolString(message->Get())) |
| 310 .setScriptId(String16::fromInteger(message->GetScriptOrigin().ScriptID()
->Value())) | 310 .setScriptId(String16::fromInteger(message->GetScriptOrigin().ScriptID()
->Value())) |
| 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()->createStac
kTraceImpl(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<bool>* wasThrown, Maybe<protocol::Runtime::Ex
ceptionDetails>* exceptionDetails) |
| 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); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 353 } | 353 } |
| 354 | 354 |
| 355 InjectedScript::Scope::Scope(ErrorString* errorString, V8InspectorImpl* inspecto
r, int contextGroupId) | 355 InjectedScript::Scope::Scope(ErrorString* errorString, V8InspectorImpl* inspecto
r, int contextGroupId) |
| 356 : m_errorString(errorString) | 356 : m_errorString(errorString) |
| 357 , m_inspector(inspector) | 357 , m_inspector(inspector) |
| 358 , m_contextGroupId(contextGroupId) | 358 , m_contextGroupId(contextGroupId) |
| 359 , m_injectedScript(nullptr) | 359 , m_injectedScript(nullptr) |
| 360 , m_handleScope(inspector->isolate()) | 360 , m_handleScope(inspector->isolate()) |
| 361 , m_tryCatch(inspector->isolate()) | 361 , m_tryCatch(inspector->isolate()) |
| 362 , m_ignoreExceptionsAndMuteConsole(false) | 362 , m_ignoreExceptionsAndMuteConsole(false) |
| 363 , m_previousPauseOnExceptionsState(V8InspectorImpl::DontPauseOnExceptions) | 363 , m_previousPauseOnExceptionsState(V8Debugger::DontPauseOnExceptions) |
| 364 , m_userGesture(false) | 364 , m_userGesture(false) |
| 365 { | 365 { |
| 366 } | 366 } |
| 367 | 367 |
| 368 bool InjectedScript::Scope::initialize() | 368 bool InjectedScript::Scope::initialize() |
| 369 { | 369 { |
| 370 cleanup(); | 370 cleanup(); |
| 371 // TODO(dgozman): what if we reattach to the same context group during evalu
ate? Introduce a session id? | 371 // TODO(dgozman): what if we reattach to the same context group during evalu
ate? Introduce a session id? |
| 372 V8InspectorSessionImpl* session = m_inspector->sessionForContextGroup(m_cont
extGroupId); | 372 V8InspectorSessionImpl* session = m_inspector->sessionForContextGroup(m_cont
extGroupId); |
| 373 if (!session) { | 373 if (!session) { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 387 DCHECK(m_injectedScript && !m_context.IsEmpty() && !m_commandLineAPIScope.ge
t()); | 387 DCHECK(m_injectedScript && !m_context.IsEmpty() && !m_commandLineAPIScope.ge
t()); |
| 388 m_commandLineAPIScope.reset(new V8Console::CommandLineAPIScope(m_context, m_
injectedScript->commandLineAPI(), m_context->Global())); | 388 m_commandLineAPIScope.reset(new V8Console::CommandLineAPIScope(m_context, m_
injectedScript->commandLineAPI(), m_context->Global())); |
| 389 return true; | 389 return true; |
| 390 } | 390 } |
| 391 | 391 |
| 392 void InjectedScript::Scope::ignoreExceptionsAndMuteConsole() | 392 void InjectedScript::Scope::ignoreExceptionsAndMuteConsole() |
| 393 { | 393 { |
| 394 DCHECK(!m_ignoreExceptionsAndMuteConsole); | 394 DCHECK(!m_ignoreExceptionsAndMuteConsole); |
| 395 m_ignoreExceptionsAndMuteConsole = true; | 395 m_ignoreExceptionsAndMuteConsole = true; |
| 396 m_inspector->client()->muteWarningsAndDeprecations(m_contextGroupId); | 396 m_inspector->client()->muteWarningsAndDeprecations(m_contextGroupId); |
| 397 m_previousPauseOnExceptionsState = setPauseOnExceptionsState(V8InspectorImpl
::DontPauseOnExceptions); | 397 m_previousPauseOnExceptionsState = setPauseOnExceptionsState(V8Debugger::Don
tPauseOnExceptions); |
| 398 } | 398 } |
| 399 | 399 |
| 400 V8InspectorImpl::PauseOnExceptionsState InjectedScript::Scope::setPauseOnExcepti
onsState(V8InspectorImpl::PauseOnExceptionsState newState) | 400 V8Debugger::PauseOnExceptionsState InjectedScript::Scope::setPauseOnExceptionsSt
ate(V8Debugger::PauseOnExceptionsState newState) |
| 401 { | 401 { |
| 402 if (!m_inspector->enabled()) | 402 if (!m_inspector->debugger()->enabled()) |
| 403 return newState; | 403 return newState; |
| 404 V8InspectorImpl::PauseOnExceptionsState presentState = m_inspector->getPause
OnExceptionsState(); | 404 V8Debugger::PauseOnExceptionsState presentState = m_inspector->debugger()->g
etPauseOnExceptionsState(); |
| 405 if (presentState != newState) | 405 if (presentState != newState) |
| 406 m_inspector->setPauseOnExceptionsState(newState); | 406 m_inspector->debugger()->setPauseOnExceptionsState(newState); |
| 407 return presentState; | 407 return presentState; |
| 408 } | 408 } |
| 409 | 409 |
| 410 void InjectedScript::Scope::pretendUserGesture() | 410 void InjectedScript::Scope::pretendUserGesture() |
| 411 { | 411 { |
| 412 DCHECK(!m_userGesture); | 412 DCHECK(!m_userGesture); |
| 413 m_userGesture = true; | 413 m_userGesture = true; |
| 414 m_inspector->client()->beginUserGesture(); | 414 m_inspector->client()->beginUserGesture(); |
| 415 } | 415 } |
| 416 | 416 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 486 void InjectedScript::CallFrameScope::findInjectedScript(V8InspectorSessionImpl*
session) | 486 void InjectedScript::CallFrameScope::findInjectedScript(V8InspectorSessionImpl*
session) |
| 487 { | 487 { |
| 488 std::unique_ptr<RemoteCallFrameId> remoteId = RemoteCallFrameId::parse(m_err
orString, m_remoteCallFrameId); | 488 std::unique_ptr<RemoteCallFrameId> remoteId = RemoteCallFrameId::parse(m_err
orString, m_remoteCallFrameId); |
| 489 if (!remoteId) | 489 if (!remoteId) |
| 490 return; | 490 return; |
| 491 m_frameOrdinal = static_cast<size_t>(remoteId->frameOrdinal()); | 491 m_frameOrdinal = static_cast<size_t>(remoteId->frameOrdinal()); |
| 492 m_injectedScript = session->findInjectedScript(m_errorString, remoteId.get()
); | 492 m_injectedScript = session->findInjectedScript(m_errorString, remoteId.get()
); |
| 493 } | 493 } |
| 494 | 494 |
| 495 } // namespace blink | 495 } // namespace blink |
| OLD | NEW |