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/Values.h" | 7 #include "platform/inspector_protocol/Values.h" |
8 #include "platform/v8_inspector/IgnoreExceptionsScope.h" | 8 #include "platform/v8_inspector/IgnoreExceptionsScope.h" |
9 #include "platform/v8_inspector/InjectedScript.h" | 9 #include "platform/v8_inspector/InjectedScript.h" |
10 #include "platform/v8_inspector/InjectedScriptHost.h" | 10 #include "platform/v8_inspector/InjectedScriptHost.h" |
(...skipping 28 matching lines...) Expand all Loading... | |
39 using blink::protocol::Runtime::RemoteObject; | 39 using blink::protocol::Runtime::RemoteObject; |
40 | 40 |
41 namespace blink { | 41 namespace blink { |
42 | 42 |
43 namespace DebuggerAgentState { | 43 namespace DebuggerAgentState { |
44 static const char javaScriptBreakpoints[] = "javaScriptBreakopints"; | 44 static const char javaScriptBreakpoints[] = "javaScriptBreakopints"; |
45 static const char pauseOnExceptionsState[] = "pauseOnExceptionsState"; | 45 static const char pauseOnExceptionsState[] = "pauseOnExceptionsState"; |
46 static const char asyncCallStackDepth[] = "asyncCallStackDepth"; | 46 static const char asyncCallStackDepth[] = "asyncCallStackDepth"; |
47 static const char promiseTrackerEnabled[] = "promiseTrackerEnabled"; | 47 static const char promiseTrackerEnabled[] = "promiseTrackerEnabled"; |
48 static const char promiseTrackerCaptureStacks[] = "promiseTrackerCaptureStacks"; | 48 static const char promiseTrackerCaptureStacks[] = "promiseTrackerCaptureStacks"; |
49 static const char blackboxState[] = "blackboxState"; | |
49 | 50 |
50 // Breakpoint properties. | 51 // Breakpoint properties. |
51 static const char url[] = "url"; | 52 static const char url[] = "url"; |
52 static const char isRegex[] = "isRegex"; | 53 static const char isRegex[] = "isRegex"; |
53 static const char lineNumber[] = "lineNumber"; | 54 static const char lineNumber[] = "lineNumber"; |
54 static const char columnNumber[] = "columnNumber"; | 55 static const char columnNumber[] = "columnNumber"; |
55 static const char condition[] = "condition"; | 56 static const char condition[] = "condition"; |
56 static const char skipAllPauses[] = "skipAllPauses"; | 57 static const char skipAllPauses[] = "skipAllPauses"; |
57 | 58 |
58 } // namespace DebuggerAgentState; | 59 } // namespace DebuggerAgentState; |
59 | 60 |
60 static const int maxSkipStepFrameCount = 128; | 61 static const int maxSkipStepFrameCount = 128; |
61 | 62 |
62 const char V8DebuggerAgent::backtraceObjectGroup[] = "backtrace"; | 63 const char V8DebuggerAgent::backtraceObjectGroup[] = "backtrace"; |
63 | 64 |
64 const int V8DebuggerAgent::unknownAsyncOperationId = 0; | 65 const int V8DebuggerAgent::unknownAsyncOperationId = 0; |
65 | 66 |
67 const char hashPrefix[] = "hash:"; | |
68 const char urlPrefix[] = "url:"; | |
69 | |
66 static String breakpointIdSuffix(V8DebuggerAgentImpl::BreakpointSource source) | 70 static String breakpointIdSuffix(V8DebuggerAgentImpl::BreakpointSource source) |
67 { | 71 { |
68 switch (source) { | 72 switch (source) { |
69 case V8DebuggerAgentImpl::UserBreakpointSource: | 73 case V8DebuggerAgentImpl::UserBreakpointSource: |
70 break; | 74 break; |
71 case V8DebuggerAgentImpl::DebugCommandBreakpointSource: | 75 case V8DebuggerAgentImpl::DebugCommandBreakpointSource: |
72 return ":debug"; | 76 return ":debug"; |
73 case V8DebuggerAgentImpl::MonitorCommandBreakpointSource: | 77 case V8DebuggerAgentImpl::MonitorCommandBreakpointSource: |
74 return ":monitor"; | 78 return ":monitor"; |
75 } | 79 } |
(...skipping 15 matching lines...) Expand all Loading... | |
91 static const LChar hexDigits[17] = "0123456789ABCDEF"; | 95 static const LChar hexDigits[17] = "0123456789ABCDEF"; |
92 | 96 |
93 static void appendUnsignedAsHex(unsigned number, String& destination) | 97 static void appendUnsignedAsHex(unsigned number, String& destination) |
94 { | 98 { |
95 for (size_t i = 0; i < 8; ++i) { | 99 for (size_t i = 0; i < 8; ++i) { |
96 destination.append(hexDigits[number & 0xF]); | 100 destination.append(hexDigits[number & 0xF]); |
97 number >>= 4; | 101 number >>= 4; |
98 } | 102 } |
99 } | 103 } |
100 | 104 |
105 static bool parseBlackboxPositions(ErrorString* error, protocol::Array<protocol: :Debugger::ScriptPosition>* inPositions, protocol::Vector<std::pair<int, int>>* outPositions) | |
106 { | |
107 if (!inPositions) { | |
108 protocol::Vector<std::pair<int, int>> blackboxed(1); | |
109 outPositions->swap(blackboxed); | |
110 return true; | |
111 } | |
112 protocol::Vector<std::pair<int, int>> positions(inPositions->length()); | |
113 for (size_t i = 0; i < positions.size(); ++i) { | |
114 protocol::Debugger::ScriptPosition* position = inPositions->get(i); | |
115 if (position->getLine() < 0) { | |
116 if (error) | |
117 *error = "Position 'line' < 0."; | |
118 return false; | |
119 } | |
120 if (position->getColumn() < 0) { | |
121 if (error) | |
122 *error = "Position 'column' < 0."; | |
123 return false; | |
124 } | |
125 positions[i] = std::make_pair(position->getLine(), position->getColumn() ); | |
126 } | |
127 | |
128 for (size_t i = 1; i < positions.size(); ++i) { | |
129 if (positions[i - 1].first < positions[i].first) | |
130 continue; | |
131 if (positions[i - 1].first == positions[i].first && positions[i - 1].sec ond < positions[i].second) | |
132 continue; | |
133 if (error) | |
134 *error = "Input positions array is not sorted or contains duplicate values."; | |
135 return false; | |
136 } | |
137 | |
138 outPositions->swap(positions); | |
139 return true; | |
140 } | |
141 | |
101 // Hash algorithm for substrings is described in "Über die Komplexität der Multi plikation in | 142 // Hash algorithm for substrings is described in "Über die Komplexität der Multi plikation in |
102 // eingeschränkten Branchingprogrammmodellen" by Woelfe. | 143 // eingeschränkten Branchingprogrammmodellen" by Woelfe. |
103 // http://opendatastructures.org/versions/edition-0.1d/ods-java/node33.html#SECT ION00832000000000000000 | 144 // http://opendatastructures.org/versions/edition-0.1d/ods-java/node33.html#SECT ION00832000000000000000 |
104 static String calculateHash(const String& str) | 145 static String calculateHash(const String& str) |
105 { | 146 { |
106 static uint64_t prime[] = { 0x3FB75161, 0xAB1F4E4F, 0x82675BC5, 0xCD924D35, 0x81ABE279 }; | 147 static uint64_t prime[] = { 0x3FB75161, 0xAB1F4E4F, 0x82675BC5, 0xCD924D35, 0x81ABE279 }; |
107 static uint64_t random[] = { 0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476, 0xC3D2E1F0 }; | 148 static uint64_t random[] = { 0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476, 0xC3D2E1F0 }; |
108 static uint32_t randomOdd[] = { 0xB4663807, 0xCC322BF5, 0xD4F91BBD, 0xA7BEA1 1D, 0x8F462907 }; | 149 static uint32_t randomOdd[] = { 0xB4663807, 0xCC322BF5, 0xD4F91BBD, 0xA7BEA1 1D, 0x8F462907 }; |
109 | 150 |
110 uint64_t hashes[] = { 0, 0, 0, 0, 0 }; | 151 uint64_t hashes[] = { 0, 0, 0, 0, 0 }; |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
233 m_state->setObject(DebuggerAgentState::javaScriptBreakpoints, protocol::Dict ionaryValue::create()); | 274 m_state->setObject(DebuggerAgentState::javaScriptBreakpoints, protocol::Dict ionaryValue::create()); |
234 m_state->setNumber(DebuggerAgentState::pauseOnExceptionsState, V8DebuggerImp l::DontPauseOnExceptions); | 275 m_state->setNumber(DebuggerAgentState::pauseOnExceptionsState, V8DebuggerImp l::DontPauseOnExceptions); |
235 m_state->setNumber(DebuggerAgentState::asyncCallStackDepth, 0); | 276 m_state->setNumber(DebuggerAgentState::asyncCallStackDepth, 0); |
236 m_state->setBoolean(DebuggerAgentState::promiseTrackerEnabled, false); | 277 m_state->setBoolean(DebuggerAgentState::promiseTrackerEnabled, false); |
237 m_state->setBoolean(DebuggerAgentState::promiseTrackerCaptureStacks, false); | 278 m_state->setBoolean(DebuggerAgentState::promiseTrackerCaptureStacks, false); |
238 | 279 |
239 debugger().removeAgent(m_contextGroupId); | 280 debugger().removeAgent(m_contextGroupId); |
240 m_pausedContext.Reset(); | 281 m_pausedContext.Reset(); |
241 m_currentCallStack.Reset(); | 282 m_currentCallStack.Reset(); |
242 m_scripts.clear(); | 283 m_scripts.clear(); |
243 m_blackboxedPositions.clear(); | 284 |
285 m_scriptToBlackboxPositions.clear(); | |
286 m_blackboxRegexpPattern = String(); | |
287 | |
244 m_breakpointIdToDebuggerBreakpointIds.clear(); | 288 m_breakpointIdToDebuggerBreakpointIds.clear(); |
245 internalSetAsyncCallStackDepth(0); | 289 internalSetAsyncCallStackDepth(0); |
246 m_promiseTracker->setEnabled(false, false); | 290 m_promiseTracker->setEnabled(false, false); |
247 m_continueToLocationBreakpointId = String(); | 291 m_continueToLocationBreakpointId = String(); |
248 clearBreakDetails(); | 292 clearBreakDetails(); |
249 m_scheduledDebuggerStep = NoStep; | 293 m_scheduledDebuggerStep = NoStep; |
250 m_skipNextDebuggerStepOut = false; | 294 m_skipNextDebuggerStepOut = false; |
251 m_javaScriptPauseScheduled = false; | 295 m_javaScriptPauseScheduled = false; |
252 m_steppingFromFramework = false; | 296 m_steppingFromFramework = false; |
253 m_pausingOnNativeEvent = false; | 297 m_pausingOnNativeEvent = false; |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
294 m_state->getNumber(DebuggerAgentState::pauseOnExceptionsState, &pauseState); | 338 m_state->getNumber(DebuggerAgentState::pauseOnExceptionsState, &pauseState); |
295 setPauseOnExceptionsImpl(&error, pauseState); | 339 setPauseOnExceptionsImpl(&error, pauseState); |
296 | 340 |
297 m_skipAllPauses = m_state->booleanProperty(DebuggerAgentState::skipAllPauses , false); | 341 m_skipAllPauses = m_state->booleanProperty(DebuggerAgentState::skipAllPauses , false); |
298 | 342 |
299 int asyncCallStackDepth = 0; | 343 int asyncCallStackDepth = 0; |
300 m_state->getNumber(DebuggerAgentState::asyncCallStackDepth, &asyncCallStackD epth); | 344 m_state->getNumber(DebuggerAgentState::asyncCallStackDepth, &asyncCallStackD epth); |
301 internalSetAsyncCallStackDepth(asyncCallStackDepth); | 345 internalSetAsyncCallStackDepth(asyncCallStackDepth); |
302 | 346 |
303 m_promiseTracker->setEnabled(m_state->booleanProperty(DebuggerAgentState::pr omiseTrackerEnabled, false), m_state->booleanProperty(DebuggerAgentState::promis eTrackerCaptureStacks, false)); | 347 m_promiseTracker->setEnabled(m_state->booleanProperty(DebuggerAgentState::pr omiseTrackerEnabled, false), m_state->booleanProperty(DebuggerAgentState::promis eTrackerCaptureStacks, false)); |
348 | |
349 restoreBlackboxState(); | |
350 } | |
351 | |
352 void V8DebuggerAgentImpl::restoreBlackboxState() | |
353 { | |
354 protocol::ListValue* patternsState = m_state->getArray(DebuggerAgentState::b lackboxState); | |
355 if (!patternsState) | |
356 return; | |
357 protocol::ErrorSupport errors; | |
358 OwnPtr<protocol::Array<protocol::Debugger::BlackboxPattern>> patterns = prot ocol::Array<protocol::Debugger::BlackboxPattern>::parse(patternsState, &errors); | |
359 ASSERT(!errors.hasErrors()); | |
360 | |
361 ErrorString error; | |
362 addBlackboxPatterns(&error, patterns.release()); | |
363 ASSERT(error.isEmpty()); | |
304 } | 364 } |
305 | 365 |
306 void V8DebuggerAgentImpl::setBreakpointsActive(ErrorString* errorString, bool ac tive) | 366 void V8DebuggerAgentImpl::setBreakpointsActive(ErrorString* errorString, bool ac tive) |
307 { | 367 { |
308 if (!checkEnabled(errorString)) | 368 if (!checkEnabled(errorString)) |
309 return; | 369 return; |
310 debugger().setBreakpointsActivated(active); | 370 debugger().setBreakpointsActivated(active); |
311 } | 371 } |
312 | 372 |
313 void V8DebuggerAgentImpl::setSkipAllPauses(ErrorString*, bool skipped) | 373 void V8DebuggerAgentImpl::setSkipAllPauses(ErrorString*, bool skipped) |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
526 bool V8DebuggerAgentImpl::isTopCallFrameBlackboxed() | 586 bool V8DebuggerAgentImpl::isTopCallFrameBlackboxed() |
527 { | 587 { |
528 ASSERT(enabled()); | 588 ASSERT(enabled()); |
529 return isCallFrameWithUnknownScriptOrBlackboxed(debugger().callFrameNoScopes (0).get()); | 589 return isCallFrameWithUnknownScriptOrBlackboxed(debugger().callFrameNoScopes (0).get()); |
530 } | 590 } |
531 | 591 |
532 bool V8DebuggerAgentImpl::isCallFrameWithUnknownScriptOrBlackboxed(JavaScriptCal lFrame* frame) | 592 bool V8DebuggerAgentImpl::isCallFrameWithUnknownScriptOrBlackboxed(JavaScriptCal lFrame* frame) |
533 { | 593 { |
534 if (!frame) | 594 if (!frame) |
535 return true; | 595 return true; |
536 ScriptsMap::iterator it = m_scripts.find(String::number(frame->sourceID())); | 596 String scriptId = String::number(frame->sourceID()); |
597 ScriptsMap::iterator it = m_scripts.find(scriptId); | |
537 if (it == m_scripts.end()) { | 598 if (it == m_scripts.end()) { |
538 // Unknown scripts are blackboxed. | 599 // Unknown scripts are blackboxed. |
539 return true; | 600 return true; |
540 } | 601 } |
541 auto itBlackboxedPositions = m_blackboxedPositions.find(String::number(frame ->sourceID())); | 602 |
542 if (itBlackboxedPositions == m_blackboxedPositions.end()) | 603 const protocol::Vector<std::pair<int, int>>* ranges = nullptr; |
604 | |
605 V8DebuggerScript& script = *(it->second); | |
606 auto itBlackboxHash = m_scriptToBlackboxPositions.find(script.hasSourceURL() ? urlPrefix + script.url() : hashPrefix + script.hash()); | |
dgozman
2016/03/08 18:48:12
I think it's not worth to add strings in this hot
| |
607 if (itBlackboxHash != m_scriptToBlackboxPositions.end()) { | |
608 ranges = itBlackboxHash->second; | |
609 } else { | |
610 if (!script.sourceURL().isEmpty() && !m_blackboxRegexpPattern.isEmpty() && matches(m_debugger, script.sourceURL(), m_blackboxRegexpPattern, true)) { | |
611 protocol::Vector<std::pair<int, int>> blackboxedSourcePositions(1); | |
dgozman
2016/03/08 18:48:12
Explicit.
| |
612 m_scriptToBlackboxPositions.set(urlPrefix + script.sourceURL(), blac kboxedSourcePositions); | |
613 return true; | |
614 } | |
543 return false; | 615 return false; |
616 } | |
544 | 617 |
545 protocol::Vector<std::pair<int, int>>* ranges = itBlackboxedPositions->secon d; | |
546 auto itRange = std::lower_bound(ranges->begin(), ranges->end(), std::make_pa ir(frame->line(), frame->column()), positionComparator); | 618 auto itRange = std::lower_bound(ranges->begin(), ranges->end(), std::make_pa ir(frame->line(), frame->column()), positionComparator); |
547 // Ranges array contains positions in script where blackbox state is changed . | 619 // Ranges array contains positions in script where blackbox state is changed . |
548 // [(0,0) ... ranges[0]) isn't blackboxed, [ranges[0] ... ranges[1]) is blac kboxed... | 620 // [(0,0) ... ranges[0]) isn't blackboxed, [ranges[0] ... ranges[1]) is blac kboxed... |
549 return std::distance(ranges->begin(), itRange) % 2; | 621 return std::distance(ranges->begin(), itRange) % 2; |
550 } | 622 } |
551 | 623 |
552 V8DebuggerAgentImpl::SkipPauseRequest V8DebuggerAgentImpl::shouldSkipExceptionPa use() | 624 V8DebuggerAgentImpl::SkipPauseRequest V8DebuggerAgentImpl::shouldSkipExceptionPa use() |
553 { | 625 { |
554 if (m_steppingFromFramework) | 626 if (m_steppingFromFramework) |
555 return RequestNoSkip; | 627 return RequestNoSkip; |
(...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1211 *errorString = "Can only perform operation while tracking async call sta cks."; | 1283 *errorString = "Can only perform operation while tracking async call sta cks."; |
1212 return; | 1284 return; |
1213 } | 1285 } |
1214 if (operationId <= 0) { | 1286 if (operationId <= 0) { |
1215 *errorString = "Wrong async operation id."; | 1287 *errorString = "Wrong async operation id."; |
1216 return; | 1288 return; |
1217 } | 1289 } |
1218 m_asyncOperationBreakpoints.remove(operationId); | 1290 m_asyncOperationBreakpoints.remove(operationId); |
1219 } | 1291 } |
1220 | 1292 |
1221 void V8DebuggerAgentImpl::setBlackboxedRanges(ErrorString* error, const String& scriptId, PassOwnPtr<protocol::Array<protocol::Debugger::ScriptPosition>> inPosi tions) | 1293 void V8DebuggerAgentImpl::addBlackboxPatterns(ErrorString* error, PassOwnPtr<pro tocol::Array<protocol::Debugger::BlackboxPattern>> patterns) |
1222 { | 1294 { |
1223 if (!m_scripts.contains(scriptId)) { | 1295 String blackboxRegexpPattern; |
1224 *error = "No script with passed id."; | 1296 protocol::HashMap<String, protocol::Vector<std::pair<int, int>>> scriptToBla ckboxPositions; |
1225 return; | 1297 |
1298 for (size_t i = 0; i < patterns->length(); ++i) { | |
1299 protocol::Debugger::BlackboxPattern* pattern = patterns->get(i); | |
1300 | |
1301 String url = pattern->getUrl(String()); | |
1302 String hash = pattern->getHash(String()); | |
1303 String regexp = pattern->getRegexp(String()); | |
1304 | |
1305 if (!url.isEmpty() + !hash.isEmpty() + !regexp.isEmpty() != 1) { | |
1306 *error = "Only one field should be set in BlackboxPattern: url or ha sh or regexp."; | |
1307 return; | |
1308 } | |
1309 | |
1310 if (pattern->hasPositions() && !regexp.isEmpty()) { | |
1311 *error = "Positions can't be used with regexp BlackboxPattern."; | |
1312 return; | |
1313 } | |
1314 | |
1315 protocol::Vector<std::pair<int, int>> positions; | |
1316 if (!parseBlackboxPositions(error, pattern->getPositions(nullptr), &posi tions)) | |
1317 return; | |
1318 | |
1319 if (!regexp.isEmpty()) | |
1320 blackboxRegexpPattern = blackboxRegexpPattern + (blackboxRegexpPatte rn.isEmpty() ? "" : "|") + regexp; | |
1321 else | |
1322 scriptToBlackboxPositions.set(url.isEmpty() ? hashPrefix + hash : ur lPrefix + url, positions); | |
1226 } | 1323 } |
1227 | 1324 |
1228 if (!inPositions->length()) { | 1325 m_blackboxRegexpPattern = m_blackboxRegexpPattern + (m_blackboxRegexpPattern .isEmpty() ? "" : "|") + blackboxRegexpPattern; |
1229 m_blackboxedPositions.remove(scriptId); | 1326 for (const auto& positions : scriptToBlackboxPositions) |
1230 return; | 1327 m_scriptToBlackboxPositions.set(positions.first, *positions.second); |
1231 } | |
1232 | 1328 |
1233 protocol::Vector<std::pair<int, int>> positions(inPositions->length()); | 1329 if (!m_state->getArray(DebuggerAgentState::blackboxState)) |
1234 for (size_t i = 0; i < positions.size(); ++i) { | 1330 m_state->setArray(DebuggerAgentState::blackboxState, protocol::ListValue ::create()); |
1235 protocol::Debugger::ScriptPosition* position = inPositions->get(i); | 1331 protocol::ListValue* currentPatterns = m_state->getArray(DebuggerAgentState: :blackboxState); |
1236 if (position->getLine() < 0) { | |
1237 *error = "Position missing 'line' or 'line' < 0."; | |
1238 return; | |
1239 } | |
1240 if (position->getColumn() < 0) { | |
1241 *error = "Position missing 'column' or 'column' < 0."; | |
1242 return; | |
1243 } | |
1244 positions[i] = std::make_pair(position->getLine(), position->getColumn() ); | |
1245 } | |
1246 | 1332 |
1247 for (size_t i = 1; i < positions.size(); ++i) { | 1333 for (size_t i = 0; i < patterns->length(); ++i) |
1248 if (positions[i - 1].first < positions[i].first) | 1334 currentPatterns->pushValue(patterns->get(i)->serialize()); |
1249 continue; | 1335 return; |
1250 if (positions[i - 1].first == positions[i].first && positions[i - 1].sec ond < positions[i].second) | 1336 } |
1251 continue; | |
1252 *error = "Input positions array is not sorted or contains duplicate valu es."; | |
1253 return; | |
1254 } | |
1255 | 1337 |
1256 m_blackboxedPositions.set(scriptId, positions); | 1338 void V8DebuggerAgentImpl::clearBlackboxPatterns(ErrorString* error) |
1339 { | |
1340 m_blackboxRegexpPattern = String(); | |
1341 m_scriptToBlackboxPositions.clear(); | |
1342 m_state->setArray(DebuggerAgentState::blackboxState, protocol::ListValue::cr eate()); | |
1257 } | 1343 } |
1258 | 1344 |
1259 void V8DebuggerAgentImpl::willExecuteScript(int scriptId) | 1345 void V8DebuggerAgentImpl::willExecuteScript(int scriptId) |
1260 { | 1346 { |
1261 changeJavaScriptRecursionLevel(+1); | 1347 changeJavaScriptRecursionLevel(+1); |
1262 // Fast return. | 1348 // Fast return. |
1263 if (m_scheduledDebuggerStep != StepInto) | 1349 if (m_scheduledDebuggerStep != StepInto) |
1264 return; | 1350 return; |
1265 // Skip unknown scripts (e.g. InjectedScript). | 1351 // Skip unknown scripts (e.g. InjectedScript). |
1266 if (!m_scripts.contains(String::number(scriptId))) | 1352 if (!m_scripts.contains(String::number(scriptId))) |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1347 script.setSourceURL(V8ContentSearchUtil::findSourceURL(script.source(), false, &isDeprecatedSourceURL)); | 1433 script.setSourceURL(V8ContentSearchUtil::findSourceURL(script.source(), false, &isDeprecatedSourceURL)); |
1348 else if (script.hasSourceURL()) | 1434 else if (script.hasSourceURL()) |
1349 V8ContentSearchUtil::findSourceURL(script.source(), false, &isDeprecated SourceURL); | 1435 V8ContentSearchUtil::findSourceURL(script.source(), false, &isDeprecated SourceURL); |
1350 | 1436 |
1351 bool isDeprecatedSourceMappingURL = false; | 1437 bool isDeprecatedSourceMappingURL = false; |
1352 if (!parsedScript.success) | 1438 if (!parsedScript.success) |
1353 script.setSourceMappingURL(V8ContentSearchUtil::findSourceMapURL(script. source(), false, &isDeprecatedSourceMappingURL)); | 1439 script.setSourceMappingURL(V8ContentSearchUtil::findSourceMapURL(script. source(), false, &isDeprecatedSourceMappingURL)); |
1354 else if (!script.sourceMappingURL().isEmpty()) | 1440 else if (!script.sourceMappingURL().isEmpty()) |
1355 V8ContentSearchUtil::findSourceMapURL(script.source(), false, &isDepreca tedSourceMappingURL); | 1441 V8ContentSearchUtil::findSourceMapURL(script.source(), false, &isDepreca tedSourceMappingURL); |
1356 | 1442 |
1357 script.setHash(calculateHash(script.source())); | 1443 if (!script.hasSourceURL()) |
1444 script.setHash(calculateHash(script.source())); | |
1358 | 1445 |
1359 int executionContextId = script.executionContextId(); | 1446 int executionContextId = script.executionContextId(); |
1360 bool isContentScript = script.isContentScript(); | 1447 bool isContentScript = script.isContentScript(); |
1361 bool isInternalScript = script.isInternalScript(); | 1448 bool isInternalScript = script.isInternalScript(); |
1362 bool isLiveEdit = script.isLiveEdit(); | 1449 bool isLiveEdit = script.isLiveEdit(); |
1363 bool hasSourceURL = script.hasSourceURL(); | 1450 bool hasSourceURL = script.hasSourceURL(); |
1364 String scriptURL = script.sourceURL(); | 1451 String scriptURL = script.sourceURL(); |
1365 String sourceMapURL = script.sourceMappingURL(); | 1452 String sourceMapURL = script.sourceMappingURL(); |
1453 String hash = script.hash(); | |
1366 bool deprecatedCommentWasUsed = isDeprecatedSourceURL || isDeprecatedSourceM appingURL; | 1454 bool deprecatedCommentWasUsed = isDeprecatedSourceURL || isDeprecatedSourceM appingURL; |
1367 | 1455 |
1456 const Maybe<String>& hashParam = hash; | |
1368 const Maybe<String>& sourceMapURLParam = sourceMapURL; | 1457 const Maybe<String>& sourceMapURLParam = sourceMapURL; |
1369 const bool* isContentScriptParam = isContentScript ? &isContentScript : null ptr; | 1458 const bool* isContentScriptParam = isContentScript ? &isContentScript : null ptr; |
1370 const bool* isInternalScriptParam = isInternalScript ? &isInternalScript : n ullptr; | 1459 const bool* isInternalScriptParam = isInternalScript ? &isInternalScript : n ullptr; |
1371 const bool* isLiveEditParam = isLiveEdit ? &isLiveEdit : nullptr; | 1460 const bool* isLiveEditParam = isLiveEdit ? &isLiveEdit : nullptr; |
1372 const bool* hasSourceURLParam = hasSourceURL ? &hasSourceURL : nullptr; | 1461 const bool* hasSourceURLParam = hasSourceURL ? &hasSourceURL : nullptr; |
1373 const bool* deprecatedCommentWasUsedParam = deprecatedCommentWasUsed ? &depr ecatedCommentWasUsed : nullptr; | 1462 const bool* deprecatedCommentWasUsedParam = deprecatedCommentWasUsed ? &depr ecatedCommentWasUsed : nullptr; |
1374 if (parsedScript.success) | 1463 if (parsedScript.success) |
1375 m_frontend->scriptParsed(parsedScript.scriptId, scriptURL, script.startL ine(), script.startColumn(), script.endLine(), script.endColumn(), executionCont extId, script.hash(), isContentScriptParam, isInternalScriptParam, isLiveEditPar am, sourceMapURLParam, hasSourceURLParam, deprecatedCommentWasUsedParam); | 1464 m_frontend->scriptParsed(parsedScript.scriptId, scriptURL, script.startL ine(), script.startColumn(), script.endLine(), script.endColumn(), executionCont extId, isContentScriptParam, isInternalScriptParam, isLiveEditParam, hashParam, sourceMapURLParam, hasSourceURLParam, deprecatedCommentWasUsedParam); |
1376 else | 1465 else |
1377 m_frontend->scriptFailedToParse(parsedScript.scriptId, scriptURL, script .startLine(), script.startColumn(), script.endLine(), script.endColumn(), execut ionContextId, script.hash(), isContentScriptParam, isInternalScriptParam, source MapURLParam, hasSourceURLParam, deprecatedCommentWasUsedParam); | 1466 m_frontend->scriptFailedToParse(parsedScript.scriptId, scriptURL, script .startLine(), script.startColumn(), script.endLine(), script.endColumn(), execut ionContextId, isContentScriptParam, isInternalScriptParam, hashParam, sourceMapU RLParam, hasSourceURLParam, deprecatedCommentWasUsedParam); |
1378 | 1467 |
1379 m_scripts.set(parsedScript.scriptId, script); | 1468 m_scripts.set(parsedScript.scriptId, script); |
1380 | 1469 |
1381 if (scriptURL.isEmpty() || !parsedScript.success) | 1470 if (scriptURL.isEmpty() || !parsedScript.success) |
1382 return; | 1471 return; |
1383 | 1472 |
1384 protocol::DictionaryValue* breakpointsCookie = m_state->getObject(DebuggerAg entState::javaScriptBreakpoints); | 1473 protocol::DictionaryValue* breakpointsCookie = m_state->getObject(DebuggerAg entState::javaScriptBreakpoints); |
1385 if (!breakpointsCookie) | 1474 if (!breakpointsCookie) |
1386 return; | 1475 return; |
1387 | 1476 |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1543 | 1632 |
1544 void V8DebuggerAgentImpl::removeBreakpointAt(const String& scriptId, int lineNum ber, int columnNumber, BreakpointSource source) | 1633 void V8DebuggerAgentImpl::removeBreakpointAt(const String& scriptId, int lineNum ber, int columnNumber, BreakpointSource source) |
1545 { | 1634 { |
1546 removeBreakpoint(generateBreakpointId(scriptId, lineNumber, columnNumber, so urce)); | 1635 removeBreakpoint(generateBreakpointId(scriptId, lineNumber, columnNumber, so urce)); |
1547 } | 1636 } |
1548 | 1637 |
1549 void V8DebuggerAgentImpl::reset() | 1638 void V8DebuggerAgentImpl::reset() |
1550 { | 1639 { |
1551 m_scheduledDebuggerStep = NoStep; | 1640 m_scheduledDebuggerStep = NoStep; |
1552 m_scripts.clear(); | 1641 m_scripts.clear(); |
1553 m_blackboxedPositions.clear(); | 1642 |
1643 m_scriptToBlackboxPositions.clear(); | |
1644 m_blackboxRegexpPattern = String(); | |
1645 | |
1554 m_breakpointIdToDebuggerBreakpointIds.clear(); | 1646 m_breakpointIdToDebuggerBreakpointIds.clear(); |
1555 resetAsyncCallTracker(); | 1647 resetAsyncCallTracker(); |
1556 m_promiseTracker->clear(); | 1648 m_promiseTracker->clear(); |
1557 if (m_frontend) | 1649 if (m_frontend) |
1558 m_frontend->globalObjectCleared(); | 1650 m_frontend->globalObjectCleared(); |
1559 } | 1651 } |
1560 | 1652 |
1561 } // namespace blink | 1653 } // namespace blink |
OLD | NEW |