Pyrogenesis HEAD
Pyrogenesis, a RTS Engine
Script Namespace Reference

Abstraction around a SpiderMonkey JSContext. More...

Namespaces

namespace  anonymous_namespace{ModuleLoader.cpp}
 
namespace  Exception
 

Classes

class  Context
 
class  CScriptStatsTable
 
class  Engine
 
class  Function
 
class  Interface
 
struct  Interface_impl
 
class  JobQueue
 
class  ModuleLoader
 
class  Request
 

Typedefs

using StructuredClone = std::shared_ptr< JSStructuredCloneData >
 Structured clones are a way to serialize 'simple' JS::Values into a buffer that can safely be passed between compartments and between threads. More...
 

Enumerations

enum  { Row_MaxBytes , Row_Bytes , Row_NumberGC , NumberRows }
 

Functions

template<>
bool FromJSVal< bool > (const Request &rq, JS::HandleValue v, bool &out)
 
template<>
bool FromJSVal< float > (const Request &rq, JS::HandleValue v, float &out)
 
template<>
bool FromJSVal< double > (const Request &rq, JS::HandleValue v, double &out)
 
template<>
bool FromJSVal< std::int32_t > (const Request &rq, JS::HandleValue v, std::int32_t &out)
 
template<>
bool FromJSVal< std::uint32_t > (const Request &rq, JS::HandleValue v, std::uint32_t &out)
 
template<>
bool FromJSVal< std::uint16_t > (const Request &rq, JS::HandleValue v, std::uint16_t &out)
 
template<>
bool FromJSVal< std::uint8_t > (const Request &rq, JS::HandleValue v, std::uint8_t &out)
 
template<>
bool FromJSVal< std::wstring > (const Request &rq, JS::HandleValue v, std::wstring &out)
 
template<>
bool FromJSVal< Path > (const Request &rq, JS::HandleValue v, Path &out)
 
template<>
bool FromJSVal< std::string > (const Request &rq, JS::HandleValue v, std::string &out)
 
template<>
bool FromJSVal< CStr8 > (const Request &rq, JS::HandleValue v, CStr8 &out)
 
template<>
bool FromJSVal< CStrW > (const Request &rq, JS::HandleValue v, CStrW &out)
 
template<>
bool FromJSVal< Entity > (const Request &rq, JS::HandleValue v, Entity &out)
 
template<>
void ToJSVal< bool > (const Request &, JS::MutableHandleValue ret, const bool &val)
 
template<>
void ToJSVal< float > (const Request &, JS::MutableHandleValue ret, const float &val)
 
template<>
void ToJSVal< double > (const Request &, JS::MutableHandleValue ret, const double &val)
 
template<>
void ToJSVal< std::int32_t > (const Request &, JS::MutableHandleValue ret, const std::int32_t &val)
 
template<>
void ToJSVal< std::uint16_t > (const Request &, JS::MutableHandleValue ret, const std::uint16_t &val)
 
template<>
void ToJSVal< std::uint8_t > (const Request &, JS::MutableHandleValue ret, const std::uint8_t &val)
 
template<>
void ToJSVal< std::uint32_t > (const Request &, JS::MutableHandleValue ret, const std::uint32_t &val)
 
template<>
void ToJSVal< std::wstring > (const Request &rq, JS::MutableHandleValue ret, const std::wstring &val)
 
template<>
void ToJSVal< Path > (const Request &rq, JS::MutableHandleValue ret, const Path &val)
 
template<>
void ToJSVal< std::string > (const Request &rq, JS::MutableHandleValue ret, const std::string &val)
 
template<>
void ToJSVal< const wchar_t * > (const Request &rq, JS::MutableHandleValue ret, const wchar_t *const &val)
 
template<>
void ToJSVal< const char * > (const Request &rq, JS::MutableHandleValue ret, const char *const &val)
 
template<>
void ToJSVal< CStrW > (const Request &rq, JS::MutableHandleValue ret, const CStrW &val)
 
template<>
void ToJSVal< CStr8 > (const Request &rq, JS::MutableHandleValue ret, const CStr8 &val)
 
template<typename T >
bool FromJSVal (const Request &rq, const JS::HandleValue val, T &ret)
 Convert a JS::Value to a C++ type. More...
 
template<typename T >
bool FromJSVal (const Request &rq, JS::HandleValue v, std::optional< T > &out)
 
