FireBreath  1.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Pages
bool NPObjectAPI::HasMethod ( const std::string &  methodName) const
virtual

Query if the JSAPI object has the 'methodName' method.

Parameters
methodNameName of the method.
Returns
true if method exists, false if not.

Implements FB::JSAPI.

Definition at line 102 of file NPObjectAPI.cpp.

103 {
104  if (m_browser.expired())
105  return false;
106 
107  NpapiBrowserHostPtr browser(getHost());
108  if (!browser->isMainThread()) {
109  typedef bool (NPObjectAPI::*curtype)(const std::string&) const;
110  return browser->CallOnMainThread(boost::bind((curtype)&NPObjectAPI::HasMethod, this, methodName));
111  }
112  if (is_JSAPI) {
113  FB::JSAPIPtr tmp = inner.lock();
114  if (tmp)
115  return tmp->HasMethod(methodName);
116  else
117  return false;
118  }
119  return browser->HasMethod(obj, browser->GetStringIdentifier(methodName.c_str()));
120 }
bool HasMethod(const std::string &methodName) const
Query if the JSAPI object has the 'methodName' method.
boost::shared_ptr< FB::JSAPI > JSAPIPtr
Defines an alias for a JSAPI shared_ptr (you should never use a JSAPI* directly)
Definition: APITypes.h:94
Provides a FB::JSObject implementation that wraps a NPObject*.
Definition: NPObjectAPI.h:32