mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 889146 (part 14) - Make DataViewObject::{byteLength,byteLengthValue,byteOffset,byteOffsetValue}() more sane. r=sfink.
--HG-- extra : rebase_source : a55357844d1495333aaa7c6310110704cd394656
This commit is contained in:
parent
2704cbc28b
commit
33a4d394f6
@ -3813,15 +3813,15 @@ const JSFunctionSpec DataViewObject::jsfuncs[] = {
|
||||
JS_FS_END
|
||||
};
|
||||
|
||||
template<Value ValueGetter(DataViewObject &view)>
|
||||
template<Value ValueGetter(DataViewObject *view)>
|
||||
bool
|
||||
DataViewObject::getterImpl(JSContext *cx, CallArgs args)
|
||||
{
|
||||
args.rval().set(ValueGetter(args.thisv().toObject().as<DataViewObject>()));
|
||||
args.rval().set(ValueGetter(&args.thisv().toObject().as<DataViewObject>()));
|
||||
return true;
|
||||
}
|
||||
|
||||
template<Value ValueGetter(DataViewObject &view)>
|
||||
template<Value ValueGetter(DataViewObject *view)>
|
||||
JSBool
|
||||
DataViewObject::getter(JSContext *cx, unsigned argc, Value *vp)
|
||||
{
|
||||
@ -3829,7 +3829,7 @@ DataViewObject::getter(JSContext *cx, unsigned argc, Value *vp)
|
||||
return CallNonGenericMethod<is, getterImpl<ValueGetter> >(cx, args);
|
||||
}
|
||||
|
||||
template<Value ValueGetter(DataViewObject &view)>
|
||||
template<Value ValueGetter(DataViewObject *view)>
|
||||
bool
|
||||
DataViewObject::defineGetter(JSContext *cx, PropertyName *name, HandleObject proto)
|
||||
{
|
||||
|
@ -455,39 +455,39 @@ class DataViewObject : public ArrayBufferViewObject
|
||||
return v.isObject() && v.toObject().hasClass(&class_);
|
||||
}
|
||||
|
||||
template<Value ValueGetter(DataViewObject &view)>
|
||||
template<Value ValueGetter(DataViewObject *view)>
|
||||
static bool
|
||||
getterImpl(JSContext *cx, CallArgs args);
|
||||
|
||||
template<Value ValueGetter(DataViewObject &view)>
|
||||
template<Value ValueGetter(DataViewObject *view)>
|
||||
static JSBool
|
||||
getter(JSContext *cx, unsigned argc, Value *vp);
|
||||
|
||||
template<Value ValueGetter(DataViewObject &view)>
|
||||
template<Value ValueGetter(DataViewObject *view)>
|
||||
static bool
|
||||
defineGetter(JSContext *cx, PropertyName *name, HandleObject proto);
|
||||
|
||||
public:
|
||||
static Class class_;
|
||||
|
||||
static Value byteOffsetValue(DataViewObject *view) {
|
||||
Value v = view->getReservedSlot(BYTEOFFSET_SLOT);
|
||||
JS_ASSERT(v.toInt32() >= 0);
|
||||
return v;
|
||||
}
|
||||
|
||||
static Value byteLengthValue(DataViewObject *view) {
|
||||
Value v = view->getReservedSlot(BYTELENGTH_SLOT);
|
||||
JS_ASSERT(v.toInt32() >= 0);
|
||||
return v;
|
||||
}
|
||||
|
||||
uint32_t byteOffset() const {
|
||||
int32_t offset = getReservedSlot(BYTEOFFSET_SLOT).toInt32();
|
||||
JS_ASSERT(offset >= 0);
|
||||
return static_cast<uint32_t>(offset);
|
||||
return byteOffsetValue(const_cast<DataViewObject*>(this)).toInt32();
|
||||
}
|
||||
|
||||
uint32_t byteLength() const {
|
||||
int32_t length = getReservedSlot(BYTELENGTH_SLOT).toInt32();
|
||||
JS_ASSERT(length >= 0);
|
||||
return static_cast<uint32_t>(length);
|
||||
}
|
||||
|
||||
static Value byteOffsetValue(DataViewObject &view) {
|
||||
return Int32Value(view.byteOffset());
|
||||
}
|
||||
|
||||
static Value byteLengthValue(DataViewObject &view) {
|
||||
return Int32Value(view.byteLength());
|
||||
return byteLengthValue(const_cast<DataViewObject*>(this)).toInt32();
|
||||
}
|
||||
|
||||
bool hasBuffer() const {
|
||||
@ -498,8 +498,8 @@ class DataViewObject : public ArrayBufferViewObject
|
||||
return getReservedSlot(BUFFER_SLOT).toObject().as<ArrayBufferObject>();
|
||||
}
|
||||
|
||||
static Value bufferValue(DataViewObject &view) {
|
||||
return view.hasBuffer() ? ObjectValue(view.arrayBuffer()) : UndefinedValue();
|
||||
static Value bufferValue(DataViewObject *view) {
|
||||
return view->hasBuffer() ? ObjectValue(view->arrayBuffer()) : UndefinedValue();
|
||||
}
|
||||
|
||||
void *dataPointer() const {
|
||||
|
Loading…
Reference in New Issue
Block a user