Fix symbol-named function template properties in the API

Thanks to Yutaka Hirano <yhirano@chromium.org> for finding the bug and
providing the test case.

R=rossberg@chromium.org
BUG=

Review URL: https://codereview.chromium.org/496663002

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@23269 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
wingo@igalia.com 2014-08-21 11:55:46 +00:00
parent c360d8d114
commit 558a05bfcf
2 changed files with 15 additions and 1 deletions

View File

@ -72,7 +72,7 @@ function InstantiateFunction(data, name) {
}
}
var fun = %CreateApiFunction(data, prototype);
if (name) %FunctionSetName(fun, name);
if (IS_STRING(name)) %FunctionSetName(fun, name);
var doNotCache = flags & (1 << kDoNotCacheBit);
if (!doNotCache) cache[serialNumber] = fun;
ConfigureTemplateInstance(fun, data);

View File

@ -2886,6 +2886,20 @@ THREADED_TEST(SymbolProperties) {
}
THREADED_TEST(SymbolTemplateProperties) {
LocalContext env;
v8::Isolate* isolate = env->GetIsolate();
v8::HandleScope scope(isolate);
v8::Local<v8::FunctionTemplate> foo = v8::FunctionTemplate::New(isolate);
v8::Local<v8::Name> name = v8::Symbol::New(isolate);
CHECK(!name.IsEmpty());
foo->PrototypeTemplate()->Set(name, v8::FunctionTemplate::New(isolate));
v8::Local<v8::Object> new_instance = foo->InstanceTemplate()->NewInstance();
CHECK(!new_instance.IsEmpty());
CHECK(new_instance->Has(name));
}
THREADED_TEST(PrivateProperties) {
LocalContext env;
v8::Isolate* isolate = env->GetIsolate();