Chromium Code Reviews| 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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 136 if (result->IsBoolean()) | 136 if (result->IsBoolean()) |
| 137 return result->BooleanValue(); | 137 return result->BooleanValue(); |
| 138 return false; | 138 return false; |
| 139 } | 139 } |
| 140 | 140 |
| 141 v8::Handle<v8::Value> JavaScriptCallFrame::returnValue() const | 141 v8::Handle<v8::Value> JavaScriptCallFrame::returnValue() const |
| 142 { | 142 { |
| 143 return m_callFrame.newLocal(m_isolate)->Get(v8AtomicString(m_isolate, "retur nValue")); | 143 return m_callFrame.newLocal(m_isolate)->Get(v8AtomicString(m_isolate, "retur nValue")); |
| 144 } | 144 } |
| 145 | 145 |
| 146 v8::Handle<v8::Value> JavaScriptCallFrame::evaluate(const String& expression) | 146 ScriptValue JavaScriptCallFrame::evaluate(const String& expression, const Script Value& contextExtension) |
| 147 { | |
| 148 return runEvaluate("evaluate", expression, contextExtension); | |
| 149 } | |
| 150 | |
| 151 ScriptValue JavaScriptCallFrame::evaluateGlobal(const String& expression, const ScriptValue& contextExtension) | |
| 152 { | |
| 153 return runEvaluate("evaluateGlobal", expression, contextExtension); | |
| 154 } | |
| 155 | |
| 156 ScriptValue JavaScriptCallFrame::runEvaluate(const char* methodName, const Strin g& expression, const ScriptValue& contextExtension) | |
| 147 { | 157 { |
| 148 v8::Handle<v8::Object> callFrame = m_callFrame.newLocal(m_isolate); | 158 v8::Handle<v8::Object> callFrame = m_callFrame.newLocal(m_isolate); |
| 149 v8::Handle<v8::Function> evalFunction = v8::Handle<v8::Function>::Cast(callF rame->Get(v8AtomicString(m_isolate, "evaluate"))); | 159 v8::Handle<v8::Function> evalFunction = v8::Handle<v8::Function>::Cast(callF rame->Get(v8AtomicString(m_isolate, methodName))); |
| 150 v8::Handle<v8::Value> argv[] = { v8String(m_debuggerContext.newLocal(m_isola te)->GetIsolate(), expression) }; | 160 v8::Handle<v8::Value> argv[] = { |
| 151 return evalFunction->Call(callFrame, 1, argv); | 161 v8String(m_debuggerContext.newLocal(m_isolate)->GetIsolate(), expression ), |
| 162 contextExtension.v8Value() | |
| 163 }; | |
| 164 return ScriptValue(evalFunction->Call(callFrame, 2, argv), m_isolate); | |
|
yurys
2014/01/21 11:56:52
Please use WTF_ARRAY_LENGTH
aandrey
2014/01/21 13:30:22
Done.
| |
| 152 } | 165 } |
| 153 | 166 |
| 154 v8::Handle<v8::Value> JavaScriptCallFrame::restart() | 167 v8::Handle<v8::Value> JavaScriptCallFrame::restart() |
| 155 { | 168 { |
| 156 v8::Handle<v8::Object> callFrame = m_callFrame.newLocal(m_isolate); | 169 v8::Handle<v8::Object> callFrame = m_callFrame.newLocal(m_isolate); |
| 157 v8::Handle<v8::Function> restartFunction = v8::Handle<v8::Function>::Cast(ca llFrame->Get(v8AtomicString(m_isolate, "restart"))); | 170 v8::Handle<v8::Function> restartFunction = v8::Handle<v8::Function>::Cast(ca llFrame->Get(v8AtomicString(m_isolate, "restart"))); |
| 158 v8::Debug::SetLiveEditEnabled(true); | 171 v8::Debug::SetLiveEditEnabled(true); |
| 159 v8::Handle<v8::Value> result = restartFunction->Call(callFrame, 0, 0); | 172 v8::Handle<v8::Value> result = restartFunction->Call(callFrame, 0, 0); |
| 160 v8::Debug::SetLiveEditEnabled(false); | 173 v8::Debug::SetLiveEditEnabled(false); |
| 161 return result; | 174 return result; |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 172 v8::Handle<v8::Function> setVariableValueFunction = v8::Handle<v8::Function> ::Cast(callFrame->Get(v8AtomicString(m_isolate, "setVariableValue"))); | 185 v8::Handle<v8::Function> setVariableValueFunction = v8::Handle<v8::Function> ::Cast(callFrame->Get(v8AtomicString(m_isolate, "setVariableValue"))); |
| 173 v8::Handle<v8::Value> argv[] = { | 186 v8::Handle<v8::Value> argv[] = { |
| 174 v8::Handle<v8::Value>(v8::Integer::New(m_isolate, scopeNumber)), | 187 v8::Handle<v8::Value>(v8::Integer::New(m_isolate, scopeNumber)), |
| 175 v8String(m_isolate, variableName), | 188 v8String(m_isolate, variableName), |
| 176 newValue.v8Value() | 189 newValue.v8Value() |
| 177 }; | 190 }; |
| 178 return ScriptValue(setVariableValueFunction->Call(callFrame, 3, argv), m_iso late); | 191 return ScriptValue(setVariableValueFunction->Call(callFrame, 3, argv), m_iso late); |
| 179 } | 192 } |
| 180 | 193 |
| 181 } // namespace WebCore | 194 } // namespace WebCore |
| OLD | NEW |