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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 v8::Handle<v8::Value> argv[] = { | 161 v8::Handle<v8::Value> argv[] = { |
162 v8String(m_debuggerContext.newLocal(m_isolate)->GetIsolate(), expression
), | 162 v8String(m_debuggerContext.newLocal(m_isolate)->GetIsolate(), expression
), |
163 scopeExtension.isEmpty() ? v8::Handle<v8::Value>::Cast(v8::Undefined(m_i
solate)) : scopeExtension.v8Value() | 163 scopeExtension.isEmpty() ? v8::Handle<v8::Value>::Cast(v8::Undefined(m_i
solate)) : scopeExtension.v8Value() |
164 }; | 164 }; |
165 v8::TryCatch tryCatch; | 165 v8::TryCatch tryCatch; |
166 v8::Handle<v8::Value> result = evalFunction->Call(callFrame, WTF_ARRAY_LENGT
H(argv), argv); | 166 v8::Handle<v8::Value> result = evalFunction->Call(callFrame, WTF_ARRAY_LENGT
H(argv), argv); |
167 | 167 |
168 v8::Handle<v8::Object> wrappedResult = v8::Object::New(m_isolate); | 168 v8::Handle<v8::Object> wrappedResult = v8::Object::New(m_isolate); |
169 if (tryCatch.HasCaught()) { | 169 if (tryCatch.HasCaught()) { |
170 wrappedResult->Set(v8::String::NewFromUtf8(m_isolate, "result"), tryCatc
h.Exception()); | 170 wrappedResult->Set(v8::String::NewFromUtf8(m_isolate, "result"), tryCatc
h.Exception()); |
171 wrappedResult->Set(v8::String::NewFromUtf8(m_isolate, "exceptionDetails"
), createExceptionDetails(tryCatch.Message(), m_isolate)); | 171 wrappedResult->Set(v8::String::NewFromUtf8(m_isolate, "exceptionDetails"
), createExceptionDetails(m_isolate, tryCatch.Message())); |
172 } else { | 172 } else { |
173 wrappedResult->Set(v8::String::NewFromUtf8(m_isolate, "result"), result)
; | 173 wrappedResult->Set(v8::String::NewFromUtf8(m_isolate, "result"), result)
; |
174 wrappedResult->Set(v8::String::NewFromUtf8(m_isolate, "exceptionDetails"
), v8::Undefined(m_isolate)); | 174 wrappedResult->Set(v8::String::NewFromUtf8(m_isolate, "exceptionDetails"
), v8::Undefined(m_isolate)); |
175 } | 175 } |
176 return ScriptValue(scriptState, wrappedResult); | 176 return ScriptValue(scriptState, wrappedResult); |
177 } | 177 } |
178 | 178 |
179 v8::Handle<v8::Value> JavaScriptCallFrame::restart() | 179 v8::Handle<v8::Value> JavaScriptCallFrame::restart() |
180 { | 180 { |
181 v8::Handle<v8::Object> callFrame = m_callFrame.newLocal(m_isolate); | 181 v8::Handle<v8::Object> callFrame = m_callFrame.newLocal(m_isolate); |
(...skipping 10 matching lines...) Expand all Loading... |
192 v8::Handle<v8::Object> callFrame = m_callFrame.newLocal(m_isolate); | 192 v8::Handle<v8::Object> callFrame = m_callFrame.newLocal(m_isolate); |
193 v8::Handle<v8::Function> setVariableValueFunction = v8::Handle<v8::Function>
::Cast(callFrame->Get(v8AtomicString(m_isolate, "setVariableValue"))); | 193 v8::Handle<v8::Function> setVariableValueFunction = v8::Handle<v8::Function>
::Cast(callFrame->Get(v8AtomicString(m_isolate, "setVariableValue"))); |
194 v8::Handle<v8::Value> argv[] = { | 194 v8::Handle<v8::Value> argv[] = { |
195 v8::Handle<v8::Value>(v8::Integer::New(m_isolate, scopeNumber)), | 195 v8::Handle<v8::Value>(v8::Integer::New(m_isolate, scopeNumber)), |
196 v8String(m_isolate, variableName), | 196 v8String(m_isolate, variableName), |
197 newValue.v8Value() | 197 newValue.v8Value() |
198 }; | 198 }; |
199 return ScriptValue(scriptState, setVariableValueFunction->Call(callFrame, WT
F_ARRAY_LENGTH(argv), argv)); | 199 return ScriptValue(scriptState, setVariableValueFunction->Call(callFrame, WT
F_ARRAY_LENGTH(argv), argv)); |
200 } | 200 } |
201 | 201 |
202 v8::Handle<v8::Object> JavaScriptCallFrame::createExceptionDetails(v8::Handle<v8
::Message> message, v8::Isolate* isolate) | 202 v8::Handle<v8::Object> JavaScriptCallFrame::createExceptionDetails(v8::Isolate*
isolate, v8::Handle<v8::Message> message) |
203 { | 203 { |
204 v8::Handle<v8::Object> exceptionDetails = v8::Object::New(isolate); | 204 v8::Handle<v8::Object> exceptionDetails = v8::Object::New(isolate); |
205 exceptionDetails->Set(v8::String::NewFromUtf8(isolate, "text"), message->Get
()); | 205 exceptionDetails->Set(v8::String::NewFromUtf8(isolate, "text"), message->Get
()); |
206 exceptionDetails->Set(v8::String::NewFromUtf8(isolate, "url"), message->GetS
criptOrigin().ResourceName()); | 206 exceptionDetails->Set(v8::String::NewFromUtf8(isolate, "url"), message->GetS
criptOrigin().ResourceName()); |
207 exceptionDetails->Set(v8::String::NewFromUtf8(isolate, "scriptId"), v8::Inte
ger::New(isolate, message->GetScriptOrigin().ScriptID()->Value())); | 207 exceptionDetails->Set(v8::String::NewFromUtf8(isolate, "scriptId"), v8::Inte
ger::New(isolate, message->GetScriptOrigin().ScriptID()->Value())); |
208 exceptionDetails->Set(v8::String::NewFromUtf8(isolate, "line"), v8::Integer:
:New(isolate, message->GetLineNumber())); | 208 exceptionDetails->Set(v8::String::NewFromUtf8(isolate, "line"), v8::Integer:
:New(isolate, message->GetLineNumber())); |
209 exceptionDetails->Set(v8::String::NewFromUtf8(isolate, "column"), v8::Intege
r::New(isolate, message->GetStartColumn())); | 209 exceptionDetails->Set(v8::String::NewFromUtf8(isolate, "column"), v8::Intege
r::New(isolate, message->GetStartColumn())); |
210 if (!message->GetStackTrace().IsEmpty()) | 210 if (!message->GetStackTrace().IsEmpty()) |
211 exceptionDetails->Set(v8::String::NewFromUtf8(isolate, "stackTrace"), me
ssage->GetStackTrace()->AsArray()); | 211 exceptionDetails->Set(v8::String::NewFromUtf8(isolate, "stackTrace"), me
ssage->GetStackTrace()->AsArray()); |
212 else | 212 else |
213 exceptionDetails->Set(v8::String::NewFromUtf8(isolate, "stackTrace"), v8
::Undefined(isolate)); | 213 exceptionDetails->Set(v8::String::NewFromUtf8(isolate, "stackTrace"), v8
::Undefined(isolate)); |
214 return exceptionDetails; | 214 return exceptionDetails; |
215 } | 215 } |
216 | 216 |
217 void JavaScriptCallFrame::trace(Visitor* visitor) | 217 void JavaScriptCallFrame::trace(Visitor* visitor) |
218 { | 218 { |
219 visitor->trace(m_caller); | 219 visitor->trace(m_caller); |
220 } | 220 } |
221 | 221 |
222 } // namespace blink | 222 } // namespace blink |
OLD | NEW |