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

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 987 matching lines...) Expand 10 before | Expand all | Expand 10 after
998 OwnPtr<JavaScriptCallFrame> javaScriptCallFrame = debugger().callFrame(remot eId->frameOrdinal()); 998 OwnPtr<JavaScriptCallFrame> javaScriptCallFrame = debugger().callFrame(remot eId->frameOrdinal());
999 if (!javaScriptCallFrame) { 999 if (!javaScriptCallFrame) {
1000 *errorString = "Could not find call frame with given id"; 1000 *errorString = "Could not find call frame with given id";
1001 return; 1001 return;
1002 } 1002 }
1003 1003
1004 v8::MaybeLocal<v8::Object> commandLineAPI = includeCommandLineAPI.fromMaybe( false) ? injectedScript->commandLineAPI(errorString) : v8::MaybeLocal<v8::Object >(); 1004 v8::MaybeLocal<v8::Object> commandLineAPI = includeCommandLineAPI.fromMaybe( false) ? injectedScript->commandLineAPI(errorString) : v8::MaybeLocal<v8::Object >();
1005 if (includeCommandLineAPI.fromMaybe(false) && commandLineAPI.IsEmpty()) 1005 if (includeCommandLineAPI.fromMaybe(false) && commandLineAPI.IsEmpty())
1006 return; 1006 return;
1007 1007
1008 InjectedScriptManager::ScopedGlobalObjectExtension scopeExtension(injectedSc ript, m_injectedScriptManager, commandLineAPI); 1008 InjectedScript::ScopedGlobalObjectExtension scopeExtension(injectedScript, c ommandLineAPI);
1009 1009
1010 v8::TryCatch tryCatch(injectedScript->isolate()); 1010 v8::TryCatch tryCatch(injectedScript->isolate());
1011 1011
1012 v8::MaybeLocal<v8::Value> maybeResultValue = javaScriptCallFrame->evaluate(t oV8String(injectedScript->isolate(), expression)); 1012 v8::MaybeLocal<v8::Value> maybeResultValue = javaScriptCallFrame->evaluate(t oV8String(injectedScript->isolate(), expression));
1013 1013
1014 // InjectedScript may be gone after any evaluate call - find it again. 1014 // InjectedScript may be gone after any evaluate call - find it again.
1015 injectedScript = m_injectedScriptManager->findInjectedScript(errorString, re moteId.get()); 1015 injectedScript = m_injectedScriptManager->findInjectedScript(errorString, re moteId.get());
1016 if (!injectedScript) 1016 if (!injectedScript)
1017 return; 1017 return;
1018 1018
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
1346 else if (m_scheduledDebuggerStep == StepOut) 1346 else if (m_scheduledDebuggerStep == StepOut)
1347 m_skipNextDebuggerStepOut = true; 1347 m_skipNextDebuggerStepOut = true;
1348 } 1348 }
1349 } 1349 }
1350 } 1350 }
1351 1351
1352 PassOwnPtr<Array<CallFrame>> V8DebuggerAgentImpl::currentCallFrames(ErrorString* errorString) 1352 PassOwnPtr<Array<CallFrame>> V8DebuggerAgentImpl::currentCallFrames(ErrorString* errorString)
1353 { 1353 {
1354 if (m_pausedContext.IsEmpty() || !m_currentCallStack) 1354 if (m_pausedContext.IsEmpty() || !m_currentCallStack)
1355 return Array<CallFrame>::create(); 1355 return Array<CallFrame>::create();
1356 InjectedScript* injectedScript = m_injectedScriptManager->injectedScriptFor( m_pausedContext.Get(m_isolate)); 1356 InjectedScript* topFrameInjectedScript = m_injectedScriptManager->injectedSc riptFor(m_pausedContext.Get(m_isolate));
1357 if (!injectedScript) { 1357 if (!topFrameInjectedScript) {
1358 // Context has been reported as removed while on pause. 1358 // Context has been reported as removed while on pause.
1359 return Array<CallFrame>::create(); 1359 return Array<CallFrame>::create();
1360 } 1360 }
1361 1361
1362 v8::Isolate* isolate = injectedScript->isolate(); 1362 v8::Isolate* isolate = topFrameInjectedScript->isolate();
1363 v8::HandleScope handles(isolate); 1363 v8::HandleScope handles(isolate);
1364 v8::Local<v8::Context> context = injectedScript->context(); 1364 v8::Local<v8::Context> context = topFrameInjectedScript->context();
1365 v8::Context::Scope contextScope(context); 1365 v8::Context::Scope contextScope(context);
1366 1366
1367 JavaScriptCallFrame* currentCallFrame = m_currentCallStack.get(); 1367 JavaScriptCallFrame* currentCallFrame = m_currentCallStack.get();
1368 int callFrameIndex = 0; 1368 int callFrameIndex = 0;
1369 OwnPtr<JavaScriptCallFrame> currentCallFrameOwner; 1369 OwnPtr<JavaScriptCallFrame> currentCallFrameOwner;
1370 v8::Local<v8::Array> objects = v8::Array::New(isolate); 1370 v8::Local<v8::Array> objects = v8::Array::New(isolate);
1371 while (currentCallFrame) { 1371 while (currentCallFrame) {
1372 v8::Local<v8::Object> details = currentCallFrame->details(); 1372 v8::Local<v8::Object> details = currentCallFrame->details();
1373 if (hasInternalError(errorString, details.IsEmpty())) 1373 if (hasInternalError(errorString, details.IsEmpty()))
1374 return Array<CallFrame>::create(); 1374 return Array<CallFrame>::create();
1375 1375
1376 int contextId = currentCallFrame->contextId();
1377 InjectedScript* injectedScript = contextId ? m_injectedScriptManager->fi ndInjectedScript(errorString, contextId) : nullptr;
1378 if (!injectedScript) {
1379 *errorString = "";
dgozman 2016/03/28 16:14:30 Pass different error string instead.
kozy 2016/03/28 17:59:19 Done.
1380 injectedScript = topFrameInjectedScript;
1381 }
1382
1376 String16 callFrameId = RemoteCallFrameId::serialize(injectedScript->cont extId(), callFrameIndex); 1383 String16 callFrameId = RemoteCallFrameId::serialize(injectedScript->cont extId(), callFrameIndex);
1377 if (hasInternalError(errorString, !details->Set(context, toV8StringInter nalized(isolate, "callFrameId"), toV8String(isolate, callFrameId)).FromMaybe(fal se))) 1384 if (hasInternalError(errorString, !details->Set(context, toV8StringInter nalized(isolate, "callFrameId"), toV8String(isolate, callFrameId)).FromMaybe(fal se)))
1378 return Array<CallFrame>::create(); 1385 return Array<CallFrame>::create();
1379 1386
1380 v8::Local<v8::Value> scopeChain; 1387 v8::Local<v8::Value> scopeChain;
1381 if (hasInternalError(errorString, !details->Get(context, toV8StringInter nalized(isolate, "scopeChain")).ToLocal(&scopeChain) || !scopeChain->IsArray())) 1388 if (hasInternalError(errorString, !details->Get(context, toV8StringInter nalized(isolate, "scopeChain")).ToLocal(&scopeChain) || !scopeChain->IsArray()))
1382 return Array<CallFrame>::create(); 1389 return Array<CallFrame>::create();
1383 v8::Local<v8::Array> scopeChainArray = scopeChain.As<v8::Array>(); 1390 v8::Local<v8::Array> scopeChainArray = scopeChain.As<v8::Array>();
1384 if (!injectedScript->wrapPropertyInArray(errorString, scopeChainArray, t oV8StringInternalized(isolate, "object"), V8DebuggerAgentImpl::backtraceObjectGr oup)) 1391 if (!injectedScript->wrapPropertyInArray(errorString, scopeChainArray, t oV8StringInternalized(isolate, "object"), V8DebuggerAgentImpl::backtraceObjectGr oup))
1385 return Array<CallFrame>::create(); 1392 return Array<CallFrame>::create();
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
1635 if (!enabled()) 1642 if (!enabled())
1636 return; 1643 return;
1637 m_scheduledDebuggerStep = NoStep; 1644 m_scheduledDebuggerStep = NoStep;
1638 m_scripts.clear(); 1645 m_scripts.clear();
1639 m_blackboxedPositions.clear(); 1646 m_blackboxedPositions.clear();
1640 m_breakpointIdToDebuggerBreakpointIds.clear(); 1647 m_breakpointIdToDebuggerBreakpointIds.clear();
1641 resetAsyncCallTracker(); 1648 resetAsyncCallTracker();
1642 } 1649 }
1643 1650
1644 } // namespace blink 1651 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698