| OLD | NEW |
| 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/Parser.h" | 7 #include "platform/inspector_protocol/Parser.h" |
| 8 #include "platform/inspector_protocol/String16.h" | 8 #include "platform/inspector_protocol/String16.h" |
| 9 #include "platform/inspector_protocol/Values.h" | 9 #include "platform/inspector_protocol/Values.h" |
| 10 #include "platform/v8_inspector/InjectedScript.h" | 10 #include "platform/v8_inspector/InjectedScript.h" |
| (...skipping 972 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 983 v8::HandleScope handles(m_isolate); | 983 v8::HandleScope handles(m_isolate); |
| 984 String16 scriptSource = toProtocolString(script->source(m_isolate)); | 984 String16 scriptSource = toProtocolString(script->source(m_isolate)); |
| 985 if (!success) | 985 if (!success) |
| 986 script->setSourceURL(findSourceURL(scriptSource, false)); | 986 script->setSourceURL(findSourceURL(scriptSource, false)); |
| 987 if (!success) | 987 if (!success) |
| 988 script->setSourceMappingURL(findSourceMapURL(scriptSource, false)); | 988 script->setSourceMappingURL(findSourceMapURL(scriptSource, false)); |
| 989 | 989 |
| 990 std::unique_ptr<protocol::DictionaryValue> executionContextAuxData; | 990 std::unique_ptr<protocol::DictionaryValue> executionContextAuxData; |
| 991 if (!script->executionContextAuxData().isEmpty()) | 991 if (!script->executionContextAuxData().isEmpty()) |
| 992 executionContextAuxData = protocol::DictionaryValue::cast(parseJSON(scri
pt->executionContextAuxData())); | 992 executionContextAuxData = protocol::DictionaryValue::cast(parseJSON(scri
pt->executionContextAuxData())); |
| 993 bool isInternalScript = script->isInternalScript(); | |
| 994 bool isLiveEdit = script->isLiveEdit(); | 993 bool isLiveEdit = script->isLiveEdit(); |
| 995 bool hasSourceURL = script->hasSourceURL(); | 994 bool hasSourceURL = script->hasSourceURL(); |
| 996 String16 scriptId = script->scriptId(); | 995 String16 scriptId = script->scriptId(); |
| 997 String16 scriptURL = script->sourceURL(); | 996 String16 scriptURL = script->sourceURL(); |
| 998 | 997 |
| 999 const Maybe<String16>& sourceMapURLParam = script->sourceMappingURL(); | 998 const Maybe<String16>& sourceMapURLParam = script->sourceMappingURL(); |
| 1000 const Maybe<protocol::DictionaryValue>& executionContextAuxDataParam(std::mo
ve(executionContextAuxData)); | 999 const Maybe<protocol::DictionaryValue>& executionContextAuxDataParam(std::mo
ve(executionContextAuxData)); |
| 1001 const bool* isInternalScriptParam = isInternalScript ? &isInternalScript : n
ullptr; | |
| 1002 const bool* isLiveEditParam = isLiveEdit ? &isLiveEdit : nullptr; | 1000 const bool* isLiveEditParam = isLiveEdit ? &isLiveEdit : nullptr; |
| 1003 const bool* hasSourceURLParam = hasSourceURL ? &hasSourceURL : nullptr; | 1001 const bool* hasSourceURLParam = hasSourceURL ? &hasSourceURL : nullptr; |
| 1004 if (success) | 1002 if (success) |
| 1005 m_frontend.scriptParsed(scriptId, scriptURL, script->startLine(), script
->startColumn(), script->endLine(), script->endColumn(), script->executionContex
tId(), script->hash(), executionContextAuxDataParam, isInternalScriptParam, isLi
veEditParam, sourceMapURLParam, hasSourceURLParam); | 1003 m_frontend.scriptParsed(scriptId, scriptURL, script->startLine(), script
->startColumn(), script->endLine(), script->endColumn(), script->executionContex
tId(), script->hash(), executionContextAuxDataParam, isLiveEditParam, sourceMapU
RLParam, hasSourceURLParam); |
| 1006 else | 1004 else |
| 1007 m_frontend.scriptFailedToParse(scriptId, scriptURL, script->startLine(),
script->startColumn(), script->endLine(), script->endColumn(), script->executio
nContextId(), script->hash(), executionContextAuxDataParam, isInternalScriptPara
m, sourceMapURLParam, hasSourceURLParam); | 1005 m_frontend.scriptFailedToParse(scriptId, scriptURL, script->startLine(),
script->startColumn(), script->endLine(), script->endColumn(), script->executio
nContextId(), script->hash(), executionContextAuxDataParam, sourceMapURLParam, h
asSourceURLParam); |
| 1008 | 1006 |
| 1009 m_scripts[scriptId] = std::move(script); | 1007 m_scripts[scriptId] = std::move(script); |
| 1010 | 1008 |
| 1011 if (scriptURL.isEmpty() || !success) | 1009 if (scriptURL.isEmpty() || !success) |
| 1012 return; | 1010 return; |
| 1013 | 1011 |
| 1014 protocol::DictionaryValue* breakpointsCookie = m_state->getObject(DebuggerAg
entState::javaScriptBreakpoints); | 1012 protocol::DictionaryValue* breakpointsCookie = m_state->getObject(DebuggerAg
entState::javaScriptBreakpoints); |
| 1015 if (!breakpointsCookie) | 1013 if (!breakpointsCookie) |
| 1016 return; | 1014 return; |
| 1017 | 1015 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 1032 if (location) | 1030 if (location) |
| 1033 m_frontend.breakpointResolved(cookie.first, std::move(location)); | 1031 m_frontend.breakpointResolved(cookie.first, std::move(location)); |
| 1034 } | 1032 } |
| 1035 } | 1033 } |
| 1036 | 1034 |
| 1037 V8DebuggerAgentImpl::SkipPauseRequest V8DebuggerAgentImpl::didPause(v8::Local<v8
::Context> context, v8::Local<v8::Value> exception, const std::vector<String16>&
hitBreakpoints, bool isPromiseRejection) | 1035 V8DebuggerAgentImpl::SkipPauseRequest V8DebuggerAgentImpl::didPause(v8::Local<v8
::Context> context, v8::Local<v8::Value> exception, const std::vector<String16>&
hitBreakpoints, bool isPromiseRejection) |
| 1038 { | 1036 { |
| 1039 JavaScriptCallFrames callFrames = m_debugger->currentCallFrames(1); | 1037 JavaScriptCallFrames callFrames = m_debugger->currentCallFrames(1); |
| 1040 JavaScriptCallFrame* topCallFrame = !callFrames.empty() ? callFrames.begin()
->get() : nullptr; | 1038 JavaScriptCallFrame* topCallFrame = !callFrames.empty() ? callFrames.begin()
->get() : nullptr; |
| 1041 | 1039 |
| 1042 // Skip pause in internal scripts (e.g. InjectedScriptSource.js). | |
| 1043 if (topCallFrame) { | |
| 1044 ScriptsMap::iterator it = m_scripts.find(String16::fromInteger(topCallFr
ame->sourceID())); | |
| 1045 if (it != m_scripts.end() && it->second->isInternalScript()) | |
| 1046 return RequestStepFrame; | |
| 1047 } | |
| 1048 | |
| 1049 V8DebuggerAgentImpl::SkipPauseRequest result; | 1040 V8DebuggerAgentImpl::SkipPauseRequest result; |
| 1050 if (m_skipAllPauses) | 1041 if (m_skipAllPauses) |
| 1051 result = RequestContinue; | 1042 result = RequestContinue; |
| 1052 else if (!hitBreakpoints.empty()) | 1043 else if (!hitBreakpoints.empty()) |
| 1053 result = RequestNoSkip; // Don't skip explicit breakpoints even if set i
n frameworks. | 1044 result = RequestNoSkip; // Don't skip explicit breakpoints even if set i
n frameworks. |
| 1054 else if (!exception.IsEmpty()) | 1045 else if (!exception.IsEmpty()) |
| 1055 result = shouldSkipExceptionPause(topCallFrame); | 1046 result = shouldSkipExceptionPause(topCallFrame); |
| 1056 else if (m_scheduledDebuggerStep != NoStep || m_javaScriptPauseScheduled ||
m_pausingOnNativeEvent) | 1047 else if (m_scheduledDebuggerStep != NoStep || m_javaScriptPauseScheduled ||
m_pausingOnNativeEvent) |
| 1057 result = shouldSkipStepPause(topCallFrame); | 1048 result = shouldSkipStepPause(topCallFrame); |
| 1058 else | 1049 else |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1172 { | 1163 { |
| 1173 if (!enabled()) | 1164 if (!enabled()) |
| 1174 return; | 1165 return; |
| 1175 m_scheduledDebuggerStep = NoStep; | 1166 m_scheduledDebuggerStep = NoStep; |
| 1176 m_scripts.clear(); | 1167 m_scripts.clear(); |
| 1177 m_blackboxedPositions.clear(); | 1168 m_blackboxedPositions.clear(); |
| 1178 m_breakpointIdToDebuggerBreakpointIds.clear(); | 1169 m_breakpointIdToDebuggerBreakpointIds.clear(); |
| 1179 } | 1170 } |
| 1180 | 1171 |
| 1181 } // namespace blink | 1172 } // namespace blink |
| OLD | NEW |