| 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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 if (result.IsEmpty() || !result->IsBoolean()) | 144 if (result.IsEmpty() || !result->IsBoolean()) |
| 145 return false; | 145 return false; |
| 146 return result->BooleanValue(); | 146 return result->BooleanValue(); |
| 147 } | 147 } |
| 148 | 148 |
| 149 v8::Handle<v8::Value> JavaScriptCallFrame::returnValue() const | 149 v8::Handle<v8::Value> JavaScriptCallFrame::returnValue() const |
| 150 { | 150 { |
| 151 return m_callFrame.newLocal(m_isolate)->Get(v8AtomicString(m_isolate, "retur
nValue")); | 151 return m_callFrame.newLocal(m_isolate)->Get(v8AtomicString(m_isolate, "retur
nValue")); |
| 152 } | 152 } |
| 153 | 153 |
| 154 v8::Handle<v8::Value> JavaScriptCallFrame::evaluateWithExceptionDetails(const St
ring& expression) | 154 ScriptValue JavaScriptCallFrame::evaluateWithExceptionDetails(ScriptState* scrip
tState, const String& expression, const ScriptValue& scopeExtension) |
| 155 { | 155 { |
| 156 ScriptState::Scope scriptScope(scriptState); |
| 156 v8::Handle<v8::Object> callFrame = m_callFrame.newLocal(m_isolate); | 157 v8::Handle<v8::Object> callFrame = m_callFrame.newLocal(m_isolate); |
| 157 v8::Handle<v8::Function> evalFunction = v8::Handle<v8::Function>::Cast(callF
rame->Get(v8AtomicString(m_isolate, "evaluate"))); | 158 v8::Handle<v8::Function> evalFunction = v8::Handle<v8::Function>::Cast(callF
rame->Get(v8AtomicString(m_isolate, "evaluate"))); |
| 158 v8::Handle<v8::Value> argv[] = { v8String(m_debuggerContext.newLocal(m_isola
te)->GetIsolate(), expression) }; | 159 v8::Handle<v8::Value> argv[] = { |
| 160 v8String(m_debuggerContext.newLocal(m_isolate)->GetIsolate(), expression
), |
| 161 scopeExtension.isEmpty() ? v8::Handle<v8::Value>::Cast(v8::Undefined(m_i
solate)) : scopeExtension.v8Value() |
| 162 }; |
| 159 v8::TryCatch tryCatch; | 163 v8::TryCatch tryCatch; |
| 160 v8::Handle<v8::Value> result = evalFunction->Call(callFrame, WTF_ARRAY_LENGT
H(argv), argv); | 164 v8::Handle<v8::Value> result = evalFunction->Call(callFrame, WTF_ARRAY_LENGT
H(argv), argv); |
| 161 | 165 |
| 162 v8::Handle<v8::Object> wrappedResult = v8::Object::New(m_isolate); | 166 v8::Handle<v8::Object> wrappedResult = v8::Object::New(m_isolate); |
| 163 if (tryCatch.HasCaught()) { | 167 if (tryCatch.HasCaught()) { |
| 164 wrappedResult->Set(v8::String::NewFromUtf8(m_isolate, "result"), tryCatc
h.Exception()); | 168 wrappedResult->Set(v8::String::NewFromUtf8(m_isolate, "result"), tryCatc
h.Exception()); |
| 165 wrappedResult->Set(v8::String::NewFromUtf8(m_isolate, "exceptionDetails"
), createExceptionDetails(tryCatch.Message(), m_isolate)); | 169 wrappedResult->Set(v8::String::NewFromUtf8(m_isolate, "exceptionDetails"
), createExceptionDetails(tryCatch.Message(), m_isolate)); |
| 166 } else { | 170 } else { |
| 167 wrappedResult->Set(v8::String::NewFromUtf8(m_isolate, "result"), result)
; | 171 wrappedResult->Set(v8::String::NewFromUtf8(m_isolate, "result"), result)
; |
| 168 wrappedResult->Set(v8::String::NewFromUtf8(m_isolate, "exceptionDetails"
), v8::Undefined(m_isolate)); | 172 wrappedResult->Set(v8::String::NewFromUtf8(m_isolate, "exceptionDetails"
), v8::Undefined(m_isolate)); |
| 169 } | 173 } |
| 170 return wrappedResult; | 174 return ScriptValue(scriptState, wrappedResult); |
| 171 } | 175 } |
| 172 | 176 |
| 173 v8::Handle<v8::Value> JavaScriptCallFrame::restart() | 177 v8::Handle<v8::Value> JavaScriptCallFrame::restart() |
| 174 { | 178 { |
| 175 v8::Handle<v8::Object> callFrame = m_callFrame.newLocal(m_isolate); | 179 v8::Handle<v8::Object> callFrame = m_callFrame.newLocal(m_isolate); |
| 176 v8::Handle<v8::Function> restartFunction = v8::Handle<v8::Function>::Cast(ca
llFrame->Get(v8AtomicString(m_isolate, "restart"))); | 180 v8::Handle<v8::Function> restartFunction = v8::Handle<v8::Function>::Cast(ca
llFrame->Get(v8AtomicString(m_isolate, "restart"))); |
| 177 v8::Debug::SetLiveEditEnabled(m_isolate, true); | 181 v8::Debug::SetLiveEditEnabled(m_isolate, true); |
| 178 v8::Handle<v8::Value> result = restartFunction->Call(callFrame, 0, 0); | 182 v8::Handle<v8::Value> result = restartFunction->Call(callFrame, 0, 0); |
| 179 v8::Debug::SetLiveEditEnabled(m_isolate, false); | 183 v8::Debug::SetLiveEditEnabled(m_isolate, false); |
| 180 return result; | 184 return result; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 207 exceptionDetails->Set(v8::String::NewFromUtf8(isolate, "stackTrace"), v8
::Undefined(isolate)); | 211 exceptionDetails->Set(v8::String::NewFromUtf8(isolate, "stackTrace"), v8
::Undefined(isolate)); |
| 208 return exceptionDetails; | 212 return exceptionDetails; |
| 209 } | 213 } |
| 210 | 214 |
| 211 void JavaScriptCallFrame::trace(Visitor* visitor) | 215 void JavaScriptCallFrame::trace(Visitor* visitor) |
| 212 { | 216 { |
| 213 visitor->trace(m_caller); | 217 visitor->trace(m_caller); |
| 214 } | 218 } |
| 215 | 219 |
| 216 } // namespace blink | 220 } // namespace blink |
| OLD | NEW |