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 return toCoreStringWithUndefinedOrNullCheck(result); |
101 } | 101 } |
102 | 102 |
103 v8::Handle<v8::Value> JavaScriptCallFrame::scopeChain() const | 103 v8::Handle<v8::Value> JavaScriptCallFrame::scopeChain() const |
104 { | 104 { |
105 v8::Handle<v8::Array> scopeChain = v8::Handle<v8::Array>::Cast(m_callFrame.n
ewLocal(m_isolate)->Get(v8AtomicString(m_isolate, "scopeChain"))); | 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> result = v8::Array::New(m_isolate, scopeChain->Length(
)); | 106 v8::Handle<v8::Array> result = v8::Array::New(m_isolate, scopeChain->Length(
)); |
107 for (uint32_t i = 0; i < scopeChain->Length(); i++) | 107 for (uint32_t i = 0; i < scopeChain->Length(); i++) |
108 result->Set(i, scopeChain->Get(i)); | 108 result->Set(i, scopeChain->Get(i)); |
109 return result; | 109 return result; |
110 } | 110 } |
111 | 111 |
112 int JavaScriptCallFrame::scopeType(int scopeIndex) const | 112 int JavaScriptCallFrame::scopeType(int scopeIndex) const |
113 { | 113 { |
114 v8::Handle<v8::Array> scopeType = v8::Handle<v8::Array>::Cast(m_callFrame.ne
wLocal(m_isolate)->Get(v8AtomicString(m_isolate, "scopeType"))); | 114 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(); | 115 return scopeType->Get(scopeIndex)->Int32Value(); |
116 } | 116 } |
117 | 117 |
118 v8::Handle<v8::Value> JavaScriptCallFrame::thisObject() const | 118 v8::Handle<v8::Value> JavaScriptCallFrame::thisObject() const |
119 { | 119 { |
120 return m_callFrame.newLocal(m_isolate)->Get(v8AtomicString(m_isolate, "thisO
bject")); | 120 return m_callFrame.newLocal(m_isolate)->Get(v8AtomicString(m_isolate, "thisO
bject")); |
121 } | 121 } |
122 | 122 |
123 String JavaScriptCallFrame::stepInPositions() const | 123 String JavaScriptCallFrame::stepInPositions() const |
124 { | 124 { |
125 v8::Handle<v8::Object> callFrame = m_callFrame.newLocal(m_isolate); | 125 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"))); | 126 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); | 127 v8::Handle<v8::Value> result = stepInPositions->Call(callFrame, 0, 0); |
128 return toWebCoreStringWithUndefinedOrNullCheck(result); | 128 return toCoreStringWithUndefinedOrNullCheck(result); |
129 } | 129 } |
130 | 130 |
131 bool JavaScriptCallFrame::isAtReturn() const | 131 bool JavaScriptCallFrame::isAtReturn() const |
132 { | 132 { |
133 v8::HandleScope handleScope(m_isolate); | 133 v8::HandleScope handleScope(m_isolate); |
134 v8::Context::Scope contextScope(m_debuggerContext.newLocal(m_isolate)); | 134 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")); | 135 v8::Handle<v8::Value> result = m_callFrame.newLocal(m_isolate)->Get(v8Atomic
String(m_isolate, "isAtReturn")); |
136 if (result->IsBoolean()) | 136 if (result->IsBoolean()) |
137 return result->BooleanValue(); | 137 return result->BooleanValue(); |
138 return false; | 138 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"))); | 172 v8::Handle<v8::Function> setVariableValueFunction = v8::Handle<v8::Function>
::Cast(callFrame->Get(v8AtomicString(m_isolate, "setVariableValue"))); |
173 v8::Handle<v8::Value> argv[] = { | 173 v8::Handle<v8::Value> argv[] = { |
174 v8::Handle<v8::Value>(v8::Integer::New(scopeNumber, m_isolate)), | 174 v8::Handle<v8::Value>(v8::Integer::New(scopeNumber, m_isolate)), |
175 v8String(m_isolate, variableName), | 175 v8String(m_isolate, variableName), |
176 newValue.v8Value() | 176 newValue.v8Value() |
177 }; | 177 }; |
178 return ScriptValue(setVariableValueFunction->Call(callFrame, 3, argv), m_iso
late); | 178 return ScriptValue(setVariableValueFunction->Call(callFrame, 3, argv), m_iso
late); |
179 } | 179 } |
180 | 180 |
181 } // namespace WebCore | 181 } // namespace WebCore |
OLD | NEW |