FireBreath  1.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Pages
void NPObjectAPI::SetProperty ( const std::string &  propertyName,
const variant value 
)
virtual

Sets the value of a property.

Parameters
propertyNameName of the property.
valueThe value.

Implements FB::JSAPI.

Definition at line 186 of file NPObjectAPI.cpp.

References FB::JSAPI::SetProperty().

Referenced by SetProperty().

187 {
188  if (m_browser.expired())
189  return;
190 
191  NpapiBrowserHostPtr browser(getHost());
192  if (!browser->isMainThread()) {
193  browser->CallOnMainThread(boost::bind((FB::SetPropertyType)&JSAPI::SetProperty, this, propertyName, value));
194  return;
195  }
196  if (is_JSAPI) {
197  FB::JSAPIPtr tmp = inner.lock();
198  if (tmp)
199  tmp->SetProperty(propertyName, value);
200  return;
201  }
202  NPVariant val;
203  browser->getNPVariant(&val, value);
204  bool res = browser->SetProperty(obj, browser->GetStringIdentifier(propertyName.c_str()), &val);
205  browser->ReleaseVariantValue(&val);
206  if (!res) {
207  throw script_error(propertyName.c_str());
208  }
209 }
virtual void SetProperty(const std::wstring &propertyName, const variant &value)
Definition: JSAPI.h:405
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
void(JSAPI::* SetPropertyType)(const std::string &, const variant &)
Defines an alias representing a function pointer to JSAPI::SetProperty.
Definition: APITypes.h:176

Here is the call graph for this function: