Index: include/v8.h |
diff --git a/include/v8.h b/include/v8.h |
index 1e97776aab008f35d6cc23a5fbc468327f9d68d8..70a3a596d82f7b474f6c4aa29e97cdba8dfce925 100644 |
--- a/include/v8.h |
+++ b/include/v8.h |
@@ -92,6 +92,7 @@ class ObjectTemplate; |
class Platform; |
class Primitive; |
class Promise; |
+class Proxy; |
class RawOperationDescriptor; |
class Script; |
class SharedArrayBuffer; |
@@ -1954,6 +1955,11 @@ class V8_EXPORT Value : public Data { |
*/ |
bool IsSharedArrayBuffer() const; |
+ /** |
+ * Returns true if this value is a JavaScript Proxy. |
+ */ |
+ bool IsProxy() const; |
+ |
V8_WARN_UNUSED_RESULT MaybeLocal<Boolean> ToBoolean( |
Local<Context> context) const; |
@@ -3376,6 +3382,32 @@ class V8_EXPORT Promise : public Object { |
}; |
+/** |
+ * An instance of the built-in Proxy constructor (ECMA-262, 6th Edition, |
+ * 26.2.1). |
+ */ |
+class V8_EXPORT Proxy : public Object { |
+ public: |
+ Local<Object> GetTarget(); |
+ Local<Value> GetHandler(); |
+ bool IsRevoked(); |
+ void Revoke(); |
+ |
+ /** |
+ * Creates a new empty Map. |
+ */ |
+ static MaybeLocal<Proxy> New(Local<Context> context, |
+ Local<Object> local_target, |
+ Local<Object> local_handler); |
+ |
+ V8_INLINE static Proxy* Cast(Value* obj); |
+ |
+ private: |
+ Proxy(); |
+ static void CheckCast(Value* obj); |
+}; |
+ |
+ |
#ifndef V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT |
// The number of required internal fields can be defined by embedder. |
#define V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT 2 |
@@ -8047,6 +8079,14 @@ Promise* Promise::Cast(v8::Value* value) { |
} |
+Proxy* Proxy::Cast(v8::Value* value) { |
+#ifdef V8_ENABLE_CHECKS |
+ CheckCast(value); |
+#endif |
+ return static_cast<Proxy*>(value); |
+} |
+ |
+ |
Promise::Resolver* Promise::Resolver::Cast(v8::Value* value) { |
#ifdef V8_ENABLE_CHECKS |
CheckCast(value); |