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 blackboxPatterns[] = "blackboxPatterns"; |
| 50 static const char blackboxHashes[] = "blackboxHashes"; |
49 | 51 |
50 // Breakpoint properties. | 52 // Breakpoint properties. |
51 static const char url[] = "url"; | 53 static const char url[] = "url"; |
52 static const char isRegex[] = "isRegex"; | 54 static const char isRegex[] = "isRegex"; |
53 static const char lineNumber[] = "lineNumber"; | 55 static const char lineNumber[] = "lineNumber"; |
54 static const char columnNumber[] = "columnNumber"; | 56 static const char columnNumber[] = "columnNumber"; |
55 static const char condition[] = "condition"; | 57 static const char condition[] = "condition"; |
56 static const char skipAllPauses[] = "skipAllPauses"; | 58 static const char skipAllPauses[] = "skipAllPauses"; |
57 | 59 |
| 60 // Blackbox hash object properties. |
| 61 static const char hashValue[] = "hashValue"; |
| 62 static const char hashPositions[] = "hashPositions"; |
| 63 |
58 } // namespace DebuggerAgentState; | 64 } // namespace DebuggerAgentState; |
59 | 65 |
60 static const int maxSkipStepFrameCount = 128; | 66 static const int maxSkipStepFrameCount = 128; |
61 | 67 |
62 const char V8DebuggerAgent::backtraceObjectGroup[] = "backtrace"; | 68 const char V8DebuggerAgent::backtraceObjectGroup[] = "backtrace"; |
63 | 69 |
64 const int V8DebuggerAgent::unknownAsyncOperationId = 0; | 70 const int V8DebuggerAgent::unknownAsyncOperationId = 0; |
65 | 71 |
66 static String breakpointIdSuffix(V8DebuggerAgentImpl::BreakpointSource source) | 72 static String breakpointIdSuffix(V8DebuggerAgentImpl::BreakpointSource source) |
67 { | 73 { |
(...skipping 26 matching lines...) Expand all Loading... |
94 { | 100 { |
95 Vector<LChar, 8> result; | 101 Vector<LChar, 8> result; |
96 do { | 102 do { |
97 result.prepend(hexDigits[number % 16]); | 103 result.prepend(hexDigits[number % 16]); |
98 number >>= 4; | 104 number >>= 4; |
99 } while (number > 0); | 105 } while (number > 0); |
100 | 106 |
101 destination.append(result.data(), result.size()); | 107 destination.append(result.data(), result.size()); |
102 } | 108 } |
103 | 109 |
| 110 static bool parseBlackboxPositions(ErrorString* error, protocol::Array<protocol:
:Debugger::ScriptPosition>* inPositions, Vector<std::pair<int, int>>* outPositio
ns) |
| 111 { |
| 112 if (!inPositions) { |
| 113 Vector<std::pair<int, int>> blackboxed(1); |
| 114 outPositions->swap(blackboxed); |
| 115 return true; |
| 116 } |
| 117 Vector<std::pair<int, int>> positions(inPositions->length()); |
| 118 for (size_t i = 0; i < positions.size(); ++i) { |
| 119 protocol::Debugger::ScriptPosition* position = inPositions->get(i); |
| 120 if (position->getLine() < 0) { |
| 121 if (error) |
| 122 *error = "Position missing 'line' or 'line' < 0."; |
| 123 return false; |
| 124 } |
| 125 if (position->getColumn() < 0) { |
| 126 if (error) |
| 127 *error = "Position missing 'column' or 'column' < 0."; |
| 128 return false; |
| 129 } |
| 130 positions[i] = std::make_pair(position->getLine(), position->getColumn()
); |
| 131 } |
| 132 |
| 133 for (size_t i = 1; i < positions.size(); ++i) { |
| 134 if (positions[i - 1].first < positions[i].first) |
| 135 continue; |
| 136 if (positions[i - 1].first == positions[i].first && positions[i - 1].sec
ond < positions[i].second) |
| 137 continue; |
| 138 if (error) |
| 139 *error = "Input positions array is not sorted or contains duplicate
values."; |
| 140 return false; |
| 141 } |
| 142 |
| 143 outPositions->swap(positions); |
| 144 return true; |
| 145 } |
| 146 |
104 // Hash algorithm for substrings is described in "Über die Komplexität der Multi
plikation in | 147 // Hash algorithm for substrings is described in "Über die Komplexität der Multi
plikation in |
105 // eingeschränkten Branchingprogrammmodellen" by Woelfe. | 148 // eingeschränkten Branchingprogrammmodellen" by Woelfe. |
106 // http://opendatastructures.org/versions/edition-0.1d/ods-java/node33.html#SECT
ION00832000000000000000 | 149 // http://opendatastructures.org/versions/edition-0.1d/ods-java/node33.html#SECT
ION00832000000000000000 |
107 static String calculateHash(const String& str) | 150 static String calculateHash(const String& str) |
108 { | 151 { |
109 static uint64_t prime[] = { 0x3FB75161, 0xAB1F4E4F, 0x82675BC5, 0xCD924D35,
0x81ABE279 }; | 152 static uint64_t prime[] = { 0x3FB75161, 0xAB1F4E4F, 0x82675BC5, 0xCD924D35,
0x81ABE279 }; |
110 static uint64_t random[] = { 0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476,
0xC3D2E1F0 }; | 153 static uint64_t random[] = { 0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476,
0xC3D2E1F0 }; |
111 static uint32_t randomOdd[] = { 0xB4663807, 0xCC322BF5, 0xD4F91BBD, 0xA7BEA1
1D, 0x8F462907 }; | 154 static uint32_t randomOdd[] = { 0xB4663807, 0xCC322BF5, 0xD4F91BBD, 0xA7BEA1
1D, 0x8F462907 }; |
112 | 155 |
113 uint64_t hashes[] = { 0, 0, 0, 0, 0 }; | 156 uint64_t hashes[] = { 0, 0, 0, 0, 0 }; |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 m_state->setObject(DebuggerAgentState::javaScriptBreakpoints, protocol::Dict
ionaryValue::create()); | 279 m_state->setObject(DebuggerAgentState::javaScriptBreakpoints, protocol::Dict
ionaryValue::create()); |
237 m_state->setNumber(DebuggerAgentState::pauseOnExceptionsState, V8DebuggerImp
l::DontPauseOnExceptions); | 280 m_state->setNumber(DebuggerAgentState::pauseOnExceptionsState, V8DebuggerImp
l::DontPauseOnExceptions); |
238 m_state->setNumber(DebuggerAgentState::asyncCallStackDepth, 0); | 281 m_state->setNumber(DebuggerAgentState::asyncCallStackDepth, 0); |
239 m_state->setBoolean(DebuggerAgentState::promiseTrackerEnabled, false); | 282 m_state->setBoolean(DebuggerAgentState::promiseTrackerEnabled, false); |
240 m_state->setBoolean(DebuggerAgentState::promiseTrackerCaptureStacks, false); | 283 m_state->setBoolean(DebuggerAgentState::promiseTrackerCaptureStacks, false); |
241 | 284 |
242 debugger().removeAgent(m_contextGroupId); | 285 debugger().removeAgent(m_contextGroupId); |
243 m_pausedContext.Reset(); | 286 m_pausedContext.Reset(); |
244 m_currentCallStack.Reset(); | 287 m_currentCallStack.Reset(); |
245 m_scripts.clear(); | 288 m_scripts.clear(); |
246 m_blackboxedPositions.clear(); | 289 m_loadedScriptHashes.clear(); |
| 290 |
| 291 m_hashToBlackboxPositions.clear(); |
| 292 m_blackboxPattern = String(); |
| 293 |
247 m_breakpointIdToDebuggerBreakpointIds.clear(); | 294 m_breakpointIdToDebuggerBreakpointIds.clear(); |
248 internalSetAsyncCallStackDepth(0); | 295 internalSetAsyncCallStackDepth(0); |
249 m_promiseTracker->setEnabled(false, false); | 296 m_promiseTracker->setEnabled(false, false); |
250 m_continueToLocationBreakpointId = String(); | 297 m_continueToLocationBreakpointId = String(); |
251 clearBreakDetails(); | 298 clearBreakDetails(); |
252 m_scheduledDebuggerStep = NoStep; | 299 m_scheduledDebuggerStep = NoStep; |
253 m_skipNextDebuggerStepOut = false; | 300 m_skipNextDebuggerStepOut = false; |
254 m_javaScriptPauseScheduled = false; | 301 m_javaScriptPauseScheduled = false; |
255 m_steppingFromFramework = false; | 302 m_steppingFromFramework = false; |
256 m_pausingOnNativeEvent = false; | 303 m_pausingOnNativeEvent = false; |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 m_state->getNumber(DebuggerAgentState::pauseOnExceptionsState, &pauseState); | 344 m_state->getNumber(DebuggerAgentState::pauseOnExceptionsState, &pauseState); |
298 setPauseOnExceptionsImpl(&error, pauseState); | 345 setPauseOnExceptionsImpl(&error, pauseState); |
299 | 346 |
300 m_skipAllPauses = m_state->booleanProperty(DebuggerAgentState::skipAllPauses
, false); | 347 m_skipAllPauses = m_state->booleanProperty(DebuggerAgentState::skipAllPauses
, false); |
301 | 348 |
302 int asyncCallStackDepth = 0; | 349 int asyncCallStackDepth = 0; |
303 m_state->getNumber(DebuggerAgentState::asyncCallStackDepth, &asyncCallStackD
epth); | 350 m_state->getNumber(DebuggerAgentState::asyncCallStackDepth, &asyncCallStackD
epth); |
304 internalSetAsyncCallStackDepth(asyncCallStackDepth); | 351 internalSetAsyncCallStackDepth(asyncCallStackDepth); |
305 | 352 |
306 m_promiseTracker->setEnabled(m_state->booleanProperty(DebuggerAgentState::pr
omiseTrackerEnabled, false), m_state->booleanProperty(DebuggerAgentState::promis
eTrackerCaptureStacks, false)); | 353 m_promiseTracker->setEnabled(m_state->booleanProperty(DebuggerAgentState::pr
omiseTrackerEnabled, false), m_state->booleanProperty(DebuggerAgentState::promis
eTrackerCaptureStacks, false)); |
| 354 |
| 355 restoreBlackboxState(); |
| 356 } |
| 357 |
| 358 void V8DebuggerAgentImpl::restoreBlackboxState() |
| 359 { |
| 360 String error; |
| 361 protocol::ErrorSupport errors; |
| 362 |
| 363 protocol::ListValue* savedPatterns = m_state->getArray(DebuggerAgentState::b
lackboxPatterns); |
| 364 if (savedPatterns) { |
| 365 OwnPtr<protocol::Array<protocol::Debugger::BlackboxPattern>> patterns =
protocol::Array<protocol::Debugger::BlackboxPattern>::parse(savedPatterns, &erro
rs); |
| 366 ASSERT(!errors.hasErrors()); |
| 367 editBlackboxPatterns(&error, patterns.release()); |
| 368 ASSERT(!error.length()); |
| 369 } |
| 370 |
| 371 protocol::ListValue* savedHashes = m_state->getArray(DebuggerAgentState::bla
ckboxHashes); |
| 372 if (!savedHashes) |
| 373 return; |
| 374 for (size_t i = 0; i < savedHashes->size(); ++i) { |
| 375 protocol::DictionaryValue* savedHash = protocol::DictionaryValue::cast(s
avedHashes->at(i)); |
| 376 |
| 377 String hash; |
| 378 OwnPtr<protocol::Array<protocol::Debugger::ScriptPosition>> positions; |
| 379 |
| 380 bool hadError = savedHash->getString(DebuggerAgentState::hashValue, &has
h); |
| 381 ASSERT_UNUSED(hadError, !hadError); |
| 382 positions = protocol::Array<protocol::Debugger::ScriptPosition>::parse(s
avedHash->getArray(DebuggerAgentState::hashPositions), &errors); |
| 383 ASSERT(!errors.hasErrors()); |
| 384 addBlackboxRanges(&error, hash, positions.release()); |
| 385 ASSERT(!error.length()); |
| 386 } |
307 } | 387 } |
308 | 388 |
309 void V8DebuggerAgentImpl::setBreakpointsActive(ErrorString* errorString, bool ac
tive) | 389 void V8DebuggerAgentImpl::setBreakpointsActive(ErrorString* errorString, bool ac
tive) |
310 { | 390 { |
311 if (!checkEnabled(errorString)) | 391 if (!checkEnabled(errorString)) |
312 return; | 392 return; |
313 debugger().setBreakpointsActivated(active); | 393 debugger().setBreakpointsActivated(active); |
314 } | 394 } |
315 | 395 |
316 void V8DebuggerAgentImpl::setSkipAllPauses(ErrorString*, bool skipped) | 396 void V8DebuggerAgentImpl::setSkipAllPauses(ErrorString*, bool skipped) |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
529 { | 609 { |
530 ASSERT(enabled()); | 610 ASSERT(enabled()); |
531 return isCallFrameWithUnknownScriptOrBlackboxed(debugger().callFrameNoScopes
(0)); | 611 return isCallFrameWithUnknownScriptOrBlackboxed(debugger().callFrameNoScopes
(0)); |
532 } | 612 } |
533 | 613 |
534 bool V8DebuggerAgentImpl::isCallFrameWithUnknownScriptOrBlackboxed(PassRefPtr<Ja
vaScriptCallFrame> pFrame) | 614 bool V8DebuggerAgentImpl::isCallFrameWithUnknownScriptOrBlackboxed(PassRefPtr<Ja
vaScriptCallFrame> pFrame) |
535 { | 615 { |
536 RefPtr<JavaScriptCallFrame> frame = pFrame; | 616 RefPtr<JavaScriptCallFrame> frame = pFrame; |
537 if (!frame) | 617 if (!frame) |
538 return true; | 618 return true; |
539 ScriptsMap::iterator it = m_scripts.find(String::number(frame->sourceID())); | 619 String scriptId = String::number(frame->sourceID()); |
| 620 ScriptsMap::iterator it = m_scripts.find(scriptId); |
540 if (it == m_scripts.end()) { | 621 if (it == m_scripts.end()) { |
541 // Unknown scripts are blackboxed. | 622 // Unknown scripts are blackboxed. |
542 return true; | 623 return true; |
543 } | 624 } |
544 auto itBlackboxedPositions = m_blackboxedPositions.find(String::number(frame
->sourceID())); | 625 |
545 if (itBlackboxedPositions == m_blackboxedPositions.end()) | 626 Vector<std::pair<int, int>> emptyPositions; |
| 627 const Vector<std::pair<int, int>>* ranges = nullptr; |
| 628 |
| 629 V8DebuggerScript& script = it->value; |
| 630 auto itBlackboxHash = m_hashToBlackboxPositions.find(script.hash()); |
| 631 if (itBlackboxHash != m_hashToBlackboxPositions.end()) { |
| 632 ranges = &itBlackboxHash->value; |
| 633 } else { |
| 634 if (!m_blackboxPattern.isEmpty() && matches(m_debugger, script.sourceURL
(), m_blackboxPattern, true)) { |
| 635 Vector<std::pair<int, int>> positions(1); |
| 636 positions[0].first = 0; |
| 637 positions[0].second = 0; |
| 638 m_hashToBlackboxPositions.set(script.hash(), positions); |
| 639 return true; |
| 640 } |
546 return false; | 641 return false; |
| 642 } |
547 | 643 |
548 const Vector<std::pair<int, int>>& ranges = itBlackboxedPositions->value; | 644 auto itRange = std::lower_bound(ranges->begin(), ranges->end(), std::make_pa
ir(frame->line(), frame->column()), positionComparator); |
549 auto itRange = std::lower_bound(ranges.begin(), ranges.end(), std::make_pair
(frame->line(), frame->column()), positionComparator); | |
550 // Ranges array contains positions in script where blackbox state is changed
. | 645 // Ranges array contains positions in script where blackbox state is changed
. |
551 // [(0,0) ... ranges[0]) isn't blackboxed, [ranges[0] ... ranges[1]) is blac
kboxed... | 646 // [(0,0) ... ranges[0]) isn't blackboxed, [ranges[0] ... ranges[1]) is blac
kboxed... |
552 return std::distance(ranges.begin(), itRange) % 2; | 647 return std::distance(ranges->begin(), itRange) % 2; |
553 } | 648 } |
554 | 649 |
555 V8DebuggerAgentImpl::SkipPauseRequest V8DebuggerAgentImpl::shouldSkipExceptionPa
use() | 650 V8DebuggerAgentImpl::SkipPauseRequest V8DebuggerAgentImpl::shouldSkipExceptionPa
use() |
556 { | 651 { |
557 if (m_steppingFromFramework) | 652 if (m_steppingFromFramework) |
558 return RequestNoSkip; | 653 return RequestNoSkip; |
559 if (isTopCallFrameBlackboxed()) | 654 if (isTopCallFrameBlackboxed()) |
560 return RequestContinue; | 655 return RequestContinue; |
561 return RequestNoSkip; | 656 return RequestNoSkip; |
562 } | 657 } |
(...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1234 *errorString = "Can only perform operation while tracking async call sta
cks."; | 1329 *errorString = "Can only perform operation while tracking async call sta
cks."; |
1235 return; | 1330 return; |
1236 } | 1331 } |
1237 if (operationId <= 0) { | 1332 if (operationId <= 0) { |
1238 *errorString = "Wrong async operation id."; | 1333 *errorString = "Wrong async operation id."; |
1239 return; | 1334 return; |
1240 } | 1335 } |
1241 m_asyncOperationBreakpoints.remove(operationId); | 1336 m_asyncOperationBreakpoints.remove(operationId); |
1242 } | 1337 } |
1243 | 1338 |
1244 void V8DebuggerAgentImpl::setBlackboxedRanges(ErrorString* error, const String&
scriptId, PassOwnPtr<protocol::Array<protocol::Debugger::ScriptPosition>> inPosi
tions) | 1339 void V8DebuggerAgentImpl::addBlackboxRanges(ErrorString* error, const String& ha
sh, PassOwnPtr<protocol::Array<protocol::Debugger::ScriptPosition>> inPositions) |
1245 { | 1340 { |
1246 ScriptsMap::iterator it = m_scripts.find(scriptId); | 1341 if (!m_loadedScriptHashes.contains(hash)) { |
1247 if (it == m_scripts.end()) { | 1342 *error = "No script with passed hash."; |
1248 *error = "No script with passed id."; | |
1249 return; | 1343 return; |
1250 } | 1344 } |
1251 | 1345 |
1252 if (!inPositions->length()) { | 1346 if (!inPositions->length()) { |
1253 m_blackboxedPositions.remove(scriptId); | 1347 m_hashToBlackboxPositions.remove(hash); |
1254 return; | 1348 return; |
1255 } | 1349 } |
1256 | 1350 |
1257 Vector<std::pair<int, int>> positions(inPositions->length()); | 1351 Vector<std::pair<int, int>> positions; |
1258 for (size_t i = 0; i < positions.size(); ++i) { | 1352 if (parseBlackboxPositions(error, inPositions.get(), &positions)) |
1259 protocol::Debugger::ScriptPosition* position = inPositions->get(i); | 1353 m_hashToBlackboxPositions.set(hash, positions); |
1260 if (position->getLine() < 0) { | 1354 |
1261 *error = "Position missing 'line' or 'line' < 0."; | 1355 if (!m_state->getArray(DebuggerAgentState::blackboxHashes)) |
| 1356 m_state->setArray(DebuggerAgentState::blackboxHashes, protocol::ListValu
e::create()); |
| 1357 protocol::ListValue* hashes = m_state->getArray(DebuggerAgentState::blackbox
Hashes); |
| 1358 OwnPtr<protocol::DictionaryValue> value = protocol::DictionaryValue::create(
); |
| 1359 value->setString(DebuggerAgentState::hashValue, hash); |
| 1360 value->setArray(DebuggerAgentState::hashPositions, inPositions->serialize())
; |
| 1361 hashes->pushValue(value.release()); |
| 1362 } |
| 1363 |
| 1364 void V8DebuggerAgentImpl::editBlackboxPatterns(ErrorString* error, PassOwnPtr<pr
otocol::Array<protocol::Debugger::BlackboxPattern>> patterns) |
| 1365 { |
| 1366 HashSet<String> hashes; |
| 1367 String blackboxPattern; |
| 1368 |
| 1369 for (size_t i = 0; i < patterns->length(); ++i) { |
| 1370 protocol::Debugger::BlackboxPattern* pattern = patterns->get(i); |
| 1371 |
| 1372 String regex = pattern->getRegex(String()); |
| 1373 String hash = pattern->getHash(String()); |
| 1374 if ((!hash.isEmpty() && !regex.isEmpty()) || (hash.isEmpty() && regex.is
Empty())) { |
| 1375 *error = "Blackbox pattern should contain regex or hash."; |
1262 return; | 1376 return; |
1263 } | 1377 } |
1264 if (position->getColumn() < 0) { | 1378 if (!regex.isEmpty()) |
1265 *error = "Position missing 'column' or 'column' < 0."; | 1379 blackboxPattern = blackboxPattern.isEmpty() ? regex : (blackboxPatte
rn + "|" + regex); |
1266 return; | 1380 if (!hash.isEmpty()) |
1267 } | 1381 hashes.add(hash); |
1268 positions[i] = std::make_pair(position->getLine(), position->getColumn()
); | |
1269 } | 1382 } |
1270 | 1383 |
1271 for (size_t i = 1; i < positions.size(); ++i) { | 1384 m_state->setArray(DebuggerAgentState::blackboxPatterns, patterns->serialize(
)); |
1272 if (positions[i - 1].first < positions[i].first) | |
1273 continue; | |
1274 if (positions[i - 1].first == positions[i].first && positions[i - 1].sec
ond < positions[i].second) | |
1275 continue; | |
1276 *error = "Input positions array is not sorted or contains duplicate valu
es."; | |
1277 return; | |
1278 } | |
1279 | 1385 |
1280 m_blackboxedPositions.set(scriptId, positions); | 1386 Vector<std::pair<int, int>> positions(1); |
| 1387 for (auto& hash : hashes) |
| 1388 m_hashToBlackboxPositions.set(hash, positions); |
| 1389 m_blackboxPattern = blackboxPattern; |
1281 } | 1390 } |
1282 | 1391 |
1283 void V8DebuggerAgentImpl::willExecuteScript(int scriptId) | 1392 void V8DebuggerAgentImpl::willExecuteScript(int scriptId) |
1284 { | 1393 { |
1285 changeJavaScriptRecursionLevel(+1); | 1394 changeJavaScriptRecursionLevel(+1); |
1286 // Fast return. | 1395 // Fast return. |
1287 if (m_scheduledDebuggerStep != StepInto) | 1396 if (m_scheduledDebuggerStep != StepInto) |
1288 return; | 1397 return; |
1289 // Skip unknown scripts (e.g. InjectedScript). | 1398 // Skip unknown scripts (e.g. InjectedScript). |
1290 if (!m_scripts.contains(String::number(scriptId))) | 1399 if (!m_scripts.contains(String::number(scriptId))) |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1394 const bool* isInternalScriptParam = isInternalScript ? &isInternalScript : n
ullptr; | 1503 const bool* isInternalScriptParam = isInternalScript ? &isInternalScript : n
ullptr; |
1395 const bool* isLiveEditParam = isLiveEdit ? &isLiveEdit : nullptr; | 1504 const bool* isLiveEditParam = isLiveEdit ? &isLiveEdit : nullptr; |
1396 const bool* hasSourceURLParam = hasSourceURL ? &hasSourceURL : nullptr; | 1505 const bool* hasSourceURLParam = hasSourceURL ? &hasSourceURL : nullptr; |
1397 const bool* deprecatedCommentWasUsedParam = deprecatedCommentWasUsed ? &depr
ecatedCommentWasUsed : nullptr; | 1506 const bool* deprecatedCommentWasUsedParam = deprecatedCommentWasUsed ? &depr
ecatedCommentWasUsed : nullptr; |
1398 if (parsedScript.success) | 1507 if (parsedScript.success) |
1399 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); | 1508 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); |
1400 else | 1509 else |
1401 m_frontend->scriptFailedToParse(parsedScript.scriptId, scriptURL, script
.startLine(), script.startColumn(), script.endLine(), script.endColumn(), execut
ionContextId, script.hash(), isContentScriptParam, isInternalScriptParam, source
MapURLParam, hasSourceURLParam, deprecatedCommentWasUsedParam); | 1510 m_frontend->scriptFailedToParse(parsedScript.scriptId, scriptURL, script
.startLine(), script.startColumn(), script.endLine(), script.endColumn(), execut
ionContextId, script.hash(), isContentScriptParam, isInternalScriptParam, source
MapURLParam, hasSourceURLParam, deprecatedCommentWasUsedParam); |
1402 | 1511 |
1403 m_scripts.set(parsedScript.scriptId, script); | 1512 m_scripts.set(parsedScript.scriptId, script); |
| 1513 m_loadedScriptHashes.add(script.hash()); |
1404 | 1514 |
1405 if (scriptURL.isEmpty() || !parsedScript.success) | 1515 if (scriptURL.isEmpty() || !parsedScript.success) |
1406 return; | 1516 return; |
1407 | 1517 |
1408 protocol::DictionaryValue* breakpointsCookie = m_state->getObject(DebuggerAg
entState::javaScriptBreakpoints); | 1518 protocol::DictionaryValue* breakpointsCookie = m_state->getObject(DebuggerAg
entState::javaScriptBreakpoints); |
1409 if (!breakpointsCookie) | 1519 if (!breakpointsCookie) |
1410 return; | 1520 return; |
1411 | 1521 |
1412 for (size_t i = 0; i < breakpointsCookie->size(); ++i) { | 1522 for (size_t i = 0; i < breakpointsCookie->size(); ++i) { |
1413 auto cookie = breakpointsCookie->at(i); | 1523 auto cookie = breakpointsCookie->at(i); |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1570 | 1680 |
1571 void V8DebuggerAgentImpl::removeBreakpointAt(const String& scriptId, int lineNum
ber, int columnNumber, BreakpointSource source) | 1681 void V8DebuggerAgentImpl::removeBreakpointAt(const String& scriptId, int lineNum
ber, int columnNumber, BreakpointSource source) |
1572 { | 1682 { |
1573 removeBreakpoint(generateBreakpointId(scriptId, lineNumber, columnNumber, so
urce)); | 1683 removeBreakpoint(generateBreakpointId(scriptId, lineNumber, columnNumber, so
urce)); |
1574 } | 1684 } |
1575 | 1685 |
1576 void V8DebuggerAgentImpl::reset() | 1686 void V8DebuggerAgentImpl::reset() |
1577 { | 1687 { |
1578 m_scheduledDebuggerStep = NoStep; | 1688 m_scheduledDebuggerStep = NoStep; |
1579 m_scripts.clear(); | 1689 m_scripts.clear(); |
1580 m_blackboxedPositions.clear(); | 1690 m_loadedScriptHashes.clear(); |
| 1691 |
| 1692 m_hashToBlackboxPositions.clear(); |
| 1693 |
1581 m_breakpointIdToDebuggerBreakpointIds.clear(); | 1694 m_breakpointIdToDebuggerBreakpointIds.clear(); |
1582 resetAsyncCallTracker(); | 1695 resetAsyncCallTracker(); |
1583 m_promiseTracker->clear(); | 1696 m_promiseTracker->clear(); |
1584 if (m_frontend) | 1697 if (m_frontend) |
1585 m_frontend->globalObjectCleared(); | 1698 m_frontend->globalObjectCleared(); |
1586 } | 1699 } |
1587 | 1700 |
1588 } // namespace blink | 1701 } // namespace blink |
OLD | NEW |