OLD | NEW |
---|---|
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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
61 | 61 |
62 const char stepIntoV8MethodName[] = "stepIntoStatement"; | 62 const char stepIntoV8MethodName[] = "stepIntoStatement"; |
63 const char stepOutV8MethodName[] = "stepOutOfFunction"; | 63 const char stepOutV8MethodName[] = "stepOutOfFunction"; |
64 } | 64 } |
65 | 65 |
66 v8::Local<v8::Value> ScriptDebugServer::callDebuggerMethod(const char* functionN ame, int argc, v8::Local<v8::Value> argv[]) | 66 v8::Local<v8::Value> ScriptDebugServer::callDebuggerMethod(const char* functionN ame, int argc, v8::Local<v8::Value> argv[]) |
67 { | 67 { |
68 v8::Local<v8::Object> debuggerScript = debuggerScriptLocal(); | 68 v8::Local<v8::Object> debuggerScript = debuggerScriptLocal(); |
69 v8::Local<v8::Function> function = v8::Local<v8::Function>::Cast(debuggerScr ipt->Get(v8InternalizedString(functionName))); | 69 v8::Local<v8::Function> function = v8::Local<v8::Function>::Cast(debuggerScr ipt->Get(v8InternalizedString(functionName))); |
70 ASSERT(m_isolate->InContext()); | 70 ASSERT(m_isolate->InContext()); |
71 return V8ScriptRunner::callInternalFunction(function, debuggerScript, argc, argv, m_isolate); | 71 return V8ScriptRunner::callInternalFunction(function, debuggerScript, argc, argv, m_isolate).ToLocalChecked(); |
haraken
2015/03/25 12:05:22
How is it guaranteed that this callInternalFunctio
yurys
2015/03/25 12:25:06
In fact it is expected to throw in some cases. See
bashi
2015/03/27 00:39:50
In other places, I changed the return value to May
| |
72 } | 72 } |
73 | 73 |
74 ScriptDebugServer::ScriptDebugServer(v8::Isolate* isolate) | 74 ScriptDebugServer::ScriptDebugServer(v8::Isolate* isolate) |
75 : m_isolate(isolate) | 75 : m_isolate(isolate) |
76 , m_breakpointsActivated(true) | 76 , m_breakpointsActivated(true) |
77 , m_compiledScripts(isolate) | 77 , m_compiledScripts(isolate) |
78 , m_runningNestedMessageLoop(false) | 78 , m_runningNestedMessageLoop(false) |
79 { | 79 { |
80 } | 80 } |
81 | 81 |
(...skipping 29 matching lines...) Expand all Loading... | |
111 void ScriptDebugServer::reportCompiledScripts(const String& contextDebugDataSubs tring, ScriptDebugListener* listener) | 111 void ScriptDebugServer::reportCompiledScripts(const String& contextDebugDataSubs tring, ScriptDebugListener* listener) |
112 { | 112 { |
113 v8::HandleScope scope(m_isolate); | 113 v8::HandleScope scope(m_isolate); |
114 v8::Local<v8::Context> debuggerContext = v8::Debug::GetDebugContext(); | 114 v8::Local<v8::Context> debuggerContext = v8::Debug::GetDebugContext(); |
115 v8::Context::Scope contextScope(debuggerContext); | 115 v8::Context::Scope contextScope(debuggerContext); |
116 | 116 |
117 v8::Local<v8::Object> debuggerScript = debuggerScriptLocal(); | 117 v8::Local<v8::Object> debuggerScript = debuggerScriptLocal(); |
118 ASSERT(!debuggerScript->IsUndefined()); | 118 ASSERT(!debuggerScript->IsUndefined()); |
119 v8::Local<v8::Function> getScriptsFunction = v8::Local<v8::Function>::Cast(d ebuggerScript->Get(v8AtomicString(m_isolate, "getScripts"))); | 119 v8::Local<v8::Function> getScriptsFunction = v8::Local<v8::Function>::Cast(d ebuggerScript->Get(v8AtomicString(m_isolate, "getScripts"))); |
120 v8::Local<v8::Value> argv[] = { v8String(m_isolate, contextDebugDataSubstrin g) }; | 120 v8::Local<v8::Value> argv[] = { v8String(m_isolate, contextDebugDataSubstrin g) }; |
121 v8::Local<v8::Value> value = V8ScriptRunner::callInternalFunction(getScripts Function, debuggerScript, WTF_ARRAY_LENGTH(argv), argv, m_isolate); | 121 v8::Local<v8::Value> value; |
122 if (value.IsEmpty()) | 122 if (!V8ScriptRunner::callInternalFunction(getScriptsFunction, debuggerScript , WTF_ARRAY_LENGTH(argv), argv, m_isolate).ToLocal(&value)) |
123 return; | 123 return; |
124 ASSERT(value->IsArray()); | 124 ASSERT(value->IsArray()); |
125 v8::Local<v8::Array> scriptsArray = v8::Local<v8::Array>::Cast(value); | 125 v8::Local<v8::Array> scriptsArray = v8::Local<v8::Array>::Cast(value); |
126 for (unsigned i = 0; i < scriptsArray->Length(); ++i) | 126 for (unsigned i = 0; i < scriptsArray->Length(); ++i) |
127 dispatchDidParseSource(listener, v8::Local<v8::Object>::Cast(scriptsArra y->Get(v8::Integer::New(m_isolate, i))), CompileSuccess); | 127 dispatchDidParseSource(listener, v8::Local<v8::Object>::Cast(scriptsArra y->Get(v8::Integer::New(m_isolate, i))), CompileSuccess); |
128 } | 128 } |
129 | 129 |
130 String ScriptDebugServer::setBreakpoint(const String& sourceID, const ScriptBrea kpoint& scriptBreakpoint, int* actualLineNumber, int* actualColumnNumber, bool i nterstatementLocation) | 130 String ScriptDebugServer::setBreakpoint(const String& sourceID, const ScriptBrea kpoint& scriptBreakpoint, int* actualLineNumber, int* actualColumnNumber, bool i nterstatementLocation) |
131 { | 131 { |
132 v8::HandleScope scope(m_isolate); | 132 v8::HandleScope scope(m_isolate); |
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
538 void ScriptDebugServer::v8DebugEventCallback(const v8::Debug::EventDetails& even tDetails) | 538 void ScriptDebugServer::v8DebugEventCallback(const v8::Debug::EventDetails& even tDetails) |
539 { | 539 { |
540 ScriptDebugServer* thisPtr = toScriptDebugServer(eventDetails.GetCallbackDat a()); | 540 ScriptDebugServer* thisPtr = toScriptDebugServer(eventDetails.GetCallbackDat a()); |
541 thisPtr->handleV8DebugEvent(eventDetails); | 541 thisPtr->handleV8DebugEvent(eventDetails); |
542 } | 542 } |
543 | 543 |
544 static v8::Local<v8::Value> callInternalGetterFunction(v8::Local<v8::Object> obj ect, const char* functionName, v8::Isolate* isolate) | 544 static v8::Local<v8::Value> callInternalGetterFunction(v8::Local<v8::Object> obj ect, const char* functionName, v8::Isolate* isolate) |
545 { | 545 { |
546 v8::Local<v8::Value> getterValue = object->Get(v8AtomicString(isolate, funct ionName)); | 546 v8::Local<v8::Value> getterValue = object->Get(v8AtomicString(isolate, funct ionName)); |
547 ASSERT(!getterValue.IsEmpty() && getterValue->IsFunction()); | 547 ASSERT(!getterValue.IsEmpty() && getterValue->IsFunction()); |
548 return V8ScriptRunner::callInternalFunction(v8::Local<v8::Function>::Cast(ge tterValue), object, 0, 0, isolate); | 548 return V8ScriptRunner::callInternalFunction(v8::Local<v8::Function>::Cast(ge tterValue), object, 0, 0, isolate).ToLocalChecked(); |
549 } | 549 } |
550 | 550 |
551 void ScriptDebugServer::handleV8DebugEvent(const v8::Debug::EventDetails& eventD etails) | 551 void ScriptDebugServer::handleV8DebugEvent(const v8::Debug::EventDetails& eventD etails) |
552 { | 552 { |
553 v8::DebugEvent event = eventDetails.GetEvent(); | 553 v8::DebugEvent event = eventDetails.GetEvent(); |
554 | 554 |
555 if (event == v8::BreakForCommand) { | 555 if (event == v8::BreakForCommand) { |
556 ClientDataImpl* data = static_cast<ClientDataImpl*>(eventDetails.GetClie ntData()); | 556 ClientDataImpl* data = static_cast<ClientDataImpl*>(eventDetails.GetClie ntData()); |
557 data->task()->run(); | 557 data->task()->run(); |
558 return; | 558 return; |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
790 *lineNumber = message->GetLineNumber(); | 790 *lineNumber = message->GetLineNumber(); |
791 *columnNumber = message->GetStartColumn(); | 791 *columnNumber = message->GetStartColumn(); |
792 v8::Local<v8::StackTrace> messageStackTrace = message->GetStackTrace (); | 792 v8::Local<v8::StackTrace> messageStackTrace = message->GetStackTrace (); |
793 if (!messageStackTrace.IsEmpty() && messageStackTrace->GetFrameCount () > 0) | 793 if (!messageStackTrace.IsEmpty() && messageStackTrace->GetFrameCount () > 0) |
794 *stackTrace = createScriptCallStack(m_isolate, messageStackTrace , messageStackTrace->GetFrameCount()); | 794 *stackTrace = createScriptCallStack(m_isolate, messageStackTrace , messageStackTrace->GetFrameCount()); |
795 } | 795 } |
796 } | 796 } |
797 } | 797 } |
798 | 798 |
799 } // namespace blink | 799 } // namespace blink |
OLD | NEW |