| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 const Maybe<bool>& generatePreview, | 81 const Maybe<bool>& generatePreview, |
| 82 const Maybe<bool>& userGesture, | 82 const Maybe<bool>& userGesture, |
| 83 OwnPtr<RemoteObject>* result, | 83 OwnPtr<RemoteObject>* result, |
| 84 Maybe<bool>* wasThrown, | 84 Maybe<bool>* wasThrown, |
| 85 Maybe<ExceptionDetails>* exceptionDetails) | 85 Maybe<ExceptionDetails>* exceptionDetails) |
| 86 { | 86 { |
| 87 int contextId; | 87 int contextId; |
| 88 if (executionContextId.isJust()) { | 88 if (executionContextId.isJust()) { |
| 89 contextId = executionContextId.fromJust(); | 89 contextId = executionContextId.fromJust(); |
| 90 } else { | 90 } else { |
| 91 InspectedContext* mainInGroup = nullptr; | 91 contextId = m_debugger->client()->ensureDefaultContextInGroup(m_session-
>contextGroupId()); |
| 92 if (const V8DebuggerImpl::ContextByIdMap* contexts = m_debugger->context
Group(m_session->contextGroupId())) { | 92 if (!contextId) { |
| 93 for (auto& idContext : *contexts) { | |
| 94 if (idContext.second->isMainInGroup()) { | |
| 95 mainInGroup = idContext.second; | |
| 96 break; | |
| 97 } | |
| 98 } | |
| 99 } | |
| 100 if (!mainInGroup) { | |
| 101 *errorString = "Cannot find default execution context"; | 93 *errorString = "Cannot find default execution context"; |
| 102 return; | 94 return; |
| 103 } | 95 } |
| 104 contextId = mainInGroup->contextId(); | |
| 105 } | 96 } |
| 106 | 97 |
| 107 InjectedScript* injectedScript = m_session->findInjectedScript(errorString,
contextId); | 98 InjectedScript* injectedScript = m_session->findInjectedScript(errorString,
contextId); |
| 108 if (!injectedScript) | 99 if (!injectedScript) |
| 109 return; | 100 return; |
| 110 | 101 |
| 111 v8::HandleScope scope(injectedScript->isolate()); | 102 v8::HandleScope scope(injectedScript->isolate()); |
| 112 v8::Local<v8::Context> context = injectedScript->context()->context(); | 103 v8::Local<v8::Context> context = injectedScript->context()->context(); |
| 113 v8::Context::Scope contextScope(context); | 104 v8::Context::Scope contextScope(context); |
| 114 | 105 |
| (...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 549 | 540 |
| 550 void V8RuntimeAgentImpl::reportExecutionContextDestroyed(InspectedContext* conte
xt) | 541 void V8RuntimeAgentImpl::reportExecutionContextDestroyed(InspectedContext* conte
xt) |
| 551 { | 542 { |
| 552 if (m_enabled && context->isReported()) { | 543 if (m_enabled && context->isReported()) { |
| 553 context->setReported(false); | 544 context->setReported(false); |
| 554 m_frontend->executionContextDestroyed(context->contextId()); | 545 m_frontend->executionContextDestroyed(context->contextId()); |
| 555 } | 546 } |
| 556 } | 547 } |
| 557 | 548 |
| 558 } // namespace blink | 549 } // namespace blink |
| OLD | NEW |