| 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 596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 607 | 607 |
| 608 void InspectorDebuggerAgent::searchInContent(ErrorString* error, const String& s
criptId, const String& query, const bool* const optionalCaseSensitive, const boo
l* const optionalIsRegex, RefPtr<Array<TypeBuilder::Debugger::SearchMatch>>& res
ults) | 608 void InspectorDebuggerAgent::searchInContent(ErrorString* error, const String& s
criptId, const String& query, const bool* const optionalCaseSensitive, const boo
l* const optionalIsRegex, RefPtr<Array<TypeBuilder::Debugger::SearchMatch>>& res
ults) |
| 609 { | 609 { |
| 610 ScriptsMap::iterator it = m_scripts.find(scriptId); | 610 ScriptsMap::iterator it = m_scripts.find(scriptId); |
| 611 if (it != m_scripts.end()) | 611 if (it != m_scripts.end()) |
| 612 results = ContentSearchUtils::searchInTextByLines(it->value.source(), qu
ery, asBool(optionalCaseSensitive), asBool(optionalIsRegex)); | 612 results = ContentSearchUtils::searchInTextByLines(it->value.source(), qu
ery, asBool(optionalCaseSensitive), asBool(optionalIsRegex)); |
| 613 else | 613 else |
| 614 *error = "No script for id: " + scriptId; | 614 *error = "No script for id: " + scriptId; |
| 615 } | 615 } |
| 616 | 616 |
| 617 void InspectorDebuggerAgent::setScriptSource(ErrorString* error, RefPtr<TypeBuil
der::Debugger::SetScriptSourceError>& errorData, const String& scriptId, const S
tring& newContent, const bool* const preview, RefPtr<Array<CallFrame> >& newCall
Frames, RefPtr<JSONObject>& result, RefPtr<StackTrace>& asyncStackTrace) | 617 void InspectorDebuggerAgent::setScriptSource(ErrorString* error, RefPtr<TypeBuil
der::Debugger::SetScriptSourceError>& errorData, const String& scriptId, const S
tring& newContent, const bool* const preview, RefPtr<Array<CallFrame>>& newCallF
rames, TypeBuilder::OptOutput<bool>* stackChanged, RefPtr<StackTrace>& asyncStac
kTrace) |
| 618 { | 618 { |
| 619 if (!checkEnabled(error)) | 619 if (!checkEnabled(error)) |
| 620 return; | 620 return; |
| 621 if (!debugger().setScriptSource(scriptId, newContent, asBool(preview), error
, errorData, &m_currentCallStack, &result)) | 621 if (!debugger().setScriptSource(scriptId, newContent, asBool(preview), error
, errorData, &m_currentCallStack, stackChanged)) |
| 622 return; | 622 return; |
| 623 | 623 |
| 624 newCallFrames = currentCallFrames(); | 624 newCallFrames = currentCallFrames(); |
| 625 asyncStackTrace = currentAsyncStackTrace(); | 625 asyncStackTrace = currentAsyncStackTrace(); |
| 626 | 626 |
| 627 ScriptsMap::iterator it = m_scripts.find(scriptId); | 627 ScriptsMap::iterator it = m_scripts.find(scriptId); |
| 628 if (it == m_scripts.end()) | 628 if (it == m_scripts.end()) |
| 629 return; | 629 return; |
| 630 String url = it->value.url(); | 630 String url = it->value.url(); |
| 631 if (url.isEmpty()) | 631 if (url.isEmpty()) |
| 632 return; | 632 return; |
| 633 m_editedScripts.set(url, newContent); | 633 m_editedScripts.set(url, newContent); |
| 634 } | 634 } |
| 635 | 635 |
| 636 void InspectorDebuggerAgent::restartFrame(ErrorString* errorString, const String
& callFrameId, RefPtr<Array<CallFrame> >& newCallFrames, RefPtr<JSONObject>& res
ult, RefPtr<StackTrace>& asyncStackTrace) | 636 void InspectorDebuggerAgent::restartFrame(ErrorString* errorString, const String
& callFrameId, RefPtr<Array<CallFrame>>& newCallFrames, RefPtr<StackTrace>& asyn
cStackTrace) |
| 637 { | 637 { |
| 638 if (!isPaused() || m_currentCallStack.IsEmpty()) { | 638 if (!isPaused() || m_currentCallStack.IsEmpty()) { |
| 639 *errorString = "Attempt to access callframe when debugger is not on paus
e"; | 639 *errorString = "Attempt to access callframe when debugger is not on paus
e"; |
| 640 return; | 640 return; |
| 641 } | 641 } |
| 642 OwnPtr<RemoteCallFrameId> remoteId = RemoteCallFrameId::parse(callFrameId); | 642 OwnPtr<RemoteCallFrameId> remoteId = RemoteCallFrameId::parse(callFrameId); |
| 643 if (!remoteId) { | 643 if (!remoteId) { |
| 644 *errorString = "Invalid call frame id"; | 644 *errorString = "Invalid call frame id"; |
| 645 return; | 645 return; |
| 646 } | 646 } |
| 647 InjectedScript injectedScript = m_injectedScriptManager->findInjectedScript(
remoteId.get()); | 647 InjectedScript injectedScript = m_injectedScriptManager->findInjectedScript(
remoteId.get()); |
| 648 if (injectedScript.isEmpty()) { | 648 if (injectedScript.isEmpty()) { |
| 649 *errorString = "Inspected frame has gone"; | 649 *errorString = "Inspected frame has gone"; |
| 650 return; | 650 return; |
| 651 } | 651 } |
| 652 | 652 |
| 653 v8::HandleScope scope(m_isolate); | 653 v8::HandleScope scope(m_isolate); |
| 654 v8::Local<v8::Object> callStack = m_currentCallStack.Get(m_isolate); | 654 v8::Local<v8::Object> callStack = m_currentCallStack.Get(m_isolate); |
| 655 injectedScript.restartFrame(errorString, callStack, callFrameId, &result); | 655 injectedScript.restartFrame(errorString, callStack, callFrameId); |
| 656 m_currentCallStack.Reset(m_isolate, debugger().currentCallFrames()); | 656 m_currentCallStack.Reset(m_isolate, debugger().currentCallFrames()); |
| 657 newCallFrames = currentCallFrames(); | 657 newCallFrames = currentCallFrames(); |
| 658 asyncStackTrace = currentAsyncStackTrace(); | 658 asyncStackTrace = currentAsyncStackTrace(); |
| 659 } | 659 } |
| 660 | 660 |
| 661 void InspectorDebuggerAgent::getScriptSource(ErrorString* error, const String& s
criptId, String* scriptSource) | 661 void InspectorDebuggerAgent::getScriptSource(ErrorString* error, const String& s
criptId, String* scriptSource) |
| 662 { | 662 { |
| 663 if (!checkEnabled(error)) | 663 if (!checkEnabled(error)) |
| 664 return; | 664 return; |
| 665 ScriptsMap::iterator it = m_scripts.find(scriptId); | 665 ScriptsMap::iterator it = m_scripts.find(scriptId); |
| (...skipping 1119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1785 RefPtr<ExceptionDetails> exceptionDetails = ExceptionDetails::create().setTe
xt(toCoreStringWithUndefinedOrNullCheck(message->Get())); | 1785 RefPtr<ExceptionDetails> exceptionDetails = ExceptionDetails::create().setTe
xt(toCoreStringWithUndefinedOrNullCheck(message->Get())); |
| 1786 exceptionDetails->setLine(message->GetLineNumber()); | 1786 exceptionDetails->setLine(message->GetLineNumber()); |
| 1787 exceptionDetails->setColumn(message->GetStartColumn()); | 1787 exceptionDetails->setColumn(message->GetStartColumn()); |
| 1788 v8::Local<v8::StackTrace> messageStackTrace = message->GetStackTrace(); | 1788 v8::Local<v8::StackTrace> messageStackTrace = message->GetStackTrace(); |
| 1789 if (!messageStackTrace.IsEmpty() && messageStackTrace->GetFrameCount() > 0) | 1789 if (!messageStackTrace.IsEmpty() && messageStackTrace->GetFrameCount() > 0) |
| 1790 exceptionDetails->setStackTrace(createScriptCallStack(isolate, messageSt
ackTrace, messageStackTrace->GetFrameCount())->buildInspectorArray()); | 1790 exceptionDetails->setStackTrace(createScriptCallStack(isolate, messageSt
ackTrace, messageStackTrace->GetFrameCount())->buildInspectorArray()); |
| 1791 return exceptionDetails.release(); | 1791 return exceptionDetails.release(); |
| 1792 } | 1792 } |
| 1793 | 1793 |
| 1794 } // namespace blink | 1794 } // namespace blink |
| OLD | NEW |