Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(363)

Side by Side Diff: third_party/WebKit/Source/platform/v8_inspector/V8DebuggerAgentImpl.cpp

Issue 1836653002: [DevTools] Wrap call frame with its injected script instead top injected script (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@compile-debugger-script
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "platform/v8_inspector/V8DebuggerAgentImpl.h" 5 #include "platform/v8_inspector/V8DebuggerAgentImpl.h"
6 6
7 #include "platform/inspector_protocol/String16.h" 7 #include "platform/inspector_protocol/String16.h"
8 #include "platform/inspector_protocol/Values.h" 8 #include "platform/inspector_protocol/Values.h"
9 #include "platform/v8_inspector/IgnoreExceptionsScope.h" 9 #include "platform/v8_inspector/IgnoreExceptionsScope.h"
10 #include "platform/v8_inspector/InjectedScript.h" 10 #include "platform/v8_inspector/InjectedScript.h"
(...skipping 982 matching lines...) Expand 10 before | Expand all | Expand 10 after
993 size_t frameOrdinal = static_cast<size_t>(remoteId->frameOrdinal()); 993 size_t frameOrdinal = static_cast<size_t>(remoteId->frameOrdinal());
994 if (frameOrdinal >= m_pausedCallFrames.size()) { 994 if (frameOrdinal >= m_pausedCallFrames.size()) {
995 *errorString = "Could not find call frame with given id"; 995 *errorString = "Could not find call frame with given id";
996 return; 996 return;
997 } 997 }
998 998
999 v8::MaybeLocal<v8::Object> commandLineAPI = includeCommandLineAPI.fromMaybe( false) ? injectedScript->commandLineAPI(errorString) : v8::MaybeLocal<v8::Object >(); 999 v8::MaybeLocal<v8::Object> commandLineAPI = includeCommandLineAPI.fromMaybe( false) ? injectedScript->commandLineAPI(errorString) : v8::MaybeLocal<v8::Object >();
1000 if (includeCommandLineAPI.fromMaybe(false) && commandLineAPI.IsEmpty()) 1000 if (includeCommandLineAPI.fromMaybe(false) && commandLineAPI.IsEmpty())
1001 return; 1001 return;
1002 1002
1003 InjectedScriptManager::ScopedGlobalObjectExtension scopeExtension(injectedSc ript, m_injectedScriptManager, commandLineAPI); 1003 InjectedScript::ScopedGlobalObjectExtension scopeExtension(injectedScript, c ommandLineAPI);
1004 1004
1005 v8::TryCatch tryCatch(injectedScript->isolate()); 1005 v8::TryCatch tryCatch(injectedScript->isolate());
1006 1006
1007 v8::MaybeLocal<v8::Value> maybeResultValue = m_pausedCallFrames[frameOrdinal ].get()->evaluate(toV8String(injectedScript->isolate(), expression)); 1007 v8::MaybeLocal<v8::Value> maybeResultValue = m_pausedCallFrames[frameOrdinal ].get()->evaluate(toV8String(injectedScript->isolate(), expression));
1008 1008
1009 // InjectedScript may be gone after any evaluate call - find it again. 1009 // InjectedScript may be gone after any evaluate call - find it again.
1010 injectedScript = m_injectedScriptManager->findInjectedScript(errorString, re moteId.get()); 1010 injectedScript = m_injectedScriptManager->findInjectedScript(errorString, re moteId.get());
1011 if (!injectedScript) 1011 if (!injectedScript)
1012 return; 1012 return;
1013 1013
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
1339 else if (m_scheduledDebuggerStep == StepOut) 1339 else if (m_scheduledDebuggerStep == StepOut)
1340 m_skipNextDebuggerStepOut = true; 1340 m_skipNextDebuggerStepOut = true;
1341 } 1341 }
1342 } 1342 }
1343 } 1343 }
1344 1344
1345 PassOwnPtr<Array<CallFrame>> V8DebuggerAgentImpl::currentCallFrames(ErrorString* errorString) 1345 PassOwnPtr<Array<CallFrame>> V8DebuggerAgentImpl::currentCallFrames(ErrorString* errorString)
1346 { 1346 {
1347 if (m_pausedContext.IsEmpty() || !m_pausedCallFrames.size()) 1347 if (m_pausedContext.IsEmpty() || !m_pausedCallFrames.size())
1348 return Array<CallFrame>::create(); 1348 return Array<CallFrame>::create();
1349 InjectedScript* injectedScript = m_injectedScriptManager->injectedScriptFor( m_pausedContext.Get(m_isolate)); 1349 InjectedScript* topFrameInjectedScript = m_injectedScriptManager->injectedSc riptFor(m_pausedContext.Get(m_isolate));
1350 if (!injectedScript) { 1350 if (!topFrameInjectedScript) {
1351 // Context has been reported as removed while on pause. 1351 // Context has been reported as removed while on pause.
1352 return Array<CallFrame>::create(); 1352 return Array<CallFrame>::create();
1353 } 1353 }
1354 1354
1355 v8::Isolate* isolate = injectedScript->isolate(); 1355 v8::Isolate* isolate = topFrameInjectedScript->isolate();
1356 v8::HandleScope handles(isolate); 1356 v8::HandleScope handles(isolate);
1357 v8::Local<v8::Context> context = injectedScript->context(); 1357 v8::Local<v8::Context> context = topFrameInjectedScript->context();
1358 v8::Context::Scope contextScope(context); 1358 v8::Context::Scope contextScope(context);
1359 1359
1360 v8::Local<v8::Array> objects = v8::Array::New(isolate); 1360 v8::Local<v8::Array> objects = v8::Array::New(isolate);
1361 for (size_t frameOrdinal = 0; frameOrdinal < m_pausedCallFrames.size(); ++fr ameOrdinal) { 1361 for (size_t frameOrdinal = 0; frameOrdinal < m_pausedCallFrames.size(); ++fr ameOrdinal) {
1362 JavaScriptCallFrame* currentCallFrame = m_pausedCallFrames[frameOrdinal] .get(); 1362 JavaScriptCallFrame* currentCallFrame = m_pausedCallFrames[frameOrdinal] .get();
1363 1363
1364 v8::Local<v8::Object> details = currentCallFrame->details(); 1364 v8::Local<v8::Object> details = currentCallFrame->details();
1365 if (hasInternalError(errorString, details.IsEmpty())) 1365 if (hasInternalError(errorString, details.IsEmpty()))
1366 return Array<CallFrame>::create(); 1366 return Array<CallFrame>::create();
1367 1367
1368 int contextId = currentCallFrame->contextId();
1369 ErrorString ignoredErrorString;
1370 InjectedScript* injectedScript = contextId ? m_injectedScriptManager->fi ndInjectedScript(&ignoredErrorString, contextId) : nullptr;
1371 if (!injectedScript)
1372 injectedScript = topFrameInjectedScript;
1373
1368 String16 callFrameId = RemoteCallFrameId::serialize(injectedScript->cont extId(), frameOrdinal); 1374 String16 callFrameId = RemoteCallFrameId::serialize(injectedScript->cont extId(), frameOrdinal);
1375
1369 if (hasInternalError(errorString, !details->Set(context, toV8StringInter nalized(isolate, "callFrameId"), toV8String(isolate, callFrameId)).FromMaybe(fal se))) 1376 if (hasInternalError(errorString, !details->Set(context, toV8StringInter nalized(isolate, "callFrameId"), toV8String(isolate, callFrameId)).FromMaybe(fal se)))
1370 return Array<CallFrame>::create(); 1377 return Array<CallFrame>::create();
1371 1378
1372 v8::Local<v8::Value> scopeChain; 1379 v8::Local<v8::Value> scopeChain;
1373 if (hasInternalError(errorString, !details->Get(context, toV8StringInter nalized(isolate, "scopeChain")).ToLocal(&scopeChain) || !scopeChain->IsArray())) 1380 if (hasInternalError(errorString, !details->Get(context, toV8StringInter nalized(isolate, "scopeChain")).ToLocal(&scopeChain) || !scopeChain->IsArray()))
1374 return Array<CallFrame>::create(); 1381 return Array<CallFrame>::create();
1375 v8::Local<v8::Array> scopeChainArray = scopeChain.As<v8::Array>(); 1382 v8::Local<v8::Array> scopeChainArray = scopeChain.As<v8::Array>();
1376 if (!injectedScript->wrapPropertyInArray(errorString, scopeChainArray, t oV8StringInternalized(isolate, "object"), V8DebuggerAgentImpl::backtraceObjectGr oup)) 1383 if (!injectedScript->wrapPropertyInArray(errorString, scopeChainArray, t oV8StringInternalized(isolate, "object"), V8DebuggerAgentImpl::backtraceObjectGr oup))
1377 return Array<CallFrame>::create(); 1384 return Array<CallFrame>::create();
1378 1385
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
1627 if (!enabled()) 1634 if (!enabled())
1628 return; 1635 return;
1629 m_scheduledDebuggerStep = NoStep; 1636 m_scheduledDebuggerStep = NoStep;
1630 m_scripts.clear(); 1637 m_scripts.clear();
1631 m_blackboxedPositions.clear(); 1638 m_blackboxedPositions.clear();
1632 m_breakpointIdToDebuggerBreakpointIds.clear(); 1639 m_breakpointIdToDebuggerBreakpointIds.clear();
1633 resetAsyncCallTracker(); 1640 resetAsyncCallTracker();
1634 } 1641 }
1635 1642
1636 } // namespace blink 1643 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698