FireBreath  1.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Pages
void NpapiBrowserHost::evaluateJavaScript ( const std::string &  script)
virtual

Evaluates arbitrary javascript; note that it does not return the result due to cross- browser compatibility issues.

Parameters
scriptThe script to evaluate.

Implements FB::BrowserHost.

Definition at line 210 of file NpapiBrowserHost.cpp.

References FB::BrowserHost::assertMainThread().

211 {
213  NPVariant retVal;
214  NPVariant tmp;
215 
216  this->getNPVariant(&tmp, FB::variant(script));
217 
218  if (!m_htmlWin)
219  throw std::runtime_error("Cannot find HTML window");
220 
221 
222  if (this->Evaluate(m_htmlWin->getNPObject(),
223  &tmp.value.stringValue, &retVal)) {
224  this->ReleaseVariantValue(&retVal);
225  /* Throw away returned variant. NPN_Evaluate supports returning
226  stuff from JS, but ActiveX IHTMLWindow2::execScript does not */
227  return;
228  } else {
229  throw script_error("Error executing JavaScript code");
230  }
231 }
Accepts any datatype, used in all interactions with javascript. Provides tools for getting back out t...
Definition: variant.h:198
void assertMainThread() const
When running in debug mode, asserts that the call is made on the main thread.

Here is the call graph for this function: