| 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 if (result->IsInt32()) | 90 if (result->IsInt32()) |
| 91 return result->Int32Value(); | 91 return result->Int32Value(); |
| 92 return 0; | 92 return 0; |
| 93 } | 93 } |
| 94 | 94 |
| 95 String JavaScriptCallFrame::functionName() const | 95 String JavaScriptCallFrame::functionName() const |
| 96 { | 96 { |
| 97 v8::HandleScope handleScope(m_isolate); | 97 v8::HandleScope handleScope(m_isolate); |
| 98 v8::Context::Scope contextScope(m_debuggerContext.newLocal(m_isolate)); | 98 v8::Context::Scope contextScope(m_debuggerContext.newLocal(m_isolate)); |
| 99 v8::Handle<v8::Value> result = m_callFrame.newLocal(m_isolate)->Get(v8Atomic
String(m_isolate, "functionName")); | 99 v8::Handle<v8::Value> result = m_callFrame.newLocal(m_isolate)->Get(v8Atomic
String(m_isolate, "functionName")); |
| 100 return toWebCoreStringWithUndefinedOrNullCheck(result); | 100 V8TRYCATCH_FOR_V8STRINGRESOURCE_RETURN(V8StringResource<WithUndefinedOrNullC
heck>, name, result, String()); |
| 101 return name; |
| 101 } | 102 } |
| 102 | 103 |
| 103 v8::Handle<v8::Value> JavaScriptCallFrame::scopeChain() const | 104 v8::Handle<v8::Value> JavaScriptCallFrame::scopeChain() const |
| 104 { | 105 { |
| 105 v8::Handle<v8::Array> scopeChain = v8::Handle<v8::Array>::Cast(m_callFrame.n
ewLocal(m_isolate)->Get(v8AtomicString(m_isolate, "scopeChain"))); | 106 v8::Handle<v8::Array> scopeChain = v8::Handle<v8::Array>::Cast(m_callFrame.n
ewLocal(m_isolate)->Get(v8AtomicString(m_isolate, "scopeChain"))); |
| 106 v8::Handle<v8::Array> result = v8::Array::New(m_isolate, scopeChain->Length(
)); | 107 v8::Handle<v8::Array> result = v8::Array::New(m_isolate, scopeChain->Length(
)); |
| 107 for (uint32_t i = 0; i < scopeChain->Length(); i++) | 108 for (uint32_t i = 0; i < scopeChain->Length(); i++) |
| 108 result->Set(i, scopeChain->Get(i)); | 109 result->Set(i, scopeChain->Get(i)); |
| 109 return result; | 110 return result; |
| 110 } | 111 } |
| 111 | 112 |
| 112 int JavaScriptCallFrame::scopeType(int scopeIndex) const | 113 int JavaScriptCallFrame::scopeType(int scopeIndex) const |
| 113 { | 114 { |
| 114 v8::Handle<v8::Array> scopeType = v8::Handle<v8::Array>::Cast(m_callFrame.ne
wLocal(m_isolate)->Get(v8AtomicString(m_isolate, "scopeType"))); | 115 v8::Handle<v8::Array> scopeType = v8::Handle<v8::Array>::Cast(m_callFrame.ne
wLocal(m_isolate)->Get(v8AtomicString(m_isolate, "scopeType"))); |
| 115 return scopeType->Get(scopeIndex)->Int32Value(); | 116 return scopeType->Get(scopeIndex)->Int32Value(); |
| 116 } | 117 } |
| 117 | 118 |
| 118 v8::Handle<v8::Value> JavaScriptCallFrame::thisObject() const | 119 v8::Handle<v8::Value> JavaScriptCallFrame::thisObject() const |
| 119 { | 120 { |
| 120 return m_callFrame.newLocal(m_isolate)->Get(v8AtomicString(m_isolate, "thisO
bject")); | 121 return m_callFrame.newLocal(m_isolate)->Get(v8AtomicString(m_isolate, "thisO
bject")); |
| 121 } | 122 } |
| 122 | 123 |
| 123 String JavaScriptCallFrame::stepInPositions() const | 124 String JavaScriptCallFrame::stepInPositions() const |
| 124 { | 125 { |
| 125 v8::Handle<v8::Object> callFrame = m_callFrame.newLocal(m_isolate); | 126 v8::Handle<v8::Object> callFrame = m_callFrame.newLocal(m_isolate); |
| 126 v8::Handle<v8::Function> stepInPositions = v8::Handle<v8::Function>::Cast(ca
llFrame->Get(v8AtomicString(m_isolate, "stepInPositions"))); | 127 v8::Handle<v8::Function> stepInPositions = v8::Handle<v8::Function>::Cast(ca
llFrame->Get(v8AtomicString(m_isolate, "stepInPositions"))); |
| 127 v8::Handle<v8::Value> result = stepInPositions->Call(callFrame, 0, 0); | 128 v8::Handle<v8::Value> result = stepInPositions->Call(callFrame, 0, 0); |
| 128 return toWebCoreStringWithUndefinedOrNullCheck(result); | 129 V8TRYCATCH_FOR_V8STRINGRESOURCE_RETURN(V8StringResource<WithUndefinedOrNullC
heck>, resultString, result, String()); |
| 130 return resultString; |
| 129 } | 131 } |
| 130 | 132 |
| 131 bool JavaScriptCallFrame::isAtReturn() const | 133 bool JavaScriptCallFrame::isAtReturn() const |
| 132 { | 134 { |
| 133 v8::HandleScope handleScope(m_isolate); | 135 v8::HandleScope handleScope(m_isolate); |
| 134 v8::Context::Scope contextScope(m_debuggerContext.newLocal(m_isolate)); | 136 v8::Context::Scope contextScope(m_debuggerContext.newLocal(m_isolate)); |
| 135 v8::Handle<v8::Value> result = m_callFrame.newLocal(m_isolate)->Get(v8Atomic
String(m_isolate, "isAtReturn")); | 137 v8::Handle<v8::Value> result = m_callFrame.newLocal(m_isolate)->Get(v8Atomic
String(m_isolate, "isAtReturn")); |
| 136 if (result->IsBoolean()) | 138 if (result->IsBoolean()) |
| 137 return result->BooleanValue(); | 139 return result->BooleanValue(); |
| 138 return false; | 140 return false; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 v8::Handle<v8::Function> setVariableValueFunction = v8::Handle<v8::Function>
::Cast(callFrame->Get(v8AtomicString(m_isolate, "setVariableValue"))); | 174 v8::Handle<v8::Function> setVariableValueFunction = v8::Handle<v8::Function>
::Cast(callFrame->Get(v8AtomicString(m_isolate, "setVariableValue"))); |
| 173 v8::Handle<v8::Value> argv[] = { | 175 v8::Handle<v8::Value> argv[] = { |
| 174 v8::Handle<v8::Value>(v8::Integer::New(scopeNumber, m_isolate)), | 176 v8::Handle<v8::Value>(v8::Integer::New(scopeNumber, m_isolate)), |
| 175 v8String(m_isolate, variableName), | 177 v8String(m_isolate, variableName), |
| 176 newValue.v8Value() | 178 newValue.v8Value() |
| 177 }; | 179 }; |
| 178 return ScriptValue(setVariableValueFunction->Call(callFrame, 3, argv), m_iso
late); | 180 return ScriptValue(setVariableValueFunction->Call(callFrame, 3, argv), m_iso
late); |
| 179 } | 181 } |
| 180 | 182 |
| 181 } // namespace WebCore | 183 } // namespace WebCore |
| OLD | NEW |