Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(466)

Side by Side Diff: Source/bindings/v8/ScriptDebugServer.cpp

Issue 290633009: DevTools: Show detailed information for exceptions during snippet execution. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/bindings/v8/ScriptDebugServer.h ('k') | Source/core/inspector/InspectorDebuggerAgent.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2010-2011 Google Inc. All rights reserved. 2 * Copyright (c) 2010-2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 16 matching lines...) Expand all
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #include "config.h" 31 #include "config.h"
32 #include "bindings/v8/ScriptDebugServer.h" 32 #include "bindings/v8/ScriptDebugServer.h"
33 33
34 #include "DebuggerScriptSource.h" 34 #include "DebuggerScriptSource.h"
35 #include "V8JavaScriptCallFrame.h" 35 #include "V8JavaScriptCallFrame.h"
36 #include "bindings/v8/ScopedPersistent.h" 36 #include "bindings/v8/ScopedPersistent.h"
37 #include "bindings/v8/ScriptCallStackFactory.h"
37 #include "bindings/v8/ScriptController.h" 38 #include "bindings/v8/ScriptController.h"
38 #include "bindings/v8/ScriptObject.h" 39 #include "bindings/v8/ScriptObject.h"
39 #include "bindings/v8/ScriptSourceCode.h" 40 #include "bindings/v8/ScriptSourceCode.h"
40 #include "bindings/v8/V8Binding.h" 41 #include "bindings/v8/V8Binding.h"
41 #include "bindings/v8/V8ScriptRunner.h" 42 #include "bindings/v8/V8ScriptRunner.h"
42 #include "core/inspector/JavaScriptCallFrame.h" 43 #include "core/inspector/JavaScriptCallFrame.h"
43 #include "core/inspector/ScriptDebugListener.h" 44 #include "core/inspector/ScriptDebugListener.h"
44 #include "platform/JSONValues.h" 45 #include "platform/JSONValues.h"
45 #include "wtf/StdLibExtras.h" 46 #include "wtf/StdLibExtras.h"
46 #include "wtf/Vector.h" 47 #include "wtf/Vector.h"
(...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after
593 }; 594 };
594 return callDebuggerMethod("setFunctionVariableValue", 4, argv); 595 return callDebuggerMethod("setFunctionVariableValue", 4, argv);
595 } 596 }
596 597
597 598
598 bool ScriptDebugServer::isPaused() 599 bool ScriptDebugServer::isPaused()
599 { 600 {
600 return !m_executionState.isEmpty(); 601 return !m_executionState.isEmpty();
601 } 602 }
602 603
603 void ScriptDebugServer::compileScript(ScriptState* scriptState, const String& ex pression, const String& sourceURL, String* scriptId, String* exceptionMessage) 604 void ScriptDebugServer::compileScript(ScriptState* scriptState, const String& ex pression, const String& sourceURL, String* scriptId, String* exceptionDetailsTex t, int* lineNumber, int* columnNumber, RefPtr<ScriptCallStack>* stackTrace)
604 { 605 {
605 if (scriptState->contextIsEmpty()) 606 if (scriptState->contextIsEmpty())
606 return; 607 return;
607 ScriptState::Scope scope(scriptState); 608 ScriptState::Scope scope(scriptState);
608 609
609 v8::Handle<v8::String> source = v8String(m_isolate, expression); 610 v8::Handle<v8::String> source = v8String(m_isolate, expression);
610 v8::TryCatch tryCatch; 611 v8::TryCatch tryCatch;
611 v8::Local<v8::Script> script = V8ScriptRunner::compileScript(source, sourceU RL, TextPosition(), 0, m_isolate); 612 v8::Local<v8::Script> script = V8ScriptRunner::compileScript(source, sourceU RL, TextPosition(), 0, m_isolate);
612 if (tryCatch.HasCaught()) { 613 if (tryCatch.HasCaught()) {
613 v8::Local<v8::Message> message = tryCatch.Message(); 614 v8::Local<v8::Message> message = tryCatch.Message();
614 if (!message.IsEmpty()) 615 if (!message.IsEmpty()) {
615 *exceptionMessage = toCoreStringWithUndefinedOrNullCheck(message->Ge t()); 616 *exceptionDetailsText = toCoreStringWithUndefinedOrNullCheck(message ->Get());
617 *lineNumber = message->GetLineNumber();
618 *columnNumber = message->GetStartColumn();
619 *stackTrace = createScriptCallStack(message->GetStackTrace(), Script CallStack::maxCallStackSizeToCapture, m_isolate);
yurys 2014/06/05 08:46:43 We should pass message->GetStackTrace()->GetFrameC
620 }
616 return; 621 return;
617 } 622 }
618 if (script.IsEmpty()) 623 if (script.IsEmpty())
619 return; 624 return;
620 625
621 *scriptId = String::number(script->GetId()); 626 *scriptId = String::number(script->GetId());
622 m_compiledScripts.set(*scriptId, adoptPtr(new ScopedPersistent<v8::Script>(m _isolate, script))); 627 m_compiledScripts.set(*scriptId, adoptPtr(new ScopedPersistent<v8::Script>(m _isolate, script)));
623 } 628 }
624 629
625 void ScriptDebugServer::clearCompiledScripts() 630 void ScriptDebugServer::clearCompiledScripts()
626 { 631 {
627 m_compiledScripts.clear(); 632 m_compiledScripts.clear();
628 } 633 }
629 634
630 void ScriptDebugServer::runScript(ScriptState* scriptState, const String& script Id, ScriptValue* result, bool* wasThrown, String* exceptionMessage) 635 void ScriptDebugServer::runScript(ScriptState* scriptState, const String& script Id, ScriptValue* result, bool* wasThrown, String* exceptionDetailsText, int* lin eNumber, int* columnNumber, RefPtr<ScriptCallStack>* stackTrace)
631 { 636 {
632 if (!m_compiledScripts.contains(scriptId)) 637 if (!m_compiledScripts.contains(scriptId))
633 return; 638 return;
634 v8::HandleScope handleScope(m_isolate); 639 v8::HandleScope handleScope(m_isolate);
635 ScopedPersistent<v8::Script>* scriptHandle = m_compiledScripts.get(scriptId) ; 640 ScopedPersistent<v8::Script>* scriptHandle = m_compiledScripts.get(scriptId) ;
636 v8::Local<v8::Script> script = scriptHandle->newLocal(m_isolate); 641 v8::Local<v8::Script> script = scriptHandle->newLocal(m_isolate);
637 m_compiledScripts.remove(scriptId); 642 m_compiledScripts.remove(scriptId);
638 if (script.IsEmpty()) 643 if (script.IsEmpty())
639 return; 644 return;
640 645
641 if (scriptState->contextIsEmpty()) 646 if (scriptState->contextIsEmpty())
642 return; 647 return;
643 ScriptState::Scope scope(scriptState); 648 ScriptState::Scope scope(scriptState);
644 v8::TryCatch tryCatch; 649 v8::TryCatch tryCatch;
645 v8::Local<v8::Value> value = V8ScriptRunner::runCompiledScript(script, scrip tState->executionContext(), m_isolate); 650 v8::Local<v8::Value> value = V8ScriptRunner::runCompiledScript(script, scrip tState->executionContext(), m_isolate);
646 *wasThrown = false; 651 *wasThrown = false;
647 if (tryCatch.HasCaught()) { 652 if (tryCatch.HasCaught()) {
648 *wasThrown = true; 653 *wasThrown = true;
649 *result = ScriptValue(scriptState, tryCatch.Exception()); 654 *result = ScriptValue(scriptState, tryCatch.Exception());
650 v8::Local<v8::Message> message = tryCatch.Message(); 655 v8::Local<v8::Message> message = tryCatch.Message();
651 if (!message.IsEmpty()) 656 if (!message.IsEmpty()) {
652 *exceptionMessage = toCoreStringWithUndefinedOrNullCheck(message->Ge t()); 657 *exceptionDetailsText = toCoreStringWithUndefinedOrNullCheck(message ->Get());
658 *lineNumber = message->GetLineNumber();
659 *columnNumber = message->GetStartColumn();
660 *stackTrace = createScriptCallStack(message->GetStackTrace(), Script CallStack::maxCallStackSizeToCapture, m_isolate);
yurys 2014/06/05 08:46:43 ditto
661 }
653 } else { 662 } else {
654 *result = ScriptValue(scriptState, value); 663 *result = ScriptValue(scriptState, value);
655 } 664 }
656 } 665 }
657 666
658 PassOwnPtr<ScriptSourceCode> ScriptDebugServer::preprocess(LocalFrame*, const Sc riptSourceCode&) 667 PassOwnPtr<ScriptSourceCode> ScriptDebugServer::preprocess(LocalFrame*, const Sc riptSourceCode&)
659 { 668 {
660 return PassOwnPtr<ScriptSourceCode>(); 669 return PassOwnPtr<ScriptSourceCode>();
661 } 670 }
662 671
663 String ScriptDebugServer::preprocessEventListener(LocalFrame*, const String& sou rce, const String& url, const String& functionName) 672 String ScriptDebugServer::preprocessEventListener(LocalFrame*, const String& sou rce, const String& url, const String& functionName)
664 { 673 {
665 return source; 674 return source;
666 } 675 }
667 676
668 } // namespace WebCore 677 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/v8/ScriptDebugServer.h ('k') | Source/core/inspector/InspectorDebuggerAgent.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698