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 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 String scriptURL = it->value.sourceURL(); | 519 String scriptURL = it->value.sourceURL(); |
520 if (m_cachedSkipStackRegExp && !scriptURL.isEmpty()) { | 520 if (m_cachedSkipStackRegExp && !scriptURL.isEmpty()) { |
521 if (!it->value.getBlackboxedState(m_cachedSkipStackGeneration, &isBlackb
oxed)) { | 521 if (!it->value.getBlackboxedState(m_cachedSkipStackGeneration, &isBlackb
oxed)) { |
522 isBlackboxed = m_cachedSkipStackRegExp->match(scriptURL) != -1; | 522 isBlackboxed = m_cachedSkipStackRegExp->match(scriptURL) != -1; |
523 it->value.setBlackboxedState(m_cachedSkipStackGeneration, isBlackbox
ed); | 523 it->value.setBlackboxedState(m_cachedSkipStackGeneration, isBlackbox
ed); |
524 } | 524 } |
525 } | 525 } |
526 return isBlackboxed; | 526 return isBlackboxed; |
527 } | 527 } |
528 | 528 |
529 ScriptDebugListener::SkipPauseRequest InspectorDebuggerAgent::shouldSkipExceptio
nPause() | 529 V8Debugger::SkipPauseRequest InspectorDebuggerAgent::shouldSkipExceptionPause() |
530 { | 530 { |
531 if (m_steppingFromFramework) | 531 if (m_steppingFromFramework) |
532 return ScriptDebugListener::NoSkip; | 532 return V8Debugger::NoSkip; |
533 if (isTopCallFrameBlackboxed()) | 533 if (isTopCallFrameBlackboxed()) |
534 return ScriptDebugListener::Continue; | 534 return V8Debugger::Continue; |
535 return ScriptDebugListener::NoSkip; | 535 return V8Debugger::NoSkip; |
536 } | 536 } |
537 | 537 |
538 ScriptDebugListener::SkipPauseRequest InspectorDebuggerAgent::shouldSkipStepPaus
e() | 538 V8Debugger::SkipPauseRequest InspectorDebuggerAgent::shouldSkipStepPause() |
539 { | 539 { |
540 if (m_steppingFromFramework) | 540 if (m_steppingFromFramework) |
541 return ScriptDebugListener::NoSkip; | 541 return V8Debugger::NoSkip; |
542 | 542 |
543 if (m_skipNextDebuggerStepOut) { | 543 if (m_skipNextDebuggerStepOut) { |
544 m_skipNextDebuggerStepOut = false; | 544 m_skipNextDebuggerStepOut = false; |
545 if (m_scheduledDebuggerStep == StepOut) | 545 if (m_scheduledDebuggerStep == StepOut) |
546 return ScriptDebugListener::StepOut; | 546 return V8Debugger::StepOut; |
547 } | 547 } |
548 | 548 |
549 if (!isTopCallFrameBlackboxed()) | 549 if (!isTopCallFrameBlackboxed()) |
550 return ScriptDebugListener::NoSkip; | 550 return V8Debugger::NoSkip; |
551 | 551 |
552 if (m_skippedStepFrameCount >= maxSkipStepFrameCount) | 552 if (m_skippedStepFrameCount >= maxSkipStepFrameCount) |
553 return ScriptDebugListener::StepOut; | 553 return V8Debugger::StepOut; |
554 | 554 |
555 if (!m_skippedStepFrameCount) | 555 if (!m_skippedStepFrameCount) |
556 m_recursionLevelForStepFrame = 1; | 556 m_recursionLevelForStepFrame = 1; |
557 | 557 |
558 ++m_skippedStepFrameCount; | 558 ++m_skippedStepFrameCount; |
559 return ScriptDebugListener::StepFrame; | 559 return V8Debugger::StepFrame; |
560 } | 560 } |
561 | 561 |
562 PassRefPtr<TypeBuilder::Debugger::Location> InspectorDebuggerAgent::resolveBreak
point(const String& breakpointId, const String& scriptId, const ScriptBreakpoint
& breakpoint, BreakpointSource source) | 562 PassRefPtr<TypeBuilder::Debugger::Location> InspectorDebuggerAgent::resolveBreak
point(const String& breakpointId, const String& scriptId, const ScriptBreakpoint
& breakpoint, BreakpointSource source) |
563 { | 563 { |
564 ASSERT(enabled()); | 564 ASSERT(enabled()); |
565 if (breakpointId.isEmpty()) { | 565 if (breakpointId.isEmpty()) { |
566 ASSERT_NOT_REACHED(); | 566 ASSERT_NOT_REACHED(); |
567 return nullptr; | 567 return nullptr; |
568 } | 568 } |
569 ScriptsMap::iterator scriptIterator = m_scripts.find(scriptId); | 569 ScriptsMap::iterator scriptIterator = m_scripts.find(scriptId); |
570 if (scriptIterator == m_scripts.end()) | 570 if (scriptIterator == m_scripts.end()) |
571 return nullptr; | 571 return nullptr; |
572 Script& script = scriptIterator->value; | 572 V8Debugger::Script& script = scriptIterator->value; |
573 if (breakpoint.lineNumber < script.startLine() || script.endLine() < breakpo
int.lineNumber) | 573 if (breakpoint.lineNumber < script.startLine() || script.endLine() < breakpo
int.lineNumber) |
574 return nullptr; | 574 return nullptr; |
575 | 575 |
576 int actualLineNumber; | 576 int actualLineNumber; |
577 int actualColumnNumber; | 577 int actualColumnNumber; |
578 String debuggerBreakpointId = debugger().setBreakpoint(scriptId, breakpoint,
&actualLineNumber, &actualColumnNumber, false); | 578 String debuggerBreakpointId = debugger().setBreakpoint(scriptId, breakpoint,
&actualLineNumber, &actualColumnNumber, false); |
579 if (debuggerBreakpointId.isEmpty()) | 579 if (debuggerBreakpointId.isEmpty()) |
580 return nullptr; | 580 return nullptr; |
581 | 581 |
582 m_serverBreakpoints.set(debuggerBreakpointId, std::make_pair(breakpointId, s
ource)); | 582 m_serverBreakpoints.set(debuggerBreakpointId, std::make_pair(breakpointId, s
ource)); |
(...skipping 874 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1457 RefPtrWillBeRawPtr<ScriptAsyncCallStack> result = nullptr; | 1457 RefPtrWillBeRawPtr<ScriptAsyncCallStack> result = nullptr; |
1458 for (AsyncCallStackVector::const_reverse_iterator it = callStacks.rbegin();
it != callStacks.rend(); ++it) { | 1458 for (AsyncCallStackVector::const_reverse_iterator it = callStacks.rbegin();
it != callStacks.rend(); ++it) { |
1459 RefPtr<JavaScriptCallFrame> callFrame = V8Debugger::toJavaScriptCallFram
eUnsafe((*it)->callFrames()); | 1459 RefPtr<JavaScriptCallFrame> callFrame = V8Debugger::toJavaScriptCallFram
eUnsafe((*it)->callFrames()); |
1460 if (!callFrame) | 1460 if (!callFrame) |
1461 break; | 1461 break; |
1462 result = ScriptAsyncCallStack::create((*it)->description(), toScriptCall
Stack(callFrame.get()), result.release()); | 1462 result = ScriptAsyncCallStack::create((*it)->description(), toScriptCall
Stack(callFrame.get()), result.release()); |
1463 } | 1463 } |
1464 return result.release(); | 1464 return result.release(); |
1465 } | 1465 } |
1466 | 1466 |
1467 String InspectorDebuggerAgent::sourceMapURLForScript(const Script& script, Compi
leResult compileResult) | 1467 String InspectorDebuggerAgent::sourceMapURLForScript(const V8Debugger::Script& s
cript, V8Debugger::CompileResult compileResult) |
1468 { | 1468 { |
1469 bool hasSyntaxError = compileResult != CompileSuccess; | 1469 bool hasSyntaxError = compileResult != V8Debugger::CompileSuccess; |
1470 if (!hasSyntaxError) | 1470 if (!hasSyntaxError) |
1471 return script.sourceMappingURL(); | 1471 return script.sourceMappingURL(); |
1472 return ContentSearchUtils::findSourceMapURL(script.source(), ContentSearchUt
ils::JavaScriptMagicComment); | 1472 return ContentSearchUtils::findSourceMapURL(script.source(), ContentSearchUt
ils::JavaScriptMagicComment); |
1473 } | 1473 } |
1474 | 1474 |
1475 // ScriptDebugListener functions | 1475 // ScriptDebugListener functions |
1476 | 1476 |
1477 void InspectorDebuggerAgent::didParseSource(const ParsedScript& parsedScript) | 1477 void InspectorDebuggerAgent::didParseSource(const V8Debugger::ParsedScript& pars
edScript) |
1478 { | 1478 { |
1479 Script script = parsedScript.script; | 1479 V8Debugger::Script script = parsedScript.script; |
1480 | 1480 |
1481 bool hasSyntaxError = parsedScript.compileResult != CompileSuccess; | 1481 bool hasSyntaxError = parsedScript.compileResult != V8Debugger::CompileSucce
ss; |
1482 if (hasSyntaxError) | 1482 if (hasSyntaxError) |
1483 script.setSourceURL(ContentSearchUtils::findSourceURL(script.source(), C
ontentSearchUtils::JavaScriptMagicComment)); | 1483 script.setSourceURL(ContentSearchUtils::findSourceURL(script.source(), C
ontentSearchUtils::JavaScriptMagicComment)); |
1484 | 1484 |
1485 bool isContentScript = script.isContentScript(); | 1485 bool isContentScript = script.isContentScript(); |
1486 bool isInternalScript = script.isInternalScript(); | 1486 bool isInternalScript = script.isInternalScript(); |
1487 bool hasSourceURL = script.hasSourceURL(); | 1487 bool hasSourceURL = script.hasSourceURL(); |
1488 String scriptURL = script.sourceURL(); | 1488 String scriptURL = script.sourceURL(); |
1489 String sourceMapURL = sourceMapURLForScript(script, parsedScript.compileResu
lt); | 1489 String sourceMapURL = sourceMapURLForScript(script, parsedScript.compileResu
lt); |
1490 | 1490 |
1491 const String* sourceMapURLParam = sourceMapURL.isNull() ? nullptr : &sourceM
apURL; | 1491 const String* sourceMapURLParam = sourceMapURL.isNull() ? nullptr : &sourceM
apURL; |
(...skipping 22 matching lines...) Expand all Loading... |
1514 ScriptBreakpoint breakpoint; | 1514 ScriptBreakpoint breakpoint; |
1515 breakpointObject->getNumber(DebuggerAgentState::lineNumber, &breakpoint.
lineNumber); | 1515 breakpointObject->getNumber(DebuggerAgentState::lineNumber, &breakpoint.
lineNumber); |
1516 breakpointObject->getNumber(DebuggerAgentState::columnNumber, &breakpoin
t.columnNumber); | 1516 breakpointObject->getNumber(DebuggerAgentState::columnNumber, &breakpoin
t.columnNumber); |
1517 breakpointObject->getString(DebuggerAgentState::condition, &breakpoint.c
ondition); | 1517 breakpointObject->getString(DebuggerAgentState::condition, &breakpoint.c
ondition); |
1518 RefPtr<TypeBuilder::Debugger::Location> location = resolveBreakpoint(coo
kie.key, parsedScript.scriptId, breakpoint, UserBreakpointSource); | 1518 RefPtr<TypeBuilder::Debugger::Location> location = resolveBreakpoint(coo
kie.key, parsedScript.scriptId, breakpoint, UserBreakpointSource); |
1519 if (location) | 1519 if (location) |
1520 frontend()->breakpointResolved(cookie.key, location); | 1520 frontend()->breakpointResolved(cookie.key, location); |
1521 } | 1521 } |
1522 } | 1522 } |
1523 | 1523 |
1524 ScriptDebugListener::SkipPauseRequest InspectorDebuggerAgent::didPause(ScriptSta
te* scriptState, const ScriptValue& callFrames, const ScriptValue& exception, co
nst Vector<String>& hitBreakpoints, bool isPromiseRejection) | 1524 V8Debugger::SkipPauseRequest InspectorDebuggerAgent::didPause(ScriptState* scrip
tState, const ScriptValue& callFrames, const ScriptValue& exception, const Vecto
r<String>& hitBreakpoints, bool isPromiseRejection) |
1525 { | 1525 { |
1526 ScriptDebugListener::SkipPauseRequest result; | 1526 V8Debugger::SkipPauseRequest result; |
1527 if (m_skipAllPauses) | 1527 if (m_skipAllPauses) |
1528 result = ScriptDebugListener::Continue; | 1528 result = V8Debugger::Continue; |
1529 else if (!hitBreakpoints.isEmpty()) | 1529 else if (!hitBreakpoints.isEmpty()) |
1530 result = ScriptDebugListener::NoSkip; // Don't skip explicit breakpoints
even if set in frameworks. | 1530 result = V8Debugger::NoSkip; // Don't skip explicit breakpoints even if
set in frameworks. |
1531 else if (!exception.isEmpty()) | 1531 else if (!exception.isEmpty()) |
1532 result = shouldSkipExceptionPause(); | 1532 result = shouldSkipExceptionPause(); |
1533 else if (m_scheduledDebuggerStep != NoStep || m_javaScriptPauseScheduled ||
m_pausingOnNativeEvent) | 1533 else if (m_scheduledDebuggerStep != NoStep || m_javaScriptPauseScheduled ||
m_pausingOnNativeEvent) |
1534 result = shouldSkipStepPause(); | 1534 result = shouldSkipStepPause(); |
1535 else | 1535 else |
1536 result = ScriptDebugListener::NoSkip; | 1536 result = V8Debugger::NoSkip; |
1537 | 1537 |
1538 m_skipNextDebuggerStepOut = false; | 1538 m_skipNextDebuggerStepOut = false; |
1539 if (result != ScriptDebugListener::NoSkip) | 1539 if (result != V8Debugger::NoSkip) |
1540 return result; | 1540 return result; |
1541 | 1541 |
1542 // Skip pauses inside V8 internal scripts and on syntax errors. | 1542 // Skip pauses inside V8 internal scripts and on syntax errors. |
1543 if (callFrames.isEmpty()) | 1543 if (callFrames.isEmpty()) |
1544 return ScriptDebugListener::Continue; | 1544 return V8Debugger::Continue; |
1545 | 1545 |
1546 ASSERT(scriptState); | 1546 ASSERT(scriptState); |
1547 ASSERT(!m_pausedScriptState); | 1547 ASSERT(!m_pausedScriptState); |
1548 m_pausedScriptState = scriptState; | 1548 m_pausedScriptState = scriptState; |
1549 m_currentCallStack = callFrames; | 1549 m_currentCallStack = callFrames; |
1550 | 1550 |
1551 if (!exception.isEmpty()) { | 1551 if (!exception.isEmpty()) { |
1552 InjectedScript injectedScript = m_injectedScriptManager->injectedScriptF
or(scriptState); | 1552 InjectedScript injectedScript = m_injectedScriptManager->injectedScriptF
or(scriptState); |
1553 if (!injectedScript.isEmpty()) { | 1553 if (!injectedScript.isEmpty()) { |
1554 m_breakReason = isPromiseRejection ? InspectorFrontend::Debugger::Re
ason::PromiseRejection : InspectorFrontend::Debugger::Reason::Exception; | 1554 m_breakReason = isPromiseRejection ? InspectorFrontend::Debugger::Re
ason::PromiseRejection : InspectorFrontend::Debugger::Reason::Exception; |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1712 RefPtr<ExceptionDetails> exceptionDetails = ExceptionDetails::create().setTe
xt(toCoreStringWithUndefinedOrNullCheck(message->Get())); | 1712 RefPtr<ExceptionDetails> exceptionDetails = ExceptionDetails::create().setTe
xt(toCoreStringWithUndefinedOrNullCheck(message->Get())); |
1713 exceptionDetails->setLine(message->GetLineNumber()); | 1713 exceptionDetails->setLine(message->GetLineNumber()); |
1714 exceptionDetails->setColumn(message->GetStartColumn()); | 1714 exceptionDetails->setColumn(message->GetStartColumn()); |
1715 v8::Local<v8::StackTrace> messageStackTrace = message->GetStackTrace(); | 1715 v8::Local<v8::StackTrace> messageStackTrace = message->GetStackTrace(); |
1716 if (!messageStackTrace.IsEmpty() && messageStackTrace->GetFrameCount() > 0) | 1716 if (!messageStackTrace.IsEmpty() && messageStackTrace->GetFrameCount() > 0) |
1717 exceptionDetails->setStackTrace(createScriptCallStack(isolate, messageSt
ackTrace, messageStackTrace->GetFrameCount())->buildInspectorArray()); | 1717 exceptionDetails->setStackTrace(createScriptCallStack(isolate, messageSt
ackTrace, messageStackTrace->GetFrameCount())->buildInspectorArray()); |
1718 return exceptionDetails.release(); | 1718 return exceptionDetails.release(); |
1719 } | 1719 } |
1720 | 1720 |
1721 } // namespace blink | 1721 } // namespace blink |
OLD | NEW |