FireBreath  1.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Pages
FB::variant FB::JSAPIAuto::Invoke ( const std::string &  methodName,
const std::vector< variant > &  args 
)
virtual

Called by the browser to invoke a method on the JSAPI object.

Parameters
methodNameName of the method.
argsThe arguments.
Returns
result of method call

Implements FB::JSAPI.

Definition at line 329 of file JSAPIAuto.cpp.

330 {
331  boost::recursive_mutex::scoped_lock lock(m_zoneMutex);
332  if(!m_valid)
333  throw object_invalidated();
334 
335  if (memberAccessible(m_zoneMap.find(methodName))) {
336  try {
337  MethodFunctorMap::iterator it = m_methodFunctorMap.find(methodName);
338  if(it == m_methodFunctorMap.end())
339  throw invalid_member(methodName);
340 
341  return it->second.call(args);
342  } catch (const FB::bad_variant_cast& ex) {
343  std::string errorMsg("Could not convert from ");
344  errorMsg += ex.from;
345  errorMsg += " to ";
346  errorMsg += ex.to;
347  throw FB::invalid_arguments(errorMsg);
348  }
349  } else {
350  throw invalid_member(methodName);
351  }
352 }
Thrown by a JSAPI object when the argument(s) provided to a SetProperty or Invoke call are found to b...
Definition: JSExceptions.h:47
Thrown when variant::cast<type> or variant::convert_cast<type> fails because the type of the value st...
Definition: variant.h:133