Loading...
Searching...
No Matches
Public Member Functions | Friends | List of all members
v8::PropertyCallbackInfo< T > Class Template Reference

#include <v8-function-callback.h>

Inheritance diagram for v8::PropertyCallbackInfo< T >:
[legend]

Public Member Functions

IsolateGetIsolate () const
 
Local< ValueData () const
 
Local< ObjectThis () const
 
Local< ObjectHolderV2 () const
 
ReturnValue< T > GetReturnValue () const
 
bool ShouldThrowOnError () const
 

Friends

template<typename U >
class PropertyCallbackInfo
 
class MacroAssembler
 
class internal::PropertyCallbackArguments
 
class internal::CustomArguments< PropertyCallbackInfo >
 
void internal::PrintPropertyCallbackInfo (void *)
 

Detailed Description

template<typename T>
class v8::PropertyCallbackInfo< T >

The information passed to a property callback about the context of the property access.

Examples
process.cc.

Member Function Documentation

◆ Data()

template<typename T >
Local< Value > v8::PropertyCallbackInfo< T >::Data
inline
Returns
The data set in the configuration, i.e., in NamedPropertyHandlerConfiguration or IndexedPropertyHandlerConfiguration.
Here is the call graph for this function:

◆ GetIsolate()

template<typename T >
Isolate * v8::PropertyCallbackInfo< T >::GetIsolate
inline
Returns
The isolate of the property access.
Here is the caller graph for this function:

◆ GetReturnValue()

template<typename T >
ReturnValue< T > v8::PropertyCallbackInfo< T >::GetReturnValue
inline
Returns
The return value of the callback. Can be changed by calling Set().
info.GetReturnValue().Set(...)

◆ HolderV2()

template<typename T >
Local< Object > v8::PropertyCallbackInfo< T >::HolderV2
inline
Returns
The object in the prototype chain of the receiver that has the interceptor. Suppose you have x and its prototype is y, and y has an interceptor. Then info.This() is x and info.Holder() is y. In case the property is installed on the global object the Holder() would return the global proxy. TODO(http://crbug.com/333672197): rename back to Holder().

◆ ShouldThrowOnError()

template<typename T >
bool v8::PropertyCallbackInfo< T >::ShouldThrowOnError
inline

For [[Set]], [[DefineOwnProperty]] and [[Delete]] operations (i.e. for setter/definer/deleter callbacks) indicates whether TypeError should be thrown upon operation failure. The callback should throw TypeError only if it's necessary to provide more details than a default error thrown by V8 contains in this case.

Returns
True if the intercepted function should throw if an error occurs. Usually, true corresponds to ‘'use strict’` execution mode.
Note
Always false when the operation was initiated by respecive Reflect call (i.e. Reflect.set(), Reflect.defineProperty() and Reflect.deleteProperty()).
Here is the call graph for this function:

◆ This()

template<typename T >
Local< Object > v8::PropertyCallbackInfo< T >::This
inline
Returns
The receiver. In many cases, this is the object on which the property access was intercepted. When using Reflect.get, Function.prototype.call, or similar functions, it is the object passed in as receiver or thisArg.
void GetterCallback(Local<Name> name,
auto context = info.GetIsolate()->GetCurrentContext();
info.This()
->GetRealNamedProperty(context, v8_str("a"))
.ToLocalChecked();
info.Holder()
->GetRealNamedProperty(context, v8_str("a"))
.ToLocalChecked();
CHECK(v8_str("r")->Equals(context, a_this).FromJust());
CHECK(v8_str("obj")->Equals(context, a_holder).FromJust());
info.GetReturnValue().Set(name);
}
templ->InstanceTemplate()->SetHandler(
LocalContext env;
env->Global()
->Set(env.local(), v8_str("obj"), templ->GetFunction(env.local())
.ToLocalChecked()
->NewInstance(env.local())
.ToLocalChecked())
.FromJust();
CompileRun("obj.a = 'obj'; var r = {a: 'r'}; Reflect.get(obj, 'x', r)");
static Local< FunctionTemplate > New(Isolate *isolate, FunctionCallback callback=nullptr, Local< Value > data=Local< Value >(), Local< Signature > signature=Local< Signature >(), int length=0, ConstructorBehavior behavior=ConstructorBehavior::kAllow, SideEffectType side_effect_type=SideEffectType::kHasSideEffect, const CFunction *c_function=nullptr, uint16_t instance_type=0, uint16_t allowed_receiver_instance_type_range_start=0, uint16_t allowed_receiver_instance_type_range_end=0)
Local< Context > GetCurrentContext()
Definition: v8-local-handle.h:366
friend class Global
Definition: v8-local-handle.h:468
MaybeLocal< Value > GetRealNamedProperty(Local< Context > context, Local< Name > key)
Definition: v8-function-callback.h:187
ReturnValue< T > GetReturnValue() const
Definition: v8-function-callback.h:698
Local< Object > This() const
Definition: v8-function-callback.h:688
Isolate * GetIsolate() const
Definition: v8-function-callback.h:671
Definition: v8-template.h:692

Friends And Related Function Documentation

◆ internal::CustomArguments< PropertyCallbackInfo >

template<typename T >
friend class internal::CustomArguments< PropertyCallbackInfo >
friend

◆ internal::PrintPropertyCallbackInfo

template<typename T >
void internal::PrintPropertyCallbackInfo ( void *  )
friend

◆ internal::PropertyCallbackArguments

template<typename T >
friend class internal::PropertyCallbackArguments
friend

◆ MacroAssembler

template<typename T >
friend class MacroAssembler
friend

◆ PropertyCallbackInfo

template<typename T >
template<typename U >
friend class PropertyCallbackInfo
friend

The documentation for this class was generated from the following file: