Index: include/v8.h |
diff --git a/include/v8.h b/include/v8.h |
index 93b55ddbbfa2c282b6a927faba66f38dbeb8d39b..2468d15c50397a71ea69166c61f60645f161e88c 100644 |
--- a/include/v8.h |
+++ b/include/v8.h |
@@ -2118,10 +2118,10 @@ class V8_EXPORT Object : public Value { |
PropertyAttribute attribute = None); |
// This function is not yet stable and should not be used at this time. |
- bool SetAccessor(Handle<String> name, |
- Handle<DeclaredAccessorDescriptor> descriptor, |
- AccessControl settings = DEFAULT, |
- PropertyAttribute attribute = None); |
+ bool SetDeclaredAccessor(Local<String> name, |
+ Local<DeclaredAccessorDescriptor> descriptor, |
+ AccessControl settings = DEFAULT, |
+ PropertyAttribute attribute = None); |
/** |
* Returns an array containing the names of the enumerable properties |
@@ -2968,6 +2968,52 @@ class V8_EXPORT Template : public Data { |
void Set(Handle<String> name, Handle<Data> value, |
PropertyAttribute attributes = None); |
V8_INLINE(void Set(const char* name, Handle<Data> value)); |
+ |
+ /** |
+ * Whenever the property with the given name is accessed on objects |
+ * created from this Template the getter and setter callbacks |
+ * are called instead of getting and setting the property directly |
+ * on the JavaScript object. |
+ * |
+ * \param name The name of the property for which an accessor is added. |
+ * \param getter The callback to invoke when getting the property. |
+ * \param setter The callback to invoke when setting the property. |
+ * \param data A piece of data that will be passed to the getter and setter |
+ * callbacks whenever they are invoked. |
+ * \param settings Access control settings for the accessor. This is a bit |
+ * field consisting of one of more of |
+ * DEFAULT = 0, ALL_CAN_READ = 1, or ALL_CAN_WRITE = 2. |
+ * The default is to not allow cross-context access. |
+ * ALL_CAN_READ means that all cross-context reads are allowed. |
+ * ALL_CAN_WRITE means that all cross-context writes are allowed. |
+ * The combination ALL_CAN_READ | ALL_CAN_WRITE can be used to allow all |
+ * cross-context access. |
+ * \param attribute The attributes of the property for which an accessor |
+ * is added. |
+ * \param signature The signature describes valid receivers for the accessor |
+ * and is used to perform implicit instance checks against them. If the |
+ * receiver is incompatible (i.e. is not an instance of the constructor as |
+ * defined by FunctionTemplate::HasInstance()), an implicit TypeError is |
+ * thrown and no callback is invoked. |
+ */ |
+ void SetNativeDataProperty(Local<String> name, |
+ AccessorGetterCallback getter, |
+ AccessorSetterCallback setter = 0, |
+ // TODO(dcarney): gcc can't handle Local below |
+ Handle<Value> data = Handle<Value>(), |
+ AccessControl settings = DEFAULT, |
+ PropertyAttribute attribute = None, |
+ Local<AccessorSignature> signature = |
+ Local<AccessorSignature>()); |
+ |
+ // This function is not yet stable and should not be used at this time. |
+ bool SetDeclaredAccessor(Local<String> name, |
+ Local<DeclaredAccessorDescriptor> descriptor, |
+ AccessControl settings = DEFAULT, |
+ PropertyAttribute attribute = None, |
+ Local<AccessorSignature> signature = |
+ Local<AccessorSignature>()); |
+ |
private: |
Template(); |
@@ -3484,14 +3530,6 @@ class V8_EXPORT ObjectTemplate : public Template { |
Handle<AccessorSignature> signature = |
Handle<AccessorSignature>()); |
- // This function is not yet stable and should not be used at this time. |
- bool SetAccessor(Handle<String> name, |
- Handle<DeclaredAccessorDescriptor> descriptor, |
- AccessControl settings = DEFAULT, |
- PropertyAttribute attribute = None, |
- Handle<AccessorSignature> signature = |
- Handle<AccessorSignature>()); |
- |
/** |
* Sets a named property handler on the object template. |
* |