author | Nicholas Nethercote <nnethercote@mozilla.com> |
Wed, 21 Aug 2013 22:26:57 -0700 | |
changeset 157351 | f8fec7c369d122af724ab6635ea81cd09f75a836 |
parent 157350 | 7f8e99aec954ac5a731b942a5cc9be2060bf6350 |
child 157352 | c2f676bad38abe7793cdb2fcf13ecd3a0ef4e214 |
push id | 2961 |
push user | lsblakk@mozilla.com |
push date | Mon, 28 Oct 2013 21:59:28 +0000 |
treeherder | mozilla-beta@73ef4f13486f [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | jwalden |
bugs | 909178 |
milestone | 26.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
js/ipc/JavaScriptParent.h | file | annotate | diff | comparison | revisions | |
js/public/Class.h | file | annotate | diff | comparison | revisions | |
js/src/jsapi-tests/testCustomIterator.cpp | file | annotate | diff | comparison | revisions | |
js/src/jsapi-tests/testIntTypesABI.cpp | file | annotate | diff | comparison | revisions | |
js/src/jsapi.h | file | annotate | diff | comparison | revisions | |
js/src/jsclass.h | file | annotate | diff | comparison | revisions | |
js/src/jsfriendapi.h | file | annotate | diff | comparison | revisions | |
js/src/jsproxy.h | file | annotate | diff | comparison | revisions | |
js/src/moz.build | file | annotate | diff | comparison | revisions | |
js/src/vm/TypedArrayObject.h | file | annotate | diff | comparison | revisions | |
xpcom/base/CycleCollectedJSRuntime.h | file | annotate | diff | comparison | revisions |
--- a/js/ipc/JavaScriptParent.h +++ b/js/ipc/JavaScriptParent.h @@ -5,17 +5,17 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #ifndef mozilla_jsipc_JavaScriptParent__ #define mozilla_jsipc_JavaScriptParent__ #include "JavaScriptShared.h" #include "mozilla/jsipc/PJavaScriptParent.h" -#include "jsclass.h" +#include "js/Class.h" #ifdef XP_WIN #undef GetClassName #undef GetClassInfo #endif namespace mozilla { namespace jsipc {
rename from js/src/jsclass.h rename to js/public/Class.h --- a/js/src/jsclass.h +++ b/js/public/Class.h @@ -1,25 +1,45 @@ /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * vim: set ts=8 sts=4 et sw=4 tw=99: * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#ifndef jsclass_h -#define jsclass_h +/* JSClass definition and its component types, plus related interfaces. */ + +#ifndef js_Class_h +#define js_Class_h + +#include "jspubtd.h" +#include "jstypes.h" + +#include "js/CallArgs.h" +#include "js/Id.h" /* * A JSClass acts as a vtable for JS objects that allows JSAPI clients to * control various aspects of the behavior of an object like property lookup. * js::Class is an engine-private extension that allows more control over * object behavior and, e.g., allows custom slow layout. */ -#include "jsapi.h" +class JSFreeOp; + +namespace JS { +template <typename T> class Handle; +template <typename T> class MutableHandle; +class Value; + +typedef JS::Handle<JSObject*> HandleObject; +typedef JS::Handle<jsid> HandleId; +typedef JS::Handle<JS::Value> HandleValue; +typedef JS::MutableHandle<JSObject*> MutableHandleObject; +typedef JS::MutableHandle<JS::Value> MutableHandleValue; +} namespace js { class Class; class FreeOp; class PropertyId; class PropertyName; class Shape; @@ -129,78 +149,261 @@ JSID_TO_SPECIALID(jsid id) if (JSID_IS_EMPTY(id)) return SpecialId::empty(); JS_ASSERT(JSID_IS_VOID(id)); return SpecialId::voidId(); } typedef JS::Handle<SpecialId> HandleSpecialId; +} // namespace js + +// JSClass operation signatures. + +// Add or get a property named by id in obj. Note the jsid id type -- id may +// be a string (Unicode property identifier) or an int (element index). The +// *vp out parameter, on success, is the new property value after the action. +typedef bool +(* JSPropertyOp)(JSContext *cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, + JS::MutableHandle<JS::Value> vp); + +// Set a property named by id in obj, treating the assignment as strict +// mode code if strict is true. Note the jsid id type -- id may be a string +// (Unicode property identifier) or an int (element index). The *vp out +// parameter, on success, is the new property value after the +// set. +typedef bool +(* JSStrictPropertyOp)(JSContext *cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, + bool strict, JS::MutableHandle<JS::Value> vp); + +// Delete a property named by id in obj. +// +// If an error occurred, return false as per normal JSAPI error practice. +// +// If no error occurred, but the deletion attempt wasn't allowed (perhaps +// because the property was non-configurable), set *succeeded to false and +// return true. This will cause |delete obj[id]| to evaluate to false in +// non-strict mode code, and to throw a TypeError in strict mode code. +// +// If no error occurred and the deletion wasn't disallowed (this is *not* the +// same as saying that a deletion actually occurred -- deleting a non-existent +// property, or an inherited property, is allowed -- it's just pointless), +// set *succeeded to true and return true. +typedef bool +(* JSDeletePropertyOp)(JSContext *cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, + bool *succeeded); + +// This function type is used for callbacks that enumerate the properties of +// a JSObject. The behavior depends on the value of enum_op: +// +// JSENUMERATE_INIT +// A new, opaque iterator state should be allocated and stored in *statep. +// (You can use PRIVATE_TO_JSVAL() to tag the pointer to be stored). +// +// The number of properties that will be enumerated should be returned as +// an integer jsval in *idp, if idp is non-null, and provided the number of +// enumerable properties is known. If idp is non-null and the number of +// enumerable properties can't be computed in advance, *idp should be set +// to JSVAL_ZERO. +// +// JSENUMERATE_INIT_ALL +// Used identically to JSENUMERATE_INIT, but exposes all properties of the +// object regardless of enumerability. +// +// JSENUMERATE_NEXT +// A previously allocated opaque iterator state is passed in via statep. +// Return the next jsid in the iteration using *idp. The opaque iterator +// state pointed at by statep is destroyed and *statep is set to JSVAL_NULL +// if there are no properties left to enumerate. +// +// JSENUMERATE_DESTROY +// Destroy the opaque iterator state previously allocated in *statep by a +// call to this function when enum_op was JSENUMERATE_INIT or +// JSENUMERATE_INIT_ALL. +// +// The return value is used to indicate success, with a value of false +// indicating failure. +typedef bool +(* JSNewEnumerateOp)(JSContext *cx, JS::Handle<JSObject*> obj, JSIterateOp enum_op, + JS::MutableHandle<JS::Value> statep, JS::MutableHandle<jsid> idp); + +// The old-style JSClass.enumerate op should define all lazy properties not +// yet reflected in obj. +typedef bool +(* JSEnumerateOp)(JSContext *cx, JS::Handle<JSObject*> obj); + +// Resolve a lazy property named by id in obj by defining it directly in obj. +// Lazy properties are those reflected from some peer native property space +// (e.g., the DOM attributes for a given node reflected as obj) on demand. +// +// JS looks for a property in an object, and if not found, tries to resolve +// the given id. If resolve succeeds, the engine looks again in case resolve +// defined obj[id]. If no such property exists directly in obj, the process +// is repeated with obj's prototype, etc. +// +// NB: JSNewResolveOp provides a cheaper way to resolve lazy properties. +typedef bool +(* JSResolveOp)(JSContext *cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id); + +// Like JSResolveOp, but flags provide contextual information as follows: +// +// JSRESOLVE_ASSIGNING obj[id] is on the left-hand side of an assignment +// +// The *objp out parameter, on success, should be null to indicate that id +// was not resolved; and non-null, referring to obj or one of its prototypes, +// if id was resolved. The hook may assume *objp is null on entry. +// +// This hook instead of JSResolveOp is called via the JSClass.resolve member +// if JSCLASS_NEW_RESOLVE is set in JSClass.flags. +typedef bool +(* JSNewResolveOp)(JSContext *cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, unsigned flags, + JS::MutableHandle<JSObject*> objp); + +// Convert obj to the given type, returning true with the resulting value in +// *vp on success, and returning false on error or exception. +typedef bool +(* JSConvertOp)(JSContext *cx, JS::Handle<JSObject*> obj, JSType type, + JS::MutableHandle<JS::Value> vp); + +// Finalize obj, which the garbage collector has determined to be unreachable +// from other live objects or from GC roots. Obviously, finalizers must never +// store a reference to obj. +typedef void +(* JSFinalizeOp)(JSFreeOp *fop, JSObject *obj); + +// Finalizes external strings created by JS_NewExternalString. +struct JSStringFinalizer { + void (*finalize)(const JSStringFinalizer *fin, jschar *chars); +}; + +// JSClass.checkAccess type: check whether obj[id] may be accessed per mode, +// returning false on error/exception, true on success with obj[id]'s last-got +// value in *vp, and its attributes in *attrsp. As for JSPropertyOp above, id +// is either a string or an int jsval. +typedef bool +(* JSCheckAccessOp)(JSContext *cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, + JSAccessMode mode, JS::MutableHandle<JS::Value> vp); + +// Check whether v is an instance of obj. Return false on error or exception, +// true on success with true in *bp if v is an instance of obj, false in +// *bp otherwise. +typedef bool +(* JSHasInstanceOp)(JSContext *cx, JS::Handle<JSObject*> obj, JS::MutableHandle<JS::Value> vp, + bool *bp); + +// Function type for trace operation of the class called to enumerate all +// traceable things reachable from obj's private data structure. For each such +// thing, a trace implementation must call one of the JS_Call*Tracer variants +// on the thing. +// +// JSTraceOp implementation can assume that no other threads mutates object +// state. It must not change state of the object or corresponding native +// structures. The only exception for this rule is the case when the embedding +// needs a tight integration with GC. In that case the embedding can check if +// the traversal is a part of the marking phase through calling +// JS_IsGCMarkingTracer and apply a special code like emptying caches or +// marking its native structures. +typedef void +(* JSTraceOp)(JSTracer *trc, JSObject *obj); + +// Callback that JSTraceOp implementation can provide to return a string +// describing the reference traced with JS_CallTracer. +typedef void +(* JSTraceNamePrinter)(JSTracer *trc, char *buf, size_t bufsize); + +// A generic type for functions mapping an object to another object, or null +// if an error or exception was thrown on cx. +typedef JSObject * +(* JSObjectOp)(JSContext *cx, JS::Handle<JSObject*> obj); + +// Hook that creates an iterator object for a given object. Returns the +// iterator object or null if an error or exception was thrown on cx. +typedef JSObject * +(* JSIteratorOp)(JSContext *cx, JS::HandleObject obj, bool keysonly); + +typedef JSObject * +(* JSWeakmapKeyDelegateOp)(JSObject *obj); + /* js::Class operation signatures. */ +namespace js { + typedef bool -(* LookupGenericOp)(JSContext *cx, HandleObject obj, HandleId id, - MutableHandleObject objp, JS::MutableHandle<Shape*> propp); +(* LookupGenericOp)(JSContext *cx, JS::HandleObject obj, JS::HandleId id, + JS::MutableHandleObject objp, JS::MutableHandle<Shape*> propp); typedef bool -(* LookupPropOp)(JSContext *cx, HandleObject obj, JS::Handle<PropertyName*> name, - MutableHandleObject objp, JS::MutableHandle<Shape*> propp); -typedef bool -(* LookupElementOp)(JSContext *cx, HandleObject obj, uint32_t index, - MutableHandleObject objp, JS::MutableHandle<Shape*> propp); +(* LookupPropOp)(JSContext *cx, JS::HandleObject obj, JS::Handle<PropertyName*> name, + JS::MutableHandleObject objp, JS::MutableHandle<Shape*> propp); typedef bool -(* LookupSpecialOp)(JSContext *cx, HandleObject obj, HandleSpecialId sid, - MutableHandleObject objp, JS::MutableHandle<Shape*> propp); -typedef bool -(* DefineGenericOp)(JSContext *cx, HandleObject obj, HandleId id, HandleValue value, - JSPropertyOp getter, JSStrictPropertyOp setter, unsigned attrs); +(* LookupElementOp)(JSContext *cx, JS::HandleObject obj, uint32_t index, + JS::MutableHandleObject objp, JS::MutableHandle<Shape*> propp); typedef bool -(* DefinePropOp)(JSContext *cx, HandleObject obj, JS::Handle<PropertyName*> name, HandleValue value, - JSPropertyOp getter, JSStrictPropertyOp setter, unsigned attrs); +(* LookupSpecialOp)(JSContext *cx, JS::HandleObject obj, HandleSpecialId sid, + JS::MutableHandleObject objp, JS::MutableHandle<Shape*> propp); typedef bool -(* DefineElementOp)(JSContext *cx, HandleObject obj, uint32_t index, HandleValue value, - JSPropertyOp getter, JSStrictPropertyOp setter, unsigned attrs); -typedef bool -(* DefineSpecialOp)(JSContext *cx, HandleObject obj, HandleSpecialId sid, HandleValue value, +(* DefineGenericOp)(JSContext *cx, JS::HandleObject obj, JS::HandleId id, JS::HandleValue value, JSPropertyOp getter, JSStrictPropertyOp setter, unsigned attrs); typedef bool -(* GenericIdOp)(JSContext *cx, HandleObject obj, HandleObject receiver, HandleId id, MutableHandleValue vp); -typedef bool -(* PropertyIdOp)(JSContext *cx, HandleObject obj, HandleObject receiver, JS::Handle<PropertyName*> name, MutableHandleValue vp); +(* DefinePropOp)(JSContext *cx, JS::HandleObject obj, JS::Handle<PropertyName*> name, + JS::HandleValue value, JSPropertyOp getter, JSStrictPropertyOp setter, + unsigned attrs); typedef bool -(* ElementIdOp)(JSContext *cx, HandleObject obj, HandleObject receiver, uint32_t index, MutableHandleValue vp); +(* DefineElementOp)(JSContext *cx, JS::HandleObject obj, uint32_t index, JS::HandleValue value, + JSPropertyOp getter, JSStrictPropertyOp setter, unsigned attrs); typedef bool -(* ElementIfPresentOp)(JSContext *cx, HandleObject obj, HandleObject receiver, uint32_t index, MutableHandleValue vp, bool* present); +(* DefineSpecialOp)(JSContext *cx, JS::HandleObject obj, HandleSpecialId sid, + JS::HandleValue value, JSPropertyOp getter, JSStrictPropertyOp setter, + unsigned attrs); typedef bool -(* SpecialIdOp)(JSContext *cx, HandleObject obj, HandleObject receiver, HandleSpecialId sid, MutableHandleValue vp); +(* GenericIdOp)(JSContext *cx, JS::HandleObject obj, JS::HandleObject receiver, JS::HandleId id, + JS::MutableHandleValue vp); typedef bool -(* StrictGenericIdOp)(JSContext *cx, HandleObject obj, HandleId id, MutableHandleValue vp, bool strict); +(* PropertyIdOp)(JSContext *cx, JS::HandleObject obj, JS::HandleObject receiver, + JS::Handle<PropertyName*> name, JS::MutableHandleValue vp); typedef bool -(* StrictPropertyIdOp)(JSContext *cx, HandleObject obj, JS::Handle<PropertyName*> name, MutableHandleValue vp, bool strict); +(* ElementIdOp)(JSContext *cx, JS::HandleObject obj, JS::HandleObject receiver, uint32_t index, + JS::MutableHandleValue vp); typedef bool -(* StrictElementIdOp)(JSContext *cx, HandleObject obj, uint32_t index, MutableHandleValue vp, bool strict); +(* ElementIfPresentOp)(JSContext *cx, JS::HandleObject obj, JS::HandleObject receiver, + uint32_t index, JS::MutableHandleValue vp, bool* present); +typedef bool +(* SpecialIdOp)(JSContext *cx, JS::HandleObject obj, JS::HandleObject receiver, + HandleSpecialId sid, JS::MutableHandleValue vp); typedef bool -(* StrictSpecialIdOp)(JSContext *cx, HandleObject obj, HandleSpecialId sid, MutableHandleValue vp, bool strict); +(* StrictGenericIdOp)(JSContext *cx, JS::HandleObject obj, JS::HandleId id, + JS::MutableHandleValue vp, bool strict); typedef bool -(* GenericAttributesOp)(JSContext *cx, HandleObject obj, HandleId id, unsigned *attrsp); +(* StrictPropertyIdOp)(JSContext *cx, JS::HandleObject obj, JS::Handle<PropertyName*> name, + JS::MutableHandleValue vp, bool strict); typedef bool -(* PropertyAttributesOp)(JSContext *cx, HandleObject obj, JS::Handle<PropertyName*> name, unsigned *attrsp); +(* StrictElementIdOp)(JSContext *cx, JS::HandleObject obj, uint32_t index, + JS::MutableHandleValue vp, bool strict); typedef bool -(* ElementAttributesOp)(JSContext *cx, HandleObject obj, uint32_t index, unsigned *attrsp); +(* StrictSpecialIdOp)(JSContext *cx, JS::HandleObject obj, HandleSpecialId sid, + JS::MutableHandleValue vp, bool strict); +typedef bool +(* GenericAttributesOp)(JSContext *cx, JS::HandleObject obj, JS::HandleId id, unsigned *attrsp); typedef bool -(* SpecialAttributesOp)(JSContext *cx, HandleObject obj, HandleSpecialId sid, unsigned *attrsp); +(* PropertyAttributesOp)(JSContext *cx, JS::HandleObject obj, JS::Handle<PropertyName*> name, + unsigned *attrsp); typedef bool -(* DeletePropertyOp)(JSContext *cx, HandleObject obj, JS::Handle<PropertyName*> name, bool *succeeded); +(* ElementAttributesOp)(JSContext *cx, JS::HandleObject obj, uint32_t index, unsigned *attrsp); +typedef bool +(* SpecialAttributesOp)(JSContext *cx, JS::HandleObject obj, HandleSpecialId sid, unsigned *attrsp); typedef bool -(* DeleteElementOp)(JSContext *cx, HandleObject obj, uint32_t index, bool *succeeded); +(* DeletePropertyOp)(JSContext *cx, JS::HandleObject obj, JS::Handle<PropertyName*> name, + bool *succeeded); typedef bool -(* DeleteSpecialOp)(JSContext *cx, HandleObject obj, HandleSpecialId sid, bool *succeeded); +(* DeleteElementOp)(JSContext *cx, JS::HandleObject obj, uint32_t index, bool *succeeded); +typedef bool +(* DeleteSpecialOp)(JSContext *cx, JS::HandleObject obj, HandleSpecialId sid, bool *succeeded); typedef JSObject * -(* ObjectOp)(JSContext *cx, HandleObject obj); +(* ObjectOp)(JSContext *cx, JS::HandleObject obj); typedef void (* FinalizeOp)(FreeOp *fop, JSObject *obj); #define JS_CLASS_MEMBERS \ const char *name; \ uint32_t flags; \ \ /* Mandatory function pointer members. */ \ @@ -292,16 +495,126 @@ struct ObjectOps ObjectOp thisObject; }; #define JS_NULL_OBJECT_OPS \ {NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, \ NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, \ NULL,NULL,NULL} +} // namespace js + +// Classes, objects, and properties. + +typedef void (*JSClassInternal)(); + +struct JSClass { + const char *name; + uint32_t flags; + + // Mandatory function pointer members. + JSPropertyOp addProperty; + JSDeletePropertyOp delProperty; + JSPropertyOp getProperty; + JSStrictPropertyOp setProperty; + JSEnumerateOp enumerate; + JSResolveOp resolve; + JSConvertOp convert; + + // Optional members (may be null). + JSFinalizeOp finalize; + JSCheckAccessOp checkAccess; + JSNative call; + JSHasInstanceOp hasInstance; + JSNative construct; + JSTraceOp trace; + + void *reserved[40]; +}; + +#define JSCLASS_HAS_PRIVATE (1<<0) // objects have private slot +#define JSCLASS_NEW_ENUMERATE (1<<1) // has JSNewEnumerateOp hook +#define JSCLASS_NEW_RESOLVE (1<<2) // has JSNewResolveOp hook +#define JSCLASS_PRIVATE_IS_NSISUPPORTS (1<<3) // private is (nsISupports *) +#define JSCLASS_IS_DOMJSCLASS (1<<4) // objects are DOM +#define JSCLASS_IMPLEMENTS_BARRIERS (1<<5) // Correctly implements GC read + // and write barriers +#define JSCLASS_EMULATES_UNDEFINED (1<<6) // objects of this class act + // like the value undefined, + // in some contexts +#define JSCLASS_USERBIT1 (1<<7) // Reserved for embeddings. + +// To reserve slots fetched and stored via JS_Get/SetReservedSlot, bitwise-or +// JSCLASS_HAS_RESERVED_SLOTS(n) into the initializer for JSClass.flags, where +// n is a constant in [1, 255]. Reserved slots are indexed from 0 to n-1. +#define JSCLASS_RESERVED_SLOTS_SHIFT 8 // room for 8 flags below */ +#define JSCLASS_RESERVED_SLOTS_WIDTH 8 // and 16 above this field */ +#define JSCLASS_RESERVED_SLOTS_MASK JS_BITMASK(JSCLASS_RESERVED_SLOTS_WIDTH) +#define JSCLASS_HAS_RESERVED_SLOTS(n) (((n) & JSCLASS_RESERVED_SLOTS_MASK) \ + << JSCLASS_RESERVED_SLOTS_SHIFT) +#define JSCLASS_RESERVED_SLOTS(clasp) (((clasp)->flags \ + >> JSCLASS_RESERVED_SLOTS_SHIFT) \ + & JSCLASS_RESERVED_SLOTS_MASK) + +#define JSCLASS_HIGH_FLAGS_SHIFT (JSCLASS_RESERVED_SLOTS_SHIFT + \ + JSCLASS_RESERVED_SLOTS_WIDTH) + +#define JSCLASS_IS_ANONYMOUS (1<<(JSCLASS_HIGH_FLAGS_SHIFT+0)) +#define JSCLASS_IS_GLOBAL (1<<(JSCLASS_HIGH_FLAGS_SHIFT+1)) +#define JSCLASS_INTERNAL_FLAG2 (1<<(JSCLASS_HIGH_FLAGS_SHIFT+2)) +#define JSCLASS_INTERNAL_FLAG3 (1<<(JSCLASS_HIGH_FLAGS_SHIFT+3)) + +// Indicate whether the proto or ctor should be frozen. +#define JSCLASS_FREEZE_PROTO (1<<(JSCLASS_HIGH_FLAGS_SHIFT+4)) +#define JSCLASS_FREEZE_CTOR (1<<(JSCLASS_HIGH_FLAGS_SHIFT+5)) + +// Reserved for embeddings. +#define JSCLASS_USERBIT2 (1<<(JSCLASS_HIGH_FLAGS_SHIFT+6)) +#define JSCLASS_USERBIT3 (1<<(JSCLASS_HIGH_FLAGS_SHIFT+7)) + +#define JSCLASS_BACKGROUND_FINALIZE (1<<(JSCLASS_HIGH_FLAGS_SHIFT+8)) + +// Bits 26 through 31 are reserved for the CACHED_PROTO_KEY mechanism, see +// below. + +// ECMA-262 requires that most constructors used internally create objects +// with "the original Foo.prototype value" as their [[Prototype]] (__proto__) +// member initial value. The "original ... value" verbiage is there because +// in ECMA-262, global properties naming class objects are read/write and +// deleteable, for the most part. +// +// Implementing this efficiently requires that global objects have classes +// with the following flags. Failure to use JSCLASS_GLOBAL_FLAGS was +// prevously allowed, but is now an ES5 violation and thus unsupported. +// +#define JSCLASS_GLOBAL_SLOT_COUNT (JSProto_LIMIT * 3 + 26) +#define JSCLASS_GLOBAL_FLAGS_WITH_SLOTS(n) \ + (JSCLASS_IS_GLOBAL | JSCLASS_HAS_RESERVED_SLOTS(JSCLASS_GLOBAL_SLOT_COUNT + (n))) +#define JSCLASS_GLOBAL_FLAGS \ + JSCLASS_GLOBAL_FLAGS_WITH_SLOTS(0) +#define JSCLASS_HAS_GLOBAL_FLAG_AND_SLOTS(clasp) \ + (((clasp)->flags & JSCLASS_IS_GLOBAL) \ + && JSCLASS_RESERVED_SLOTS(clasp) >= JSCLASS_GLOBAL_SLOT_COUNT) + +// Fast access to the original value of each standard class's prototype. +#define JSCLASS_CACHED_PROTO_SHIFT (JSCLASS_HIGH_FLAGS_SHIFT + 10) +#define JSCLASS_CACHED_PROTO_WIDTH 6 +#define JSCLASS_CACHED_PROTO_MASK JS_BITMASK(JSCLASS_CACHED_PROTO_WIDTH) +#define JSCLASS_HAS_CACHED_PROTO(key) (uint32_t(key) << JSCLASS_CACHED_PROTO_SHIFT) +#define JSCLASS_CACHED_PROTO_KEY(clasp) ((JSProtoKey) \ + (((clasp)->flags \ + >> JSCLASS_CACHED_PROTO_SHIFT) \ + & JSCLASS_CACHED_PROTO_MASK)) + +// Initializer for unused members of statically initialized JSClass structs. +#define JSCLASS_NO_INTERNAL_MEMBERS {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0} +#define JSCLASS_NO_OPTIONAL_MEMBERS 0,0,0,0,0,JSCLASS_NO_INTERNAL_MEMBERS + +namespace js { + struct Class { JS_CLASS_MEMBERS; ClassExtension ext; ObjectOps ops; uint8_t pad[sizeof(JSClass) - sizeof(ClassSizeMeasurement) - sizeof(ClassExtension) - sizeof(ObjectOps)]; @@ -381,28 +694,28 @@ enum ESClassValue { * so the caller must not assume anything about obj's representation (e.g., obj * may be a proxy). */ inline bool ObjectClassIs(JSObject &obj, ESClassValue classValue, JSContext *cx); /* Just a helper that checks v.isObject before calling ObjectClassIs. */ inline bool -IsObjectWithClass(const Value &v, ESClassValue classValue, JSContext *cx); +IsObjectWithClass(const JS::Value &v, ESClassValue classValue, JSContext *cx); inline bool IsPoisonedSpecialId(js::SpecialId iden) { if (iden.isObject()) - return IsPoisonedPtr(iden.toObject()); + return JS::IsPoisonedPtr(iden.toObject()); return false; } template <> struct GCMethods<SpecialId> { static SpecialId initial() { return SpecialId(); } static ThingRootKind kind() { return THING_ROOT_ID; } static bool poisoned(SpecialId id) { return IsPoisonedSpecialId(id); } }; } /* namespace js */ -#endif /* jsclass_h */ +#endif /* js_Class_h */
--- a/js/src/jsapi-tests/testCustomIterator.cpp +++ b/js/src/jsapi-tests/testCustomIterator.cpp @@ -1,14 +1,13 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include "jsclass.h" - +#include "js/Class.h" #include "jsapi-tests/tests.h" int count = 0; static bool IterNext(JSContext *cx, unsigned argc, jsval *vp) { if (count++ == 100)
--- a/js/src/jsapi-tests/testIntTypesABI.cpp +++ b/js/src/jsapi-tests/testIntTypesABI.cpp @@ -5,24 +5,24 @@ /* * This test exercises the full, deliberately-exposed JSAPI interface to ensure * that no internal integer typedefs leak out. Include every intentionally * public header file (and those headers included by them, for completeness), * even the ones tests.h itself included, to verify this. */ #include "jsapi.h" -#include "jsclass.h" #include "jscpucfg.h" #include "jspubtd.h" #include "jstypes.h" #include "js/Anchor.h" #include "js/CallArgs.h" #include "js/CharacterEncoding.h" +#include "js/Class.h" #include "js/Date.h" #include "js/GCAPI.h" #include "js/HashTable.h" #include "js/HeapAPI.h" #include "js/MemoryMetrics.h" #include "js/PropertyKey.h" #include "js/Utility.h" #include "js/Value.h"
--- a/js/src/jsapi.h +++ b/js/src/jsapi.h @@ -17,16 +17,17 @@ #include <stddef.h> #include <stdint.h> #include <stdio.h> #include "jsalloc.h" #include "jspubtd.h" #include "js/CallArgs.h" +#include "js/Class.h" #include "js/HashTable.h" #include "js/Id.h" #include "js/RootingAPI.h" #include "js/Utility.h" #include "js/Value.h" #include "js/Vector.h" /************************************************************************/ @@ -744,234 +745,34 @@ CallNonGenericMethod(JSContext *cx, IsAc return detail::CallMethodIfWrapped(cx, Test, Impl, args); } } /* namespace JS */ /************************************************************************/ -/* JSClass operation signatures. */ - -/* - * Add or get a property named by id in obj. Note the jsid id type -- id may - * be a string (Unicode property identifier) or an int (element index). The - * *vp out parameter, on success, is the new property value after the action. - */ -typedef bool -(* JSPropertyOp)(JSContext *cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, - JS::MutableHandle<JS::Value> vp); - -/* - * Set a property named by id in obj, treating the assignment as strict - * mode code if strict is true. Note the jsid id type -- id may be a string - * (Unicode property identifier) or an int (element index). The *vp out - * parameter, on success, is the new property value after the - * set. - */ -typedef bool -(* JSStrictPropertyOp)(JSContext *cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, - bool strict, JS::MutableHandle<JS::Value> vp); - -/* - * Delete a property named by id in obj. - * - * If an error occurred, return false as per normal JSAPI error practice. - * - * If no error occurred, but the deletion attempt wasn't allowed (perhaps - * because the property was non-configurable), set *succeeded to false and - * return true. This will cause |delete obj[id]| to evaluate to false in - * non-strict mode code, and to throw a TypeError in strict mode code. - * - * If no error occurred and the deletion wasn't disallowed (this is *not* the - * same as saying that a deletion actually occurred -- deleting a non-existent - * property, or an inherited property, is allowed -- it's just pointless), - * set *succeeded to true and return true. - */ -typedef bool -(* JSDeletePropertyOp)(JSContext *cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, - bool *succeeded); - -/* - * This function type is used for callbacks that enumerate the properties of - * a JSObject. The behavior depends on the value of enum_op: - * - * JSENUMERATE_INIT - * A new, opaque iterator state should be allocated and stored in *statep. - * (You can use PRIVATE_TO_JSVAL() to tag the pointer to be stored). - * - * The number of properties that will be enumerated should be returned as - * an integer jsval in *idp, if idp is non-null, and provided the number of - * enumerable properties is known. If idp is non-null and the number of - * enumerable properties can't be computed in advance, *idp should be set - * to JSVAL_ZERO. - * - * JSENUMERATE_INIT_ALL - * Used identically to JSENUMERATE_INIT, but exposes all properties of the - * object regardless of enumerability. - * - * JSENUMERATE_NEXT - * A previously allocated opaque iterator state is passed in via statep. - * Return the next jsid in the iteration using *idp. The opaque iterator - * state pointed at by statep is destroyed and *statep is set to JSVAL_NULL - * if there are no properties left to enumerate. - * - * JSENUMERATE_DESTROY - * Destroy the opaque iterator state previously allocated in *statep by a - * call to this function when enum_op was JSENUMERATE_INIT or - * JSENUMERATE_INIT_ALL. - * - * The return value is used to indicate success, with a value of false - * indicating failure. - */ -typedef bool -(* JSNewEnumerateOp)(JSContext *cx, JS::Handle<JSObject*> obj, JSIterateOp enum_op, - JS::MutableHandle<JS::Value> statep, JS::MutableHandle<jsid> idp); - -/* - * The old-style JSClass.enumerate op should define all lazy properties not - * yet reflected in obj. - */ -typedef bool -(* JSEnumerateOp)(JSContext *cx, JS::Handle<JSObject*> obj); - -/* - * Resolve a lazy property named by id in obj by defining it directly in obj. - * Lazy properties are those reflected from some peer native property space - * (e.g., the DOM attributes for a given node reflected as obj) on demand. - * - * JS looks for a property in an object, and if not found, tries to resolve - * the given id. If resolve succeeds, the engine looks again in case resolve - * defined obj[id]. If no such property exists directly in obj, the process - * is repeated with obj's prototype, etc. - * - * NB: JSNewResolveOp provides a cheaper way to resolve lazy properties. - */ -typedef bool -(* JSResolveOp)(JSContext *cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id); - -/* - * Like JSResolveOp, but flags provide contextual information as follows: - * - * JSRESOLVE_ASSIGNING obj[id] is on the left-hand side of an assignment - * - * The *objp out parameter, on success, should be null to indicate that id - * was not resolved; and non-null, referring to obj or one of its prototypes, - * if id was resolved. The hook may assume *objp is null on entry. - * - * This hook instead of JSResolveOp is called via the JSClass.resolve member - * if JSCLASS_NEW_RESOLVE is set in JSClass.flags. - */ -typedef bool -(* JSNewResolveOp)(JSContext *cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, unsigned flags, - JS::MutableHandle<JSObject*> objp); - -/* - * Convert obj to the given type, returning true with the resulting value in - * *vp on success, and returning false on error or exception. - */ -typedef bool -(* JSConvertOp)(JSContext *cx, JS::Handle<JSObject*> obj, JSType type, - JS::MutableHandle<JS::Value> vp); - -typedef struct JSFreeOp JSFreeOp; - struct JSFreeOp { private: JSRuntime *runtime_; protected: JSFreeOp(JSRuntime *rt) : runtime_(rt) { } public: JSRuntime *runtime() const { return runtime_; } }; -/* - * Finalize obj, which the garbage collector has determined to be unreachable - * from other live objects or from GC roots. Obviously, finalizers must never - * store a reference to obj. - */ -typedef void -(* JSFinalizeOp)(JSFreeOp *fop, JSObject *obj); - -/* - * Finalizes external strings created by JS_NewExternalString. - */ -typedef struct JSStringFinalizer JSStringFinalizer; - -struct JSStringFinalizer { - void (*finalize)(const JSStringFinalizer *fin, jschar *chars); -}; - -/* - * JSClass.checkAccess type: check whether obj[id] may be accessed per mode, - * returning false on error/exception, true on success with obj[id]'s last-got - * value in *vp, and its attributes in *attrsp. As for JSPropertyOp above, id - * is either a string or an int jsval. - */ -typedef bool -(* JSCheckAccessOp)(JSContext *cx, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, - JSAccessMode mode, JS::MutableHandle<JS::Value> vp); - -/* - * Check whether v is an instance of obj. Return false on error or exception, - * true on success with true in *bp if v is an instance of obj, false in - * *bp otherwise. - */ -typedef bool -(* JSHasInstanceOp)(JSContext *cx, JS::Handle<JSObject*> obj, JS::MutableHandle<JS::Value> vp, - bool *bp); - -/* - * Function type for trace operation of the class called to enumerate all - * traceable things reachable from obj's private data structure. For each such - * thing, a trace implementation must call one of the JS_Call*Tracer variants - * on the thing. - * - * JSTraceOp implementation can assume that no other threads mutates object - * state. It must not change state of the object or corresponding native - * structures. The only exception for this rule is the case when the embedding - * needs a tight integration with GC. In that case the embedding can check if - * the traversal is a part of the marking phase through calling - * JS_IsGCMarkingTracer and apply a special code like emptying caches or - * marking its native structures. - */ -typedef void -(* JSTraceOp)(JSTracer *trc, JSObject *obj); - -/* - * Callback that JSTraceOp implementation can provide to return a string - * describing the reference traced with JS_CallTracer. - */ -typedef void -(* JSTraceNamePrinter)(JSTracer *trc, char *buf, size_t bufsize); - -/* - * A generic type for functions mapping an object to another object, or null - * if an error or exception was thrown on cx. - */ -typedef JSObject * -(* JSObjectOp)(JSContext *cx, JS::Handle<JSObject*> obj); - -/* - * Hook that creates an iterator object for a given object. Returns the - * iterator object or null if an error or exception was thrown on cx. - */ -typedef JSObject * -(* JSIteratorOp)(JSContext *cx, JS::HandleObject obj, bool keysonly); - -typedef JSObject * -(* JSWeakmapKeyDelegateOp)(JSObject *obj); - /* Callbacks and their arguments. */ +/************************************************************************/ + typedef enum JSContextOp { JSCONTEXT_NEW, JSCONTEXT_DESTROY } JSContextOp; /* * The possible values for contextOp when the runtime calls the callback are: * JSCONTEXT_NEW JS_NewContext successfully created a new JSContext @@ -2668,131 +2469,16 @@ JS_GetExternalStringFinalizer(JSString * * Set the size of the native stack that should not be exceed. To disable * stack size checking pass 0. */ extern JS_PUBLIC_API(void) JS_SetNativeStackQuota(JSRuntime *cx, size_t stackSize); /************************************************************************/ -/* - * Classes, objects, and properties. - */ -typedef void (*JSClassInternal)(); - -struct JSClass { - const char *name; - uint32_t flags; - - /* Mandatory function pointer members. */ - JSPropertyOp addProperty; - JSDeletePropertyOp delProperty; - JSPropertyOp getProperty; - JSStrictPropertyOp setProperty; - JSEnumerateOp enumerate; - JSResolveOp resolve; - JSConvertOp convert; - - /* Optional members (may be null). */ - JSFinalizeOp finalize; - JSCheckAccessOp checkAccess; - JSNative call; - JSHasInstanceOp hasInstance; - JSNative construct; - JSTraceOp trace; - - void *reserved[40]; -}; - -#define JSCLASS_HAS_PRIVATE (1<<0) /* objects have private slot */ -#define JSCLASS_NEW_ENUMERATE (1<<1) /* has JSNewEnumerateOp hook */ -#define JSCLASS_NEW_RESOLVE (1<<2) /* has JSNewResolveOp hook */ -#define JSCLASS_PRIVATE_IS_NSISUPPORTS (1<<3) /* private is (nsISupports *) */ -#define JSCLASS_IS_DOMJSCLASS (1<<4) /* objects are DOM */ -#define JSCLASS_IMPLEMENTS_BARRIERS (1<<5) /* Correctly implements GC read - and write barriers */ -#define JSCLASS_EMULATES_UNDEFINED (1<<6) /* objects of this class act - like the value undefined, - in some contexts */ -#define JSCLASS_USERBIT1 (1<<7) /* Reserved for embeddings. */ - -/* - * To reserve slots fetched and stored via JS_Get/SetReservedSlot, bitwise-or - * JSCLASS_HAS_RESERVED_SLOTS(n) into the initializer for JSClass.flags, where - * n is a constant in [1, 255]. Reserved slots are indexed from 0 to n-1. - */ -#define JSCLASS_RESERVED_SLOTS_SHIFT 8 /* room for 8 flags below */ -#define JSCLASS_RESERVED_SLOTS_WIDTH 8 /* and 16 above this field */ -#define JSCLASS_RESERVED_SLOTS_MASK JS_BITMASK(JSCLASS_RESERVED_SLOTS_WIDTH) -#define JSCLASS_HAS_RESERVED_SLOTS(n) (((n) & JSCLASS_RESERVED_SLOTS_MASK) \ - << JSCLASS_RESERVED_SLOTS_SHIFT) -#define JSCLASS_RESERVED_SLOTS(clasp) (((clasp)->flags \ - >> JSCLASS_RESERVED_SLOTS_SHIFT) \ - & JSCLASS_RESERVED_SLOTS_MASK) - -#define JSCLASS_HIGH_FLAGS_SHIFT (JSCLASS_RESERVED_SLOTS_SHIFT + \ - JSCLASS_RESERVED_SLOTS_WIDTH) - -#define JSCLASS_IS_ANONYMOUS (1<<(JSCLASS_HIGH_FLAGS_SHIFT+0)) -#define JSCLASS_IS_GLOBAL (1<<(JSCLASS_HIGH_FLAGS_SHIFT+1)) -#define JSCLASS_INTERNAL_FLAG2 (1<<(JSCLASS_HIGH_FLAGS_SHIFT+2)) -#define JSCLASS_INTERNAL_FLAG3 (1<<(JSCLASS_HIGH_FLAGS_SHIFT+3)) - -/* Indicate whether the proto or ctor should be frozen. */ -#define JSCLASS_FREEZE_PROTO (1<<(JSCLASS_HIGH_FLAGS_SHIFT+4)) -#define JSCLASS_FREEZE_CTOR (1<<(JSCLASS_HIGH_FLAGS_SHIFT+5)) - -/* Reserved for embeddings. */ -#define JSCLASS_USERBIT2 (1<<(JSCLASS_HIGH_FLAGS_SHIFT+6)) -#define JSCLASS_USERBIT3 (1<<(JSCLASS_HIGH_FLAGS_SHIFT+7)) - -#define JSCLASS_BACKGROUND_FINALIZE (1<<(JSCLASS_HIGH_FLAGS_SHIFT+8)) - -/* - * Bits 26 through 31 are reserved for the CACHED_PROTO_KEY mechanism, see - * below. - */ - -/* Global flags. */ -#define JSGLOBAL_FLAGS_CLEARED 0x1 - -/* - * ECMA-262 requires that most constructors used internally create objects - * with "the original Foo.prototype value" as their [[Prototype]] (__proto__) - * member initial value. The "original ... value" verbiage is there because - * in ECMA-262, global properties naming class objects are read/write and - * deleteable, for the most part. - * - * Implementing this efficiently requires that global objects have classes - * with the following flags. Failure to use JSCLASS_GLOBAL_FLAGS was - * prevously allowed, but is now an ES5 violation and thus unsupported. - */ -#define JSCLASS_GLOBAL_SLOT_COUNT (JSProto_LIMIT * 3 + 26) -#define JSCLASS_GLOBAL_FLAGS_WITH_SLOTS(n) \ - (JSCLASS_IS_GLOBAL | JSCLASS_HAS_RESERVED_SLOTS(JSCLASS_GLOBAL_SLOT_COUNT + (n))) -#define JSCLASS_GLOBAL_FLAGS \ - JSCLASS_GLOBAL_FLAGS_WITH_SLOTS(0) -#define JSCLASS_HAS_GLOBAL_FLAG_AND_SLOTS(clasp) \ - (((clasp)->flags & JSCLASS_IS_GLOBAL) \ - && JSCLASS_RESERVED_SLOTS(clasp) >= JSCLASS_GLOBAL_SLOT_COUNT) - -/* Fast access to the original value of each standard class's prototype. */ -#define JSCLASS_CACHED_PROTO_SHIFT (JSCLASS_HIGH_FLAGS_SHIFT + 10) -#define JSCLASS_CACHED_PROTO_WIDTH 6 -#define JSCLASS_CACHED_PROTO_MASK JS_BITMASK(JSCLASS_CACHED_PROTO_WIDTH) -#define JSCLASS_HAS_CACHED_PROTO(key) (uint32_t(key) << JSCLASS_CACHED_PROTO_SHIFT) -#define JSCLASS_CACHED_PROTO_KEY(clasp) ((JSProtoKey) \ - (((clasp)->flags \ - >> JSCLASS_CACHED_PROTO_SHIFT) \ - & JSCLASS_CACHED_PROTO_MASK)) - -/* Initializer for unused members of statically initialized JSClass structs. */ -#define JSCLASS_NO_INTERNAL_MEMBERS {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0} -#define JSCLASS_NO_OPTIONAL_MEMBERS 0,0,0,0,0,JSCLASS_NO_INTERNAL_MEMBERS - extern JS_PUBLIC_API(int) JS_IdArrayLength(JSContext *cx, JSIdArray *ida); extern JS_PUBLIC_API(jsid) JS_IdArrayGet(JSContext *cx, JSIdArray *ida, int index); extern JS_PUBLIC_API(void) JS_DestroyIdArray(JSContext *cx, JSIdArray *ida);
--- a/js/src/jsfriendapi.h +++ b/js/src/jsfriendapi.h @@ -6,18 +6,18 @@ #ifndef jsfriendapi_h #define jsfriendapi_h #ifdef JS_HAS_CTYPES #include "mozilla/MemoryReporting.h" #endif +#include "jsapi.h" #include "jsbytecode.h" -#include "jsclass.h" #include "jspubtd.h" #include "js/CallArgs.h" /* * This macro checks if the stack pointer has exceeded a given limit. If * |tolerance| is non-zero, it returns true only if the stack pointer has * exceeded the limit by more than |tolerance| bytes.
--- a/js/src/jsproxy.h +++ b/js/src/jsproxy.h @@ -144,17 +144,17 @@ class JS_FRIEND_API(BaseProxyHandler) virtual JSString *fun_toString(JSContext *cx, HandleObject proxy, unsigned indent); virtual bool regexp_toShared(JSContext *cx, HandleObject proxy, RegExpGuard *g); virtual bool defaultValue(JSContext *cx, HandleObject obj, JSType hint, MutableHandleValue vp); virtual void finalize(JSFreeOp *fop, JSObject *proxy); virtual bool getElementIfPresent(JSContext *cx, HandleObject obj, HandleObject receiver, uint32_t index, MutableHandleValue vp, bool *present); virtual bool getPrototypeOf(JSContext *cx, HandleObject proxy, MutableHandleObject protop); - /* See comment for weakmapKeyDelegateOp in jsclass.h. */ + /* See comment for weakmapKeyDelegateOp in js/Class.h. */ virtual JSObject *weakmapKeyDelegate(JSObject *proxy); }; /* * DirectProxyHandler includes a notion of a target object. All traps are * reimplemented such that they forward their behavior to the target. This * allows consumers of this class to forward to another object as transparently * and efficiently as possible.
--- a/js/src/moz.build +++ b/js/src/moz.build @@ -30,17 +30,16 @@ CONFIGURE_SUBST_FILES += ['devtools/root # browser builds. Don't add new files here unless you know what you're # doing! EXPORTS += [ 'js-config.h', 'js.msg', 'jsalloc.h', 'jsapi.h', 'jsbytecode.h', - 'jsclass.h', 'jsclist.h', 'jscpucfg.h', 'jsdbgapi.h', 'jsfriendapi.h', 'jsprf.h', 'jsprototypes.h', 'jsproxy.h', 'jspubtd.h', @@ -57,16 +56,17 @@ if CONFIG['HAVE_DTRACE']: # If you add a header here, add it to js/src/jsapi-tests/testIntTypesABI.cpp so # that we ensure we don't over-expose our internal integer typedefs. Note that # LegacyIntTypes.h below is deliberately exempted from this requirement. EXPORTS.js += [ '../public/Anchor.h', '../public/CallArgs.h', '../public/CharacterEncoding.h', + '../public/Class.h', '../public/Date.h', '../public/GCAPI.h', '../public/HashTable.h', '../public/HeapAPI.h', '../public/Id.h', '../public/IdForward.h', '../public/LegacyIntTypes.h', '../public/MemoryMetrics.h',
--- a/js/src/vm/TypedArrayObject.h +++ b/js/src/vm/TypedArrayObject.h @@ -3,19 +3,20 @@ * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #ifndef vm_TypedArrayObject_h #define vm_TypedArrayObject_h #include "jsapi.h" -#include "jsclass.h" #include "jsobj.h" +#include "js/Class.h" + typedef struct JSProperty JSProperty; namespace js { typedef Vector<ArrayBufferObject *, 0, SystemAllocPolicy> ArrayBufferVector; // The inheritance hierarchy for the various classes relating to typed arrays // is as follows.
--- a/xpcom/base/CycleCollectedJSRuntime.h +++ b/xpcom/base/CycleCollectedJSRuntime.h @@ -4,17 +4,17 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #ifndef mozilla_CycleCollectedJSRuntime_h__ #define mozilla_CycleCollectedJSRuntime_h__ #include "mozilla/MemoryReporting.h" #include "jsapi.h" -#include "jsclass.h" +#include "js/Class.h" #include "nsCycleCollector.h" #include "nsCycleCollectionParticipant.h" #include "nsDataHashtable.h" #include "nsHashKeys.h" #include "nsTArray.h" class nsCycleCollectionNoteRootCallback;