Index: src/api.cc |
diff --git a/src/api.cc b/src/api.cc |
index 45efd68312a864109ac7a0d18f35461c3a81841f..9dd19f6a84a52134bd4fc1a50adb4e5b84bca505 100644 |
--- a/src/api.cc |
+++ b/src/api.cc |
@@ -1427,19 +1427,23 @@ void ObjectTemplate::SetAccessor(v8::Handle<Name> name, |
} |
-void ObjectTemplate::SetNamedPropertyHandler( |
- NamedPropertyGetterCallback getter, |
- NamedPropertySetterCallback setter, |
- NamedPropertyQueryCallback query, |
- NamedPropertyDeleterCallback remover, |
- NamedPropertyEnumeratorCallback enumerator, |
- Handle<Value> data) { |
- i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
+template<typename Getter, typename Setter, typename Query, typename Deleter, |
+ typename Enumerator> |
+static void ObjectTemplateSetNamedPropertyHandler( |
+ ObjectTemplate *templ, |
+ Getter getter, |
+ Setter setter, |
+ Query query, |
+ Deleter remover, |
+ Enumerator enumerator, |
+ Handle<Value> data, |
+ bool can_intercept_symbols) { |
+ i::Isolate* isolate = Utils::OpenHandle(templ)->GetIsolate(); |
ENTER_V8(isolate); |
i::HandleScope scope(isolate); |
- EnsureConstructor(isolate, this); |
+ EnsureConstructor(isolate, templ); |
i::FunctionTemplateInfo* constructor = i::FunctionTemplateInfo::cast( |
- Utils::OpenHandle(this)->constructor()); |
+ Utils::OpenHandle(templ)->constructor()); |
i::Handle<i::FunctionTemplateInfo> cons(constructor); |
i::Handle<i::Struct> struct_obj = |
isolate->factory()->NewStruct(i::INTERCEPTOR_INFO_TYPE); |
@@ -1451,6 +1455,8 @@ void ObjectTemplate::SetNamedPropertyHandler( |
if (query != 0) SET_FIELD_WRAPPED(obj, set_query, query); |
if (remover != 0) SET_FIELD_WRAPPED(obj, set_deleter, remover); |
if (enumerator != 0) SET_FIELD_WRAPPED(obj, set_enumerator, enumerator); |
+ obj->set_flags(0); |
+ obj->set_can_intercept_symbols(can_intercept_symbols); |
if (data.IsEmpty()) { |
data = v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate)); |
@@ -1460,6 +1466,30 @@ void ObjectTemplate::SetNamedPropertyHandler( |
} |
+void ObjectTemplate::SetNamedPropertyHandler( |
+ NamedPropertyGetterCallback getter, |
+ NamedPropertySetterCallback setter, |
+ NamedPropertyQueryCallback query, |
+ NamedPropertyDeleterCallback remover, |
+ NamedPropertyEnumeratorCallback enumerator, |
+ Handle<Value> data) { |
+ ObjectTemplateSetNamedPropertyHandler( |
+ this, getter, setter, query, remover, enumerator, data, false); |
+} |
+ |
+ |
+void ObjectTemplate::SetNamedPropertyHandler( |
+ GenericNamedPropertyGetterCallback getter, |
+ GenericNamedPropertySetterCallback setter, |
+ GenericNamedPropertyQueryCallback query, |
+ GenericNamedPropertyDeleterCallback remover, |
+ GenericNamedPropertyEnumeratorCallback enumerator, |
+ Handle<Value> data) { |
+ ObjectTemplateSetNamedPropertyHandler( |
+ this, getter, setter, query, remover, enumerator, data, true); |
+} |
+ |
+ |
void ObjectTemplate::MarkAsUndetectable() { |
i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
ENTER_V8(isolate); |
@@ -1527,6 +1557,7 @@ void ObjectTemplate::SetIndexedPropertyHandler( |
if (query != 0) SET_FIELD_WRAPPED(obj, set_query, query); |
if (remover != 0) SET_FIELD_WRAPPED(obj, set_deleter, remover); |
if (enumerator != 0) SET_FIELD_WRAPPED(obj, set_enumerator, enumerator); |
+ obj->set_flags(0); |
if (data.IsEmpty()) { |
data = v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate)); |