| Index: include/v8.h
|
| diff --git a/include/v8.h b/include/v8.h
|
| index edba8eaece01ae12955c89426ef8c57edf7a973d..ba71ee8924b9fec4f1ce5efb7f966f91967f65cd 100644
|
| --- a/include/v8.h
|
| +++ b/include/v8.h
|
| @@ -2968,6 +2968,21 @@ class V8_EXPORT Object : public Value {
|
| Local<Context> context, Local<String> key);
|
|
|
| V8_DEPRECATE_SOON("Use maybe version", bool Has(Local<Value> key));
|
| + /**
|
| + * Object::Has() calls the abstract operation HasProperty(O, P) described
|
| + * in ECMA-262, 7.3.10. Has() returns
|
| + * true, if the object has the property, either own or on the prototype chain.
|
| + * Interceptors, i.e., PropertyQueryCallbacks, are called if present.
|
| + *
|
| + * Has() has the same side effects as JavaScript's `variable in object`.
|
| + * For example, calling Has() on a revoked proxy will throw an exception.
|
| + *
|
| + * \note Has() converts the key to a name, which possibly calls back into
|
| + * JavaScript.
|
| + *
|
| + * See also v8::Object::HasOwnProperty() and
|
| + * v8::Object::HasRealNamedProperty().
|
| + */
|
| V8_WARN_UNUSED_RESULT Maybe<bool> Has(Local<Context> context,
|
| Local<Value> key);
|
|
|
| @@ -3132,12 +3147,31 @@ class V8_EXPORT Object : public Value {
|
|
|
| // Testers for local properties.
|
| V8_DEPRECATED("Use maybe version", bool HasOwnProperty(Local<String> key));
|
| +
|
| + /**
|
| + * HasOwnProperty() is like JavaScript's Object.prototype.hasOwnProperty().
|
| + *
|
| + * See also v8::Object::Has() and v8::Object::HasRealNamedProperty().
|
| + */
|
| V8_WARN_UNUSED_RESULT Maybe<bool> HasOwnProperty(Local<Context> context,
|
| Local<Name> key);
|
| V8_WARN_UNUSED_RESULT Maybe<bool> HasOwnProperty(Local<Context> context,
|
| uint32_t index);
|
| V8_DEPRECATE_SOON("Use maybe version",
|
| bool HasRealNamedProperty(Local<String> key));
|
| + /**
|
| + * Use HasRealNamedProperty() if you want to check if an object has an own
|
| + * property without causing side effects, i.e., without calling interceptors.
|
| + *
|
| + * This function is similar to v8::Object::HasOwnProperty(), but it does not
|
| + * call interceptors.
|
| + *
|
| + * \note Consider using non-masking interceptors, i.e., the interceptors are
|
| + * not called if the receiver has the real named property. See
|
| + * `v8::PropertyHandlerFlags::kNonMasking`.
|
| + *
|
| + * See also v8::Object::Has().
|
| + */
|
| V8_WARN_UNUSED_RESULT Maybe<bool> HasRealNamedProperty(Local<Context> context,
|
| Local<Name> key);
|
| V8_DEPRECATE_SOON("Use maybe version",
|
| @@ -5126,16 +5160,31 @@ class V8_EXPORT FunctionTemplate : public Template {
|
| friend class ObjectTemplate;
|
| };
|
|
|
| +/**
|
| + * Configuration flags for v8::NamedPropertyHandlerConfiguration or
|
| + * v8::IndexedPropertyHandlerConfiguration.
|
| + */
|
| enum class PropertyHandlerFlags {
|
| + /**
|
| + * None.
|
| + */
|
| kNone = 0,
|
| - // See ALL_CAN_READ above.
|
| +
|
| + /**
|
| + * See ALL_CAN_READ above.
|
| + */
|
| kAllCanRead = 1,
|
| - // Will not call into interceptor for properties on the receiver or prototype
|
| - // chain, i.e., only call into interceptor for properties that do not exist.
|
| - // Currently only valid for named interceptors.
|
| +
|
| + /** Will not call into interceptor for properties on the receiver or prototype
|
| + * chain, i.e., only call into interceptor for properties that do not exist.
|
| + * Currently only valid for named interceptors.
|
| + */
|
| kNonMasking = 1 << 1,
|
| - // Will not call into interceptor for symbol lookup. Only meaningful for
|
| - // named interceptors.
|
| +
|
| + /**
|
| + * Will not call into interceptor for symbol lookup. Only meaningful for
|
| + * named interceptors.
|
| + */
|
| kOnlyInterceptStrings = 1 << 2,
|
| };
|
|
|
|
|