Index: include/v8.h |
diff --git a/include/v8.h b/include/v8.h |
index edba8eaece01ae12955c89426ef8c57edf7a973d..6a7cc54b33905b73cd1bab97836f714ef2f699df 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,27 @@ 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. |
jochen (gone - plz use gerrit)
2016/09/26 15:16:12
you could add that usually, you should just use an
|
+ * |
+ * See also v8::Object::Has(). |
+ */ |
V8_WARN_UNUSED_RESULT Maybe<bool> HasRealNamedProperty(Local<Context> context, |
Local<Name> key); |
V8_DEPRECATE_SOON("Use maybe version", |