| 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 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 412 return m_commandLineAPI.Get(m_context->isolate()); | 412 return m_commandLineAPI.Get(m_context->isolate()); |
| 413 } | 413 } |
| 414 | 414 |
| 415 InjectedScript::Scope::Scope(V8InspectorImpl* inspector, int contextGroupId) | 415 InjectedScript::Scope::Scope(V8InspectorImpl* inspector, int contextGroupId) |
| 416 : m_inspector(inspector), | 416 : m_inspector(inspector), |
| 417 m_contextGroupId(contextGroupId), | 417 m_contextGroupId(contextGroupId), |
| 418 m_injectedScript(nullptr), | 418 m_injectedScript(nullptr), |
| 419 m_handleScope(inspector->isolate()), | 419 m_handleScope(inspector->isolate()), |
| 420 m_tryCatch(inspector->isolate()), | 420 m_tryCatch(inspector->isolate()), |
| 421 m_ignoreExceptionsAndMuteConsole(false), | 421 m_ignoreExceptionsAndMuteConsole(false), |
| 422 m_previousPauseOnExceptionsState(v8::DebugInterface::NoBreakOnException), | 422 m_previousPauseOnExceptionsState(v8::debug::NoBreakOnException), |
| 423 m_userGesture(false) {} | 423 m_userGesture(false) {} |
| 424 | 424 |
| 425 Response InjectedScript::Scope::initialize() { | 425 Response InjectedScript::Scope::initialize() { |
| 426 cleanup(); | 426 cleanup(); |
| 427 // TODO(dgozman): what if we reattach to the same context group during | 427 // TODO(dgozman): what if we reattach to the same context group during |
| 428 // evaluate? Introduce a session id? | 428 // evaluate? Introduce a session id? |
| 429 V8InspectorSessionImpl* session = | 429 V8InspectorSessionImpl* session = |
| 430 m_inspector->sessionForContextGroup(m_contextGroupId); | 430 m_inspector->sessionForContextGroup(m_contextGroupId); |
| 431 if (!session) return Response::InternalError(); | 431 if (!session) return Response::InternalError(); |
| 432 Response response = findInjectedScript(session); | 432 Response response = findInjectedScript(session); |
| 433 if (!response.isSuccess()) return response; | 433 if (!response.isSuccess()) return response; |
| 434 m_context = m_injectedScript->context()->context(); | 434 m_context = m_injectedScript->context()->context(); |
| 435 m_context->Enter(); | 435 m_context->Enter(); |
| 436 return Response::OK(); | 436 return Response::OK(); |
| 437 } | 437 } |
| 438 | 438 |
| 439 void InjectedScript::Scope::installCommandLineAPI() { | 439 void InjectedScript::Scope::installCommandLineAPI() { |
| 440 DCHECK(m_injectedScript && !m_context.IsEmpty() && | 440 DCHECK(m_injectedScript && !m_context.IsEmpty() && |
| 441 !m_commandLineAPIScope.get()); | 441 !m_commandLineAPIScope.get()); |
| 442 m_commandLineAPIScope.reset(new V8Console::CommandLineAPIScope( | 442 m_commandLineAPIScope.reset(new V8Console::CommandLineAPIScope( |
| 443 m_context, m_injectedScript->commandLineAPI(), m_context->Global())); | 443 m_context, m_injectedScript->commandLineAPI(), m_context->Global())); |
| 444 } | 444 } |
| 445 | 445 |
| 446 void InjectedScript::Scope::ignoreExceptionsAndMuteConsole() { | 446 void InjectedScript::Scope::ignoreExceptionsAndMuteConsole() { |
| 447 DCHECK(!m_ignoreExceptionsAndMuteConsole); | 447 DCHECK(!m_ignoreExceptionsAndMuteConsole); |
| 448 m_ignoreExceptionsAndMuteConsole = true; | 448 m_ignoreExceptionsAndMuteConsole = true; |
| 449 m_inspector->client()->muteMetrics(m_contextGroupId); | 449 m_inspector->client()->muteMetrics(m_contextGroupId); |
| 450 m_inspector->muteExceptions(m_contextGroupId); | 450 m_inspector->muteExceptions(m_contextGroupId); |
| 451 m_previousPauseOnExceptionsState = | 451 m_previousPauseOnExceptionsState = |
| 452 setPauseOnExceptionsState(v8::DebugInterface::NoBreakOnException); | 452 setPauseOnExceptionsState(v8::debug::NoBreakOnException); |
| 453 } | 453 } |
| 454 | 454 |
| 455 v8::DebugInterface::ExceptionBreakState | 455 v8::debug::ExceptionBreakState InjectedScript::Scope::setPauseOnExceptionsState( |
| 456 InjectedScript::Scope::setPauseOnExceptionsState( | 456 v8::debug::ExceptionBreakState newState) { |
| 457 v8::DebugInterface::ExceptionBreakState newState) { | |
| 458 if (!m_inspector->debugger()->enabled()) return newState; | 457 if (!m_inspector->debugger()->enabled()) return newState; |
| 459 v8::DebugInterface::ExceptionBreakState presentState = | 458 v8::debug::ExceptionBreakState presentState = |
| 460 m_inspector->debugger()->getPauseOnExceptionsState(); | 459 m_inspector->debugger()->getPauseOnExceptionsState(); |
| 461 if (presentState != newState) | 460 if (presentState != newState) |
| 462 m_inspector->debugger()->setPauseOnExceptionsState(newState); | 461 m_inspector->debugger()->setPauseOnExceptionsState(newState); |
| 463 return presentState; | 462 return presentState; |
| 464 } | 463 } |
| 465 | 464 |
| 466 void InjectedScript::Scope::pretendUserGesture() { | 465 void InjectedScript::Scope::pretendUserGesture() { |
| 467 DCHECK(!m_userGesture); | 466 DCHECK(!m_userGesture); |
| 468 m_userGesture = true; | 467 m_userGesture = true; |
| 469 m_inspector->client()->beginUserGesture(); | 468 m_inspector->client()->beginUserGesture(); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 534 Response InjectedScript::CallFrameScope::findInjectedScript( | 533 Response InjectedScript::CallFrameScope::findInjectedScript( |
| 535 V8InspectorSessionImpl* session) { | 534 V8InspectorSessionImpl* session) { |
| 536 std::unique_ptr<RemoteCallFrameId> remoteId; | 535 std::unique_ptr<RemoteCallFrameId> remoteId; |
| 537 Response response = RemoteCallFrameId::parse(m_remoteCallFrameId, &remoteId); | 536 Response response = RemoteCallFrameId::parse(m_remoteCallFrameId, &remoteId); |
| 538 if (!response.isSuccess()) return response; | 537 if (!response.isSuccess()) return response; |
| 539 m_frameOrdinal = static_cast<size_t>(remoteId->frameOrdinal()); | 538 m_frameOrdinal = static_cast<size_t>(remoteId->frameOrdinal()); |
| 540 return session->findInjectedScript(remoteId.get(), m_injectedScript); | 539 return session->findInjectedScript(remoteId.get(), m_injectedScript); |
| 541 } | 540 } |
| 542 | 541 |
| 543 } // namespace v8_inspector | 542 } // namespace v8_inspector |
| OLD | NEW |