summaryrefslogtreecommitdiffstats
path: root/chrome/renderer/extensions/event_bindings.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/renderer/extensions/event_bindings.cc')
-rw-r--r--chrome/renderer/extensions/event_bindings.cc15
1 files changed, 14 insertions, 1 deletions
diff --git a/chrome/renderer/extensions/event_bindings.cc b/chrome/renderer/extensions/event_bindings.cc
index 576beba..19a9245 100644
--- a/chrome/renderer/extensions/event_bindings.cc
+++ b/chrome/renderer/extensions/event_bindings.cc
@@ -168,6 +168,19 @@ void EventBindings::CallFunction(const std::string& function_name,
int argc, v8::Handle<v8::Value>* argv) {
for (ContextList::iterator it = GetRegisteredContexts().begin();
it != GetRegisteredContexts().end(); ++it) {
- CallFunctionInContext(*it, function_name, argc, argv);
+ DCHECK(!it->IsEmpty());
+ v8::Context::Scope context_scope(*it);
+ v8::Local<v8::Object> global = (*it)->Global();
+
+ v8::Local<v8::Script> script = v8::Script::Compile(
+ v8::String::New(function_name.c_str()));
+ v8::Local<v8::Value> function_obj = script->Run();
+ if (!function_obj->IsFunction())
+ continue;
+
+ v8::Local<v8::Function> function =
+ v8::Local<v8::Function>::Cast(function_obj);
+ if (!function.IsEmpty())
+ function->Call(v8::Object::New(), argc, argv);
}
}