1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 * vim: set ts=8 sw=4 et tw=80:
3 *
4 * ***** BEGIN LICENSE BLOCK *****
5 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
6 *
7 * The contents of this file are subject to the Mozilla Public License Version
8 * 1.1 (the "License"); you may not use this file except in compliance with
9 * the License. You may obtain a copy of the License at
10 * http://www.mozilla.org/MPL/
11 *
12 * Software distributed under the License is distributed on an "AS IS" basis,
13 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
14 * for the specific language governing rights and limitations under the
15 * License.
16 *
17 * The Original Code is Mozilla Communicator client code, released
18 * March 31, 1998.
19 *
20 * The Initial Developer of the Original Code is
21 * Netscape Communications Corporation.
22 * Portions created by the Initial Developer are Copyright (C) 1998
23 * the Initial Developer. All Rights Reserved.
24 *
25 * Contributor(s):
26 *
27 * Alternatively, the contents of this file may be used under the terms of
28 * either of the GNU General Public License Version 2 or later (the "GPL"),
29 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
30 * in which case the provisions of the GPL or the LGPL are applicable instead
31 * of those above. If you wish to allow use of your version of this file only
32 * under the terms of either the GPL or the LGPL, and not to allow others to
33 * use your version of this file under the terms of the MPL, indicate your
34 * decision by deleting the provisions above and replace them with the notice
35 * and other provisions required by the GPL or the LGPL. If you do not delete
36 * the provisions above, a recipient may use your version of this file under
37 * the terms of any one of the MPL, the GPL or the LGPL.
38 *
39 * ***** END LICENSE BLOCK ***** */
41 #ifndef jsobj_h___
42 #define jsobj_h___
43 /*
44 * JS object definitions.
45 *
46 * A JS object consists of a possibly-shared object descriptor containing
47 * ordered property names, called the map; and a dense vector of property
48 * values, called slots. The map/slot pointer pair is GC'ed, while the map
49 * is reference counted and the slot vector is malloc'ed.
50 */
51 #include "jshash.h" /* Added by JSIFY */
52 #include "jsprvtd.h"
53 #include "jspubtd.h"
55 JS_BEGIN_EXTERN_C
57 struct JSObjectMap {
58 jsrefcount nrefs; /* count of all referencing objects */
59 JSObjectOps *ops; /* high level object operation vtable */
60 uint32 nslots; /* length of obj->slots vector */
61 uint32 freeslot; /* index of next free obj->slots element */
62 };
64 /* Shorthand macros for frequently-made calls. */
65 #define OBJ_LOOKUP_PROPERTY(cx,obj,id,objp,propp) \
66 (obj)->map->ops->lookupProperty(cx,obj,id,objp,propp)
67 #define OBJ_DEFINE_PROPERTY(cx,obj,id,value,getter,setter,attrs,propp) \
68 (obj)->map->ops->defineProperty(cx,obj,id,value,getter,setter,attrs,propp)
69 #define OBJ_GET_PROPERTY(cx,obj,id,vp) \
70 (obj)->map->ops->getProperty(cx,obj,id,vp)
71 #define OBJ_SET_PROPERTY(cx,obj,id,vp) \
72 (obj)->map->ops->setProperty(cx,obj,id,vp)
73 #define OBJ_GET_ATTRIBUTES(cx,obj,id,prop,attrsp) \
74 (obj)->map->ops->getAttributes(cx,obj,id,prop,attrsp)
75 #define OBJ_SET_ATTRIBUTES(cx,obj,id,prop,attrsp) \
76 (obj)->map->ops->setAttributes(cx,obj,id,prop,attrsp)
77 #define OBJ_DELETE_PROPERTY(cx,obj,id,rval) \
78 (obj)->map->ops->deleteProperty(cx,obj,id,rval)
79 #define OBJ_DEFAULT_VALUE(cx,obj,hint,vp) \
80 (obj)->map->ops->defaultValue(cx,obj,hint,vp)
81 #define OBJ_ENUMERATE(cx,obj,enum_op,statep,idp) \
82 (obj)->map->ops->enumerate(cx,obj,enum_op,statep,idp)
83 #define OBJ_CHECK_ACCESS(cx,obj,id,mode,vp,attrsp) \
84 (obj)->map->ops->checkAccess(cx,obj,id,mode,vp,attrsp)
86 /* These four are time-optimized to avoid stub calls. */
87 #define OBJ_THIS_OBJECT(cx,obj) \
88 ((obj)->map->ops->thisObject \
89 ? (obj)->map->ops->thisObject(cx,obj) \
90 : (obj))
91 #define OBJ_DROP_PROPERTY(cx,obj,prop) \
92 ((obj)->map->ops->dropProperty \
93 ? (obj)->map->ops->dropProperty(cx,obj,prop) \
94 : (void)0)
95 #define OBJ_GET_REQUIRED_SLOT(cx,obj,slot) \
96 ((obj)->map->ops->getRequiredSlot \
97 ? (obj)->map->ops->getRequiredSlot(cx, obj, slot) \
98 : JSVAL_VOID)
99 #define OBJ_SET_REQUIRED_SLOT(cx,obj,slot,v) \
100 ((obj)->map->ops->setRequiredSlot \
101 ? (obj)->map->ops->setRequiredSlot(cx, obj, slot, v) \
102 : JS_TRUE)
104 #define OBJ_TO_INNER_OBJECT(cx,obj) \
105 JS_BEGIN_MACRO \
106 JSClass *clasp_ = OBJ_GET_CLASS(cx, obj); \
107 if (clasp_->flags & JSCLASS_IS_EXTENDED) { \
108 JSExtendedClass *xclasp_ = (JSExtendedClass*)clasp_; \
109 if (xclasp_->innerObject) \
110 obj = xclasp_->innerObject(cx, obj); \
111 } \
112 JS_END_MACRO
114 /*
115 * In the original JS engine design, obj->slots pointed to a vector of length
116 * JS_INITIAL_NSLOTS words if obj->map was shared with a prototype object,
117 * else of length obj->map->nslots. With the advent of JS_GetReservedSlot,
118 * JS_SetReservedSlot, and JSCLASS_HAS_RESERVED_SLOTS (see jsapi.h), the size
119 * of the minimum length slots vector in the case where map is shared cannot
120 * be constant. This length starts at JS_INITIAL_NSLOTS, but may advance to
121 * include all the reserved slots.
122 *
123 * Therefore slots must be self-describing. Rather than tag its low order bit
124 * (a bit is all we need) to distinguish initial length from reserved length,
125 * we do "the BSTR thing": over-allocate slots by one jsval, and store the
126 * *net* length (counting usable slots, which have non-negative obj->slots[]
127 * indices) in obj->slots[-1]. All code that sets obj->slots must be aware of
128 * this hack -- you have been warned, and jsobj.c has been updated!
129 */
130 struct JSObject {
131 JSObjectMap *map;
132 jsval *slots;
133 };
135 #define JSSLOT_PROTO 0
136 #define JSSLOT_PARENT 1
137 #define JSSLOT_CLASS 2
138 #define JSSLOT_PRIVATE 3
139 #define JSSLOT_START(clasp) (((clasp)->flags & JSCLASS_HAS_PRIVATE) \
140 ? JSSLOT_PRIVATE + 1 \
141 : JSSLOT_CLASS + 1)
143 #define JSSLOT_FREE(clasp) (JSSLOT_START(clasp) \
144 + JSCLASS_RESERVED_SLOTS(clasp))
146 #define JS_INITIAL_NSLOTS 5
148 #ifdef DEBUG
149 #define MAP_CHECK_SLOT(map,slot) \
150 JS_ASSERT((uint32)slot < JS_MIN((map)->freeslot, (map)->nslots))
151 #define OBJ_CHECK_SLOT(obj,slot) \
152 MAP_CHECK_SLOT((obj)->map, slot)
153 #else
154 #define OBJ_CHECK_SLOT(obj,slot) ((void)0)
155 #endif
157 /* Fast macros for accessing obj->slots while obj is locked (if thread-safe). */
158 #define LOCKED_OBJ_GET_SLOT(obj,slot) \
159 (OBJ_CHECK_SLOT(obj, slot), (obj)->slots[slot])
160 #define LOCKED_OBJ_SET_SLOT(obj,slot,value) \
161 (OBJ_CHECK_SLOT(obj, slot), (obj)->slots[slot] = (value))
162 #define LOCKED_OBJ_GET_PROTO(obj) \
163 JSVAL_TO_OBJECT(LOCKED_OBJ_GET_SLOT(obj, JSSLOT_PROTO))
164 #define LOCKED_OBJ_GET_CLASS(obj) \
165 ((JSClass *)JSVAL_TO_PRIVATE(LOCKED_OBJ_GET_SLOT(obj, JSSLOT_CLASS)))
167 #ifdef JS_THREADSAFE
169 /* Thread-safe functions and wrapper macros for accessing obj->slots. */
170 #define OBJ_GET_SLOT(cx,obj,slot) \
171 (OBJ_CHECK_SLOT(obj, slot), \
172 (OBJ_IS_NATIVE(obj) && OBJ_SCOPE(obj)->ownercx == cx) \
173 ? LOCKED_OBJ_GET_SLOT(obj, slot) \
174 : js_GetSlotThreadSafe(cx, obj, slot))
176 #define OBJ_SET_SLOT(cx,obj,slot,value) \
177 (OBJ_CHECK_SLOT(obj, slot), \
178 (OBJ_IS_NATIVE(obj) && OBJ_SCOPE(obj)->ownercx == cx) \
179 ? (void) LOCKED_OBJ_SET_SLOT(obj, slot, value) \
180 : js_SetSlotThreadSafe(cx, obj, slot, value))
182 /*
183 * If thread-safe, define an OBJ_GET_SLOT wrapper that bypasses, for a native
184 * object, the lock-free "fast path" test of (OBJ_SCOPE(obj)->ownercx == cx),
185 * to avoid needlessly switching from lock-free to lock-full scope when doing
186 * GC on a different context from the last one to own the scope. The caller
187 * in this case is probably a JSClass.mark function, e.g., fun_mark, or maybe
188 * a finalizer.
189 *
190 * The GC runs only when all threads except the one on which the GC is active
191 * are suspended at GC-safe points, so there is no hazard in directly accessing
192 * obj->slots[slot] from the GC's thread, once rt->gcRunning has been set. See
193 * jsgc.c for details.
194 */
195 #define THREAD_IS_RUNNING_GC(rt, thread) \
196 ((rt)->gcRunning && (rt)->gcThread == (thread))
198 #define CX_THREAD_IS_RUNNING_GC(cx) \
199 THREAD_IS_RUNNING_GC((cx)->runtime, (cx)->thread)
201 #define GC_AWARE_GET_SLOT(cx, obj, slot) \
202 ((OBJ_IS_NATIVE(obj) && CX_THREAD_IS_RUNNING_GC(cx)) \
203 ? (obj)->slots[slot] \
204 : OBJ_GET_SLOT(cx, obj, slot))
206 #else /* !JS_THREADSAFE */
208 #define OBJ_GET_SLOT(cx,obj,slot) LOCKED_OBJ_GET_SLOT(obj,slot)
209 #define OBJ_SET_SLOT(cx,obj,slot,value) LOCKED_OBJ_SET_SLOT(obj,slot,value)
210 #define GC_AWARE_GET_SLOT(cx,obj,slot) LOCKED_OBJ_GET_SLOT(obj,slot)
212 #endif /* !JS_THREADSAFE */
214 /* Thread-safe proto, parent, and class access macros. */
215 #define OBJ_GET_PROTO(cx,obj) \
216 JSVAL_TO_OBJECT(OBJ_GET_SLOT(cx, obj, JSSLOT_PROTO))
217 #define OBJ_SET_PROTO(cx,obj,proto) \
218 OBJ_SET_SLOT(cx, obj, JSSLOT_PROTO, OBJECT_TO_JSVAL(proto))
220 #define OBJ_GET_PARENT(cx,obj) \
221 JSVAL_TO_OBJECT(OBJ_GET_SLOT(cx, obj, JSSLOT_PARENT))
222 #define OBJ_SET_PARENT(cx,obj,parent) \
223 OBJ_SET_SLOT(cx, obj, JSSLOT_PARENT, OBJECT_TO_JSVAL(parent))
225 #define OBJ_GET_CLASS(cx,obj) \
226 ((JSClass *)JSVAL_TO_PRIVATE(OBJ_GET_SLOT(cx, obj, JSSLOT_CLASS)))
228 /* Test whether a map or object is native. */
229 #define MAP_IS_NATIVE(map) \
230 ((map)->ops == &js_ObjectOps || \
231 ((map)->ops && (map)->ops->newObjectMap == js_ObjectOps.newObjectMap))
233 #define OBJ_IS_NATIVE(obj) MAP_IS_NATIVE((obj)->map)
235 extern JS_FRIEND_DATA(JSObjectOps) js_ObjectOps;
236 extern JS_FRIEND_DATA(JSObjectOps) js_WithObjectOps;
237 extern JSClass js_ObjectClass;
238 extern JSClass js_WithClass;
240 extern JSObject *
241 js_NewWithObject(JSContext *cx, JSObject *proto, JSObject *parent, jsint depth);
243 /*
244 * A With object is like a Block object, in that both have one reserved slot
245 * telling the stack depth of the relevant slots (the slot whose value is the
246 * object named in the with statement, the slots containing the block's local
247 * variables); and both have a private slot referring to the JSStackFrame in
248 * whose activation they were created (or null if the with or block object
249 * outlives the frame).
250 */
251 #define JSSLOT_BLOCK_DEPTH (JSSLOT_PRIVATE + 1)
253 #define OBJ_BLOCK_DEPTH(cx,obj) \
254 JSVAL_TO_INT(OBJ_GET_SLOT(cx, obj, JSSLOT_BLOCK_DEPTH))
255 #define OBJ_SET_BLOCK_DEPTH(cx,obj,depth) \
256 OBJ_SET_SLOT(cx, obj, JSSLOT_BLOCK_DEPTH, INT_TO_JSVAL(depth))
258 struct JSSharpObjectMap {
259 jsrefcount depth;
260 jsatomid sharpgen;
261 JSHashTable *table;
262 };
264 #define SHARP_BIT ((jsatomid) 1)
265 #define BUSY_BIT ((jsatomid) 2)
266 #define SHARP_ID_SHIFT 2
267 #define IS_SHARP(he) (JS_PTR_TO_UINT32((he)->value) & SHARP_BIT)
268 #define MAKE_SHARP(he) ((he)->value = JS_UINT32_TO_PTR(JS_PTR_TO_UINT32((he)->value)|SHARP_BIT))
269 #define IS_BUSY(he) (JS_PTR_TO_UINT32((he)->value) & BUSY_BIT)
270 #define MAKE_BUSY(he) ((he)->value = JS_UINT32_TO_PTR(JS_PTR_TO_UINT32((he)->value)|BUSY_BIT))
271 #define CLEAR_BUSY(he) ((he)->value = JS_UINT32_TO_PTR(JS_PTR_TO_UINT32((he)->value)&~BUSY_BIT))
273 extern JSHashEntry *
274 js_EnterSharpObject(JSContext *cx, JSObject *obj, JSIdArray **idap,
275 jschar **sp);
277 extern void
278 js_LeaveSharpObject(JSContext *cx, JSIdArray **idap);
280 /*
281 * Mark objects stored in map if GC happens between js_EnterSharpObject
282 * and js_LeaveSharpObject. GC calls this when map->depth > 0.
283 */
284 extern void
285 js_GCMarkSharpMap(JSContext *cx, JSSharpObjectMap *map);
287 extern JSBool
288 js_obj_toSource(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
289 jsval *rval);
291 extern JSBool
292 js_obj_toString(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
293 jsval *rval);
295 extern JSBool
296 js_HasOwnPropertyHelper(JSContext *cx, JSObject *obj, JSLookupPropOp lookup,
297 uintN argc, jsval *argv, jsval *rval);
299 extern JSObject *
300 js_InitObjectClass(JSContext *cx, JSObject *obj);
302 /* Select Object.prototype method names shared between jsapi.c and jsobj.c. */
303 extern const char js_watch_str[];
304 extern const char js_unwatch_str[];
305 extern const char js_hasOwnProperty_str[];
306 extern const char js_isPrototypeOf_str[];
307 extern const char js_propertyIsEnumerable_str[];
308 extern const char js_defineGetter_str[];
309 extern const char js_defineSetter_str[];
310 extern const char js_lookupGetter_str[];
311 extern const char js_lookupSetter_str[];
313 extern void
314 js_InitObjectMap(JSObjectMap *map, jsrefcount nrefs, JSObjectOps *ops,
315 JSClass *clasp);
317 extern JSObjectMap *
318 js_NewObjectMap(JSContext *cx, jsrefcount nrefs, JSObjectOps *ops,
319 JSClass *clasp, JSObject *obj);
321 extern void
322 js_DestroyObjectMap(JSContext *cx, JSObjectMap *map);
324 extern JSObjectMap *
325 js_HoldObjectMap(JSContext *cx, JSObjectMap *map);
327 extern JSObjectMap *
328 js_DropObjectMap(JSContext *cx, JSObjectMap *map, JSObject *obj);
330 extern JSObject *
331 js_NewObject(JSContext *cx, JSClass *clasp, JSObject *proto, JSObject *parent);
333 extern JSBool
334 js_FindConstructor(JSContext *cx, JSObject *start, const char *name, jsval *vp);
336 extern JSObject *
337 js_ConstructObject(JSContext *cx, JSClass *clasp, JSObject *proto,
338 JSObject *parent, uintN argc, jsval *argv);
340 extern void
341 js_FinalizeObject(JSContext *cx, JSObject *obj);
343 extern JSBool
344 js_AllocSlot(JSContext *cx, JSObject *obj, uint32 *slotp);
346 extern void
347 js_FreeSlot(JSContext *cx, JSObject *obj, uint32 slot);
349 /*
350 * Native property add and lookup variants that hide id in the hidden atom
351 * subspace, so as to avoid collisions between internal properties such as
352 * formal arguments and local variables in function objects, and externally
353 * set properties with the same ids.
354 */
355 extern JSScopeProperty *
356 js_AddHiddenProperty(JSContext *cx, JSObject *obj, jsid id,
357 JSPropertyOp getter, JSPropertyOp setter, uint32 slot,
358 uintN attrs, uintN flags, intN shortid);
360 extern JSBool
361 js_LookupHiddenProperty(JSContext *cx, JSObject *obj, jsid id, JSObject **objp,
362 JSProperty **propp);
364 /*
365 * Find or create a property named by id in obj's scope, with the given getter
366 * and setter, slot, attributes, and other members.
367 */
368 extern JSScopeProperty *
369 js_AddNativeProperty(JSContext *cx, JSObject *obj, jsid id,
370 JSPropertyOp getter, JSPropertyOp setter, uint32 slot,
371 uintN attrs, uintN flags, intN shortid);
373 /*
374 * Change sprop to have the given attrs, getter, and setter in scope, morphing
375 * it into a potentially new JSScopeProperty. Return a pointer to the changed
376 * or identical property.
377 */
378 extern JSScopeProperty *
379 js_ChangeNativePropertyAttrs(JSContext *cx, JSObject *obj,
380 JSScopeProperty *sprop, uintN attrs, uintN mask,
381 JSPropertyOp getter, JSPropertyOp setter);
383 /*
384 * On error, return false. On success, if propp is non-null, return true with
385 * obj locked and with a held property in *propp; if propp is null, return true
386 * but release obj's lock first. Therefore all callers who pass non-null propp
387 * result parameters must later call OBJ_DROP_PROPERTY(cx, obj, *propp) both to
388 * drop the held property, and to release the lock on obj.
389 */
390 extern JSBool
391 js_DefineProperty(JSContext *cx, JSObject *obj, jsid id, jsval value,
392 JSPropertyOp getter, JSPropertyOp setter, uintN attrs,
393 JSProperty **propp);
395 extern JSBool
396 js_DefineNativeProperty(JSContext *cx, JSObject *obj, jsid id, jsval value,
397 JSPropertyOp getter, JSPropertyOp setter, uintN attrs,
398 uintN flags, intN shortid, JSProperty **propp);
400 /*
401 * Unlike js_DefineProperty, propp must be non-null. On success, and if id was
402 * found, return true with *objp non-null and locked, and with a held property
403 * stored in *propp. If successful but id was not found, return true with both
404 * *objp and *propp null. Therefore all callers who receive a non-null *propp
405 * must later call OBJ_DROP_PROPERTY(cx, *objp, *propp).
406 */
407 extern JS_FRIEND_API(JSBool)
408 js_LookupProperty(JSContext *cx, JSObject *obj, jsid id, JSObject **objp,
409 JSProperty **propp);
411 /*
412 * Specialized subroutine that allows caller to preset JSRESOLVE_* flags.
413 */
414 extern JSBool
415 js_LookupPropertyWithFlags(JSContext *cx, JSObject *obj, jsid id, uintN flags,
416 JSObject **objp, JSProperty **propp);
418 extern JS_FRIEND_API(JSBool)
419 js_FindProperty(JSContext *cx, jsid id, JSObject **objp, JSObject **pobjp,
420 JSProperty **propp);
422 extern JSObject *
423 js_FindIdentifierBase(JSContext *cx, jsid id);
425 extern JSObject *
426 js_FindVariableScope(JSContext *cx, JSFunction **funp);
428 extern JSBool
429 js_GetProperty(JSContext *cx, JSObject *obj, jsid id, jsval *vp);
431 extern JSBool
432 js_SetProperty(JSContext *cx, JSObject *obj, jsid id, jsval *vp);
434 extern JSBool
435 js_GetAttributes(JSContext *cx, JSObject *obj, jsid id, JSProperty *prop,
436 uintN *attrsp);
438 extern JSBool
439 js_SetAttributes(JSContext *cx, JSObject *obj, jsid id, JSProperty *prop,
440 uintN *attrsp);
442 extern JSBool
443 js_DeleteProperty(JSContext *cx, JSObject *obj, jsid id, jsval *rval);
445 extern JSBool
446 js_DefaultValue(JSContext *cx, JSObject *obj, JSType hint, jsval *vp);
448 extern JSIdArray *
449 js_NewIdArray(JSContext *cx, jsint length);
451 /*
452 * Unlike realloc(3), this function frees ida on failure.
453 */
454 extern JSIdArray *
455 js_SetIdArrayLength(JSContext *cx, JSIdArray *ida, jsint length);
457 extern JSBool
458 js_Enumerate(JSContext *cx, JSObject *obj, JSIterateOp enum_op,
459 jsval *statep, jsid *idp);
461 extern void
462 js_MarkNativeIteratorStates(JSContext *cx);
464 extern JSBool
465 js_CheckAccess(JSContext *cx, JSObject *obj, jsid id, JSAccessMode mode,
466 jsval *vp, uintN *attrsp);
468 extern JSBool
469 js_Call(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);
471 extern JSBool
472 js_Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
473 jsval *rval);
475 extern JSBool
476 js_HasInstance(JSContext *cx, JSObject *obj, jsval v, JSBool *bp);
478 extern JSBool
479 js_SetProtoOrParent(JSContext *cx, JSObject *obj, uint32 slot, JSObject *pobj);
481 extern JSBool
482 js_IsDelegate(JSContext *cx, JSObject *obj, jsval v, JSBool *bp);
484 extern JSBool
485 js_GetClassPrototype(JSContext *cx, const char *name, JSObject **protop);
487 extern JSBool
488 js_SetClassPrototype(JSContext *cx, JSObject *ctor, JSObject *proto,
489 uintN attrs);
491 extern JSBool
492 js_ValueToObject(JSContext *cx, jsval v, JSObject **objp);
494 extern JSObject *
495 js_ValueToNonNullObject(JSContext *cx, jsval v);
497 extern JSBool
498 js_TryValueOf(JSContext *cx, JSObject *obj, JSType type, jsval *rval);
500 extern JSBool
501 js_TryMethod(JSContext *cx, JSObject *obj, JSAtom *atom,
502 uintN argc, jsval *argv, jsval *rval);
504 extern JSBool
505 js_XDRObject(JSXDRState *xdr, JSObject **objp);
507 extern uint32
508 js_Mark(JSContext *cx, JSObject *obj, void *arg);
510 extern void
511 js_Clear(JSContext *cx, JSObject *obj);
513 extern jsval
514 js_GetRequiredSlot(JSContext *cx, JSObject *obj, uint32 slot);
516 extern JSBool
517 js_SetRequiredSlot(JSContext *cx, JSObject *obj, uint32 slot, jsval v);
519 extern JSObject *
520 js_CheckScopeChainValidity(JSContext *cx, JSObject *scopeobj, const char *caller);
522 extern JSBool
523 js_CheckPrincipalsAccess(JSContext *cx, JSObject *scopeobj,
524 JSPrincipals *principals, const char *caller);
525 JS_END_EXTERN_C
527 #endif /* jsobj_h___ */