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

Side by Side Diff: Source/core/inspector/InspectorDebuggerAgent.cpp

Issue 369333002: DevTools: Added error message when the command is invoked from the console with exception (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@add-evaluate-exception-details
Patch Set: Created 6 years, 5 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 /* 1 /*
2 * Copyright (C) 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2010 Apple Inc. All rights reserved.
3 * Copyright (C) 2013 Google Inc. All rights reserved. 3 * Copyright (C) 2013 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 950 matching lines...) Expand 10 before | Expand all | Expand 10 after
961 961
962 void InspectorDebuggerAgent::setPauseOnExceptionsImpl(ErrorString* errorString, int pauseState) 962 void InspectorDebuggerAgent::setPauseOnExceptionsImpl(ErrorString* errorString, int pauseState)
963 { 963 {
964 scriptDebugServer().setPauseOnExceptionsState(static_cast<ScriptDebugServer: :PauseOnExceptionsState>(pauseState)); 964 scriptDebugServer().setPauseOnExceptionsState(static_cast<ScriptDebugServer: :PauseOnExceptionsState>(pauseState));
965 if (scriptDebugServer().pauseOnExceptionsState() != pauseState) 965 if (scriptDebugServer().pauseOnExceptionsState() != pauseState)
966 *errorString = "Internal error. Could not change pause on exceptions sta te"; 966 *errorString = "Internal error. Could not change pause on exceptions sta te";
967 else 967 else
968 m_state->setLong(DebuggerAgentState::pauseOnExceptionsState, pauseState) ; 968 m_state->setLong(DebuggerAgentState::pauseOnExceptionsState, pauseState) ;
969 } 969 }
970 970
971 void InspectorDebuggerAgent::evaluateOnCallFrame(ErrorString* errorString, const String& callFrameId, const String& expression, const String* const objectGroup, const bool* const includeCommandLineAPI, const bool* const doNotPauseOnExceptio nsAndMuteConsole, const bool* const returnByValue, const bool* generatePreview, RefPtr<RemoteObject>& result, TypeBuilder::OptOutput<bool>* wasThrown) 971 void InspectorDebuggerAgent::evaluateOnCallFrame(ErrorString* errorString, const String& callFrameId, const String& expression, const String* const objectGroup, const bool* const includeCommandLineAPI, const bool* const doNotPauseOnExceptio nsAndMuteConsole, const bool* const returnByValue, const bool* generatePreview, RefPtr<RemoteObject>& result, TypeBuilder::OptOutput<bool>* wasThrown, RefPtr<Ty peBuilder::Debugger::ExceptionDetails>& exceptionDetails)
972 { 972 {
973 if (!isPaused() || m_currentCallStack.isEmpty()) { 973 if (!isPaused() || m_currentCallStack.isEmpty()) {
974 *errorString = "Attempt to access callframe when debugger is not on paus e"; 974 *errorString = "Attempt to access callframe when debugger is not on paus e";
975 return; 975 return;
976 } 976 }
977 InjectedScript injectedScript = m_injectedScriptManager->injectedScriptForOb jectId(callFrameId); 977 InjectedScript injectedScript = m_injectedScriptManager->injectedScriptForOb jectId(callFrameId);
978 if (injectedScript.isEmpty()) { 978 if (injectedScript.isEmpty()) {
979 *errorString = "Inspected frame has gone"; 979 *errorString = "Inspected frame has gone";
980 return; 980 return;
981 } 981 }
982 982
983 ScriptDebugServer::PauseOnExceptionsState previousPauseOnExceptionsState = s criptDebugServer().pauseOnExceptionsState(); 983 ScriptDebugServer::PauseOnExceptionsState previousPauseOnExceptionsState = s criptDebugServer().pauseOnExceptionsState();
984 if (doNotPauseOnExceptionsAndMuteConsole ? *doNotPauseOnExceptionsAndMuteCon sole : false) { 984 if (doNotPauseOnExceptionsAndMuteConsole ? *doNotPauseOnExceptionsAndMuteCon sole : false) {
985 if (previousPauseOnExceptionsState != ScriptDebugServer::DontPauseOnExce ptions) 985 if (previousPauseOnExceptionsState != ScriptDebugServer::DontPauseOnExce ptions)
986 scriptDebugServer().setPauseOnExceptionsState(ScriptDebugServer::Don tPauseOnExceptions); 986 scriptDebugServer().setPauseOnExceptionsState(ScriptDebugServer::Don tPauseOnExceptions);
987 muteConsole(); 987 muteConsole();
988 } 988 }
989 989
990 Vector<ScriptValue> asyncCallStacks; 990 Vector<ScriptValue> asyncCallStacks;
991 const AsyncCallStackTracker::AsyncCallChain* asyncChain = m_asyncCallStackTr acker.isEnabled() ? m_asyncCallStackTracker.currentAsyncCallChain() : 0; 991 const AsyncCallStackTracker::AsyncCallChain* asyncChain = m_asyncCallStackTr acker.isEnabled() ? m_asyncCallStackTracker.currentAsyncCallChain() : 0;
992 if (asyncChain) { 992 if (asyncChain) {
993 const AsyncCallStackTracker::AsyncCallStackVector& callStacks = asyncCha in->callStacks(); 993 const AsyncCallStackTracker::AsyncCallStackVector& callStacks = asyncCha in->callStacks();
994 asyncCallStacks.resize(callStacks.size()); 994 asyncCallStacks.resize(callStacks.size());
995 AsyncCallStackTracker::AsyncCallStackVector::const_iterator it = callSta cks.begin(); 995 AsyncCallStackTracker::AsyncCallStackVector::const_iterator it = callSta cks.begin();
996 for (size_t i = 0; it != callStacks.end(); ++it, ++i) 996 for (size_t i = 0; it != callStacks.end(); ++it, ++i)
997 asyncCallStacks[i] = (*it)->callFrames(); 997 asyncCallStacks[i] = (*it)->callFrames();
998 } 998 }
999 999
1000 injectedScript.evaluateOnCallFrame(errorString, m_currentCallStack, asyncCal lStacks, callFrameId, expression, objectGroup ? *objectGroup : "", includeComman dLineAPI ? *includeCommandLineAPI : false, returnByValue ? *returnByValue : fals e, generatePreview ? *generatePreview : false, &result, wasThrown); 1000 injectedScript.evaluateOnCallFrame(errorString, m_currentCallStack, asyncCal lStacks, callFrameId, expression, objectGroup ? *objectGroup : "", includeComman dLineAPI ? *includeCommandLineAPI : false, returnByValue ? *returnByValue : fals e, generatePreview ? *generatePreview : false, &result, wasThrown, &exceptionDet ails);
1001 1001 if (exceptionDetails)
1002 exceptionDetails->setStackTrace(TypeBuilder::Array<TypeBuilder::Console: :CallFrame>::create());
vsevik 2014/07/15 16:14:33 This is worth a comment.
kozyatinskiy1 2014/07/16 13:15:47 Done.
1002 if (doNotPauseOnExceptionsAndMuteConsole ? *doNotPauseOnExceptionsAndMuteCon sole : false) { 1003 if (doNotPauseOnExceptionsAndMuteConsole ? *doNotPauseOnExceptionsAndMuteCon sole : false) {
1003 unmuteConsole(); 1004 unmuteConsole();
1004 if (scriptDebugServer().pauseOnExceptionsState() != previousPauseOnExcep tionsState) 1005 if (scriptDebugServer().pauseOnExceptionsState() != previousPauseOnExcep tionsState)
1005 scriptDebugServer().setPauseOnExceptionsState(previousPauseOnExcepti onsState); 1006 scriptDebugServer().setPauseOnExceptionsState(previousPauseOnExcepti onsState);
1006 } 1007 }
1007 } 1008 }
1008 1009
1009 void InspectorDebuggerAgent::compileScript(ErrorString* errorString, const Strin g& expression, const String& sourceURL, const int* executionContextId, TypeBuild er::OptOutput<ScriptId>* scriptId, RefPtr<ExceptionDetails>& exceptionDetails) 1010 void InspectorDebuggerAgent::compileScript(ErrorString* errorString, const Strin g& expression, const String& sourceURL, const int* executionContextId, TypeBuild er::OptOutput<ScriptId>* scriptId, RefPtr<ExceptionDetails>& exceptionDetails)
1010 { 1011 {
1011 InjectedScript injectedScript = injectedScriptForEval(errorString, execution ContextId); 1012 InjectedScript injectedScript = injectedScriptForEval(errorString, execution ContextId);
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
1419 { 1420 {
1420 m_scripts.clear(); 1421 m_scripts.clear();
1421 m_breakpointIdToDebugServerBreakpointIds.clear(); 1422 m_breakpointIdToDebugServerBreakpointIds.clear();
1422 m_asyncCallStackTracker.clear(); 1423 m_asyncCallStackTracker.clear();
1423 if (m_frontend) 1424 if (m_frontend)
1424 m_frontend->globalObjectCleared(); 1425 m_frontend->globalObjectCleared();
1425 } 1426 }
1426 1427
1427 } // namespace WebCore 1428 } // namespace WebCore
1428 1429
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698