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