Constants should be readOnly and DontDelete
authorFedor Indutny <fedor.indutny@gmail.com>
Mon, 30 Aug 2010 09:04:31 +0000 (16:04 +0700)
committerRyan Dahl <ry@tinyclouds.org>
Mon, 30 Aug 2010 19:13:41 +0000 (12:13 -0700)
src/node.h

index e20c801..901d853 100644 (file)
@@ -25,7 +25,8 @@ namespace node {
 
 #define NODE_DEFINE_CONSTANT(target, constant)                            \
   (target)->Set(v8::String::NewSymbol(#constant),                         \
-                v8::Integer::New(constant))
+                v8::Integer::New(constant),                               \
+                static_cast<v8::PropertyAttribute>(v8::ReadOnly|v8::DontDelete))
 
 #define NODE_SET_METHOD(obj, name, callback)                              \
   obj->Set(v8::String::NewSymbol(name),                                   \