Bug 707096 - Add a public API for TypedArray / ArrayBuffer. r=dmandelin

This commit is contained in:
David Rajchenbach Teller 2012-01-10 08:56:47 +01:00
parent 08f3e24abd
commit 0f953f4c92
2 changed files with 18 additions and 0 deletions

View File

@ -2412,6 +2412,12 @@ js_IsArrayBuffer(JSObject *obj)
return obj->isArrayBuffer();
}
JS_FRIEND_API(JSBool)
JS_IsArrayBufferObject(JSObject *obj)
{
return js_IsArrayBuffer(obj);
}
namespace js {
bool
@ -2449,6 +2455,12 @@ js_CreateArrayBuffer(JSContext *cx, jsuint nbytes)
return ArrayBuffer::create(cx, nbytes);
}
JS_FRIEND_API(JSObject *)
JS_NewArrayBuffer(JSContext *cx, jsuint nbytes)
{
return js_CreateArrayBuffer(cx, nbytes);
}
static inline JSObject *
TypedArrayConstruct(JSContext *cx, jsint atype, uintN argc, Value *argv)
{

View File

@ -325,6 +325,12 @@ js_CreateTypedArrayWithBuffer(JSContext *cx, jsint atype, JSObject *bufArg,
extern int32_t JS_FASTCALL
js_TypedArray_uint8_clamp_double(const double x);
JS_FRIEND_API(JSBool)
JS_IsArrayBufferObject(JSObject *obj);
JS_FRIEND_API(JSObject *)
JS_NewArrayBuffer(JSContext *cx, jsuint nbytes);
JS_FRIEND_API(uint32_t)
JS_GetArrayBufferByteLength(JSObject *obj);