зеркало из https://github.com/mozilla/pjs.git
apply scole@planetweb.com's fix for JS_InitClass (bug 162946)
This commit is contained in:
Родитель
9aaa215d2b
Коммит
4a1468f8c2
|
@ -3233,7 +3233,7 @@ JSObject * JS_InitClass(JSContext *cx, JSObject *obj,
|
|||
</SYNTAX>
|
||||
<DESCRIPTION>
|
||||
<C>JS_InitClass</C> 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.<P/>
|
||||
<C>JS_InitClass</C> returns a pointer to a JS object that represents the newly created class. If <C>JS_InitClass</C> fails, then the pointer returned is <C>NULL</C>.<P/>
|
||||
<C>JS_InitClass</C> returns a pointer to a JS object that is the prototype for the newly initialized class. If <C>JS_InitClass</C> fails, then the pointer returned is <C>NULL</C>.<P/>
|
||||
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.<P/>
|
||||
The constructor for the class is built in the same context as <C>cx</C>, and in the same scope as <C>obj</C>. If you pass <C>NULL</C> to <C>JS_InitClass</C>, then a constructor is not built, and you cannot specify static properties and functions for the class.<P/>
|
||||
If you provide a constructor for the class, then you should also pass an object to <C>parent_proto</C>. <C>JS_InitClass</C> uses <C>parent_proto</C> 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, <C>JS_InitClass</C> returns a pointer to the JS object. Otherwise it returns <C>NULL</C>, indicating failure to create the accessor object, and therefore failure to create the class itself.<P/>
|
||||
|
|
Загрузка…
Ссылка в новой задаче