1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
15 * The Original Code is mozilla.org code.
17 * The Initial Developer of the Original Code is
18 * Netscape Communications Corporation.
19 * Portions created by the Initial Developer are Copyright (C) 1998
20 * the Initial Developer. All Rights Reserved.
24 * Alternatively, the contents of this file may be used under the terms of
25 * either the GNU General Public License Version 2 or later (the "GPL"), or
26 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 * in which case the provisions of the GPL or the LGPL are applicable instead
28 * of those above. If you wish to allow use of your version of this file only
29 * under the terms of either the GPL or the LGPL, and not to allow others to
30 * use your version of this file under the terms of the MPL, indicate your
31 * decision by deleting the provisions above and replace them with the notice
32 * and other provisions required by the GPL or the LGPL. If you do not delete
33 * the provisions above, a recipient may use your version of this file under
34 * the terms of any one of the MPL, the GPL or the LGPL.
36 * ***** END LICENSE BLOCK ***** */
39 * JavaScript Debugging support - Value and Property support
48 void JSD_ASSERT_VALID_VALUE(JSDValue
* jsdval
)
51 JS_ASSERT(jsdval
->nref
> 0);
52 if(!JS_CLIST_IS_EMPTY(&jsdval
->props
))
54 JS_ASSERT(CHECK_BIT_FLAG(jsdval
->flags
, GOT_PROPS
));
55 JS_ASSERT(JSVAL_IS_OBJECT(jsdval
->val
));
60 JS_ASSERT(CHECK_BIT_FLAG(jsdval
->flags
, GOT_PROTO
));
61 JS_ASSERT(jsdval
->proto
->nref
> 0);
65 JS_ASSERT(CHECK_BIT_FLAG(jsdval
->flags
, GOT_PARENT
));
66 JS_ASSERT(jsdval
->parent
->nref
> 0);
70 JS_ASSERT(CHECK_BIT_FLAG(jsdval
->flags
, GOT_CTOR
));
71 JS_ASSERT(jsdval
->ctor
->nref
> 0);
75 void JSD_ASSERT_VALID_PROPERTY(JSDProperty
* jsdprop
)
78 JS_ASSERT(jsdprop
->name
);
79 JS_ASSERT(jsdprop
->name
->nref
> 0);
80 JS_ASSERT(jsdprop
->val
);
81 JS_ASSERT(jsdprop
->val
->nref
> 0);
83 JS_ASSERT(jsdprop
->alias
->nref
> 0);
89 jsd_IsValueObject(JSDContext
* jsdc
, JSDValue
* jsdval
)
91 return JSVAL_IS_OBJECT(jsdval
->val
);
95 jsd_IsValueNumber(JSDContext
* jsdc
, JSDValue
* jsdval
)
97 return JSVAL_IS_NUMBER(jsdval
->val
);
101 jsd_IsValueInt(JSDContext
* jsdc
, JSDValue
* jsdval
)
103 return JSVAL_IS_INT(jsdval
->val
);
107 jsd_IsValueDouble(JSDContext
* jsdc
, JSDValue
* jsdval
)
109 return JSVAL_IS_DOUBLE(jsdval
->val
);
113 jsd_IsValueString(JSDContext
* jsdc
, JSDValue
* jsdval
)
115 return JSVAL_IS_STRING(jsdval
->val
);
119 jsd_IsValueBoolean(JSDContext
* jsdc
, JSDValue
* jsdval
)
121 return JSVAL_IS_BOOLEAN(jsdval
->val
);
125 jsd_IsValueNull(JSDContext
* jsdc
, JSDValue
* jsdval
)
127 return JSVAL_IS_NULL(jsdval
->val
);
131 jsd_IsValueVoid(JSDContext
* jsdc
, JSDValue
* jsdval
)
133 return JSVAL_IS_VOID(jsdval
->val
);
137 jsd_IsValuePrimitive(JSDContext
* jsdc
, JSDValue
* jsdval
)
139 return JSVAL_IS_PRIMITIVE(jsdval
->val
);
143 jsd_IsValueFunction(JSDContext
* jsdc
, JSDValue
* jsdval
)
145 return !JSVAL_IS_PRIMITIVE(jsdval
->val
) &&
146 JS_ObjectIsFunction(jsdc
->dumbContext
, JSVAL_TO_OBJECT(jsdval
->val
));
150 jsd_IsValueNative(JSDContext
* jsdc
, JSDValue
* jsdval
)
152 JSContext
* cx
= jsdc
->dumbContext
;
153 jsval val
= jsdval
->val
;
155 JSExceptionState
* exceptionState
;
156 JSCrossCompartmentCall
*call
= NULL
;
158 if(jsd_IsValueFunction(jsdc
, jsdval
))
160 JSBool ok
= JS_FALSE
;
162 call
= JS_EnterCrossCompartmentCall(jsdc
->dumbContext
, JSVAL_TO_OBJECT(val
));
169 exceptionState
= JS_SaveExceptionState(cx
);
170 fun
= JS_ValueToFunction(cx
, val
);
171 JS_RestoreExceptionState(cx
, exceptionState
);
173 ok
= JS_GetFunctionScript(cx
, fun
) ? JS_FALSE
: JS_TRUE
;
174 JS_LeaveCrossCompartmentCall(call
);
179 return !JSVAL_IS_PRIMITIVE(val
);
182 /***************************************************************************/
185 jsd_GetValueBoolean(JSDContext
* jsdc
, JSDValue
* jsdval
)
187 jsval val
= jsdval
->val
;
188 if(!JSVAL_IS_BOOLEAN(val
))
190 return JSVAL_TO_BOOLEAN(val
);
194 jsd_GetValueInt(JSDContext
* jsdc
, JSDValue
* jsdval
)
196 jsval val
= jsdval
->val
;
197 if(!JSVAL_IS_INT(val
))
199 return JSVAL_TO_INT(val
);
203 jsd_GetValueDouble(JSDContext
* jsdc
, JSDValue
* jsdval
)
205 if(!JSVAL_IS_DOUBLE(jsdval
->val
))
207 return JSVAL_TO_DOUBLE(jsdval
->val
);
211 jsd_GetValueString(JSDContext
* jsdc
, JSDValue
* jsdval
)
213 JSContext
* cx
= jsdc
->dumbContext
;
214 JSExceptionState
* exceptionState
;
215 JSCrossCompartmentCall
*call
= NULL
;
219 /* if the jsval is a string, then we don't need to double root it */
220 if(JSVAL_IS_STRING(jsdval
->val
))
221 jsdval
->string
= JSVAL_TO_STRING(jsdval
->val
);
225 call
= JSVAL_IS_PRIMITIVE(jsdval
->val
)
227 : JS_EnterCrossCompartmentCall(jsdc
->dumbContext
, JSVAL_TO_OBJECT(jsdval
->val
));
234 exceptionState
= JS_SaveExceptionState(cx
);
235 jsdval
->string
= JS_ValueToString(cx
, jsdval
->val
);
236 JS_RestoreExceptionState(cx
, exceptionState
);
239 if(!JS_AddNamedStringRoot(cx
, &jsdval
->string
, "ValueString"))
240 jsdval
->string
= NULL
;
242 JS_LeaveCrossCompartmentCall(call
);
246 return jsdval
->string
;
250 jsd_GetValueFunctionName(JSDContext
* jsdc
, JSDValue
* jsdval
)
252 JSContext
* cx
= jsdc
->dumbContext
;
254 JSExceptionState
* exceptionState
;
255 JSCrossCompartmentCall
*call
= NULL
;
257 if(!jsdval
->funName
&& jsd_IsValueFunction(jsdc
, jsdval
))
261 call
= JS_EnterCrossCompartmentCall(jsdc
->dumbContext
, JSVAL_TO_OBJECT(jsdval
->val
));
268 exceptionState
= JS_SaveExceptionState(cx
);
269 fun
= JS_ValueToFunction(cx
, jsdval
->val
);
270 JS_RestoreExceptionState(cx
, exceptionState
);
271 JS_LeaveCrossCompartmentCall(call
);
275 jsdval
->funName
= JS_GetFunctionId(fun
);
276 if (!jsdval
->funName
)
277 jsdval
->funName
= JS_GetEmptyString(jsdc
->jsrt
);
279 return jsdval
->funName
;
282 /***************************************************************************/
285 jsd_NewValue(JSDContext
* jsdc
, jsval val
)
288 JSCrossCompartmentCall
*call
= NULL
;
290 if(!(jsdval
= (JSDValue
*) calloc(1, sizeof(JSDValue
))))
293 if(JSVAL_IS_GCTHING(val
))
295 JSBool ok
= JS_FALSE
;
296 JS_BeginRequest(jsdc
->dumbContext
);
298 call
= JS_EnterCrossCompartmentCall(jsdc
->dumbContext
, jsdc
->glob
);
300 JS_EndRequest(jsdc
->dumbContext
);
305 ok
= JS_AddNamedValueRoot(jsdc
->dumbContext
, &jsdval
->val
, "JSDValue");
306 JS_LeaveCrossCompartmentCall(call
);
307 JS_EndRequest(jsdc
->dumbContext
);
316 JS_INIT_CLIST(&jsdval
->props
);
322 jsd_DropValue(JSDContext
* jsdc
, JSDValue
* jsdval
)
324 JSCrossCompartmentCall
*call
= NULL
;
326 JS_ASSERT(jsdval
->nref
> 0);
327 if(0 == --jsdval
->nref
)
329 jsd_RefreshValue(jsdc
, jsdval
);
330 if(JSVAL_IS_GCTHING(jsdval
->val
))
332 JS_BeginRequest(jsdc
->dumbContext
);
333 call
= JS_EnterCrossCompartmentCall(jsdc
->dumbContext
, jsdc
->glob
);
335 JS_EndRequest(jsdc
->dumbContext
);
340 JS_RemoveValueRoot(jsdc
->dumbContext
, &jsdval
->val
);
341 JS_LeaveCrossCompartmentCall(call
);
342 JS_EndRequest(jsdc
->dumbContext
);
349 jsd_GetValueWrappedJSVal(JSDContext
* jsdc
, JSDValue
* jsdval
)
353 jsval val
= jsdval
->val
;
354 if (!JSVAL_IS_PRIMITIVE(val
)) {
355 cx
= JSD_GetDefaultJSContext(jsdc
);
356 obj
= js_ObjectToOuterObject(cx
, JSVAL_TO_OBJECT(val
));
359 JS_ClearPendingException(cx
);
363 val
= OBJECT_TO_JSVAL(obj
);
369 static JSDProperty
* _newProperty(JSDContext
* jsdc
, JSPropertyDesc
* pd
,
370 uintN additionalFlags
)
372 JSDProperty
* jsdprop
;
374 if(!(jsdprop
= (JSDProperty
*) calloc(1, sizeof(JSDProperty
))))
377 JS_INIT_CLIST(&jsdprop
->links
);
379 jsdprop
->flags
= pd
->flags
| additionalFlags
;
380 jsdprop
->slot
= pd
->slot
;
382 if(!(jsdprop
->name
= jsd_NewValue(jsdc
, pd
->id
)))
385 if(!(jsdprop
->val
= jsd_NewValue(jsdc
, pd
->value
)))
388 if((jsdprop
->flags
& JSDPD_ALIAS
) &&
389 !(jsdprop
->alias
= jsd_NewValue(jsdc
, pd
->alias
)))
394 jsd_DropProperty(jsdc
, jsdprop
);
398 static void _freeProps(JSDContext
* jsdc
, JSDValue
* jsdval
)
400 JSDProperty
* jsdprop
;
402 while(jsdprop
= (JSDProperty
*)jsdval
->props
.next
,
403 jsdprop
!= (JSDProperty
*)&jsdval
->props
)
405 JS_REMOVE_AND_INIT_LINK(&jsdprop
->links
);
406 jsd_DropProperty(jsdc
, jsdprop
);
408 JS_ASSERT(JS_CLIST_IS_EMPTY(&jsdval
->props
));
409 CLEAR_BIT_FLAG(jsdval
->flags
, GOT_PROPS
);
412 static JSBool
_buildProps(JSDContext
* jsdc
, JSDValue
* jsdval
)
414 JSContext
* cx
= jsdc
->dumbContext
;
416 JSPropertyDescArray pda
;
418 JSCrossCompartmentCall
*call
= NULL
;
420 JS_ASSERT(JS_CLIST_IS_EMPTY(&jsdval
->props
));
421 JS_ASSERT(!(CHECK_BIT_FLAG(jsdval
->flags
, GOT_PROPS
)));
422 JS_ASSERT(JSVAL_IS_OBJECT(jsdval
->val
));
424 if(JSVAL_IS_PRIMITIVE(jsdval
->val
))
427 obj
= JSVAL_TO_OBJECT(jsdval
->val
);
430 call
= JS_EnterCrossCompartmentCall(jsdc
->dumbContext
, obj
);
433 JS_EndRequest(jsdc
->dumbContext
);
437 if(!JS_GetPropertyDescArray(cx
, obj
, &pda
))
440 JS_LeaveCrossCompartmentCall(call
);
444 for(i
= 0; i
< pda
.length
; i
++)
446 JSDProperty
* prop
= _newProperty(jsdc
, &pda
.array
[i
], 0);
449 _freeProps(jsdc
, jsdval
);
452 JS_APPEND_LINK(&prop
->links
, &jsdval
->props
);
454 JS_PutPropertyDescArray(cx
, &pda
);
455 JS_LeaveCrossCompartmentCall(call
);
457 SET_BIT_FLAG(jsdval
->flags
, GOT_PROPS
);
458 return !JS_CLIST_IS_EMPTY(&jsdval
->props
);
461 #undef DROP_CLEAR_VALUE
462 #define DROP_CLEAR_VALUE(jsdc, x) if(x){jsd_DropValue(jsdc,x); x = NULL;}
465 jsd_RefreshValue(JSDContext
* jsdc
, JSDValue
* jsdval
)
467 JSContext
* cx
= jsdc
->dumbContext
;
468 JSCrossCompartmentCall
*call
= NULL
;
472 /* if the jsval is a string, then we didn't need to root the string */
473 if(!JSVAL_IS_STRING(jsdval
->val
))
476 call
= JS_EnterCrossCompartmentCall(cx
, jsdc
->glob
);
483 JS_RemoveStringRoot(cx
, &jsdval
->string
);
484 JS_LeaveCrossCompartmentCall(call
);
487 jsdval
->string
= NULL
;
490 jsdval
->funName
= NULL
;
491 jsdval
->className
= NULL
;
492 DROP_CLEAR_VALUE(jsdc
, jsdval
->proto
);
493 DROP_CLEAR_VALUE(jsdc
, jsdval
->parent
);
494 DROP_CLEAR_VALUE(jsdc
, jsdval
->ctor
);
495 _freeProps(jsdc
, jsdval
);
499 /***************************************************************************/
502 jsd_GetCountOfProperties(JSDContext
* jsdc
, JSDValue
* jsdval
)
504 JSDProperty
* jsdprop
;
507 if(!(CHECK_BIT_FLAG(jsdval
->flags
, GOT_PROPS
)))
508 if(!_buildProps(jsdc
, jsdval
))
511 for(jsdprop
= (JSDProperty
*)jsdval
->props
.next
;
512 jsdprop
!= (JSDProperty
*)&jsdval
->props
;
513 jsdprop
= (JSDProperty
*)jsdprop
->links
.next
)
521 jsd_IterateProperties(JSDContext
* jsdc
, JSDValue
* jsdval
, JSDProperty
**iterp
)
523 JSDProperty
* jsdprop
= *iterp
;
524 if(!(CHECK_BIT_FLAG(jsdval
->flags
, GOT_PROPS
)))
527 if(!_buildProps(jsdc
, jsdval
))
532 jsdprop
= (JSDProperty
*)jsdval
->props
.next
;
533 if(jsdprop
== (JSDProperty
*)&jsdval
->props
)
535 *iterp
= (JSDProperty
*)jsdprop
->links
.next
;
543 jsd_GetValueProperty(JSDContext
* jsdc
, JSDValue
* jsdval
, JSString
* name
)
545 JSContext
* cx
= jsdc
->dumbContext
;
546 JSDProperty
* jsdprop
;
547 JSDProperty
* iter
= NULL
;
552 const jschar
* nameChars
;
556 JSCrossCompartmentCall
*call
= NULL
;
558 if(!jsd_IsValueObject(jsdc
, jsdval
))
561 /* If we already have the prop, then return it */
562 while(NULL
!= (jsdprop
= jsd_IterateProperties(jsdc
, jsdval
, &iter
)))
564 JSString
* propName
= jsd_GetValueString(jsdc
, jsdprop
->name
);
565 if(propName
&& !JS_CompareStrings(propName
, name
))
567 JSD_DropProperty(jsdc
, jsdprop
);
569 /* Not found in property list, look it up explicitly */
571 if(!(obj
= JSVAL_TO_OBJECT(jsdval
->val
)))
574 nameChars
= JS_GetStringChars(name
);
575 nameLen
= JS_GetStringLength(name
);
578 call
= JS_EnterCrossCompartmentCall(cx
, obj
);
585 JS_GetUCPropertyAttributes(cx
, obj
, nameChars
, nameLen
, &attrs
, &found
);
588 JS_LeaveCrossCompartmentCall(call
);
593 JS_ClearPendingException(cx
);
595 if(!JS_GetUCProperty(cx
, obj
, nameChars
, nameLen
, &val
))
597 if (JS_IsExceptionPending(cx
))
599 if (!JS_GetPendingException(cx
, &pd
.value
))
601 JS_LeaveCrossCompartmentCall(call
);
605 pd
.flags
= JSPD_EXCEPTION
;
609 pd
.flags
= JSPD_ERROR
;
610 pd
.value
= JSVAL_VOID
;
618 JS_LeaveCrossCompartmentCall(call
);
621 nameval
= STRING_TO_JSVAL(name
);
622 if (!JS_ValueToId(cx
, nameval
, &nameid
) ||
623 !JS_IdToValue(cx
, nameid
, &pd
.id
)) {
627 pd
.slot
= pd
.spare
= 0;
628 pd
.alias
= JSVAL_NULL
;
629 pd
.flags
|= (attrs
& JSPROP_ENUMERATE
) ? JSPD_ENUMERATE
: 0
630 | (attrs
& JSPROP_READONLY
) ? JSPD_READONLY
: 0
631 | (attrs
& JSPROP_PERMANENT
) ? JSPD_PERMANENT
: 0;
633 return _newProperty(jsdc
, &pd
, JSDPD_HINTED
);
638 jsd_GetValuePrototype(JSDContext
* jsdc
, JSDValue
* jsdval
)
640 JSCrossCompartmentCall
*call
= NULL
;
642 if(!(CHECK_BIT_FLAG(jsdval
->flags
, GOT_PROTO
)))
646 JS_ASSERT(!jsdval
->proto
);
647 SET_BIT_FLAG(jsdval
->flags
, GOT_PROTO
);
648 if(!JSVAL_IS_OBJECT(jsdval
->val
))
650 if(!(obj
= JSVAL_TO_OBJECT(jsdval
->val
)))
652 JS_BeginRequest(jsdc
->dumbContext
);
653 call
= JS_EnterCrossCompartmentCall(jsdc
->dumbContext
, obj
);
655 JS_EndRequest(jsdc
->dumbContext
);
659 proto
= JS_GetPrototype(jsdc
->dumbContext
, obj
);
660 JS_LeaveCrossCompartmentCall(call
);
661 JS_EndRequest(jsdc
->dumbContext
);
664 jsdval
->proto
= jsd_NewValue(jsdc
, OBJECT_TO_JSVAL(proto
));
667 jsdval
->proto
->nref
++;
668 return jsdval
->proto
;
672 jsd_GetValueParent(JSDContext
* jsdc
, JSDValue
* jsdval
)
674 JSCrossCompartmentCall
*call
= NULL
;
676 if(!(CHECK_BIT_FLAG(jsdval
->flags
, GOT_PARENT
)))
680 JS_ASSERT(!jsdval
->parent
);
681 SET_BIT_FLAG(jsdval
->flags
, GOT_PARENT
);
682 if(!JSVAL_IS_OBJECT(jsdval
->val
))
684 if(!(obj
= JSVAL_TO_OBJECT(jsdval
->val
)))
686 JS_BeginRequest(jsdc
->dumbContext
);
687 call
= JS_EnterCrossCompartmentCall(jsdc
->dumbContext
, obj
);
689 JS_EndRequest(jsdc
->dumbContext
);
693 parent
= JS_GetParent(jsdc
->dumbContext
,obj
);
694 JS_LeaveCrossCompartmentCall(call
);
695 JS_EndRequest(jsdc
->dumbContext
);
698 jsdval
->parent
= jsd_NewValue(jsdc
, OBJECT_TO_JSVAL(parent
));
701 jsdval
->parent
->nref
++;
702 return jsdval
->parent
;
706 jsd_GetValueConstructor(JSDContext
* jsdc
, JSDValue
* jsdval
)
708 JSCrossCompartmentCall
*call
= NULL
;
710 if(!(CHECK_BIT_FLAG(jsdval
->flags
, GOT_CTOR
)))
715 JS_ASSERT(!jsdval
->ctor
);
716 SET_BIT_FLAG(jsdval
->flags
, GOT_CTOR
);
717 if(!JSVAL_IS_OBJECT(jsdval
->val
))
719 if(!(obj
= JSVAL_TO_OBJECT(jsdval
->val
)))
721 JS_BeginRequest(jsdc
->dumbContext
);
722 call
= JS_EnterCrossCompartmentCall(jsdc
->dumbContext
, obj
);
724 JS_EndRequest(jsdc
->dumbContext
);
728 proto
= JS_GetPrototype(jsdc
->dumbContext
,obj
);
731 JS_LeaveCrossCompartmentCall(call
);
732 JS_EndRequest(jsdc
->dumbContext
);
735 ctor
= JS_GetConstructor(jsdc
->dumbContext
,proto
);
736 JS_LeaveCrossCompartmentCall(call
);
737 JS_EndRequest(jsdc
->dumbContext
);
740 jsdval
->ctor
= jsd_NewValue(jsdc
, OBJECT_TO_JSVAL(ctor
));
743 jsdval
->ctor
->nref
++;
748 jsd_GetValueClassName(JSDContext
* jsdc
, JSDValue
* jsdval
)
750 jsval val
= jsdval
->val
;
751 JSCrossCompartmentCall
*call
= NULL
;
753 if(!jsdval
->className
&& JSVAL_IS_OBJECT(val
))
756 if(!(obj
= JSVAL_TO_OBJECT(val
)))
758 JS_BeginRequest(jsdc
->dumbContext
);
759 call
= JS_EnterCrossCompartmentCall(jsdc
->dumbContext
, obj
);
761 JS_EndRequest(jsdc
->dumbContext
);
765 if(JS_GET_CLASS(jsdc
->dumbContext
, obj
))
766 jsdval
->className
= JS_GET_CLASS(jsdc
->dumbContext
, obj
)->name
;
767 JS_LeaveCrossCompartmentCall(call
);
768 JS_EndRequest(jsdc
->dumbContext
);
770 return jsdval
->className
;
774 jsd_GetScriptForValue(JSDContext
* jsdc
, JSDValue
* jsdval
)
776 JSContext
* cx
= jsdc
->dumbContext
;
777 jsval val
= jsdval
->val
;
778 JSFunction
* fun
= NULL
;
779 JSExceptionState
* exceptionState
;
780 JSScript
* script
= NULL
;
781 JSDScript
* jsdscript
;
782 JSCrossCompartmentCall
*call
= NULL
;
784 if (!jsd_IsValueFunction(jsdc
, jsdval
))
788 call
= JS_EnterCrossCompartmentCall(cx
, JSVAL_TO_OBJECT(val
));
795 exceptionState
= JS_SaveExceptionState(cx
);
796 fun
= JS_ValueToFunction(cx
, val
);
797 JS_RestoreExceptionState(cx
, exceptionState
);
799 script
= JS_GetFunctionScript(cx
, fun
);
800 JS_LeaveCrossCompartmentCall(call
);
806 JSD_LOCK_SCRIPTS(jsdc
);
807 jsdscript
= jsd_FindJSDScript(jsdc
, script
);
808 JSD_UNLOCK_SCRIPTS(jsdc
);
813 /***************************************************************************/
814 /***************************************************************************/
817 jsd_GetPropertyName(JSDContext
* jsdc
, JSDProperty
* jsdprop
)
819 jsdprop
->name
->nref
++;
820 return jsdprop
->name
;
824 jsd_GetPropertyValue(JSDContext
* jsdc
, JSDProperty
* jsdprop
)
826 jsdprop
->val
->nref
++;
831 jsd_GetPropertyAlias(JSDContext
* jsdc
, JSDProperty
* jsdprop
)
834 jsdprop
->alias
->nref
++;
835 return jsdprop
->alias
;
839 jsd_GetPropertyFlags(JSDContext
* jsdc
, JSDProperty
* jsdprop
)
841 return jsdprop
->flags
;
845 jsd_GetPropertyVarArgSlot(JSDContext
* jsdc
, JSDProperty
* jsdprop
)
847 return jsdprop
->slot
;
851 jsd_DropProperty(JSDContext
* jsdc
, JSDProperty
* jsdprop
)
853 JS_ASSERT(jsdprop
->nref
> 0);
854 if(0 == --jsdprop
->nref
)
856 JS_ASSERT(JS_CLIST_IS_EMPTY(&jsdprop
->links
));
857 DROP_CLEAR_VALUE(jsdc
, jsdprop
->val
);
858 DROP_CLEAR_VALUE(jsdc
, jsdprop
->name
);
859 DROP_CLEAR_VALUE(jsdc
, jsdprop
->alias
);