Status: New
Owner: ----

New issue 3861 by [email protected]: The method GetOwnPropertyNames() will not return non-enumerable fields
https://code.google.com/p/v8/issues/detail?id=3861

There non-enumerable properties of an object are not returned via GetOwnPropertyNames().

Sample code:

#include <v8.h>
#include <iostream>
int main(int argc, char* argv[]) {
    v8::V8::Initialize();
    v8::Isolate* isolate = v8::Isolate::New();
    v8::Isolate::Scope isolate_scope(isolate);
    v8::HandleScope handle_scope(isolate);
    v8::Handle<v8::Context> context = v8::Context::New(isolate);
    v8::Context::Scope context_scope(context);
    v8::Handle<v8::Object> obj = v8::Object::New(isolate);
obj->ForceSet(v8::String::NewFromUtf8(isolate,"field1"), v8::String::NewFromUtf8(isolate,"value1"), v8::DontEnum); obj->ForceSet(v8::String::NewFromUtf8(isolate,"field2"), v8::String::NewFromUtf8(isolate,"value2"), v8::None);
    v8::Local<v8::Array> property_names = obj->GetPropertyNames();
std::cout << "obj got " << property_names->Length() << " field(s)" << std::endl;
    v8::Local<v8::Array> own_property_names = obj->GetOwnPropertyNames();
std::cout << "obj got " << own_property_names->Length() << " own field(s)" << std::endl;
    return 0;
}

The printout is:

obj got 1 field(s)
obj got 1 own field(s)


--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to