| 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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 v8::Local<v8::Function> evalFunction = v8::Local<v8::Function>::Cast(callFra
me->Get(v8AtomicString(m_isolate, "evaluate"))); | 171 v8::Local<v8::Function> evalFunction = v8::Local<v8::Function>::Cast(callFra
me->Get(v8AtomicString(m_isolate, "evaluate"))); |
| 172 v8::Local<v8::Value> argv[] = { | 172 v8::Local<v8::Value> argv[] = { |
| 173 v8String(m_debuggerContext.newLocal(m_isolate)->GetIsolate(), expression
), | 173 v8String(m_debuggerContext.newLocal(m_isolate)->GetIsolate(), expression
), |
| 174 scopeExtension.isEmpty() ? v8::Handle<v8::Value>::Cast(v8::Undefined(m_i
solate)) : scopeExtension.v8Value() | 174 scopeExtension.isEmpty() ? v8::Handle<v8::Value>::Cast(v8::Undefined(m_i
solate)) : scopeExtension.v8Value() |
| 175 }; | 175 }; |
| 176 v8::TryCatch tryCatch; | 176 v8::TryCatch tryCatch; |
| 177 v8::Local<v8::Value> result = V8ScriptRunner::callInternalFunction(evalFunct
ion, callFrame, WTF_ARRAY_LENGTH(argv), argv, m_isolate); | 177 v8::Local<v8::Value> result = V8ScriptRunner::callInternalFunction(evalFunct
ion, callFrame, WTF_ARRAY_LENGTH(argv), argv, m_isolate); |
| 178 | 178 |
| 179 v8::Local<v8::Object> wrappedResult = v8::Object::New(m_isolate); | 179 v8::Local<v8::Object> wrappedResult = v8::Object::New(m_isolate); |
| 180 if (tryCatch.HasCaught()) { | 180 if (tryCatch.HasCaught()) { |
| 181 wrappedResult->Set(v8::String::NewFromUtf8(m_isolate, "result"), tryCatc
h.Exception()); | 181 wrappedResult->Set(v8NormalString(m_isolate, "result"), tryCatch.Excepti
on()); |
| 182 wrappedResult->Set(v8::String::NewFromUtf8(m_isolate, "exceptionDetails"
), createExceptionDetails(m_isolate, tryCatch.Message())); | 182 wrappedResult->Set(v8NormalString(m_isolate, "exceptionDetails"), create
ExceptionDetails(m_isolate, tryCatch.Message())); |
| 183 } else { | 183 } else { |
| 184 wrappedResult->Set(v8::String::NewFromUtf8(m_isolate, "result"), result)
; | 184 wrappedResult->Set(v8NormalString(m_isolate, "result"), result); |
| 185 wrappedResult->Set(v8::String::NewFromUtf8(m_isolate, "exceptionDetails"
), v8::Undefined(m_isolate)); | 185 wrappedResult->Set(v8NormalString(m_isolate, "exceptionDetails"), v8::Un
defined(m_isolate)); |
| 186 } | 186 } |
| 187 return ScriptValue(scriptState, wrappedResult); | 187 return ScriptValue(scriptState, wrappedResult); |
| 188 } | 188 } |
| 189 | 189 |
| 190 v8::Local<v8::Value> JavaScriptCallFrame::restart() | 190 v8::Local<v8::Value> JavaScriptCallFrame::restart() |
| 191 { | 191 { |
| 192 v8::Local<v8::Object> callFrame = m_callFrame.newLocal(m_isolate); | 192 v8::Local<v8::Object> callFrame = m_callFrame.newLocal(m_isolate); |
| 193 v8::Local<v8::Function> restartFunction = v8::Local<v8::Function>::Cast(call
Frame->Get(v8AtomicString(m_isolate, "restart"))); | 193 v8::Local<v8::Function> restartFunction = v8::Local<v8::Function>::Cast(call
Frame->Get(v8AtomicString(m_isolate, "restart"))); |
| 194 v8::Debug::SetLiveEditEnabled(m_isolate, true); | 194 v8::Debug::SetLiveEditEnabled(m_isolate, true); |
| 195 v8::Local<v8::Value> result = V8ScriptRunner::callInternalFunction(restartFu
nction, callFrame, 0, 0, m_isolate); | 195 v8::Local<v8::Value> result = V8ScriptRunner::callInternalFunction(restartFu
nction, callFrame, 0, 0, m_isolate); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 206 v8::Local<v8::Value>(v8::Integer::New(m_isolate, scopeNumber)), | 206 v8::Local<v8::Value>(v8::Integer::New(m_isolate, scopeNumber)), |
| 207 v8String(m_isolate, variableName), | 207 v8String(m_isolate, variableName), |
| 208 newValue.v8Value() | 208 newValue.v8Value() |
| 209 }; | 209 }; |
| 210 return ScriptValue(scriptState, V8ScriptRunner::callInternalFunction(setVari
ableValueFunction, callFrame, WTF_ARRAY_LENGTH(argv), argv, m_isolate)); | 210 return ScriptValue(scriptState, V8ScriptRunner::callInternalFunction(setVari
ableValueFunction, callFrame, WTF_ARRAY_LENGTH(argv), argv, m_isolate)); |
| 211 } | 211 } |
| 212 | 212 |
| 213 v8::Local<v8::Object> JavaScriptCallFrame::createExceptionDetails(v8::Isolate* i
solate, v8::Local<v8::Message> message) | 213 v8::Local<v8::Object> JavaScriptCallFrame::createExceptionDetails(v8::Isolate* i
solate, v8::Local<v8::Message> message) |
| 214 { | 214 { |
| 215 v8::Local<v8::Object> exceptionDetails = v8::Object::New(isolate); | 215 v8::Local<v8::Object> exceptionDetails = v8::Object::New(isolate); |
| 216 exceptionDetails->Set(v8::String::NewFromUtf8(isolate, "text"), message->Get
()); | 216 exceptionDetails->Set(v8NormalString(isolate, "text"), message->Get()); |
| 217 exceptionDetails->Set(v8::String::NewFromUtf8(isolate, "url"), message->GetS
criptOrigin().ResourceName()); | 217 exceptionDetails->Set(v8NormalString(isolate, "url"), message->GetScriptOrig
in().ResourceName()); |
| 218 exceptionDetails->Set(v8::String::NewFromUtf8(isolate, "scriptId"), v8::Inte
ger::New(isolate, message->GetScriptOrigin().ScriptID()->Value())); | 218 exceptionDetails->Set(v8NormalString(isolate, "scriptId"), v8::Integer::New(
isolate, message->GetScriptOrigin().ScriptID()->Value())); |
| 219 exceptionDetails->Set(v8::String::NewFromUtf8(isolate, "line"), v8::Integer:
:New(isolate, message->GetLineNumber())); | 219 exceptionDetails->Set(v8NormalString(isolate, "line"), v8::Integer::New(isol
ate, message->GetLineNumber())); |
| 220 exceptionDetails->Set(v8::String::NewFromUtf8(isolate, "column"), v8::Intege
r::New(isolate, message->GetStartColumn())); | 220 exceptionDetails->Set(v8NormalString(isolate, "column"), v8::Integer::New(is
olate, message->GetStartColumn())); |
| 221 if (!message->GetStackTrace().IsEmpty()) | 221 if (!message->GetStackTrace().IsEmpty()) |
| 222 exceptionDetails->Set(v8::String::NewFromUtf8(isolate, "stackTrace"), me
ssage->GetStackTrace()->AsArray()); | 222 exceptionDetails->Set(v8NormalString(isolate, "stackTrace"), message->Ge
tStackTrace()->AsArray()); |
| 223 else | 223 else |
| 224 exceptionDetails->Set(v8::String::NewFromUtf8(isolate, "stackTrace"), v8
::Undefined(isolate)); | 224 exceptionDetails->Set(v8NormalString(isolate, "stackTrace"), v8::Undefin
ed(isolate)); |
| 225 return exceptionDetails; | 225 return exceptionDetails; |
| 226 } | 226 } |
| 227 | 227 |
| 228 DEFINE_TRACE(JavaScriptCallFrame) | 228 DEFINE_TRACE(JavaScriptCallFrame) |
| 229 { | 229 { |
| 230 visitor->trace(m_caller); | 230 visitor->trace(m_caller); |
| 231 } | 231 } |
| 232 | 232 |
| 233 } // namespace blink | 233 } // namespace blink |
| OLD | NEW |