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