Skip to content
Snippets Groups Projects
Commit 3dfc2b57 authored by rswindell's avatar rswindell
Browse files

js_CreateUserObject() no longer creates named property if name arg = NULL.

This is used by system.new_user() to create a user object without automatically
assigning it as a new property of system.
parent 147309c8
No related branches found
No related tags found
No related merge requests found
......@@ -956,9 +956,10 @@ JSObject* DLLCALL js_CreateUserObject(JSContext* cx, JSObject* parent, scfg_t* c
private_t* p;
jsval val;
/* Return existing user object if it's already been created */
if(JS_GetProperty(cx,parent,name,&val) && val!=JSVAL_VOID)
userobj = JSVAL_TO_OBJECT(val);
if(name==NULL)
userobj = JS_NewObject(cx, &js_user_class, NULL, parent);
else if(JS_GetProperty(cx,parent,name,&val) && val!=JSVAL_VOID)
userobj = JSVAL_TO_OBJECT(val); /* Return existing user object */
else
userobj = JS_DefineObject(cx, parent, name, &js_user_class
, NULL, JSPROP_ENUMERATE|JSPROP_READONLY);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment