| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 if (!scope.success()) { | 178 if (!scope.success()) { |
| 179 hadException = true; | 179 hadException = true; |
| 180 return ScriptObject(); | 180 return ScriptObject(); |
| 181 } | 181 } |
| 182 | 182 |
| 183 return ScriptObject(m_scriptState, result); | 183 return ScriptObject(m_scriptState, result); |
| 184 } | 184 } |
| 185 | 185 |
| 186 ScriptCallback::ScriptCallback(ScriptState* state, const ScriptValue& function) | 186 ScriptCallback::ScriptCallback(ScriptState* state, const ScriptValue& function) |
| 187 : ScriptCallArgumentHandler(state) | 187 : ScriptCallArgumentHandler(state) |
| 188 , m_scriptState(state) |
| 188 , m_function(function) | 189 , m_function(function) |
| 189 { | 190 { |
| 190 } | 191 } |
| 191 | 192 |
| 192 ScriptValue ScriptCallback::call() | 193 ScriptValue ScriptCallback::call() |
| 193 { | 194 { |
| 194 ASSERT(v8::Context::InContext()); | 195 ASSERT(v8::Context::InContext()); |
| 195 ASSERT(m_function.v8Value()->IsFunction()); | 196 ASSERT(m_function.v8Value()->IsFunction()); |
| 196 | 197 |
| 197 v8::TryCatch exceptionCatcher; | 198 v8::TryCatch exceptionCatcher; |
| 198 exceptionCatcher.SetVerbose(true); | 199 exceptionCatcher.SetVerbose(true); |
| 199 v8::Handle<v8::Object> object = v8::Context::GetCurrent()->Global(); | 200 v8::Handle<v8::Object> object = v8::Context::GetCurrent()->Global(); |
| 200 v8::Handle<v8::Function> function = v8::Handle<v8::Function>::Cast(m_functio
n.v8Value()); | 201 v8::Handle<v8::Function> function = v8::Handle<v8::Function>::Cast(m_functio
n.v8Value()); |
| 201 | 202 |
| 202 OwnArrayPtr<v8::Handle<v8::Value> > args = adoptArrayPtr(new v8::Handle<v8::
Value>[m_arguments.size()]); | 203 OwnArrayPtr<v8::Handle<v8::Value> > args = adoptArrayPtr(new v8::Handle<v8::
Value>[m_arguments.size()]); |
| 203 for (size_t i = 0; i < m_arguments.size(); ++i) | 204 for (size_t i = 0; i < m_arguments.size(); ++i) |
| 204 args[i] = m_arguments[i].v8Value(); | 205 args[i] = m_arguments[i].v8Value(); |
| 205 | 206 |
| 206 v8::Handle<v8::Value> result = ScriptController::callFunctionWithInstrumenta
tion(0, function, object, m_arguments.size(), args.get(), m_scriptState->isolate
()); | 207 v8::Handle<v8::Value> result = ScriptController::callFunction(m_scriptState-
>scriptExecutionContext(), function, object, m_arguments.size(), args.get(), m_s
criptState->isolate()); |
| 207 return ScriptValue(result, m_scriptState->isolate()); | 208 return ScriptValue(result, m_scriptState->isolate()); |
| 208 } | 209 } |
| 209 | 210 |
| 210 } // namespace WebCore | 211 } // namespace WebCore |
| OLD | NEW |