OLD | NEW |
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 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 RefPtr<JSONObject> breakpointsCookie = m_state->getObject(DebuggerAgentState
::javaScriptBreakpoints); | 373 RefPtr<JSONObject> breakpointsCookie = m_state->getObject(DebuggerAgentState
::javaScriptBreakpoints); |
374 if (breakpointsCookie->find(breakpointId) != breakpointsCookie->end()) { | 374 if (breakpointsCookie->find(breakpointId) != breakpointsCookie->end()) { |
375 *errorString = "Breakpoint at specified location already exists."; | 375 *errorString = "Breakpoint at specified location already exists."; |
376 return; | 376 return; |
377 } | 377 } |
378 | 378 |
379 breakpointsCookie->setObject(breakpointId, buildObjectForBreakpointCookie(ur
l, lineNumber, columnNumber, condition, isRegex)); | 379 breakpointsCookie->setObject(breakpointId, buildObjectForBreakpointCookie(ur
l, lineNumber, columnNumber, condition, isRegex)); |
380 m_state->setObject(DebuggerAgentState::javaScriptBreakpoints, breakpointsCoo
kie); | 380 m_state->setObject(DebuggerAgentState::javaScriptBreakpoints, breakpointsCoo
kie); |
381 | 381 |
382 ScriptBreakpoint breakpoint(lineNumber, columnNumber, condition); | 382 ScriptBreakpoint breakpoint(lineNumber, columnNumber, condition); |
383 for (ScriptsMap::iterator it = m_scripts.begin(); it != m_scripts.end(); ++i
t) { | 383 for (auto& script : m_scripts) { |
384 if (!matches(it->value.sourceURL(), url, isRegex)) | 384 if (!matches(script.value.sourceURL(), url, isRegex)) |
385 continue; | 385 continue; |
386 RefPtr<TypeBuilder::Debugger::Location> location = resolveBreakpoint(bre
akpointId, it->key, breakpoint, UserBreakpointSource); | 386 RefPtr<TypeBuilder::Debugger::Location> location = resolveBreakpoint(bre
akpointId, script.key, breakpoint, UserBreakpointSource); |
387 if (location) | 387 if (location) |
388 locations->addItem(location); | 388 locations->addItem(location); |
389 } | 389 } |
390 | 390 |
391 *outBreakpointId = breakpointId; | 391 *outBreakpointId = breakpointId; |
392 } | 392 } |
393 | 393 |
394 static bool parseLocation(ErrorString* errorString, PassRefPtr<JSONObject> locat
ion, String* scriptId, int* lineNumber, int* columnNumber) | 394 static bool parseLocation(ErrorString* errorString, PassRefPtr<JSONObject> locat
ion, String* scriptId, int* lineNumber, int* columnNumber) |
395 { | 395 { |
396 if (!location->getString("scriptId", scriptId) || !location->getNumber("line
Number", lineNumber)) { | 396 if (!location->getString("scriptId", scriptId) || !location->getNumber("line
Number", lineNumber)) { |
(...skipping 979 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1376 m_frontend->scriptParsed(scriptId, scriptURL, script.startLine(), script
.startColumn(), script.endLine(), script.endColumn(), isContentScriptParam, sour
ceMapURLParam, hasSourceURLParam); | 1376 m_frontend->scriptParsed(scriptId, scriptURL, script.startLine(), script
.startColumn(), script.endLine(), script.endColumn(), isContentScriptParam, sour
ceMapURLParam, hasSourceURLParam); |
1377 else | 1377 else |
1378 m_frontend->scriptFailedToParse(scriptId, scriptURL, script.startLine(),
script.startColumn(), script.endLine(), script.endColumn(), isContentScriptPara
m, sourceMapURLParam, hasSourceURLParam); | 1378 m_frontend->scriptFailedToParse(scriptId, scriptURL, script.startLine(),
script.startColumn(), script.endLine(), script.endColumn(), isContentScriptPara
m, sourceMapURLParam, hasSourceURLParam); |
1379 | 1379 |
1380 m_scripts.set(scriptId, script); | 1380 m_scripts.set(scriptId, script); |
1381 | 1381 |
1382 if (scriptURL.isEmpty() || hasSyntaxError) | 1382 if (scriptURL.isEmpty() || hasSyntaxError) |
1383 return; | 1383 return; |
1384 | 1384 |
1385 RefPtr<JSONObject> breakpointsCookie = m_state->getObject(DebuggerAgentState
::javaScriptBreakpoints); | 1385 RefPtr<JSONObject> breakpointsCookie = m_state->getObject(DebuggerAgentState
::javaScriptBreakpoints); |
1386 for (JSONObject::iterator it = breakpointsCookie->begin(); it != breakpoints
Cookie->end(); ++it) { | 1386 for (auto& cookie : *breakpointsCookie) { |
1387 RefPtr<JSONObject> breakpointObject = it->value->asObject(); | 1387 RefPtr<JSONObject> breakpointObject = cookie.value->asObject(); |
1388 bool isRegex; | 1388 bool isRegex; |
1389 breakpointObject->getBoolean(DebuggerAgentState::isRegex, &isRegex); | 1389 breakpointObject->getBoolean(DebuggerAgentState::isRegex, &isRegex); |
1390 String url; | 1390 String url; |
1391 breakpointObject->getString(DebuggerAgentState::url, &url); | 1391 breakpointObject->getString(DebuggerAgentState::url, &url); |
1392 if (!matches(scriptURL, url, isRegex)) | 1392 if (!matches(scriptURL, url, isRegex)) |
1393 continue; | 1393 continue; |
1394 ScriptBreakpoint breakpoint; | 1394 ScriptBreakpoint breakpoint; |
1395 breakpointObject->getNumber(DebuggerAgentState::lineNumber, &breakpoint.
lineNumber); | 1395 breakpointObject->getNumber(DebuggerAgentState::lineNumber, &breakpoint.
lineNumber); |
1396 breakpointObject->getNumber(DebuggerAgentState::columnNumber, &breakpoin
t.columnNumber); | 1396 breakpointObject->getNumber(DebuggerAgentState::columnNumber, &breakpoin
t.columnNumber); |
1397 breakpointObject->getString(DebuggerAgentState::condition, &breakpoint.c
ondition); | 1397 breakpointObject->getString(DebuggerAgentState::condition, &breakpoint.c
ondition); |
1398 RefPtr<TypeBuilder::Debugger::Location> location = resolveBreakpoint(it-
>key, scriptId, breakpoint, UserBreakpointSource); | 1398 RefPtr<TypeBuilder::Debugger::Location> location = resolveBreakpoint(coo
kie.key, scriptId, breakpoint, UserBreakpointSource); |
1399 if (location) | 1399 if (location) |
1400 m_frontend->breakpointResolved(it->key, location); | 1400 m_frontend->breakpointResolved(cookie.key, location); |
1401 } | 1401 } |
1402 } | 1402 } |
1403 | 1403 |
1404 ScriptDebugListener::SkipPauseRequest InspectorDebuggerAgent::didPause(ScriptSta
te* scriptState, const ScriptValue& callFrames, const ScriptValue& exception, co
nst Vector<String>& hitBreakpoints, bool isPromiseRejection) | 1404 ScriptDebugListener::SkipPauseRequest InspectorDebuggerAgent::didPause(ScriptSta
te* scriptState, const ScriptValue& callFrames, const ScriptValue& exception, co
nst Vector<String>& hitBreakpoints, bool isPromiseRejection) |
1405 { | 1405 { |
1406 ScriptDebugListener::SkipPauseRequest result; | 1406 ScriptDebugListener::SkipPauseRequest result; |
1407 if (callFrames.isEmpty()) | 1407 if (callFrames.isEmpty()) |
1408 result = ScriptDebugListener::Continue; // Skip pauses inside V8 interna
l scripts and on syntax errors. | 1408 result = ScriptDebugListener::Continue; // Skip pauses inside V8 interna
l scripts and on syntax errors. |
1409 else if (m_skipAllPauses) | 1409 else if (m_skipAllPauses) |
1410 result = ScriptDebugListener::Continue; | 1410 result = ScriptDebugListener::Continue; |
(...skipping 19 matching lines...) Expand all Loading... |
1430 InjectedScript injectedScript = m_injectedScriptManager->injectedScriptF
or(scriptState); | 1430 InjectedScript injectedScript = m_injectedScriptManager->injectedScriptF
or(scriptState); |
1431 if (!injectedScript.isEmpty()) { | 1431 if (!injectedScript.isEmpty()) { |
1432 m_breakReason = isPromiseRejection ? InspectorFrontend::Debugger::Re
ason::PromiseRejection : InspectorFrontend::Debugger::Reason::Exception; | 1432 m_breakReason = isPromiseRejection ? InspectorFrontend::Debugger::Re
ason::PromiseRejection : InspectorFrontend::Debugger::Reason::Exception; |
1433 m_breakAuxData = injectedScript.wrapObject(exception, InspectorDebug
gerAgent::backtraceObjectGroup)->openAccessors(); | 1433 m_breakAuxData = injectedScript.wrapObject(exception, InspectorDebug
gerAgent::backtraceObjectGroup)->openAccessors(); |
1434 // m_breakAuxData might be null after this. | 1434 // m_breakAuxData might be null after this. |
1435 } | 1435 } |
1436 } | 1436 } |
1437 | 1437 |
1438 RefPtr<Array<String> > hitBreakpointIds = Array<String>::create(); | 1438 RefPtr<Array<String> > hitBreakpointIds = Array<String>::create(); |
1439 | 1439 |
1440 for (Vector<String>::const_iterator i = hitBreakpoints.begin(); i != hitBrea
kpoints.end(); ++i) { | 1440 for (const auto& point : hitBreakpoints) { |
1441 DebugServerBreakpointToBreakpointIdAndSourceMap::iterator breakpointIter
ator = m_serverBreakpoints.find(*i); | 1441 DebugServerBreakpointToBreakpointIdAndSourceMap::iterator breakpointIter
ator = m_serverBreakpoints.find(point); |
1442 if (breakpointIterator != m_serverBreakpoints.end()) { | 1442 if (breakpointIterator != m_serverBreakpoints.end()) { |
1443 const String& localId = breakpointIterator->value.first; | 1443 const String& localId = breakpointIterator->value.first; |
1444 hitBreakpointIds->addItem(localId); | 1444 hitBreakpointIds->addItem(localId); |
1445 | 1445 |
1446 BreakpointSource source = breakpointIterator->value.second; | 1446 BreakpointSource source = breakpointIterator->value.second; |
1447 if (m_breakReason == InspectorFrontend::Debugger::Reason::Other && s
ource == DebugCommandBreakpointSource) | 1447 if (m_breakReason == InspectorFrontend::Debugger::Reason::Other && s
ource == DebugCommandBreakpointSource) |
1448 m_breakReason = InspectorFrontend::Debugger::Reason::DebugComman
d; | 1448 m_breakReason = InspectorFrontend::Debugger::Reason::DebugComman
d; |
1449 } | 1449 } |
1450 } | 1450 } |
1451 | 1451 |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1565 visitor->trace(m_listener); | 1565 visitor->trace(m_listener); |
1566 visitor->trace(m_asyncCallStackTracker); | 1566 visitor->trace(m_asyncCallStackTracker); |
1567 visitor->trace(m_promiseTracker); | 1567 visitor->trace(m_promiseTracker); |
1568 visitor->trace(m_asyncOperationsForStepInto); | 1568 visitor->trace(m_asyncOperationsForStepInto); |
1569 visitor->trace(m_currentAsyncCallChain); | 1569 visitor->trace(m_currentAsyncCallChain); |
1570 #endif | 1570 #endif |
1571 InspectorBaseAgent::trace(visitor); | 1571 InspectorBaseAgent::trace(visitor); |
1572 } | 1572 } |
1573 | 1573 |
1574 } // namespace blink | 1574 } // namespace blink |
OLD | NEW |