template<typename T >
void ToJSVal (const Request &rq, JS::MutableHandleValue ret, T const &val)
 Convert a C++ type to a JS::Value. More...
 
template<std::size_t N>
void ToJSVal (const Request &rq, JS::MutableHandleValue ret, const char(&val)[N])
 
template<std::size_t N>
void ToJSVal (const Request &rq, JS::MutableHandleValue ret, const wchar_t(&val)[N])
 
template<>
void ToJSVal< JS::PersistentRootedValue > (const Request &, JS::MutableHandleValue handle, const JS::PersistentRootedValue &a)
 
template<>
void ToJSVal< JS::Heap< JS::Value > > (const Request &, JS::MutableHandleValue handle, const JS::Heap< JS::Value > &a)
 
template<>
void ToJSVal< JS::RootedValue > (const Request &, JS::MutableHandleValue handle, const JS::RootedValue &a)
 
template<>
void ToJSVal< JS::HandleValue > (const Request &, JS::MutableHandleValue handle, const JS::HandleValue &a)
 
template<typename T >
bool FromJSProperty (const Request &rq, const JS::HandleValue val, const char *name, T &ret, bool strict=false)
 Convert a named property of an object to a C++ type. More...
 
template<typename T >
void ToJSVal_vector (const Request &rq, JS::MutableHandleValue ret, const std::vector< T > &val)
 
template<typename T >
bool FromJSVal_vector (const Request &rq, JS::HandleValue v, std::vector< T > &out)
 
std::string ToString (const Script::Request &rq, JS::MutableHandleValue obj, bool pretty=false)
 Convert an object to a UTF-8 encoded string, either with JSON (if pretty == true and there is no JSON error) or with toSource(). More...
 
bool ParseJSON (const Script::Request &rq, const std::string &string_utf8, JS::MutableHandleValue out)
 Parse a UTF-8-encoded JSON string. More...
 
void ReadJSONFile (const Script::Request &rq, const VfsPath &path, JS::MutableHandleValue out)
 Read a JSON file. More...
 
std::string StringifyJSON (const Script::Request &rq, JS::MutableHandleValue obj, bool indent=true)
 Stringify to a JSON string, UTF-8 encoded. More...
 
template<typename PropType >
bool GetProperty (const Script::Request &rq, JS::HandleValue obj, PropType name, JS::MutableHandleValue out)
 Get the named property on the given object. More...
 
template<typename T , typename PropType >
bool GetProperty (const Script::Request &rq, JS::HandleValue obj, PropType name, T &out)
 
bool GetProperty (const Script::Request &rq, JS::HandleValue obj, const char *name, JS::MutableHandleObject out)
 
template<typename T >
bool GetPropertyInt (const Script::Request &rq, JS::HandleValue obj, int name, T &out)
 
bool GetPropertyInt (const Script::Request &rq, JS::HandleValue obj, int name, JS::MutableHandleValue out)
 
bool HasProperty (const Script::Request &rq, JS::HandleValue obj, const char *name)
 Check the named property has been defined on the given object. More...
 
template<typename PropType >
bool SetProperty (const Script::Request &rq, JS::HandleValue obj, PropType name, JS::HandleValue value, bool constant=false, bool enumerable=true)
 Set the named property on the given object. More...
 
template<typename T , typename PropType >
bool SetProperty (const Script::Request &rq, JS::HandleValue obj, PropType name, const T &value, bool constant=false, bool enumerable=true)
 
template<typename T >
bool SetPropertyInt (const Script::Request &rq, JS::HandleValue obj, int name, const T &value, bool constant=false, bool enumerable=true)
 
template<typename T >
bool GetObjectClassName (const Script::Request &rq, JS::HandleObject obj, T &name)
 
template<typename T >
bool GetObjectClassName (const Script::Request &rq, JS::HandleValue val, T &name)
 Get the name of the object's class. More...
 
bool DeepFreezeObject (const Script::Request &rq, JS::HandleValue objVal)
 
bool EnumeratePropertyNames (const Script::Request &rq, JS::HandleValue objVal, bool enumerableOnly, std::vector< std::string > &out)
 Returns all properties of the object, both own properties and inherited. More...
 
