Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / bindings / templates / callback_interface.cpp
index 5f33caa..022c8a1 100644 (file)
@@ -12,7 +12,7 @@
 #include "{{filename}}"
 {% endfor %}
 
-namespace WebCore {
+namespace blink {
 
 {{v8_class}}::{{v8_class}}(v8::Handle<v8::Function> callback, ScriptState* scriptState)
     : ActiveDOMCallback(scriptState->executionContext())
@@ -25,7 +25,7 @@ namespace WebCore {
 {
 }
 
-{% for method in methods if not method.custom %}
+{% for method in methods if not method.is_custom %}
 {{method.cpp_type}} {{v8_class}}::{{method.name}}({{method.argument_declarations | join(', ')}})
 {
     {% set return_default = 'return true'
@@ -33,7 +33,6 @@ namespace WebCore {
     if (!canInvokeCallback())
         {{return_default}};
 
-    v8::Isolate* isolate = m_scriptState->isolate();
     if (m_scriptState->contextIsEmpty())
         {{return_default}};
 
@@ -57,17 +56,21 @@ namespace WebCore {
     {% if method.arguments %}
     v8::Handle<v8::Value> argv[] = { {{method.arguments | join(', ', 'handle')}} };
     {% else %}
+    {# Empty array initializers are illegal, and don't compile in MSVC. #}
     v8::Handle<v8::Value> *argv = 0;
     {% endif %}
 
-    {% set this_handle_parameter = 'thisHandle, ' if method.call_with_this_handle else '' %}
+    {% set this_handle_parameter = 'thisHandle, ' if method.call_with_this_handle else 'm_scriptState->context()->Global(), ' %}
     {% if method.idl_type == 'boolean' %}
-    return invokeCallback(m_scriptState.get(), m_callback.newLocal(isolate), {{this_handle_parameter}}{{method.arguments | length}}, argv);
+    v8::TryCatch exceptionCatcher;
+    exceptionCatcher.SetVerbose(true);
+    ScriptController::callFunction(m_scriptState->executionContext(), m_callback.newLocal(m_scriptState->isolate()), {{this_handle_parameter}}{{method.arguments | length}}, argv, m_scriptState->isolate());
+    return !exceptionCatcher.HasCaught();
     {% else %}{# void #}
-    invokeCallback(m_scriptState.get(), m_callback.newLocal(isolate), {{this_handle_parameter}}{{method.arguments | length}}, argv);
+    ScriptController::callFunction(m_scriptState->executionContext(), m_callback.newLocal(m_scriptState->isolate()), {{this_handle_parameter}}{{method.arguments | length}}, argv, m_scriptState->isolate());
     {% endif %}
 }
 
 {% endfor %}
-} // namespace WebCore
+} // namespace blink
 {% endfilter %}