bool GlobalObject::initStandardClasses(JSContext *cx) { JSAtomState &state = cx->runtime->atomState; /* Define a top-level property 'undefined' with the undefined value. */ if (!defineProperty(cx, state.typeAtoms[JSTYPE_VOID], UndefinedValue(), JS_PropertyStub, JS_StrictPropertyStub, JSPROP_PERMANENT | JSPROP_READONLY)) { return false; } if (!initFunctionAndObjectClasses(cx)) return false; /* Initialize the rest of the standard objects and functions. */ return js_InitArrayClass(cx, this) && js_InitBooleanClass(cx, this) && js_InitExceptionClasses(cx, this) && js_InitMathClass(cx, this) && js_InitNumberClass(cx, this) && js_InitJSONClass(cx, this) && js_InitRegExpClass(cx, this) && js_InitStringClass(cx, this) && js_InitTypedArrayClasses(cx, this) && #if JS_HAS_XML_SUPPORT js_InitXMLClasses(cx, this) && #endif #if JS_HAS_GENERATORS js_InitIteratorClasses(cx, this) && #endif js_InitDateClass(cx, this) && js_InitProxyClass(cx, this); }
/* static */ bool GlobalObject::initStandardClasses(JSContext *cx, Handle<GlobalObject*> global) { JSAtomState &state = cx->runtime->atomState; /* Define a top-level property 'undefined' with the undefined value. */ RootedValue undefinedValue(cx, UndefinedValue()); if (!global->defineProperty(cx, state.typeAtoms[JSTYPE_VOID], undefinedValue, JS_PropertyStub, JS_StrictPropertyStub, JSPROP_PERMANENT | JSPROP_READONLY)) { return false; } if (!global->initFunctionAndObjectClasses(cx)) return false; /* Initialize the rest of the standard objects and functions. */ return js_InitArrayClass(cx, global) && js_InitBooleanClass(cx, global) && js_InitExceptionClasses(cx, global) && js_InitMathClass(cx, global) && js_InitNumberClass(cx, global) && js_InitJSONClass(cx, global) && js_InitRegExpClass(cx, global) && js_InitStringClass(cx, global) && js_InitTypedArrayClasses(cx, global) && #if JS_HAS_XML_SUPPORT (!VersionHasAllowXML(cx->findVersion()) || js_InitXMLClasses(cx, global)) && #endif js_InitIteratorClasses(cx, global) && js_InitDateClass(cx, global) && js_InitWeakMapClass(cx, global) && js_InitProxyClass(cx, global) && js_InitMapClass(cx, global) && GlobalObject::initMapIteratorProto(cx, global) && js_InitSetClass(cx, global) && GlobalObject::initSetIteratorProto(cx, global); }
bool GlobalObject::initStandardClasses(JSContext *cx) { /* Native objects get their reserved slots from birth. */ JS_ASSERT(numSlots() >= JSSLOT_FREE(getClass())); JSAtomState &state = cx->runtime->atomState; /* Define a top-level property 'undefined' with the undefined value. */ if (!defineProperty(cx, ATOM_TO_JSID(state.typeAtoms[JSTYPE_VOID]), UndefinedValue(), PropertyStub, StrictPropertyStub, JSPROP_PERMANENT | JSPROP_READONLY)) { return false; } if (!js_InitFunctionAndObjectClasses(cx, this)) return false; /* Initialize the rest of the standard objects and functions. */ return js_InitArrayClass(cx, this) && js_InitBooleanClass(cx, this) && js_InitExceptionClasses(cx, this) && js_InitMathClass(cx, this) && js_InitNumberClass(cx, this) && js_InitJSONClass(cx, this) && js_InitRegExpClass(cx, this) && js_InitStringClass(cx, this) && js_InitTypedArrayClasses(cx, this) && #if JS_HAS_XML_SUPPORT js_InitXMLClasses(cx, this) && #endif #if JS_HAS_GENERATORS js_InitIteratorClasses(cx, this) && #endif js_InitDateClass(cx, this) && js_InitProxyClass(cx, this); }