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

Unified Diff: include/v8.h

Issue 2807333003: [api] Add DefineProperty() method that skips interceptors.
Patch Set: Change enum to enum class Created 3 years, 7 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 | src/api.cc » ('j') | 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 ca8c0347ffe720b829b8fb386fdd5145b7cc2190..45f52f9e6a98aa90b3fdf0a73b1f99b606e88384 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -456,7 +456,6 @@ class WeakCallbackInfo {
void* embedder_fields_[kEmbedderFieldsInWeakCallback];
};
-
// kParameter will pass a void* parameter back to the callback, kInternalFields
// will pass the first two internal fields back to the callback, kFinalizer
// will pass a void* parameter back, but is invoked before the object is
@@ -2990,6 +2989,13 @@ enum class IndexFilter { kIncludeIndices, kSkipIndices };
enum class IntegrityLevel { kFrozen, kSealed };
/**
+ * kDontSkip is the default behaviour and triggers the definer
+ * interceptor when setting an own property on an object using
+ * DefineProperty. kSkip bypasses the interceptors.
+ */
+enum class CallInterceptors { kSkip, kDontSkip };
+
+/**
* A JavaScript object (ECMA-262, 4.3.3)
*/
class V8_EXPORT Object : public Value {
@@ -3026,7 +3032,8 @@ class V8_EXPORT Object : public Value {
// Returns true on success.
V8_WARN_UNUSED_RESULT Maybe<bool> DefineOwnProperty(
Local<Context> context, Local<Name> key, Local<Value> value,
- PropertyAttribute attributes = None);
+ PropertyAttribute attributes = None,
+ CallInterceptors call_interceptors = CallInterceptors::kDontSkip);
// Implements Object.DefineProperty(O, P, Attributes), see Ecma-262 19.1.2.4.
//
@@ -3040,9 +3047,13 @@ class V8_EXPORT Object : public Value {
//
// The PropertyDescriptor can change when redefining a property.
//
+ // CallInterceptors call_interceptors = kSkip
+ // bypasses interceptors when setting property on an object.
+ //
// Returns true on success.
V8_WARN_UNUSED_RESULT Maybe<bool> DefineProperty(
- Local<Context> context, Local<Name> key, PropertyDescriptor& descriptor);
+ Local<Context> context, Local<Name> key, PropertyDescriptor& descriptor,
+ CallInterceptors call_interceptors = CallInterceptors::kDontSkip);
// Sets an own property on this object bypassing interceptors and
// overriding accessors or read-only properties.
« no previous file with comments | « no previous file | src/api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698