From 4a1468f8c2f7ab60ff3d69174013e65bc327ec02 Mon Sep 17 00:00:00 2001 From: "rginda%netscape.com" Date: Fri, 16 Aug 2002 05:11:36 +0000 Subject: [PATCH] apply scole@planetweb.com's fix for JS_InitClass (bug 162946) --- js/docs/jsref.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/docs/jsref.xml b/js/docs/jsref.xml index 0989296e565..4ed54339337 100644 --- a/js/docs/jsref.xml +++ b/js/docs/jsref.xml @@ -3233,7 +3233,7 @@ JSObject * JS_InitClass(JSContext *cx, JSObject *obj, JS_InitClass builds a class structure, its object constructor, its prototype, its properties, and its methods. A class is an internal JS structure that is not exposed outside the JS engine. You can use a class, its properties, methods, and prototypes to build other objects that are exposed outside the engine.

- JS_InitClass returns a pointer to a JS object that represents the newly created class. If JS_InitClass fails, then the pointer returned is NULL.

+ JS_InitClass returns a pointer to a JS object that is the prototype for the newly initialized class. If JS_InitClass fails, then the pointer returned is NULL.

A class is comprised of a class structure, a constructor, a prototype object, and properties and functions. The class structure specifies the name of the class, its flags, and its property functions. These include functions for adding and deleting properties, getting and setting property values, and enumerating converting, resolving, and finalizing its properties.

The constructor for the class is built in the same context as cx, and in the same scope as obj. If you pass NULL to JS_InitClass, then a constructor is not built, and you cannot specify static properties and functions for the class.

If you provide a constructor for the class, then you should also pass an object to parent_proto. JS_InitClass uses parent_proto to build a prototype accessor object for the class. The accessor object is modeled on the prototype object you provide. If the accessor object is successfully created, JS_InitClass returns a pointer to the JS object. Otherwise it returns NULL, indicating failure to create the accessor object, and therefore failure to create the class itself.