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 603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
614 return; | 614 return; |
615 if (!debugger().setScriptSource(scriptId, newContent, asBool(preview), error
, errorData, &m_currentCallStack, &result)) | 615 if (!debugger().setScriptSource(scriptId, newContent, asBool(preview), error
, errorData, &m_currentCallStack, &result)) |
616 return; | 616 return; |
617 | 617 |
618 newCallFrames = currentCallFrames(); | 618 newCallFrames = currentCallFrames(); |
619 asyncStackTrace = currentAsyncStackTrace(); | 619 asyncStackTrace = currentAsyncStackTrace(); |
620 | 620 |
621 ScriptsMap::iterator it = m_scripts.find(scriptId); | 621 ScriptsMap::iterator it = m_scripts.find(scriptId); |
622 if (it == m_scripts.end()) | 622 if (it == m_scripts.end()) |
623 return; | 623 return; |
624 it->value.setSource(newContent); | 624 String url = it->value.url(); |
| 625 if (url.isEmpty()) |
| 626 return; |
| 627 m_editedScripts.set(url, newContent); |
625 } | 628 } |
626 | 629 |
627 void InspectorDebuggerAgent::restartFrame(ErrorString* errorString, const String
& callFrameId, RefPtr<Array<CallFrame> >& newCallFrames, RefPtr<JSONObject>& res
ult, RefPtr<StackTrace>& asyncStackTrace) | 630 void InspectorDebuggerAgent::restartFrame(ErrorString* errorString, const String
& callFrameId, RefPtr<Array<CallFrame> >& newCallFrames, RefPtr<JSONObject>& res
ult, RefPtr<StackTrace>& asyncStackTrace) |
628 { | 631 { |
629 if (!isPaused() || m_currentCallStack.IsEmpty()) { | 632 if (!isPaused() || m_currentCallStack.IsEmpty()) { |
630 *errorString = "Attempt to access callframe when debugger is not on paus
e"; | 633 *errorString = "Attempt to access callframe when debugger is not on paus
e"; |
631 return; | 634 return; |
632 } | 635 } |
633 InjectedScript injectedScript = m_injectedScriptManager->injectedScriptForOb
jectId(callFrameId); | 636 InjectedScript injectedScript = m_injectedScriptManager->injectedScriptForOb
jectId(callFrameId); |
634 if (injectedScript.isEmpty()) { | 637 if (injectedScript.isEmpty()) { |
(...skipping 11 matching lines...) Expand all Loading... |
646 | 649 |
647 void InspectorDebuggerAgent::getScriptSource(ErrorString* error, const String& s
criptId, String* scriptSource) | 650 void InspectorDebuggerAgent::getScriptSource(ErrorString* error, const String& s
criptId, String* scriptSource) |
648 { | 651 { |
649 if (!checkEnabled(error)) | 652 if (!checkEnabled(error)) |
650 return; | 653 return; |
651 ScriptsMap::iterator it = m_scripts.find(scriptId); | 654 ScriptsMap::iterator it = m_scripts.find(scriptId); |
652 if (it == m_scripts.end()) { | 655 if (it == m_scripts.end()) { |
653 *error = "No script for id: " + scriptId; | 656 *error = "No script for id: " + scriptId; |
654 return; | 657 return; |
655 } | 658 } |
| 659 |
| 660 String url = it->value.url(); |
| 661 if (!url.isEmpty() && getEditedScript(url, scriptSource)) |
| 662 return; |
656 *scriptSource = it->value.source(); | 663 *scriptSource = it->value.source(); |
657 } | 664 } |
658 | 665 |
659 void InspectorDebuggerAgent::getFunctionDetails(ErrorString* errorString, const
String& functionId, RefPtr<FunctionDetails>& details) | 666 void InspectorDebuggerAgent::getFunctionDetails(ErrorString* errorString, const
String& functionId, RefPtr<FunctionDetails>& details) |
660 { | 667 { |
661 if (!checkEnabled(errorString)) | 668 if (!checkEnabled(errorString)) |
662 return; | 669 return; |
663 InjectedScript injectedScript = m_injectedScriptManager->injectedScriptForOb
jectId(functionId); | 670 InjectedScript injectedScript = m_injectedScriptManager->injectedScriptForOb
jectId(functionId); |
664 if (injectedScript.isEmpty()) { | 671 if (injectedScript.isEmpty()) { |
665 *errorString = "Function object id is obsolete"; | 672 *errorString = "Function object id is obsolete"; |
(...skipping 748 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1414 // from the old StepFrame. | 1421 // from the old StepFrame. |
1415 m_skippedStepFrameCount = 0; | 1422 m_skippedStepFrameCount = 0; |
1416 if (m_scheduledDebuggerStep == NoStep) | 1423 if (m_scheduledDebuggerStep == NoStep) |
1417 debugger().clearStepping(); | 1424 debugger().clearStepping(); |
1418 else if (m_scheduledDebuggerStep == StepOut) | 1425 else if (m_scheduledDebuggerStep == StepOut) |
1419 m_skipNextDebuggerStepOut = true; | 1426 m_skipNextDebuggerStepOut = true; |
1420 } | 1427 } |
1421 } | 1428 } |
1422 } | 1429 } |
1423 | 1430 |
| 1431 bool InspectorDebuggerAgent::getEditedScript(const String& url, String* content) |
| 1432 { |
| 1433 if (!m_editedScripts.contains(url)) |
| 1434 return false; |
| 1435 *content = m_editedScripts.get(url); |
| 1436 return true; |
| 1437 } |
| 1438 |
1424 PassRefPtr<Array<CallFrame> > InspectorDebuggerAgent::currentCallFrames() | 1439 PassRefPtr<Array<CallFrame> > InspectorDebuggerAgent::currentCallFrames() |
1425 { | 1440 { |
1426 if (!m_pausedScriptState || m_currentCallStack.IsEmpty()) | 1441 if (!m_pausedScriptState || m_currentCallStack.IsEmpty()) |
1427 return Array<CallFrame>::create(); | 1442 return Array<CallFrame>::create(); |
1428 InjectedScript injectedScript = m_injectedScriptManager->injectedScriptFor(m
_pausedScriptState.get()); | 1443 InjectedScript injectedScript = m_injectedScriptManager->injectedScriptFor(m
_pausedScriptState.get()); |
1429 if (injectedScript.isEmpty()) { | 1444 if (injectedScript.isEmpty()) { |
1430 ASSERT_NOT_REACHED(); | 1445 ASSERT_NOT_REACHED(); |
1431 return Array<CallFrame>::create(); | 1446 return Array<CallFrame>::create(); |
1432 } | 1447 } |
1433 | 1448 |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1709 { | 1724 { |
1710 m_scheduledDebuggerStep = NoStep; | 1725 m_scheduledDebuggerStep = NoStep; |
1711 m_scripts.clear(); | 1726 m_scripts.clear(); |
1712 m_breakpointIdToDebuggerBreakpointIds.clear(); | 1727 m_breakpointIdToDebuggerBreakpointIds.clear(); |
1713 resetAsyncCallTracker(); | 1728 resetAsyncCallTracker(); |
1714 promiseTracker().clear(); | 1729 promiseTracker().clear(); |
1715 if (frontend()) | 1730 if (frontend()) |
1716 frontend()->globalObjectCleared(); | 1731 frontend()->globalObjectCleared(); |
1717 } | 1732 } |
1718 | 1733 |
| 1734 void InspectorDebuggerAgent::resetModifiedSources() |
| 1735 { |
| 1736 m_editedScripts.clear(); |
| 1737 } |
| 1738 |
1719 DEFINE_TRACE(InspectorDebuggerAgent) | 1739 DEFINE_TRACE(InspectorDebuggerAgent) |
1720 { | 1740 { |
1721 #if ENABLE(OILPAN) | 1741 #if ENABLE(OILPAN) |
1722 visitor->trace(m_injectedScriptManager); | 1742 visitor->trace(m_injectedScriptManager); |
1723 visitor->trace(m_debugger); | 1743 visitor->trace(m_debugger); |
1724 visitor->trace(m_listener); | 1744 visitor->trace(m_listener); |
1725 visitor->trace(m_v8AsyncCallTracker); | 1745 visitor->trace(m_v8AsyncCallTracker); |
1726 visitor->trace(m_promiseTracker); | 1746 visitor->trace(m_promiseTracker); |
1727 visitor->trace(m_asyncOperations); | 1747 visitor->trace(m_asyncOperations); |
1728 visitor->trace(m_currentAsyncCallChain); | 1748 visitor->trace(m_currentAsyncCallChain); |
1729 visitor->trace(m_asyncCallTrackingListeners); | 1749 visitor->trace(m_asyncCallTrackingListeners); |
1730 #endif | 1750 #endif |
1731 InspectorBaseAgent::trace(visitor); | 1751 InspectorBaseAgent::trace(visitor); |
1732 } | 1752 } |
1733 | 1753 |
1734 PassRefPtr<TypeBuilder::Debugger::ExceptionDetails> InspectorDebuggerAgent::crea
teExceptionDetails(v8::Isolate* isolate, v8::Local<v8::Message> message) | 1754 PassRefPtr<TypeBuilder::Debugger::ExceptionDetails> InspectorDebuggerAgent::crea
teExceptionDetails(v8::Isolate* isolate, v8::Local<v8::Message> message) |
1735 { | 1755 { |
1736 RefPtr<ExceptionDetails> exceptionDetails = ExceptionDetails::create().setTe
xt(toCoreStringWithUndefinedOrNullCheck(message->Get())); | 1756 RefPtr<ExceptionDetails> exceptionDetails = ExceptionDetails::create().setTe
xt(toCoreStringWithUndefinedOrNullCheck(message->Get())); |
1737 exceptionDetails->setLine(message->GetLineNumber()); | 1757 exceptionDetails->setLine(message->GetLineNumber()); |
1738 exceptionDetails->setColumn(message->GetStartColumn()); | 1758 exceptionDetails->setColumn(message->GetStartColumn()); |
1739 v8::Local<v8::StackTrace> messageStackTrace = message->GetStackTrace(); | 1759 v8::Local<v8::StackTrace> messageStackTrace = message->GetStackTrace(); |
1740 if (!messageStackTrace.IsEmpty() && messageStackTrace->GetFrameCount() > 0) | 1760 if (!messageStackTrace.IsEmpty() && messageStackTrace->GetFrameCount() > 0) |
1741 exceptionDetails->setStackTrace(createScriptCallStack(isolate, messageSt
ackTrace, messageStackTrace->GetFrameCount())->buildInspectorArray()); | 1761 exceptionDetails->setStackTrace(createScriptCallStack(isolate, messageSt
ackTrace, messageStackTrace->GetFrameCount())->buildInspectorArray()); |
1742 return exceptionDetails.release(); | 1762 return exceptionDetails.release(); |
1743 } | 1763 } |
1744 | 1764 |
1745 } // namespace blink | 1765 } // namespace blink |
OLD | NEW |