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 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 findInjectedScript(session); | 398 findInjectedScript(session); |
399 if (!m_injectedScript) | 399 if (!m_injectedScript) |
400 return false; | 400 return false; |
401 m_context = m_injectedScript->context()->context(); | 401 m_context = m_injectedScript->context()->context(); |
402 m_context->Enter(); | 402 m_context->Enter(); |
403 return true; | 403 return true; |
404 } | 404 } |
405 | 405 |
406 bool InjectedScript::Scope::installCommandLineAPI() | 406 bool InjectedScript::Scope::installCommandLineAPI() |
407 { | 407 { |
408 DCHECK(m_injectedScript && !m_context.IsEmpty() && m_global.IsEmpty()); | 408 DCHECK(m_injectedScript && !m_context.IsEmpty() && !m_commandLineAPIScope.ge
t()); |
409 m_extensionPrivate = V8Debugger::scopeExtensionPrivate(m_debugger->isolate()
); | 409 m_commandLineAPIScope.reset(new V8Console::CommandLineAPIScope(m_context, m_
injectedScript->commandLineAPI(), m_context->Global())); |
410 v8::Local<v8::Object> global = m_context->Global(); | |
411 if (!global->SetPrivate(m_context, m_extensionPrivate, m_injectedScript->com
mandLineAPI()).FromMaybe(false)) { | |
412 *m_errorString = "Internal error"; | |
413 return false; | |
414 } | |
415 m_global = global; | |
416 return true; | 410 return true; |
417 } | 411 } |
418 | 412 |
419 void InjectedScript::Scope::ignoreExceptionsAndMuteConsole() | 413 void InjectedScript::Scope::ignoreExceptionsAndMuteConsole() |
420 { | 414 { |
421 DCHECK(!m_ignoreExceptionsAndMuteConsole); | 415 DCHECK(!m_ignoreExceptionsAndMuteConsole); |
422 m_ignoreExceptionsAndMuteConsole = true; | 416 m_ignoreExceptionsAndMuteConsole = true; |
423 m_debugger->client()->muteConsole(); | 417 m_debugger->client()->muteConsole(); |
424 m_previousPauseOnExceptionsState = setPauseOnExceptionsState(V8DebuggerImpl:
:DontPauseOnExceptions); | 418 m_previousPauseOnExceptionsState = setPauseOnExceptionsState(V8DebuggerImpl:
:DontPauseOnExceptions); |
425 } | 419 } |
(...skipping 10 matching lines...) Expand all Loading... |
436 | 430 |
437 void InjectedScript::Scope::pretendUserGesture() | 431 void InjectedScript::Scope::pretendUserGesture() |
438 { | 432 { |
439 DCHECK(!m_userGesture); | 433 DCHECK(!m_userGesture); |
440 m_userGesture = true; | 434 m_userGesture = true; |
441 m_debugger->client()->beginUserGesture(); | 435 m_debugger->client()->beginUserGesture(); |
442 } | 436 } |
443 | 437 |
444 void InjectedScript::Scope::cleanup() | 438 void InjectedScript::Scope::cleanup() |
445 { | 439 { |
446 v8::Local<v8::Object> global; | 440 m_commandLineAPIScope.reset(); |
447 if (m_global.ToLocal(&global)) { | |
448 DCHECK(!m_context.IsEmpty()); | |
449 global->DeletePrivate(m_context, m_extensionPrivate); | |
450 m_global = v8::MaybeLocal<v8::Object>(); | |
451 } | |
452 if (!m_context.IsEmpty()) { | 441 if (!m_context.IsEmpty()) { |
453 m_context->Exit(); | 442 m_context->Exit(); |
454 m_context.Clear(); | 443 m_context.Clear(); |
455 } | 444 } |
456 } | 445 } |
457 | 446 |
458 InjectedScript::Scope::~Scope() | 447 InjectedScript::Scope::~Scope() |
459 { | 448 { |
460 if (m_ignoreExceptionsAndMuteConsole) { | 449 if (m_ignoreExceptionsAndMuteConsole) { |
461 setPauseOnExceptionsState(m_previousPauseOnExceptionsState); | 450 setPauseOnExceptionsState(m_previousPauseOnExceptionsState); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
518 void InjectedScript::CallFrameScope::findInjectedScript(V8InspectorSessionImpl*
session) | 507 void InjectedScript::CallFrameScope::findInjectedScript(V8InspectorSessionImpl*
session) |
519 { | 508 { |
520 std::unique_ptr<RemoteCallFrameId> remoteId = RemoteCallFrameId::parse(m_err
orString, m_remoteCallFrameId); | 509 std::unique_ptr<RemoteCallFrameId> remoteId = RemoteCallFrameId::parse(m_err
orString, m_remoteCallFrameId); |
521 if (!remoteId) | 510 if (!remoteId) |
522 return; | 511 return; |
523 m_frameOrdinal = static_cast<size_t>(remoteId->frameOrdinal()); | 512 m_frameOrdinal = static_cast<size_t>(remoteId->frameOrdinal()); |
524 m_injectedScript = session->findInjectedScript(m_errorString, remoteId.get()
); | 513 m_injectedScript = session->findInjectedScript(m_errorString, remoteId.get()
); |
525 } | 514 } |
526 | 515 |
527 } // namespace blink | 516 } // namespace blink |
OLD | NEW |