Chromium Code Reviews| Index: src/api.cc |
| diff --git a/src/api.cc b/src/api.cc |
| index 469c7a1814df85e35e1e409684be5c22efa3437c..4e3d52b36fb8c5dba27e3960ac6dbab41948bd6b 100644 |
| --- a/src/api.cc |
| +++ b/src/api.cc |
| @@ -4112,6 +4112,28 @@ Handle<Value> Function::GetInferredName() const { |
| } |
| +Handle<Value> Function::GetDisplayName() const { |
|
yurys
2013/10/16 14:57:52
If you anyways return either empty handle or Strin
aandrey
2013/10/16 15:25:19
I guess we can, but there are 2 similar methods de
yurys
2013/10/17 07:40:19
That's because they will return Undefined when the
|
| + i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
| + ON_BAILOUT(isolate, "v8::Function::GetDisplayName()", |
| + return Local<v8::Value>()); |
| + ENTER_V8(isolate); |
| + i::HandleScope scope(isolate); |
| + i::Handle<i::JSFunction> func = Utils::OpenHandle(this); |
| + i::Handle<i::String> property_name = |
| + isolate->factory()->InternalizeOneByteString( |
| + STATIC_ASCII_VECTOR("displayName")); |
| + i::LookupResult lookup(isolate); |
| + func->LookupRealNamedProperty(*property_name, &lookup); |
|
yurys
2013/10/16 14:57:52
Should we count displayName property declared on p
aandrey
2013/10/16 15:19:45
I think we should. And this code does look up on p
|
| + if (!lookup.IsFound()) return Local<v8::Value>(); |
| + i::Object* value = lookup.GetLazyValue(); |
| + if (value && value->IsString()) { |
| + i::String* name = i::String::cast(value); |
| + if (name->length() > 0) return Utils::ToLocal(i::Handle<i::String>(name)); |
| + } |
| + return Local<v8::Value>(); |
| +} |
| + |
| + |
| ScriptOrigin Function::GetScriptOrigin() const { |
| i::Handle<i::JSFunction> func = Utils::OpenHandle(this); |
| if (func->shared()->script()->IsScript()) { |