Bug 886829 - In-source comments incorrectly say JSClass::finalizer is mandatory r=billm

--HG--
extra : rebase_source : d01ba99257b2a392d332f56dfc655f6439462c1b
This commit is contained in:
Jon Coppeard 2013-07-02 09:42:01 +01:00
parent 61e0c743b1
commit 262546d6b1
3 changed files with 13 additions and 4 deletions

View File

@ -2795,7 +2795,7 @@ struct JSClass {
const char *name;
uint32_t flags;
/* Mandatory non-null function pointer members. */
/* Mandatory function pointer members. */
JSPropertyOp addProperty;
JSDeletePropertyOp delProperty;
JSPropertyOp getProperty;
@ -2803,9 +2803,9 @@ struct JSClass {
JSEnumerateOp enumerate;
JSResolveOp resolve;
JSConvertOp convert;
JSFinalizeOp finalize;
/* Optionally non-null members start here. */
/* Optional members (may be null). */
JSFinalizeOp finalize;
JSCheckAccessOp checkAccess;
JSNative call;
JSHasInstanceOp hasInstance;

View File

@ -207,9 +207,9 @@ typedef void
JSEnumerateOp enumerate; \
JSResolveOp resolve; \
JSConvertOp convert; \
FinalizeOp finalize; \
\
/* Optionally non-null members start here. */ \
FinalizeOp finalize; \
JSCheckAccessOp checkAccess; \
JSNative call; \
JSHasInstanceOp hasInstance; \

View File

@ -2402,6 +2402,15 @@ js_InitClass(JSContext *cx, HandleObject obj, JSObject *protoProto_,
{
RootedObject protoProto(cx, protoProto_);
/* Assert mandatory function pointer members. */
JS_ASSERT(clasp->addProperty);
JS_ASSERT(clasp->delProperty);
JS_ASSERT(clasp->getProperty);
JS_ASSERT(clasp->setProperty);
JS_ASSERT(clasp->enumerate);
JS_ASSERT(clasp->resolve);
JS_ASSERT(clasp->convert);
RootedAtom atom(cx, Atomize(cx, clasp->name, strlen(clasp->name)));
if (!atom)
return NULL;