Index: test/cctest/test-api.cc |
diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc |
index 01c2ea8404ae5bac4c5b0d6a4b2440d3fbe2895f..ce576daa3d9be29f3710105c4c126023d9b3deff 100644 |
--- a/test/cctest/test-api.cc |
+++ b/test/cctest/test-api.cc |
@@ -1856,7 +1856,7 @@ THREADED_TEST(DescriptorInheritance) { |
int echo_named_call_count; |
-static void EchoNamedProperty(Local<String> name, |
+static void EchoNamedProperty(Local<Name> name, |
const v8::PropertyCallbackInfo<v8::Value>& info) { |
ApiTestFuzzer::Fuzz(); |
CHECK_EQ(v8_str("data"), info.Data()); |
@@ -1898,17 +1898,26 @@ void SymbolAccessorSetter(Local<Name> name, Local<Value> value, |
SimpleAccessorSetter(Local<String>::Cast(sym->Name()), value, info); |
} |
-void EmptyInterceptorGetter(Local<String> name, |
+void EmptyInterceptorGetter(Local<Name> name, |
const v8::PropertyCallbackInfo<v8::Value>& info) { |
} |
-void EmptyInterceptorSetter(Local<String> name, |
+void EmptyInterceptorSetter(Local<Name> name, |
Local<Value> value, |
const v8::PropertyCallbackInfo<v8::Value>& info) { |
} |
-void InterceptorGetter(Local<String> name, |
- const v8::PropertyCallbackInfo<v8::Value>& info) { |
+void EmptyGenericInterceptorGetter(Local<Name> name, |
+ const v8::PropertyCallbackInfo<v8::Value>& info) { |
+} |
+ |
+void EmptyGenericInterceptorSetter(Local<Name> name, |
+ Local<Value> value, |
+ const v8::PropertyCallbackInfo<v8::Value>& info) { |
+} |
+ |
+void StringInterceptorGetter(Local<String> name, |
+ const v8::PropertyCallbackInfo<v8::Value>& info) { |
// Intercept names that start with 'interceptor_'. |
String::Utf8Value utf8(name); |
char* name_str = *utf8; |
@@ -1921,9 +1930,9 @@ void InterceptorGetter(Local<String> name, |
info.GetReturnValue().Set(self->GetHiddenValue(v8_str(name_str + i))); |
} |
-void InterceptorSetter(Local<String> name, |
- Local<Value> value, |
- const v8::PropertyCallbackInfo<v8::Value>& info) { |
+void StringInterceptorSetter(Local<String> name, |
+ Local<Value> value, |
+ const v8::PropertyCallbackInfo<v8::Value>& info) { |
// Intercept accesses that set certain integer values, for which the name does |
// not start with 'accessor_'. |
String::Utf8Value utf8(name); |
@@ -1942,6 +1951,59 @@ void InterceptorSetter(Local<String> name, |
} |
} |
+void InterceptorGetter(Local<Name> generic_name, |
+ const v8::PropertyCallbackInfo<v8::Value>& info) { |
+ if (generic_name->IsSymbol()) return; |
+ StringInterceptorGetter(Local<String>::Cast(generic_name), info); |
+} |
+ |
+void InterceptorSetter(Local<Name> generic_name, |
+ Local<Value> value, |
+ const v8::PropertyCallbackInfo<v8::Value>& info) { |
+ if (generic_name->IsSymbol()) return; |
+ StringInterceptorSetter(Local<String>::Cast(generic_name), value, info); |
+} |
+ |
+void GenericInterceptorGetter(Local<Name> generic_name, |
+ const v8::PropertyCallbackInfo<v8::Value>& info) { |
+ Local<String> str; |
+ if (generic_name->IsSymbol()) { |
+ Local<Value> name = Local<Symbol>::Cast(generic_name)->Name(); |
+ if (name->IsUndefined()) return; |
+ str = String::Concat(v8_str("_sym_"), Local<String>::Cast(name)); |
+ } else { |
+ Local<String> name = Local<String>::Cast(generic_name); |
+ String::Utf8Value utf8(name); |
+ char* name_str = *utf8; |
+ if (*name_str == '_') return; |
+ str = String::Concat(v8_str("_str_"), name); |
+ } |
+ |
+ Handle<Object> self = Handle<Object>::Cast(info.This()); |
+ info.GetReturnValue().Set(self->Get(str)); |
+} |
+ |
+void GenericInterceptorSetter(Local<Name> generic_name, |
+ Local<Value> value, |
+ const v8::PropertyCallbackInfo<v8::Value>& info) { |
+ Local<String> str; |
+ if (generic_name->IsSymbol()) { |
+ Local<Value> name = Local<Symbol>::Cast(generic_name)->Name(); |
+ if (name->IsUndefined()) return; |
+ str = String::Concat(v8_str("_sym_"), Local<String>::Cast(name)); |
+ } else { |
+ Local<String> name = Local<String>::Cast(generic_name); |
+ String::Utf8Value utf8(name); |
+ char* name_str = *utf8; |
+ if (*name_str == '_') return; |
+ str = String::Concat(v8_str("_str_"), name); |
+ } |
+ |
+ Handle<Object> self = Handle<Object>::Cast(info.This()); |
+ self->Set(str, value); |
+ info.GetReturnValue().Set(value); |
+} |
+ |
void AddAccessor(Handle<FunctionTemplate> templ, |
Handle<String> name, |
v8::AccessorGetterCallback getter, |
@@ -1963,6 +2025,12 @@ void AddAccessor(Handle<FunctionTemplate> templ, |
templ->PrototypeTemplate()->SetAccessor(name, getter, setter); |
} |
+void AddInterceptor(Handle<FunctionTemplate> templ, |
+ v8::GenericNamedPropertyGetterCallback getter, |
+ v8::GenericNamedPropertySetterCallback setter) { |
+ templ->InstanceTemplate()->SetNamedPropertyHandler(getter, setter); |
+} |
+ |
THREADED_TEST(EmptyInterceptorDoesNotShadowAccessors) { |
v8::HandleScope scope(CcTest::isolate()); |
@@ -1982,6 +2050,60 @@ THREADED_TEST(EmptyInterceptorDoesNotShadowAccessors) { |
} |
+THREADED_TEST(LegacyInterceptorDoesNotSeeSymbols) { |
+ LocalContext env; |
+ v8::Isolate* isolate = CcTest::isolate(); |
+ v8::HandleScope scope(isolate); |
+ Handle<FunctionTemplate> parent = FunctionTemplate::New(isolate); |
+ Handle<FunctionTemplate> child = FunctionTemplate::New(isolate); |
+ v8::Local<v8::Symbol> age = v8::Symbol::New(isolate, v8_str("age")); |
+ |
+ child->Inherit(parent); |
+ AddAccessor(parent, age, SymbolAccessorGetter, SymbolAccessorSetter); |
+ AddInterceptor(child, StringInterceptorGetter, StringInterceptorSetter); |
+ |
+ env->Global()->Set(v8_str("Child"), child->GetFunction()); |
+ env->Global()->Set(v8_str("age"), age); |
+ CompileRun("var child = new Child;" |
+ "child[age] = 10;"); |
+ ExpectInt32("child[age]", 10); |
+ ExpectBoolean("child.hasOwnProperty('age')", false); |
+ ExpectBoolean("child.hasOwnProperty('accessor_age')", true); |
+} |
+ |
+ |
+THREADED_TEST(GenericInterceptorDoesSeeSymbols) { |
+ LocalContext env; |
+ v8::Isolate* isolate = CcTest::isolate(); |
+ v8::HandleScope scope(isolate); |
+ Handle<FunctionTemplate> parent = FunctionTemplate::New(isolate); |
+ Handle<FunctionTemplate> child = FunctionTemplate::New(isolate); |
+ v8::Local<v8::Symbol> age = v8::Symbol::New(isolate, v8_str("age")); |
+ v8::Local<v8::Symbol> anon = v8::Symbol::New(isolate); |
+ |
+ child->Inherit(parent); |
+ AddAccessor(parent, age, SymbolAccessorGetter, SymbolAccessorSetter); |
+ AddInterceptor(child, GenericInterceptorGetter, GenericInterceptorSetter); |
+ |
+ env->Global()->Set(v8_str("Child"), child->GetFunction()); |
+ env->Global()->Set(v8_str("age"), age); |
+ env->Global()->Set(v8_str("anon"), anon); |
+ CompileRun("var child = new Child;" |
+ "child[age] = 10;"); |
+ ExpectInt32("child[age]", 10); |
+ ExpectInt32("child._sym_age", 10); |
+ |
+ // Check that it also sees strings. |
+ CompileRun("child.foo = 47"); |
+ ExpectInt32("child.foo", 47); |
+ ExpectInt32("child._str_foo", 47); |
+ |
+ // Check that the interceptor can punt (in this case, on anonymous symbols). |
+ CompileRun("child[anon] = 31337"); |
+ ExpectInt32("child[anon]", 31337); |
+} |
+ |
+ |
THREADED_TEST(ExecutableAccessorIsPreservedOnAttributeChange) { |
v8::Isolate* isolate = CcTest::isolate(); |
v8::HandleScope scope(isolate); |
@@ -2287,7 +2409,7 @@ static void CheckThisIndexedPropertyHandler( |
} |
static void CheckThisNamedPropertyHandler( |
- Local<String> name, |
+ Local<Name> name, |
const v8::PropertyCallbackInfo<v8::Value>& info) { |
CheckReturnValue(info, FUNCTION_ADDR(CheckThisNamedPropertyHandler)); |
ApiTestFuzzer::Fuzz(); |
@@ -2305,7 +2427,7 @@ void CheckThisIndexedPropertySetter( |
void CheckThisNamedPropertySetter( |
- Local<String> property, |
+ Local<Name> property, |
Local<Value> value, |
const v8::PropertyCallbackInfo<v8::Value>& info) { |
CheckReturnValue(info, FUNCTION_ADDR(CheckThisNamedPropertySetter)); |
@@ -2323,7 +2445,7 @@ void CheckThisIndexedPropertyQuery( |
void CheckThisNamedPropertyQuery( |
- Local<String> property, |
+ Local<Name> property, |
const v8::PropertyCallbackInfo<v8::Integer>& info) { |
CheckReturnValue(info, FUNCTION_ADDR(CheckThisNamedPropertyQuery)); |
ApiTestFuzzer::Fuzz(); |
@@ -2341,7 +2463,7 @@ void CheckThisIndexedPropertyDeleter( |
void CheckThisNamedPropertyDeleter( |
- Local<String> property, |
+ Local<Name> property, |
const v8::PropertyCallbackInfo<v8::Boolean>& info) { |
CheckReturnValue(info, FUNCTION_ADDR(CheckThisNamedPropertyDeleter)); |
ApiTestFuzzer::Fuzz(); |
@@ -2416,7 +2538,7 @@ THREADED_PROFILED_TEST(PropertyHandlerInPrototype) { |
static void PrePropertyHandlerGet( |
- Local<String> key, |
+ Local<Name> key, |
const v8::PropertyCallbackInfo<v8::Value>& info) { |
ApiTestFuzzer::Fuzz(); |
if (v8_str("pre")->Equals(key)) { |
@@ -2426,7 +2548,7 @@ static void PrePropertyHandlerGet( |
static void PrePropertyHandlerQuery( |
- Local<String> key, |
+ Local<Name> key, |
const v8::PropertyCallbackInfo<v8::Integer>& info) { |
if (v8_str("pre")->Equals(key)) { |
info.GetReturnValue().Set(static_cast<int32_t>(v8::None)); |
@@ -2513,15 +2635,18 @@ THREADED_TEST(DeepCrossLanguageRecursion) { |
static void ThrowingPropertyHandlerGet( |
- Local<String> key, |
+ Local<Name> key, |
const v8::PropertyCallbackInfo<v8::Value>& info) { |
+ // Since this interceptor is used on "with" objects, the runtime will look up |
+ // @@unscopables. Punt. |
+ if (key->IsSymbol()) return; |
ApiTestFuzzer::Fuzz(); |
info.GetReturnValue().Set(info.GetIsolate()->ThrowException(key)); |
} |
static void ThrowingPropertyHandlerSet( |
- Local<String> key, |
+ Local<Name> key, |
Local<Value>, |
const v8::PropertyCallbackInfo<v8::Value>& info) { |
info.GetIsolate()->ThrowException(key); |
@@ -3327,7 +3452,7 @@ THREADED_TEST(Regress97784) { |
static bool interceptor_for_hidden_properties_called; |
static void InterceptorForHiddenProperties( |
- Local<String> name, const v8::PropertyCallbackInfo<v8::Value>& info) { |
+ Local<Name> name, const v8::PropertyCallbackInfo<v8::Value>& info) { |
interceptor_for_hidden_properties_called = true; |
} |
@@ -5896,7 +6021,7 @@ THREADED_TEST(NoAccessors) { |
} |
-static void XPropertyGetter(Local<String> property, |
+static void XPropertyGetter(Local<Name> property, |
const v8::PropertyCallbackInfo<v8::Value>& info) { |
ApiTestFuzzer::Fuzz(); |
CHECK(info.Data()->IsUndefined()); |
@@ -5992,7 +6117,7 @@ THREADED_TEST(NamedInterceptorDictionaryICMultipleContext) { |
static void SetXOnPrototypeGetter( |
- Local<String> property, |
+ Local<Name> property, |
const v8::PropertyCallbackInfo<v8::Value>& info) { |
// Set x on the prototype object and do not handle the get request. |
v8::Handle<v8::Value> proto = info.Holder()->GetPrototype(); |
@@ -7449,7 +7574,7 @@ THREADED_TEST(Arguments) { |
} |
-static void NoBlockGetterX(Local<String> name, |
+static void NoBlockGetterX(Local<Name> name, |
const v8::PropertyCallbackInfo<v8::Value>&) { |
} |
@@ -7459,7 +7584,7 @@ static void NoBlockGetterI(uint32_t index, |
} |
-static void PDeleter(Local<String> name, |
+static void PDeleter(Local<Name> name, |
const v8::PropertyCallbackInfo<v8::Boolean>& info) { |
if (!name->Equals(v8_str("foo"))) { |
return; // not intercepted |
@@ -7506,7 +7631,7 @@ THREADED_TEST(Deleter) { |
} |
-static void GetK(Local<String> name, |
+static void GetK(Local<Name> name, |
const v8::PropertyCallbackInfo<v8::Value>& info) { |
ApiTestFuzzer::Fuzz(); |
if (name->Equals(v8_str("foo")) || |
@@ -7640,7 +7765,7 @@ static void RunHolderTest(v8::Handle<v8::ObjectTemplate> obj) { |
} |
-static void PGetter2(Local<String> name, |
+static void PGetter2(Local<Name> name, |
const v8::PropertyCallbackInfo<v8::Value>& info) { |
ApiTestFuzzer::Fuzz(); |
p_getter_count2++; |
@@ -9546,7 +9671,11 @@ THREADED_TEST(GetOwnPropertyNamesWithInterceptor) { |
obj_template->Set(v8_str("x"), v8::Integer::New(CcTest::isolate(), 42)); |
obj_template->SetIndexedPropertyHandler(NULL, NULL, NULL, NULL, |
IndexedPropertyEnumerator); |
- obj_template->SetNamedPropertyHandler(NULL, NULL, NULL, NULL, |
+ // TODO(wingo): Types needed to disambiguate between deprecated and new |
+ // SetNamedPropertyHandler implementations. Go back to just passing NULL |
+ // values once deprecated API is removed. |
+ v8::GenericNamedPropertyGetterCallback getter = NULL; |
+ obj_template->SetNamedPropertyHandler(getter, NULL, NULL, NULL, |
NamedPropertyEnumerator); |
LocalContext context; |
@@ -9837,14 +9966,14 @@ THREADED_TEST(AccessControlFlatten) { |
static void AccessControlNamedGetter( |
- Local<String>, |
+ Local<Name>, |
const v8::PropertyCallbackInfo<v8::Value>& info) { |
info.GetReturnValue().Set(42); |
} |
static void AccessControlNamedSetter( |
- Local<String>, |
+ Local<Name>, |
Local<Value> value, |
const v8::PropertyCallbackInfo<v8::Value>& info) { |
info.GetReturnValue().Set(value); |
@@ -9969,7 +10098,7 @@ THREADED_TEST(InstanceProperties) { |
static void GlobalObjectInstancePropertiesGet( |
- Local<String> key, |
+ Local<Name> key, |
const v8::PropertyCallbackInfo<v8::Value>&) { |
ApiTestFuzzer::Fuzz(); |
} |
@@ -10107,7 +10236,7 @@ static void ShadowIndexedGet(uint32_t index, |
} |
-static void ShadowNamedGet(Local<String> key, |
+static void ShadowNamedGet(Local<Name> key, |
const v8::PropertyCallbackInfo<v8::Value>&) { |
} |
@@ -11230,7 +11359,7 @@ THREADED_TEST(HandleIteration) { |
static void InterceptorHasOwnPropertyGetter( |
- Local<String> name, |
+ Local<Name> name, |
const v8::PropertyCallbackInfo<v8::Value>& info) { |
ApiTestFuzzer::Fuzz(); |
} |
@@ -11261,7 +11390,7 @@ THREADED_TEST(InterceptorHasOwnProperty) { |
static void InterceptorHasOwnPropertyGetterGC( |
- Local<String> name, |
+ Local<Name> name, |
const v8::PropertyCallbackInfo<v8::Value>& info) { |
ApiTestFuzzer::Fuzz(); |
CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags); |
@@ -11298,14 +11427,9 @@ THREADED_TEST(InterceptorHasOwnPropertyCausingGC) { |
} |
-typedef void (*NamedPropertyGetter)( |
- Local<String> property, |
- const v8::PropertyCallbackInfo<v8::Value>& info); |
- |
- |
-static void CheckInterceptorLoadIC(NamedPropertyGetter getter, |
- const char* source, |
- int expected) { |
+static void CheckInterceptorLoadIC( |
+ v8::GenericNamedPropertyGetterCallback getter, const char* source, |
+ int expected) { |
v8::Isolate* isolate = CcTest::isolate(); |
v8::HandleScope scope(isolate); |
v8::Handle<v8::ObjectTemplate> templ = ObjectTemplate::New(isolate); |
@@ -11318,7 +11442,7 @@ static void CheckInterceptorLoadIC(NamedPropertyGetter getter, |
static void InterceptorLoadICGetter( |
- Local<String> name, |
+ Local<Name> name, |
const v8::PropertyCallbackInfo<v8::Value>& info) { |
ApiTestFuzzer::Fuzz(); |
v8::Isolate* isolate = CcTest::isolate(); |
@@ -11345,7 +11469,7 @@ THREADED_TEST(InterceptorLoadIC) { |
// (those cases are special cased to get better performance). |
static void InterceptorLoadXICGetter( |
- Local<String> name, |
+ Local<Name> name, |
const v8::PropertyCallbackInfo<v8::Value>& info) { |
ApiTestFuzzer::Fuzz(); |
info.GetReturnValue().Set( |
@@ -11461,7 +11585,7 @@ THREADED_TEST(InterceptorLoadICInvalidatedField) { |
static int interceptor_load_not_handled_calls = 0; |
static void InterceptorLoadNotHandled( |
- Local<String> name, |
+ Local<Name> name, |
const v8::PropertyCallbackInfo<v8::Value>& info) { |
++interceptor_load_not_handled_calls; |
} |
@@ -11704,7 +11828,7 @@ THREADED_TEST(InterceptorLoadICInvalidatedCallbackViaGlobal) { |
static void InterceptorLoadICGetter0( |
- Local<String> name, |
+ Local<Name> name, |
const v8::PropertyCallbackInfo<v8::Value>& info) { |
ApiTestFuzzer::Fuzz(); |
CHECK(v8_str("x")->Equals(name)); |
@@ -11720,7 +11844,7 @@ THREADED_TEST(InterceptorReturningZero) { |
static void InterceptorStoreICSetter( |
- Local<String> key, |
+ Local<Name> key, |
Local<Value> value, |
const v8::PropertyCallbackInfo<v8::Value>& info) { |
CHECK(v8_str("x")->Equals(key)); |
@@ -11769,7 +11893,7 @@ v8::Handle<Value> call_ic_function2; |
v8::Handle<Value> call_ic_function3; |
static void InterceptorCallICGetter( |
- Local<String> name, |
+ Local<Name> name, |
const v8::PropertyCallbackInfo<v8::Value>& info) { |
ApiTestFuzzer::Fuzz(); |
CHECK(v8_str("x")->Equals(name)); |
@@ -11817,7 +11941,7 @@ THREADED_TEST(InterceptorCallICSeesOthers) { |
static v8::Handle<Value> call_ic_function4; |
static void InterceptorCallICGetter4( |
- Local<String> name, |
+ Local<Name> name, |
const v8::PropertyCallbackInfo<v8::Value>& info) { |
ApiTestFuzzer::Fuzz(); |
CHECK(v8_str("x")->Equals(name)); |
@@ -11898,7 +12022,7 @@ THREADED_TEST(InterceptorCallICConstantFunctionUsed) { |
static v8::Handle<Value> call_ic_function5; |
static void InterceptorCallICGetter5( |
- Local<String> name, |
+ Local<Name> name, |
const v8::PropertyCallbackInfo<v8::Value>& info) { |
ApiTestFuzzer::Fuzz(); |
if (v8_str("x")->Equals(name)) |
@@ -11932,7 +12056,7 @@ THREADED_TEST(InterceptorCallICConstantFunctionNotNeeded) { |
static v8::Handle<Value> call_ic_function6; |
static void InterceptorCallICGetter6( |
- Local<String> name, |
+ Local<Name> name, |
const v8::PropertyCallbackInfo<v8::Value>& info) { |
ApiTestFuzzer::Fuzz(); |
if (v8_str("x")->Equals(name)) |
@@ -12060,7 +12184,7 @@ THREADED_TEST(InterceptorCallICCachedFromGlobal) { |
} |
static void InterceptorCallICFastApi( |
- Local<String> name, |
+ Local<Name> name, |
const v8::PropertyCallbackInfo<v8::Value>& info) { |
ApiTestFuzzer::Fuzz(); |
CheckReturnValue(info, FUNCTION_ADDR(InterceptorCallICFastApi)); |
@@ -12636,7 +12760,7 @@ THREADED_PROFILED_TEST(CallICFastApi_SimpleSignature_TypeError) { |
v8::Handle<Value> keyed_call_ic_function; |
static void InterceptorKeyedCallICGetter( |
- Local<String> name, |
+ Local<Name> name, |
const v8::PropertyCallbackInfo<v8::Value>& info) { |
ApiTestFuzzer::Fuzz(); |
if (v8_str("x")->Equals(name)) { |
@@ -12800,7 +12924,7 @@ THREADED_TEST(InterceptorKeyedCallICMapChangeAfter) { |
static int interceptor_call_count = 0; |
static void InterceptorICRefErrorGetter( |
- Local<String> name, |
+ Local<Name> name, |
const v8::PropertyCallbackInfo<v8::Value>& info) { |
ApiTestFuzzer::Fuzz(); |
if (v8_str("x")->Equals(name) && interceptor_call_count++ < 20) { |
@@ -12844,7 +12968,7 @@ THREADED_TEST(InterceptorICReferenceErrors) { |
static int interceptor_ic_exception_get_count = 0; |
static void InterceptorICExceptionGetter( |
- Local<String> name, |
+ Local<Name> name, |
const v8::PropertyCallbackInfo<v8::Value>& info) { |
ApiTestFuzzer::Fuzz(); |
if (v8_str("x")->Equals(name) && ++interceptor_ic_exception_get_count < 20) { |
@@ -12892,7 +13016,7 @@ THREADED_TEST(InterceptorICGetterExceptions) { |
static int interceptor_ic_exception_set_count = 0; |
static void InterceptorICExceptionSetter( |
- Local<String> key, |
+ Local<Name> key, |
Local<Value> value, |
const v8::PropertyCallbackInfo<v8::Value>& info) { |
ApiTestFuzzer::Fuzz(); |
@@ -12929,7 +13053,7 @@ THREADED_TEST(NullNamedInterceptor) { |
v8::HandleScope scope(isolate); |
v8::Handle<v8::ObjectTemplate> templ = ObjectTemplate::New(isolate); |
templ->SetNamedPropertyHandler( |
- static_cast<v8::NamedPropertyGetterCallback>(0)); |
+ static_cast<v8::GenericNamedPropertyGetterCallback>(0)); |
LocalContext context; |
templ->Set(CcTest::isolate(), "x", v8_num(42)); |
v8::Handle<v8::Object> obj = templ->NewInstance(); |
@@ -15314,8 +15438,15 @@ static void ForceSetSetter(v8::Local<v8::String> name, |
force_set_set_count++; |
} |
+static void ForceSetInterceptGetter( |
+ v8::Local<v8::Name> name, |
+ const v8::PropertyCallbackInfo<v8::Value>& info) { |
+ CHECK(name->IsString()); |
+ ForceSetGetter(Local<String>::Cast(name), info); |
+} |
+ |
static void ForceSetInterceptSetter( |
- v8::Local<v8::String> name, |
+ v8::Local<v8::Name> name, |
v8::Local<v8::Value> value, |
const v8::PropertyCallbackInfo<v8::Value>& info) { |
force_set_set_count++; |
@@ -15376,7 +15507,8 @@ TEST(ForceSetWithInterceptor) { |
v8::Isolate* isolate = CcTest::isolate(); |
v8::HandleScope scope(isolate); |
v8::Handle<v8::ObjectTemplate> templ = v8::ObjectTemplate::New(isolate); |
- templ->SetNamedPropertyHandler(ForceSetGetter, ForceSetInterceptSetter); |
+ templ->SetNamedPropertyHandler(ForceSetInterceptGetter, |
+ ForceSetInterceptSetter); |
LocalContext context(NULL, templ); |
v8::Handle<v8::Object> global = context->Global(); |
@@ -15444,7 +15576,7 @@ static bool pass_on_delete = false; |
static void ForceDeleteDeleter( |
- v8::Local<v8::String> name, |
+ v8::Local<v8::Name> name, |
const v8::PropertyCallbackInfo<v8::Boolean>& info) { |
force_delete_interceptor_count++; |
if (pass_on_delete) return; |
@@ -18537,7 +18669,7 @@ static void SetterWhichSetsYOnThisTo23( |
} |
-void FooGetInterceptor(Local<String> name, |
+void FooGetInterceptor(Local<Name> name, |
const v8::PropertyCallbackInfo<v8::Value>& info) { |
CHECK(v8::Utils::OpenHandle(*info.This())->IsJSObject()); |
CHECK(v8::Utils::OpenHandle(*info.Holder())->IsJSObject()); |
@@ -18546,7 +18678,7 @@ void FooGetInterceptor(Local<String> name, |
} |
-void FooSetInterceptor(Local<String> name, |
+void FooSetInterceptor(Local<Name> name, |
Local<Value> value, |
const v8::PropertyCallbackInfo<v8::Value>& info) { |
CHECK(v8::Utils::OpenHandle(*info.This())->IsJSObject()); |
@@ -18593,14 +18725,14 @@ script = v8_compile("new C2();"); |
static void NamedPropertyGetterWhichReturns42( |
- Local<String> name, |
+ Local<Name> name, |
const v8::PropertyCallbackInfo<v8::Value>& info) { |
info.GetReturnValue().Set(v8_num(42)); |
} |
static void NamedPropertySetterWhichSetsYOnThisTo23( |
- Local<String> name, |
+ Local<Name> name, |
Local<Value> value, |
const v8::PropertyCallbackInfo<v8::Value>& info) { |
if (name->Equals(v8_str("x"))) { |
@@ -19908,7 +20040,7 @@ THREADED_TEST(Equals) { |
} |
-static void Getter(v8::Local<v8::String> property, |
+static void Getter(v8::Local<v8::Name> property, |
const v8::PropertyCallbackInfo<v8::Value>& info ) { |
info.GetReturnValue().Set(v8_str("42!")); |
} |
@@ -20073,7 +20205,7 @@ void HasOwnPropertyIndexedPropertyGetter( |
void HasOwnPropertyNamedPropertyGetter( |
- Local<String> property, |
+ Local<Name> property, |
const v8::PropertyCallbackInfo<v8::Value>& info) { |
if (property->Equals(v8_str("foo"))) info.GetReturnValue().Set(v8_str("yes")); |
} |
@@ -20086,14 +20218,14 @@ void HasOwnPropertyIndexedPropertyQuery( |
void HasOwnPropertyNamedPropertyQuery( |
- Local<String> property, |
+ Local<Name> property, |
const v8::PropertyCallbackInfo<v8::Integer>& info) { |
if (property->Equals(v8_str("foo"))) info.GetReturnValue().Set(1); |
} |
void HasOwnPropertyNamedPropertyQuery2( |
- Local<String> property, |
+ Local<Name> property, |
const v8::PropertyCallbackInfo<v8::Integer>& info) { |
if (property->Equals(v8_str("bar"))) info.GetReturnValue().Set(1); |
} |
@@ -22073,7 +22205,7 @@ class RequestInterruptTestWithMethodCallAndInterceptor |
private: |
static void EmptyInterceptor( |
- Local<String> property, |
+ Local<Name> property, |
const v8::PropertyCallbackInfo<v8::Value>& info) { |
} |
}; |