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

Side by Side Diff: include/v8.h

Issue 2272383002: [api] Add interceptor for defineProperty(). (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@DefineProperty
Patch Set: Query descriptor triggers on defineProperty(). 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 unified diff | Download patch
« no previous file with comments | « no previous file | src/api.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** \mainpage V8 API Reference Guide 5 /** \mainpage V8 API Reference Guide
6 * 6 *
7 * V8 is Google's open source JavaScript engine. 7 * V8 is Google's open source JavaScript engine.
8 * 8 *
9 * This set of documents provides reference material generated from the 9 * This set of documents provides reference material generated from the
10 * V8 header file, include/v8.h. 10 * V8 header file, include/v8.h.
(...skipping 4669 matching lines...) Expand 10 before | Expand all | Expand 10 after
4680 Local<Name> property, const PropertyCallbackInfo<Boolean>& info); 4680 Local<Name> property, const PropertyCallbackInfo<Boolean>& info);
4681 4681
4682 4682
4683 /** 4683 /**
4684 * Returns an array containing the names of the properties the named 4684 * Returns an array containing the names of the properties the named
4685 * property getter intercepts. 4685 * property getter intercepts.
4686 */ 4686 */
4687 typedef void (*GenericNamedPropertyEnumeratorCallback)( 4687 typedef void (*GenericNamedPropertyEnumeratorCallback)(
4688 const PropertyCallbackInfo<Array>& info); 4688 const PropertyCallbackInfo<Array>& info);
4689 4689
4690 /**
4691 * Interceptor for defineProperty requests on an object.
4692 *
4693 * Use `info.GetReturnValue()` to indicate whether the request was intercepted
4694 * or not. If the definer successfully intercepts the request, i.e., if the
4695 * request should not be further executed, call
4696 * `info.GetReturnValue().Set(value)`. If the definer
4697 * did not intercept the request, i.e., if the request should be handled as
4698 * if no interceptor is present, do not not call `Set()`.
4699 *
4700 * \param property The name of the property for which the request was
4701 * intercepted.
4702 * \param desc The property descriptor which is used to define the
4703 * property if the request is not intercepted.
4704 * \param info Information about the intercepted request, such as
4705 * isolate, receiver, return value, or whether running in `'use strict'` mode.
4706 * See `PropertyCallbackInfo`.
4707 *
4708 * See also `ObjectTemplate::SetNamedPropertyHandler`.
4709 */
4710 typedef void (*GenericNamedPropertyDefinerCallback)(
4711 Local<Name> key, const PropertyDescriptor& desc,
4712 const PropertyCallbackInfo<Value>& info);
4690 4713
4691 /** 4714 /**
4692 * Returns the value of the property if the getter intercepts the 4715 * Returns the value of the property if the getter intercepts the
4693 * request. Otherwise, returns an empty handle. 4716 * request. Otherwise, returns an empty handle.
4694 */ 4717 */
4695 typedef void (*IndexedPropertyGetterCallback)( 4718 typedef void (*IndexedPropertyGetterCallback)(
4696 uint32_t index, 4719 uint32_t index,
4697 const PropertyCallbackInfo<Value>& info); 4720 const PropertyCallbackInfo<Value>& info);
4698 4721
4699 4722
(...skipping 26 matching lines...) Expand all
4726 const PropertyCallbackInfo<Boolean>& info); 4749 const PropertyCallbackInfo<Boolean>& info);
4727 4750
4728 4751
4729 /** 4752 /**
4730 * Returns an array containing the indices of the properties the 4753 * Returns an array containing the indices of the properties the
4731 * indexed property getter intercepts. 4754 * indexed property getter intercepts.
4732 */ 4755 */
4733 typedef void (*IndexedPropertyEnumeratorCallback)( 4756 typedef void (*IndexedPropertyEnumeratorCallback)(
4734 const PropertyCallbackInfo<Array>& info); 4757 const PropertyCallbackInfo<Array>& info);
4735 4758
4759 typedef void (*IndexedPropertyDefinerCallback)(
4760 uint32_t index, const PropertyDescriptor& desc,
4761 const PropertyCallbackInfo<Value>& info);
4736 4762
4737 /** 4763 /**
4738 * Access type specification. 4764 * Access type specification.
4739 */ 4765 */
4740 enum AccessType { 4766 enum AccessType {
4741 ACCESS_GET, 4767 ACCESS_GET,
4742 ACCESS_SET, 4768 ACCESS_SET,
4743 ACCESS_HAS, 4769 ACCESS_HAS,
4744 ACCESS_DELETE, 4770 ACCESS_DELETE,
4745 ACCESS_KEYS 4771 ACCESS_KEYS
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
4988 GenericNamedPropertyQueryCallback query = 0, 5014 GenericNamedPropertyQueryCallback query = 0,
4989 GenericNamedPropertyDeleterCallback deleter = 0, 5015 GenericNamedPropertyDeleterCallback deleter = 0,
4990 GenericNamedPropertyEnumeratorCallback enumerator = 0, 5016 GenericNamedPropertyEnumeratorCallback enumerator = 0,
4991 Local<Value> data = Local<Value>(), 5017 Local<Value> data = Local<Value>(),
4992 PropertyHandlerFlags flags = PropertyHandlerFlags::kNone) 5018 PropertyHandlerFlags flags = PropertyHandlerFlags::kNone)
4993 : getter(getter), 5019 : getter(getter),
4994 setter(setter), 5020 setter(setter),
4995 query(query), 5021 query(query),
4996 deleter(deleter), 5022 deleter(deleter),
4997 enumerator(enumerator), 5023 enumerator(enumerator),
5024 definer(0),
4998 data(data), 5025 data(data),
4999 flags(flags) {} 5026 flags(flags) {}
5000 5027
5028 NamedPropertyHandlerConfiguration(
5029 GenericNamedPropertyGetterCallback getter,
5030 GenericNamedPropertySetterCallback setter,
5031 GenericNamedPropertyQueryCallback query,
5032 GenericNamedPropertyDeleterCallback deleter,
5033 GenericNamedPropertyEnumeratorCallback enumerator,
5034 GenericNamedPropertyDefinerCallback definer,
5035 Local<Value> data = Local<Value>(),
5036 PropertyHandlerFlags flags = PropertyHandlerFlags::kNone)
5037 : getter(getter),
5038 setter(setter),
5039 query(query),
5040 deleter(deleter),
5041 enumerator(enumerator),
5042 definer(definer),
5043 data(data),
5044 flags(flags) {}
5045
5001 GenericNamedPropertyGetterCallback getter; 5046 GenericNamedPropertyGetterCallback getter;
5002 GenericNamedPropertySetterCallback setter; 5047 GenericNamedPropertySetterCallback setter;
5003 GenericNamedPropertyQueryCallback query; 5048 GenericNamedPropertyQueryCallback query;
5004 GenericNamedPropertyDeleterCallback deleter; 5049 GenericNamedPropertyDeleterCallback deleter;
5005 GenericNamedPropertyEnumeratorCallback enumerator; 5050 GenericNamedPropertyEnumeratorCallback enumerator;
5051 GenericNamedPropertyDefinerCallback definer;
5006 Local<Value> data; 5052 Local<Value> data;
5007 PropertyHandlerFlags flags; 5053 PropertyHandlerFlags flags;
5008 }; 5054 };
5009 5055
5010 5056
5011 struct IndexedPropertyHandlerConfiguration { 5057 struct IndexedPropertyHandlerConfiguration {
5012 IndexedPropertyHandlerConfiguration( 5058 IndexedPropertyHandlerConfiguration(
5013 /** Note: getter is required **/ 5059 /** Note: getter is required **/
5014 IndexedPropertyGetterCallback getter = 0, 5060 IndexedPropertyGetterCallback getter = 0,
5015 IndexedPropertySetterCallback setter = 0, 5061 IndexedPropertySetterCallback setter = 0,
5016 IndexedPropertyQueryCallback query = 0, 5062 IndexedPropertyQueryCallback query = 0,
5017 IndexedPropertyDeleterCallback deleter = 0, 5063 IndexedPropertyDeleterCallback deleter = 0,
5018 IndexedPropertyEnumeratorCallback enumerator = 0, 5064 IndexedPropertyEnumeratorCallback enumerator = 0,
5019 Local<Value> data = Local<Value>(), 5065 Local<Value> data = Local<Value>(),
5020 PropertyHandlerFlags flags = PropertyHandlerFlags::kNone) 5066 PropertyHandlerFlags flags = PropertyHandlerFlags::kNone)
5021 : getter(getter), 5067 : getter(getter),
5022 setter(setter), 5068 setter(setter),
5023 query(query), 5069 query(query),
5024 deleter(deleter), 5070 deleter(deleter),
5025 enumerator(enumerator), 5071 enumerator(enumerator),
5072 definer(0),
5026 data(data), 5073 data(data),
5027 flags(flags) {} 5074 flags(flags) {}
5028 5075
5076 IndexedPropertyHandlerConfiguration(
5077 IndexedPropertyGetterCallback getter,
5078 IndexedPropertySetterCallback setter, IndexedPropertyQueryCallback query,
5079 IndexedPropertyDeleterCallback deleter,
5080 IndexedPropertyEnumeratorCallback enumerator,
5081 IndexedPropertyDefinerCallback definer,
5082 Local<Value> data = Local<Value>(),
5083 PropertyHandlerFlags flags = PropertyHandlerFlags::kNone)
5084 : getter(getter),
5085 setter(setter),
5086 query(query),
5087 deleter(deleter),
5088 enumerator(enumerator),
5089 definer(definer),
5090 data(data),
5091 flags(flags) {}
5092
5029 IndexedPropertyGetterCallback getter; 5093 IndexedPropertyGetterCallback getter;
5030 IndexedPropertySetterCallback setter; 5094 IndexedPropertySetterCallback setter;
5031 IndexedPropertyQueryCallback query; 5095 IndexedPropertyQueryCallback query;
5032 IndexedPropertyDeleterCallback deleter; 5096 IndexedPropertyDeleterCallback deleter;
5033 IndexedPropertyEnumeratorCallback enumerator; 5097 IndexedPropertyEnumeratorCallback enumerator;
5098 IndexedPropertyDefinerCallback definer;
5034 Local<Value> data; 5099 Local<Value> data;
5035 PropertyHandlerFlags flags; 5100 PropertyHandlerFlags flags;
5036 }; 5101 };
5037 5102
5038 5103
5039 /** 5104 /**
5040 * An ObjectTemplate is used to create objects at runtime. 5105 * An ObjectTemplate is used to create objects at runtime.
5041 * 5106 *
5042 * Properties added to an ObjectTemplate are added to each object 5107 * Properties added to an ObjectTemplate are added to each object
5043 * created from the ObjectTemplate. 5108 * created from the ObjectTemplate.
(...skipping 4324 matching lines...) Expand 10 before | Expand all | Expand 10 after
9368 */ 9433 */
9369 9434
9370 9435
9371 } // namespace v8 9436 } // namespace v8
9372 9437
9373 9438
9374 #undef TYPE_CHECK 9439 #undef TYPE_CHECK
9375 9440
9376 9441
9377 #endif // INCLUDE_V8_H_ 9442 #endif // INCLUDE_V8_H_
OLDNEW
« 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