| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2010, Google Inc. All rights reserved. | 2 * Copyright (c) 2010, 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 13 matching lines...) Expand all Loading... |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 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 "platform/v8_inspector/JavaScriptCallFrame.h" | 31 #include "platform/v8_inspector/JavaScriptCallFrame.h" |
| 32 | 32 |
| 33 #include "platform/v8_inspector/V8StringUtil.h" | 33 #include "platform/v8_inspector/V8StringUtil.h" |
| 34 #include "platform/v8_inspector/public/V8DebuggerClient.h" |
| 34 | 35 |
| 35 #include <v8-debug.h> | 36 #include <v8-debug.h> |
| 36 | 37 |
| 37 namespace blink { | 38 namespace blink { |
| 38 | 39 |
| 39 JavaScriptCallFrame::JavaScriptCallFrame(v8::Local<v8::Context> debuggerContext,
v8::Local<v8::Object> callFrame) | 40 JavaScriptCallFrame::JavaScriptCallFrame(V8DebuggerClient* client, v8::Local<v8:
:Context> debuggerContext, v8::Local<v8::Object> callFrame) |
| 40 : m_isolate(debuggerContext->GetIsolate()) | 41 : m_client(client) |
| 42 , m_isolate(debuggerContext->GetIsolate()) |
| 41 , m_debuggerContext(m_isolate, debuggerContext) | 43 , m_debuggerContext(m_isolate, debuggerContext) |
| 42 , m_callFrame(m_isolate, callFrame) | 44 , m_callFrame(m_isolate, callFrame) |
| 43 { | 45 { |
| 44 } | 46 } |
| 45 | 47 |
| 46 JavaScriptCallFrame::~JavaScriptCallFrame() | 48 JavaScriptCallFrame::~JavaScriptCallFrame() |
| 47 { | 49 { |
| 48 } | 50 } |
| 49 | 51 |
| 50 PassOwnPtr<JavaScriptCallFrame> JavaScriptCallFrame::caller() | 52 PassOwnPtr<JavaScriptCallFrame> JavaScriptCallFrame::caller() |
| 51 { | 53 { |
| 52 v8::HandleScope handleScope(m_isolate); | 54 v8::HandleScope handleScope(m_isolate); |
| 53 v8::Local<v8::Context> debuggerContext = v8::Local<v8::Context>::New(m_isola
te, m_debuggerContext); | 55 v8::Local<v8::Context> debuggerContext = v8::Local<v8::Context>::New(m_isola
te, m_debuggerContext); |
| 56 v8::Context::Scope contextScope(debuggerContext); |
| 54 v8::Local<v8::Value> callerFrame = v8::Local<v8::Object>::New(m_isolate, m_c
allFrame)->Get(toV8StringInternalized(m_isolate, "caller")); | 57 v8::Local<v8::Value> callerFrame = v8::Local<v8::Object>::New(m_isolate, m_c
allFrame)->Get(toV8StringInternalized(m_isolate, "caller")); |
| 55 if (callerFrame.IsEmpty() || !callerFrame->IsObject()) | 58 if (callerFrame.IsEmpty() || !callerFrame->IsObject()) |
| 56 return 0; | 59 return 0; |
| 57 return JavaScriptCallFrame::create(debuggerContext, v8::Local<v8::Object>::C
ast(callerFrame)); | 60 return JavaScriptCallFrame::create(m_client, debuggerContext, v8::Local<v8::
Object>::Cast(callerFrame)); |
| 58 } | 61 } |
| 59 | 62 |
| 60 int JavaScriptCallFrame::callV8FunctionReturnInt(const char* name) const | 63 int JavaScriptCallFrame::callV8FunctionReturnInt(const char* name) const |
| 61 { | 64 { |
| 62 v8::HandleScope handleScope(m_isolate); | 65 v8::HandleScope handleScope(m_isolate); |
| 63 v8::Local<v8::Context> context = v8::Local<v8::Context>::New(m_isolate, m_de
buggerContext); | 66 v8::Context::Scope contextScope(v8::Local<v8::Context>::New(m_isolate, m_deb
uggerContext)); |
| 64 v8::Local<v8::Object> callFrame = v8::Local<v8::Object>::New(m_isolate, m_ca
llFrame); | 67 v8::Local<v8::Object> callFrame = v8::Local<v8::Object>::New(m_isolate, m_ca
llFrame); |
| 65 v8::Local<v8::Function> func = v8::Local<v8::Function>::Cast(callFrame->Get(
toV8StringInternalized(m_isolate, name))); | 68 v8::Local<v8::Function> func = v8::Local<v8::Function>::Cast(callFrame->Get(
toV8StringInternalized(m_isolate, name))); |
| 66 v8::Local<v8::Value> result; | 69 v8::Local<v8::Value> result; |
| 67 if (!func->Call(context, callFrame, 0, nullptr).ToLocal(&result) || !result-
>IsInt32()) | 70 if (!m_client->callInternalFunction(func, callFrame, 0, nullptr).ToLocal(&re
sult) || !result->IsInt32()) |
| 68 return 0; | 71 return 0; |
| 69 return result.As<v8::Int32>()->Value(); | 72 return result.As<v8::Int32>()->Value(); |
| 70 } | 73 } |
| 71 | 74 |
| 72 String16 JavaScriptCallFrame::callV8FunctionReturnString(const char* name) const | 75 String16 JavaScriptCallFrame::callV8FunctionReturnString(const char* name) const |
| 73 { | 76 { |
| 74 v8::HandleScope handleScope(m_isolate); | 77 v8::HandleScope handleScope(m_isolate); |
| 75 v8::Local<v8::Context> context = v8::Local<v8::Context>::New(m_isolate, m_de
buggerContext); | 78 v8::Context::Scope contextScope(v8::Local<v8::Context>::New(m_isolate, m_deb
uggerContext)); |
| 76 v8::Local<v8::Object> callFrame = v8::Local<v8::Object>::New(m_isolate, m_ca
llFrame); | 79 v8::Local<v8::Object> callFrame = v8::Local<v8::Object>::New(m_isolate, m_ca
llFrame); |
| 77 v8::Local<v8::Function> func = v8::Local<v8::Function>::Cast(callFrame->Get(
toV8StringInternalized(m_isolate, name))); | 80 v8::Local<v8::Function> func = v8::Local<v8::Function>::Cast(callFrame->Get(
toV8StringInternalized(m_isolate, name))); |
| 78 v8::Local<v8::Value> result; | 81 v8::Local<v8::Value> result; |
| 79 if (!func->Call(context, callFrame, 0, nullptr).ToLocal(&result)) | 82 if (!m_client->callInternalFunction(func, callFrame, 0, nullptr).ToLocal(&re
sult)) |
| 80 return String16(); | 83 return String16(); |
| 81 return toProtocolStringWithTypeCheck(result); | 84 return toProtocolStringWithTypeCheck(result); |
| 82 } | 85 } |
| 83 | 86 |
| 84 int JavaScriptCallFrame::sourceID() const | 87 int JavaScriptCallFrame::sourceID() const |
| 85 { | 88 { |
| 86 return callV8FunctionReturnInt("sourceID"); | 89 return callV8FunctionReturnInt("sourceID"); |
| 87 } | 90 } |
| 88 | 91 |
| 89 int JavaScriptCallFrame::line() const | 92 int JavaScriptCallFrame::line() const |
| (...skipping 23 matching lines...) Expand all Loading... |
| 113 | 116 |
| 114 int JavaScriptCallFrame::functionColumn() const | 117 int JavaScriptCallFrame::functionColumn() const |
| 115 { | 118 { |
| 116 return callV8FunctionReturnInt("functionColumn"); | 119 return callV8FunctionReturnInt("functionColumn"); |
| 117 } | 120 } |
| 118 | 121 |
| 119 v8::Local<v8::Value> JavaScriptCallFrame::scopeChain() const | 122 v8::Local<v8::Value> JavaScriptCallFrame::scopeChain() const |
| 120 { | 123 { |
| 121 v8::Local<v8::Object> callFrame = v8::Local<v8::Object>::New(m_isolate, m_ca
llFrame); | 124 v8::Local<v8::Object> callFrame = v8::Local<v8::Object>::New(m_isolate, m_ca
llFrame); |
| 122 v8::Local<v8::Function> func = v8::Local<v8::Function>::Cast(callFrame->Get(
toV8StringInternalized(m_isolate, "scopeChain"))); | 125 v8::Local<v8::Function> func = v8::Local<v8::Function>::Cast(callFrame->Get(
toV8StringInternalized(m_isolate, "scopeChain"))); |
| 123 v8::Local<v8::Array> scopeChain = v8::Local<v8::Array>::Cast(func->Call(m_is
olate->GetCurrentContext(), callFrame, 0, nullptr).ToLocalChecked()); | 126 v8::Local<v8::Array> scopeChain = v8::Local<v8::Array>::Cast(m_client->callI
nternalFunction(func, callFrame, 0, nullptr).ToLocalChecked()); |
| 124 v8::Local<v8::Array> result = v8::Array::New(m_isolate, scopeChain->Length()
); | 127 v8::Local<v8::Array> result = v8::Array::New(m_isolate, scopeChain->Length()
); |
| 125 for (uint32_t i = 0; i < scopeChain->Length(); i++) | 128 for (uint32_t i = 0; i < scopeChain->Length(); i++) |
| 126 result->Set(i, scopeChain->Get(i)); | 129 result->Set(i, scopeChain->Get(i)); |
| 127 return result; | 130 return result; |
| 128 } | 131 } |
| 129 | 132 |
| 130 int JavaScriptCallFrame::scopeType(int scopeIndex) const | 133 int JavaScriptCallFrame::scopeType(int scopeIndex) const |
| 131 { | 134 { |
| 132 v8::Local<v8::Object> callFrame = v8::Local<v8::Object>::New(m_isolate, m_ca
llFrame); | 135 v8::Local<v8::Object> callFrame = v8::Local<v8::Object>::New(m_isolate, m_ca
llFrame); |
| 133 v8::Local<v8::Function> func = v8::Local<v8::Function>::Cast(callFrame->Get(
toV8StringInternalized(m_isolate, "scopeType"))); | 136 v8::Local<v8::Function> func = v8::Local<v8::Function>::Cast(callFrame->Get(
toV8StringInternalized(m_isolate, "scopeType"))); |
| 134 v8::Local<v8::Array> scopeType = v8::Local<v8::Array>::Cast(func->Call(m_iso
late->GetCurrentContext(), callFrame, 0, nullptr).ToLocalChecked()); | 137 v8::Local<v8::Array> scopeType = v8::Local<v8::Array>::Cast(m_client->callIn
ternalFunction(func, callFrame, 0, nullptr).ToLocalChecked()); |
| 135 return scopeType->Get(scopeIndex)->Int32Value(); | 138 return scopeType->Get(scopeIndex)->Int32Value(); |
| 136 } | 139 } |
| 137 | 140 |
| 138 v8::Local<v8::String> JavaScriptCallFrame::scopeName(int scopeIndex) const | 141 v8::Local<v8::String> JavaScriptCallFrame::scopeName(int scopeIndex) const |
| 139 { | 142 { |
| 140 v8::Local<v8::Object> callFrame = v8::Local<v8::Object>::New(m_isolate, m_ca
llFrame); | 143 v8::Local<v8::Object> callFrame = v8::Local<v8::Object>::New(m_isolate, m_ca
llFrame); |
| 141 v8::Local<v8::Function> func = v8::Local<v8::Function>::Cast(callFrame->Get(
toV8StringInternalized(m_isolate, "scopeName"))); | 144 v8::Local<v8::Function> func = v8::Local<v8::Function>::Cast(callFrame->Get(
toV8StringInternalized(m_isolate, "scopeName"))); |
| 142 v8::Local<v8::Array> scopeType = v8::Local<v8::Array>::Cast(func->Call(m_iso
late->GetCurrentContext(), callFrame, 0, nullptr).ToLocalChecked()); | 145 v8::Local<v8::Array> scopeType = v8::Local<v8::Array>::Cast(m_client->callIn
ternalFunction(func, callFrame, 0, nullptr).ToLocalChecked()); |
| 143 return scopeType->Get(scopeIndex)->ToString(); | 146 return scopeType->Get(scopeIndex)->ToString(); |
| 144 } | 147 } |
| 145 | 148 |
| 146 v8::Local<v8::Value> JavaScriptCallFrame::scopeStartLocation(int scopeIndex) con
st | 149 v8::Local<v8::Value> JavaScriptCallFrame::scopeStartLocation(int scopeIndex) con
st |
| 147 { | 150 { |
| 148 return callScopeLocationFunction("scopeStartLocation", scopeIndex); | 151 return callScopeLocationFunction("scopeStartLocation", scopeIndex); |
| 149 } | 152 } |
| 150 | 153 |
| 151 v8::Local<v8::Value> JavaScriptCallFrame::scopeEndLocation(int scopeIndex) const | 154 v8::Local<v8::Value> JavaScriptCallFrame::scopeEndLocation(int scopeIndex) const |
| 152 { | 155 { |
| 153 return callScopeLocationFunction("scopeEndLocation", scopeIndex); | 156 return callScopeLocationFunction("scopeEndLocation", scopeIndex); |
| 154 } | 157 } |
| 155 | 158 |
| 156 v8::Local<v8::Value> JavaScriptCallFrame::callScopeLocationFunction(const char*
name, int scopeIndex) const | 159 v8::Local<v8::Value> JavaScriptCallFrame::callScopeLocationFunction(const char*
name, int scopeIndex) const |
| 157 { | 160 { |
| 158 v8::Local<v8::Object> callFrame = v8::Local<v8::Object>::New(m_isolate, m_ca
llFrame); | 161 v8::Local<v8::Object> callFrame = v8::Local<v8::Object>::New(m_isolate, m_ca
llFrame); |
| 159 v8::Local<v8::Function> func = v8::Local<v8::Function>::Cast(callFrame->Get(
toV8StringInternalized(m_isolate, name))); | 162 v8::Local<v8::Function> func = v8::Local<v8::Function>::Cast(callFrame->Get(
toV8StringInternalized(m_isolate, name))); |
| 160 v8::Local<v8::Array> locations = v8::Local<v8::Array>::Cast(func->Call(m_iso
late->GetCurrentContext(), callFrame, 0, nullptr).ToLocalChecked()); | 163 v8::Local<v8::Array> locations = v8::Local<v8::Array>::Cast(m_client->callIn
ternalFunction(func, callFrame, 0, nullptr).ToLocalChecked()); |
| 161 return locations->Get(scopeIndex); | 164 return locations->Get(scopeIndex); |
| 162 } | 165 } |
| 163 | 166 |
| 164 v8::Local<v8::Value> JavaScriptCallFrame::thisObject() const | 167 v8::Local<v8::Value> JavaScriptCallFrame::thisObject() const |
| 165 { | 168 { |
| 166 return v8::Local<v8::Object>::New(m_isolate, m_callFrame)->Get(toV8StringInt
ernalized(m_isolate, "thisObject")); | 169 return v8::Local<v8::Object>::New(m_isolate, m_callFrame)->Get(toV8StringInt
ernalized(m_isolate, "thisObject")); |
| 167 } | 170 } |
| 168 | 171 |
| 169 String16 JavaScriptCallFrame::stepInPositions() const | 172 String16 JavaScriptCallFrame::stepInPositions() const |
| 170 { | 173 { |
| 171 return callV8FunctionReturnString("stepInPositions"); | 174 return callV8FunctionReturnString("stepInPositions"); |
| 172 } | 175 } |
| 173 | 176 |
| 174 bool JavaScriptCallFrame::isAtReturn() const | 177 bool JavaScriptCallFrame::isAtReturn() const |
| 175 { | 178 { |
| 176 v8::HandleScope handleScope(m_isolate); | 179 v8::HandleScope handleScope(m_isolate); |
| 180 v8::Context::Scope contextScope(v8::Local<v8::Context>::New(m_isolate, m_deb
uggerContext)); |
| 177 v8::Local<v8::Value> result = v8::Local<v8::Object>::New(m_isolate, m_callFr
ame)->Get(toV8StringInternalized(m_isolate, "isAtReturn")); | 181 v8::Local<v8::Value> result = v8::Local<v8::Object>::New(m_isolate, m_callFr
ame)->Get(toV8StringInternalized(m_isolate, "isAtReturn")); |
| 178 if (result.IsEmpty() || !result->IsBoolean()) | 182 if (result.IsEmpty() || !result->IsBoolean()) |
| 179 return false; | 183 return false; |
| 180 return result->BooleanValue(); | 184 return result->BooleanValue(); |
| 181 } | 185 } |
| 182 | 186 |
| 183 v8::Local<v8::Value> JavaScriptCallFrame::returnValue() const | 187 v8::Local<v8::Value> JavaScriptCallFrame::returnValue() const |
| 184 { | 188 { |
| 185 return v8::Local<v8::Object>::New(m_isolate, m_callFrame)->Get(toV8StringInt
ernalized(m_isolate, "returnValue")); | 189 return v8::Local<v8::Object>::New(m_isolate, m_callFrame)->Get(toV8StringInt
ernalized(m_isolate, "returnValue")); |
| 186 } | 190 } |
| 187 | 191 |
| 188 v8::Local<v8::Value> JavaScriptCallFrame::evaluateWithExceptionDetails(v8::Local
<v8::Value> expression, v8::Local<v8::Value> scopeExtension) | 192 v8::Local<v8::Value> JavaScriptCallFrame::evaluateWithExceptionDetails(v8::Local
<v8::Value> expression, v8::Local<v8::Value> scopeExtension) |
| 189 { | 193 { |
| 190 v8::Local<v8::Object> callFrame = v8::Local<v8::Object>::New(m_isolate, m_ca
llFrame); | 194 v8::Local<v8::Object> callFrame = v8::Local<v8::Object>::New(m_isolate, m_ca
llFrame); |
| 191 v8::Local<v8::Function> evalFunction = v8::Local<v8::Function>::Cast(callFra
me->Get(toV8StringInternalized(m_isolate, "evaluate"))); | 195 v8::Local<v8::Function> evalFunction = v8::Local<v8::Function>::Cast(callFra
me->Get(toV8StringInternalized(m_isolate, "evaluate"))); |
| 192 v8::Local<v8::Value> argv[] = { | 196 v8::Local<v8::Value> argv[] = { |
| 193 expression, | 197 expression, |
| 194 scopeExtension | 198 scopeExtension |
| 195 }; | 199 }; |
| 196 v8::TryCatch tryCatch(m_isolate); | 200 v8::TryCatch tryCatch(m_isolate); |
| 197 v8::Local<v8::Object> wrappedResult = v8::Object::New(m_isolate); | 201 v8::Local<v8::Object> wrappedResult = v8::Object::New(m_isolate); |
| 198 v8::Local<v8::Value> result; | 202 v8::Local<v8::Value> result; |
| 199 if (evalFunction->Call(m_isolate->GetCurrentContext(), callFrame, WTF_ARRAY_
LENGTH(argv), argv).ToLocal(&result)) { | 203 if (m_client->callInternalFunction(evalFunction, callFrame, WTF_ARRAY_LENGTH
(argv), argv).ToLocal(&result)) { |
| 200 wrappedResult->Set(v8::String::NewFromUtf8(m_isolate, "result"), result)
; | 204 wrappedResult->Set(v8::String::NewFromUtf8(m_isolate, "result"), result)
; |
| 201 wrappedResult->Set(v8::String::NewFromUtf8(m_isolate, "exceptionDetails"
), v8::Undefined(m_isolate)); | 205 wrappedResult->Set(v8::String::NewFromUtf8(m_isolate, "exceptionDetails"
), v8::Undefined(m_isolate)); |
| 202 } else { | 206 } else { |
| 203 wrappedResult->Set(v8::String::NewFromUtf8(m_isolate, "result"), tryCatc
h.Exception()); | 207 wrappedResult->Set(v8::String::NewFromUtf8(m_isolate, "result"), tryCatc
h.Exception()); |
| 204 wrappedResult->Set(v8::String::NewFromUtf8(m_isolate, "exceptionDetails"
), createExceptionDetails(m_isolate, tryCatch.Message())); | 208 wrappedResult->Set(v8::String::NewFromUtf8(m_isolate, "exceptionDetails"
), createExceptionDetails(m_isolate, tryCatch.Message())); |
| 205 } | 209 } |
| 206 return wrappedResult; | 210 return wrappedResult; |
| 207 } | 211 } |
| 208 | 212 |
| 209 v8::MaybeLocal<v8::Value> JavaScriptCallFrame::restart() | 213 v8::MaybeLocal<v8::Value> JavaScriptCallFrame::restart() |
| 210 { | 214 { |
| 211 v8::Local<v8::Object> callFrame = v8::Local<v8::Object>::New(m_isolate, m_ca
llFrame); | 215 v8::Local<v8::Object> callFrame = v8::Local<v8::Object>::New(m_isolate, m_ca
llFrame); |
| 212 v8::Local<v8::Function> restartFunction = v8::Local<v8::Function>::Cast(call
Frame->Get(toV8StringInternalized(m_isolate, "restart"))); | 216 v8::Local<v8::Function> restartFunction = v8::Local<v8::Function>::Cast(call
Frame->Get(toV8StringInternalized(m_isolate, "restart"))); |
| 213 v8::Debug::SetLiveEditEnabled(m_isolate, true); | 217 v8::Debug::SetLiveEditEnabled(m_isolate, true); |
| 214 v8::MaybeLocal<v8::Value> result = restartFunction->Call(m_isolate->GetCurre
ntContext(), callFrame, 0, nullptr); | 218 v8::MaybeLocal<v8::Value> result = m_client->callInternalFunction(restartFun
ction, callFrame, 0, nullptr); |
| 215 v8::Debug::SetLiveEditEnabled(m_isolate, false); | 219 v8::Debug::SetLiveEditEnabled(m_isolate, false); |
| 216 return result; | 220 return result; |
| 217 } | 221 } |
| 218 | 222 |
| 219 v8::MaybeLocal<v8::Value> JavaScriptCallFrame::setVariableValue(int scopeNumber,
v8::Local<v8::Value> variableName, v8::Local<v8::Value> newValue) | 223 v8::MaybeLocal<v8::Value> JavaScriptCallFrame::setVariableValue(int scopeNumber,
v8::Local<v8::Value> variableName, v8::Local<v8::Value> newValue) |
| 220 { | 224 { |
| 221 v8::Local<v8::Object> callFrame = v8::Local<v8::Object>::New(m_isolate, m_ca
llFrame); | 225 v8::Local<v8::Object> callFrame = v8::Local<v8::Object>::New(m_isolate, m_ca
llFrame); |
| 222 v8::Local<v8::Function> setVariableValueFunction = v8::Local<v8::Function>::
Cast(callFrame->Get(toV8StringInternalized(m_isolate, "setVariableValue"))); | 226 v8::Local<v8::Function> setVariableValueFunction = v8::Local<v8::Function>::
Cast(callFrame->Get(toV8StringInternalized(m_isolate, "setVariableValue"))); |
| 223 v8::Local<v8::Value> argv[] = { | 227 v8::Local<v8::Value> argv[] = { |
| 224 v8::Local<v8::Value>(v8::Integer::New(m_isolate, scopeNumber)), | 228 v8::Local<v8::Value>(v8::Integer::New(m_isolate, scopeNumber)), |
| 225 variableName, | 229 variableName, |
| 226 newValue | 230 newValue |
| 227 }; | 231 }; |
| 228 return setVariableValueFunction->Call(m_isolate->GetCurrentContext(), callFr
ame, WTF_ARRAY_LENGTH(argv), argv); | 232 return m_client->callInternalFunction(setVariableValueFunction, callFrame, W
TF_ARRAY_LENGTH(argv), argv); |
| 229 } | 233 } |
| 230 | 234 |
| 231 v8::Local<v8::Object> JavaScriptCallFrame::createExceptionDetails(v8::Isolate* i
solate, v8::Local<v8::Message> message) | 235 v8::Local<v8::Object> JavaScriptCallFrame::createExceptionDetails(v8::Isolate* i
solate, v8::Local<v8::Message> message) |
| 232 { | 236 { |
| 233 v8::Local<v8::Object> exceptionDetails = v8::Object::New(isolate); | 237 v8::Local<v8::Object> exceptionDetails = v8::Object::New(isolate); |
| 234 exceptionDetails->Set(v8::String::NewFromUtf8(isolate, "text"), message->Get
()); | 238 exceptionDetails->Set(v8::String::NewFromUtf8(isolate, "text"), message->Get
()); |
| 235 exceptionDetails->Set(v8::String::NewFromUtf8(isolate, "url"), message->GetS
criptOrigin().ResourceName()); | 239 exceptionDetails->Set(v8::String::NewFromUtf8(isolate, "url"), message->GetS
criptOrigin().ResourceName()); |
| 236 exceptionDetails->Set(v8::String::NewFromUtf8(isolate, "scriptId"), v8::Inte
ger::New(isolate, message->GetScriptOrigin().ScriptID()->Value())); | 240 exceptionDetails->Set(v8::String::NewFromUtf8(isolate, "scriptId"), v8::Inte
ger::New(isolate, message->GetScriptOrigin().ScriptID()->Value())); |
| 237 exceptionDetails->Set(v8::String::NewFromUtf8(isolate, "line"), v8::Integer:
:New(isolate, message->GetLineNumber())); | 241 exceptionDetails->Set(v8::String::NewFromUtf8(isolate, "line"), v8::Integer:
:New(isolate, message->GetLineNumber())); |
| 238 exceptionDetails->Set(v8::String::NewFromUtf8(isolate, "column"), v8::Intege
r::New(isolate, message->GetStartColumn())); | 242 exceptionDetails->Set(v8::String::NewFromUtf8(isolate, "column"), v8::Intege
r::New(isolate, message->GetStartColumn())); |
| 239 if (!message->GetStackTrace().IsEmpty()) | 243 if (!message->GetStackTrace().IsEmpty()) |
| 240 exceptionDetails->Set(v8::String::NewFromUtf8(isolate, "stackTrace"), me
ssage->GetStackTrace()->AsArray()); | 244 exceptionDetails->Set(v8::String::NewFromUtf8(isolate, "stackTrace"), me
ssage->GetStackTrace()->AsArray()); |
| 241 else | 245 else |
| 242 exceptionDetails->Set(v8::String::NewFromUtf8(isolate, "stackTrace"), v8
::Undefined(isolate)); | 246 exceptionDetails->Set(v8::String::NewFromUtf8(isolate, "stackTrace"), v8
::Undefined(isolate)); |
| 243 return exceptionDetails; | 247 return exceptionDetails; |
| 244 } | 248 } |
| 245 | 249 |
| 246 } // namespace blink | 250 } // namespace blink |
| OLD | NEW |