| 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 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 406 findInjectedScript(session); | 406 findInjectedScript(session); |
| 407 if (!m_injectedScript) | 407 if (!m_injectedScript) |
| 408 return false; | 408 return false; |
| 409 m_context = m_injectedScript->context()->context(); | 409 m_context = m_injectedScript->context()->context(); |
| 410 m_context->Enter(); | 410 m_context->Enter(); |
| 411 return true; | 411 return true; |
| 412 } | 412 } |
| 413 | 413 |
| 414 bool InjectedScript::Scope::installCommandLineAPI() | 414 bool InjectedScript::Scope::installCommandLineAPI() |
| 415 { | 415 { |
| 416 ASSERT(m_injectedScript && !m_context.IsEmpty()); | 416 DCHECK(m_injectedScript && !m_context.IsEmpty() && m_global.IsEmpty()); |
| 417 v8::Local<v8::Object> extensionObject; | 417 v8::Local<v8::Object> extensionObject; |
| 418 if (!m_injectedScript->commandLineAPI(m_errorString).ToLocal(&extensionObjec
t)) | 418 if (!m_injectedScript->commandLineAPI(m_errorString).ToLocal(&extensionObjec
t)) |
| 419 return false; | 419 return false; |
| 420 return installGlobalObjectExtension(extensionObject); | 420 m_extensionPrivate = V8Debugger::scopeExtensionPrivate(m_debugger->isolate()
); |
| 421 } | 421 v8::Local<v8::Object> global = m_context->Global(); |
| 422 | 422 if (!global->SetPrivate(m_context, m_extensionPrivate, extensionObject).From
Maybe(false)) { |
| 423 bool InjectedScript::Scope::installRemoteObjectAPI(const String16& objectGroupNa
me) | |
| 424 { | |
| 425 ASSERT(m_injectedScript && !m_context.IsEmpty()); | |
| 426 V8FunctionCall function(m_debugger, m_context, m_injectedScript->v8Value(),
"remoteObjectAPI"); | |
| 427 function.appendArgument(objectGroupName); | |
| 428 bool hadException = false; | |
| 429 v8::Local<v8::Value> extension = function.call(hadException, false); | |
| 430 if (hadException || extension.IsEmpty() || !extension->IsObject()) { | |
| 431 *m_errorString = "Internal error"; | 423 *m_errorString = "Internal error"; |
| 432 return false; | 424 return false; |
| 433 } | 425 } |
| 434 v8::Local<v8::Object> extensionObject = extension.As<v8::Object>(); | |
| 435 return installGlobalObjectExtension(extensionObject); | |
| 436 } | |
| 437 | |
| 438 bool InjectedScript::Scope::installGlobalObjectExtension(v8::Local<v8::Object> e
xtension) | |
| 439 { | |
| 440 ASSERT(m_global.IsEmpty()); | |
| 441 m_extensionPrivate = V8Debugger::scopeExtensionPrivate(m_debugger->isolate()
); | |
| 442 v8::Local<v8::Object> global = m_context->Global(); | |
| 443 if (!global->SetPrivate(m_context, m_extensionPrivate, extension).FromMaybe(
false)) { | |
| 444 *m_errorString = "Internal error"; | |
| 445 return false; | |
| 446 } | |
| 447 m_global = global; | 426 m_global = global; |
| 448 return true; | 427 return true; |
| 449 } | 428 } |
| 450 | 429 |
| 451 void InjectedScript::Scope::ignoreExceptionsAndMuteConsole() | 430 void InjectedScript::Scope::ignoreExceptionsAndMuteConsole() |
| 452 { | 431 { |
| 453 ASSERT(!m_ignoreExceptionsAndMuteConsole); | 432 ASSERT(!m_ignoreExceptionsAndMuteConsole); |
| 454 m_ignoreExceptionsAndMuteConsole = true; | 433 m_ignoreExceptionsAndMuteConsole = true; |
| 455 m_debugger->client()->muteConsole(); | 434 m_debugger->client()->muteConsole(); |
| 456 m_previousPauseOnExceptionsState = setPauseOnExceptionsState(V8DebuggerImpl:
:DontPauseOnExceptions); | 435 m_previousPauseOnExceptionsState = setPauseOnExceptionsState(V8DebuggerImpl:
:DontPauseOnExceptions); |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 550 void InjectedScript::CallFrameScope::findInjectedScript(V8InspectorSessionImpl*
session) | 529 void InjectedScript::CallFrameScope::findInjectedScript(V8InspectorSessionImpl*
session) |
| 551 { | 530 { |
| 552 OwnPtr<RemoteCallFrameId> remoteId = RemoteCallFrameId::parse(m_errorString,
m_remoteCallFrameId); | 531 OwnPtr<RemoteCallFrameId> remoteId = RemoteCallFrameId::parse(m_errorString,
m_remoteCallFrameId); |
| 553 if (!remoteId) | 532 if (!remoteId) |
| 554 return; | 533 return; |
| 555 m_frameOrdinal = static_cast<size_t>(remoteId->frameOrdinal()); | 534 m_frameOrdinal = static_cast<size_t>(remoteId->frameOrdinal()); |
| 556 m_injectedScript = session->findInjectedScript(m_errorString, remoteId.get()
); | 535 m_injectedScript = session->findInjectedScript(m_errorString, remoteId.get()
); |
| 557 } | 536 } |
| 558 | 537 |
| 559 } // namespace blink | 538 } // namespace blink |
| OLD | NEW |