JS::Value CreateObject (const Script::Request &rq)
 Create a plain object (i.e. More...
 
bool CreateObject (const Script::Request &rq, JS::MutableHandleValue objectValue)
 
template<typename T , typename... Args>
bool CreateObject (const Script::Request &rq, JS::MutableHandleValue objectValue, const char *propertyName, const T &propertyValue, Args const &... args)
 Sets the given value to a new plain JS::Object, converts the arguments to JS::Values and sets them as properties. More...
 
void UnhandledRejectedPromise (JSContext *cx, bool, JS::HandleObject promise, JS::PromiseRejectionHandlingState state, void *)
 
StructuredClone WriteStructuredClone (const Script::Request &rq, JS::HandleValue v)
 
void ReadStructuredClone (const Script::Request &rq, const StructuredClone &ptr, JS::MutableHandleValue ret)
 
JS::Value CloneValueFromOtherCompartment (const Script::Interface &to, const Script::Interface &from, JS::HandleValue val)
 Construct a new value by cloning a value (possibly from a different Compartment). More...
 
JS::Value DeepCopy (const Script::Request &rq, JS::HandleValue val)
 Clone a JS value, ensuring that changes to the result won't affect the original value. More...
 

Detailed Description

Abstraction around a SpiderMonkey JSContext.

Spidermonkey maintains some 'local' state via the JSContext* object.

Wraps SM APIs for manipulating JS objects.

Abstraction around a SpiderMonkey JS::Realm.

This class introduces templates to conveniently wrap C++ functions in JSNative functions.

A class using the RAII (Resource Acquisition Is Initialization) idiom to manage initialization and shutdown of the SpiderMonkey script engine.

A single Script::Context, with the associated context, should only be used on a single thread.

(One means to share data between threads and contexts is to create a Script::StructuredClone.)

It also keeps a count of active script contexts in order to validate the following constraints:

  1. JS_Init must be called before any ScriptContexts are initialized
  2. JS_Shutdown must be called after all ScriptContexts have been destroyed

This is rather template heavy, so compilation times beware. The C++ code can have arbitrary arguments and arbitrary return types, so long as they can be converted to/from JS using ToJSVal (FromJSVal respectively), and they are default-constructible (TODO: that can probably changed). (This could be a namespace, but I like being able to specify public/private).

Thread-safety:

  • May be used in non-main threads.
  • Each Script::Interface must be created, used, and destroyed, all in a single thread (it must never be shared between threads).

This object is an argument to most JSAPI functions. Furthermore, this state is Realm (~ global) dependent. For many reasons, including GC safety, The JSContext* Realm must be set up correctly when accessing it. 'Entering' and 'Leaving' realms must be done in a LIFO manner. SM recommends using JSAutoRealm, which provides an RAII option.

Request combines both of the above in a single convenient package, providing safe access to the JSContext*, the global object, and ensuring that the proper realm has been entered. Most scriptinterface/ functions will take a Request, to ensure proper rooting. You may sometimes have to create one from a Interface.

Be particularly careful when manipulating several script interfaces.

Typedef Documentation

◆ StructuredClone

using Script::StructuredClone = typedef std::shared_ptr<JSStructuredCloneData>

Structured clones are a way to serialize 'simple' JS::Values into a buffer that can safely be passed between compartments and between threads.

A StructuredClone can be stored and read multiple times if desired. We wrap them in shared_ptr so memory management is automatic and thread-safe.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
Row_MaxBytes 
Row_Bytes 
Row_NumberGC 
NumberRows 

Function Documentation

◆ CloneValueFromOtherCompartment()

JS::Value Script::CloneValueFromOtherCompartment ( const Script::Interface &  to,
const Script::Interface &  from,
JS::HandleValue  val 
)

Construct a new value by cloning a value (possibly from a different Compartment).

Complex values (functions, XML, etc) won't be cloned correctly, but basic types and cyclic references should be fine. Takes ScriptInterfaces to enter the correct realm. Caller beware - manipulating several compartments in the same function is tricky.

Parameters
to- Script::Interface of the target. Should match the rooting context of the result.
from- Script::Interface of val.

◆ CreateObject() [1/3]

JS::Value Script::CreateObject ( const Script::Request &  rq)
inline

Create a plain object (i.e.

{}). If it fails, returns undefined.

◆ CreateObject() [2/3]

bool Script::CreateObject ( const Script::Request &  rq,
JS::MutableHandleValue  objectValue 
)
inline

◆ CreateObject() [3/3]

template<typename T , typename... Args>
bool Script::CreateObject ( const Script::Request &  rq,
JS::MutableHandleValue  objectValue,
const char *  propertyName,
const T &  propertyValue,
Args const &...  args 
)
inline

Sets the given value to a new plain JS::Object, converts the arguments to JS::Values and sets them as properties.

This is static so that callers like ToJSVal can use it with the JSContext directly instead of having to obtain the instance using GetScriptInterfaceAndCBData. Can throw an exception.

◆ DeepCopy()

JS::Value Script::DeepCopy ( const Script::Request &  rq,
JS::HandleValue  val 
)

Clone a JS value, ensuring that changes to the result won't affect the original value.

Works by cloning, so the same restrictions as CloneValueFromOtherCompartment apply.

◆ DeepFreezeObject()

bool Script::DeepFreezeObject ( const Script::Request &  rq,
JS::HandleValue  objVal 
)
inline

◆ EnumeratePropertyNames()

bool Script::EnumeratePropertyNames ( const Script::Request &  rq,
JS::HandleValue  objVal,
bool  enumerableOnly,
std::vector< std::string > &  out 
)
inline

Returns all properties of the object, both own properties and inherited.

This is essentially equivalent to calling Object.getOwnPropertyNames() and recursing up the prototype chain. NB: this does not return properties with symbol or numeric keys, as that would require a variant in the vector, and it's not useful for now.

Parameters
enumerableOnly- only return enumerable properties.

◆ FromJSProperty()

template<typename T >
bool Script::FromJSProperty ( const Request &  rq,
const JS::HandleValue  val,
const char *  name,
T &  ret,
bool  strict = false 
)
inline

Convert a named property of an object to a C++ type.

◆ FromJSVal() [1/2]

template<typename T >
bool Script::FromJSVal ( const Request &  rq,
const JS::HandleValue  val,
T &  ret 
)

Convert a JS::Value to a C++ type.

(This might trigger GC.)

◆ FromJSVal() [2/2]

template<typename T >
bool Script::FromJSVal ( const Request &  rq,
JS::HandleValue  v,
std::optional< T > &  out 
)

◆ FromJSVal< bool >()

template<>
bool Script::FromJSVal< bool > ( const Request &  rq,
JS::HandleValue  v,
bool &  out 
)

◆ FromJSVal< CStr8 >()

template<>
bool Script::FromJSVal< CStr8 > ( const Request &  rq,
JS::HandleValue  v,
CStr8 &  out 
)

◆ FromJSVal< CStrW >()

template<>
bool Script::FromJSVal< CStrW > ( const Request &  rq,
JS::HandleValue  v,
CStrW &  out 
)

◆ FromJSVal< double >()

template<>
bool Script::FromJSVal< double > ( const Request &  rq,
JS::HandleValue  v,
double &  out 
)

◆ FromJSVal< Entity >()

template<>
bool Script::FromJSVal< Entity > ( const Request &  rq,
JS::HandleValue  v,
Entity &  out 
)

◆ FromJSVal< float >()

template<>
bool Script::FromJSVal< float > ( const Request &  rq,
JS::HandleValue  v,
float &  out 
)

◆ FromJSVal< Path >()

template<>
bool Script::FromJSVal< Path > ( const Request &  rq,
JS::HandleValue  v,
Path &  out 
)

◆ FromJSVal< std::int32_t >()

template<>
bool Script::FromJSVal< std::int32_t > ( const Request &  rq,
JS::HandleValue  v,
std::int32_t &  out 
)

◆ FromJSVal< std::string >()

template<>
bool Script::FromJSVal< std::string > ( const Request &  rq,
JS::HandleValue  v,
std::string &  out 
)

◆ FromJSVal< std::uint16_t >()

template<>
bool Script::FromJSVal< std::uint16_t > ( const Request &  rq,
JS::HandleValue  v,
std::uint16_t &  out 
)

◆ FromJSVal< std::uint32_t >()

template<>
bool Script::FromJSVal< std::uint32_t > ( const Request &  rq,
JS::HandleValue  v,
std::uint32_t &  out 
)

◆ FromJSVal< std::uint8_t >()

template<>
bool Script::FromJSVal< std::uint8_t > ( const Request &  rq,
JS::HandleValue  v,
std::uint8_t &  out 
)

◆ FromJSVal< std::wstring >()

template<>
bool Script::FromJSVal< std::wstring > ( const Request &  rq,
JS::HandleValue  v,
std::wstring &  out 
)

◆ FromJSVal_vector()

template<typename T >
bool Script::FromJSVal_vector ( const Request &  rq,
JS::HandleValue  v,
std::vector< T > &  out 
)
inline

◆ GetObjectClassName() [1/2]

template<typename T >
bool Script::GetObjectClassName ( const Script::Request &  rq,
JS::HandleObject  obj,
T &  name 
)
inline

◆ GetObjectClassName() [2/2]

template<typename T >
bool Script::GetObjectClassName ( const Script::Request &  rq,
JS::HandleValue  val,
T &  name 
)
inline

Get the name of the object's class.

Note that inheritance may lead to unexpected results.

◆ GetProperty() [1/3]

bool Script::GetProperty ( const Script::Request &  rq,
JS::HandleValue  obj,
const char *  name,
JS::MutableHandleObject  out 
)
inline

◆ GetProperty() [2/3]

template<typename PropType >
bool Script::GetProperty ( const Script::Request &  rq,
JS::HandleValue  obj,
PropType  name,
JS::MutableHandleValue  out 
)
inline

Get the named property on the given object.

◆ GetProperty() [3/3]

template<typename T , typename PropType >
bool Script::GetProperty ( const Script::Request &  rq,
JS::HandleValue  obj,
PropType  name,
T &  out 
)
inline

◆ GetPropertyInt() [1/2]

bool Script::GetPropertyInt ( const Script::Request &  rq,
JS::HandleValue  obj,
int  name,
JS::MutableHandleValue  out 
)
inline

◆ GetPropertyInt() [2/2]

template<typename T >
bool Script::GetPropertyInt ( const Script::Request &  rq,
JS::HandleValue  obj,
int  name,
T &  out 
)
inline

◆ HasProperty()

bool Script::HasProperty ( const Script::Request &  rq,
JS::HandleValue  obj,
const char *  name 
)
inline

Check the named property has been defined on the given object.

◆ ParseJSON()

bool Script::ParseJSON ( const Script::Request &  rq,
const std::string &  string_utf8,
JS::MutableHandleValue  out 
)

Parse a UTF-8-encoded JSON string.

Returns the unmodified value on error and prints an error message.

Returns
true on success; false otherwise

◆ ReadJSONFile()

void Script::ReadJSONFile ( const Script::Request &  rq,
const VfsPath &  path,
JS::MutableHandleValue  out 
)

Read a JSON file.

Returns the unmodified value on error and prints an error message.

◆ ReadStructuredClone()

void Script::ReadStructuredClone ( const Script::Request &  rq,
const StructuredClone &  ptr,
JS::MutableHandleValue  ret 
)

◆ SetProperty() [1/2]

template<typename T , typename PropType >
bool Script::SetProperty ( const Script::Request &  rq,
JS::HandleValue  obj,
PropType  name,
const T &  value,
bool  constant = false,
bool  enumerable = true 
)
inline

◆ SetProperty() [2/2]

template<typename PropType >
bool Script::SetProperty ( const Script::Request &  rq,
JS::HandleValue  obj,
PropType  name,
JS::HandleValue  value,
bool  constant = false,
bool  enumerable = true 
)
inline

Set the named property on the given object.

◆ SetPropertyInt()

template<typename T >
bool Script::SetPropertyInt ( const Script::Request &  rq,
JS::HandleValue  obj,
int  name,
const T &  value,
bool  constant = false,
bool  enumerable = true 
)
inline

◆ StringifyJSON()

std::string Script::StringifyJSON ( const Script::Request &  rq,
JS::MutableHandleValue  obj,
bool  indent = true 
)

Stringify to a JSON string, UTF-8 encoded.

Returns an empty string on error.

◆ ToJSVal() [1/3]

template<std::size_t N>
void Script::ToJSVal ( const Request &  rq,
JS::MutableHandleValue  ret,
const char(&)  val[N] 
)

◆ ToJSVal() [2/3]

template<std::size_t N>
void Script::ToJSVal ( const Request &  rq,
JS::MutableHandleValue  ret,
const wchar_t(&)  val[N] 
)

◆ ToJSVal() [3/3]

template<typename T >
void Script::ToJSVal ( const Request &  rq,
JS::MutableHandleValue  ret,
T const &  val 
)

Convert a C++ type to a JS::Value.

(This might trigger GC. The return value must be rooted if you don't want it to be collected.) NOTE: We are passing the JS::Value by reference instead of returning it by value. The reason is a memory corruption problem that appears to be caused by a bug in Visual Studio. Details here: http://www.wildfiregames.com/forum/index.php?showtopic=17289&p=285921

◆ ToJSVal< bool >()

template<>
void Script::ToJSVal< bool > ( const Request &  ,
JS::MutableHandleValue  ret,
const bool &  val 
)

◆ ToJSVal< const char * >()

template<>
void Script::ToJSVal< const char * > ( const Request &  rq,
JS::MutableHandleValue  ret,
const char *const &  val 
)

◆ ToJSVal< const wchar_t * >()

template<>
void Script::ToJSVal< const wchar_t * > ( const Request &  rq,
JS::MutableHandleValue  ret,
const wchar_t *const &  val 
)

◆ ToJSVal< CStr8 >()

template<>
void Script::ToJSVal< CStr8 > ( const Request &  rq,
JS::MutableHandleValue  ret,
const CStr8 &  val 
)

◆ ToJSVal< CStrW >()

template<>
void Script::ToJSVal< CStrW > ( const Request &  rq,
JS::MutableHandleValue  ret,
const CStrW &  val 
)

◆ ToJSVal< double >()

template<>
void Script::ToJSVal< double > ( const Request &  ,
JS::MutableHandleValue  ret,
const double &  val 
)

◆ ToJSVal< float >()

template<>
void Script::ToJSVal< float > ( const Request &  ,
JS::MutableHandleValue  ret,
const float &  val 
)

◆ ToJSVal< JS::HandleValue >()

template<>
void Script::ToJSVal< JS::HandleValue > ( const Request &  ,
JS::MutableHandleValue  handle,
const JS::HandleValue &  a 
)
inline

◆ ToJSVal< JS::Heap< JS::Value > >()

template<>
void Script::ToJSVal< JS::Heap< JS::Value > > ( const Request &  ,
JS::MutableHandleValue  handle,
const JS::Heap< JS::Value > &  a 
)
inline

◆ ToJSVal< JS::PersistentRootedValue >()

template<>
void Script::ToJSVal< JS::PersistentRootedValue > ( const Request &  ,
JS::MutableHandleValue  handle,
const JS::PersistentRootedValue &  a 
)
inline

◆ ToJSVal< JS::RootedValue >()

template<>
void Script::ToJSVal< JS::RootedValue > ( const Request &  ,
JS::MutableHandleValue  handle,
const JS::RootedValue &  a 
)
inline

◆ ToJSVal< Path >()

template<>
void Script::ToJSVal< Path > ( const Request &  rq,
JS::MutableHandleValue  ret,
const Path &  val 
)

◆ ToJSVal< std::int32_t >()

template<>
void Script::ToJSVal< std::int32_t > ( const Request &  ,
JS::MutableHandleValue  ret,
const std::int32_t &  val 
)

◆ ToJSVal< std::string >()

template<>
void Script::ToJSVal< std::string > ( const Request &  rq,
JS::MutableHandleValue  ret,
const std::string &  val 
)

◆ ToJSVal< std::uint16_t >()

template<>
void Script::ToJSVal< std::uint16_t > ( const Request &  ,
JS::MutableHandleValue  ret,
const std::uint16_t &  val 
)

◆ ToJSVal< std::uint32_t >()

template<>
void Script::ToJSVal< std::uint32_t > ( const Request &  ,
JS::MutableHandleValue  ret,
const std::uint32_t &  val 
)

◆ ToJSVal< std::uint8_t >()

template<>
void Script::ToJSVal< std::uint8_t > ( const Request &  ,
JS::MutableHandleValue  ret,
const std::uint8_t &  val 
)

◆ ToJSVal< std::wstring >()

template<>
void Script::ToJSVal< std::wstring > ( const Request &  rq,
JS::MutableHandleValue  ret,
const std::wstring &  val 
)

◆ ToJSVal_vector()

template<typename T >
void Script::ToJSVal_vector ( const Request &  rq,
JS::MutableHandleValue  ret,
const std::vector< T > &  val 
)
inline

◆ ToString()

std::string Script::ToString ( const Script::Request &  rq,
JS::MutableHandleValue  obj,
bool  pretty = false 
)

Convert an object to a UTF-8 encoded string, either with JSON (if pretty == true and there is no JSON error) or with toSource().

◆ UnhandledRejectedPromise()

void Script::UnhandledRejectedPromise ( JSContext *  cx,
bool  ,
JS::HandleObject  promise,
JS::PromiseRejectionHandlingState  state,
void *   
)

◆ WriteStructuredClone()

Script::StructuredClone Script::WriteStructuredClone ( const Script::Request &  rq,
JS::HandleValue  v 
)