v8 13.6.233 (node 24.1.0)
V8 is Google's open source JavaScript engine
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages Concepts
PropertyCallbackInfo< T > Class Template Reference

#include <v8-function-callback.h>

Public Member Functions

V8_INLINE IsolateGetIsolate () const
 
V8_INLINE Local< ValueData () const
 
V8_INLINE Local< ObjectThis () const
 
 V8_DEPRECATE_SOON ("V8 will stop providing access to hidden prototype (i.e. " "JSGlobalObject). Use HolderV2() instead. \n" "DO NOT try to workaround this by accessing JSGlobalObject via " "v8::Object::GetPrototype() - it'll be deprecated soon too. \n" "See http://crbug.com/333672197. ") V8_INLINE Local< Object > Holder() const
 
V8_INLINE Local< ObjectHolderV2 () const
 
V8_INLINE ReturnValue< T > GetReturnValue () const
 
V8_INLINE 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.

Definition at line 187 of file v8-function-callback.h.

Member Function Documentation

◆ Data()

template<typename T>
Local< Value > Data ( ) const
Returns
The data set in the configuration, i.e., in NamedPropertyHandlerConfiguration or IndexedPropertyHandlerConfiguration.

Definition at line 670 of file v8-function-callback.h.

◆ GetIsolate()

◆ GetReturnValue()

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

Definition at line 702 of file v8-function-callback.h.

◆ HolderV2()

template<typename T>
Local< Object > HolderV2 ( ) const
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.

Definition at line 692 of file v8-function-callback.h.

References v8::api_internal::ConvertToJSGlobalProxyIfNecessary().

◆ ShouldThrowOnError()

template<typename T>
bool ShouldThrowOnError ( ) const
Returns
True if the intercepted function should throw if an error occurs. Usually, true corresponds to ‘'use strict’`.
Note
Always false when intercepting Reflect.set() independent of the language mode.

Definition at line 707 of file v8-function-callback.h.

References GetIsolate(), and v8::internal::ShouldThrowOnError().

◆ This()

template<typename T>
Local< Object > This ( ) const
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()
friend class Global
V8_WARN_UNUSED_RESULT MaybeLocal< Value > GetRealNamedProperty(Local< Context > context, Local< Name > key)
V8_INLINE ReturnValue< T > GetReturnValue() const
V8_INLINE Local< Object > This() const
V8_INLINE Isolate * GetIsolate() const

Definition at line 675 of file v8-function-callback.h.

◆ V8_DEPRECATE_SOON()

template<typename T>
V8_DEPRECATE_SOON ( "V8 will stop providing access to hidden prototype (i.e. " "JSGlobalObject). Use HolderV2() instead. \n" "DO NOT try to workaround this by accessing JSGlobalObject via " "v8::Object::GetPrototype() - it'll be deprecated soon too. \n" "See http://crbug.com/333672197. " ) const
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. The Holder() could be a hidden object (the global object, rather than the global proxy).
Note
For security reasons, do not pass the object back into the runtime.

References V8_INLINE.

Friends And Related Symbol Documentation

◆ internal::CustomArguments< PropertyCallbackInfo >

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

◆ internal::PrintPropertyCallbackInfo

◆ internal::PropertyCallbackArguments

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

◆ MacroAssembler

template<typename T>
friend class MacroAssembler
friend

Definition at line 292 of file v8-function-callback.h.

References MacroAssembler.

Referenced by MacroAssembler.

◆ PropertyCallbackInfo

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

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