FireBreath  1.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Pages
FB::variant NPObjectAPI::GetProperty ( const std::string &  propertyName)
virtual

Gets a property value.

Parameters
propertyNameName of the property.
Returns
The property value

Implements FB::JSAPI.

Definition at line 159 of file NPObjectAPI.cpp.

References FB::JSAPI::GetProperty().

Referenced by GetProperty().

160 {
161  if (m_browser.expired())
162  return FB::FBVoid();
163 
164  NpapiBrowserHostPtr browser(getHost());
165  if (!browser->isMainThread()) {
166  return browser->CallOnMainThread(boost::bind((FB::GetPropertyType)&JSAPI::GetProperty, this, propertyName));
167  }
168  if (is_JSAPI) {
169  FB::JSAPIPtr tmp = inner.lock();
170  if (tmp)
171  return tmp->GetProperty(propertyName);
172  else
173  return false;
174  }
175  NPVariant retVal;
176  if (!browser->GetProperty(obj, browser->GetStringIdentifier(propertyName.c_str()), &retVal)) {
177  browser->ReleaseVariantValue(&retVal);
178  throw script_error(propertyName.c_str());
179  } else {
180  FB::variant ret = browser->getVariant(&retVal);
181  browser->ReleaseVariantValue(&retVal);
182  return ret;
183  }
184 }
virtual variant GetProperty(const std::wstring &propertyName)
Definition: JSAPI.h:386
Accepts any datatype, used in all interactions with javascript. Provides tools for getting back out t...
Definition: variant.h:198
variant(JSAPI::* GetPropertyType)(const std::string &)
Defines an alias representing a function pointer to JSAPI::GetProperty.
Definition: APITypes.h:178
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

Here is the call graph for this function: