Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Unified Diff: include/v8.h

Issue 2365403003: [api] Add documentation for various HasProperty functions. (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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",
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698