mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-13 21:35:39 +00:00
Bug 935173 - Fix JS_NeuterArrayBuffer and call it, r=Waldo
--HG-- extra : rebase_source : 974ec3f776849382fe7684117c647013f7e14236
This commit is contained in:
parent
3f9be57384
commit
565e5e83ac
@ -1326,13 +1326,7 @@ Neuter(JSContext *cx, unsigned argc, jsval *vp)
|
||||
return false;
|
||||
}
|
||||
|
||||
void *contents;
|
||||
uint8_t *data;
|
||||
if (!JS_StealArrayBufferContents(cx, obj, &contents, &data))
|
||||
return false;
|
||||
|
||||
js_free(contents);
|
||||
return true;
|
||||
return JS_NeuterArrayBuffer(cx, obj);
|
||||
}
|
||||
|
||||
static const JSFunctionSpecWithHelp TestingFunctions[] = {
|
||||
|
@ -1248,8 +1248,8 @@ JS_GetArrayBufferViewBuffer(JSObject *obj);
|
||||
/*
|
||||
* Set an ArrayBuffer's length to 0 and neuter all of its views.
|
||||
*/
|
||||
extern JS_FRIEND_API(void)
|
||||
JS_NeuterArrayBuffer(JSObject *obj, JSContext *cx);
|
||||
extern JS_FRIEND_API(bool)
|
||||
JS_NeuterArrayBuffer(JSContext *cx, JS::HandleObject obj);
|
||||
|
||||
/*
|
||||
* Check whether obj supports JS_GetDataView* APIs.
|
||||
|
@ -4031,12 +4031,12 @@ JS_GetArrayBufferData(JSObject *obj)
|
||||
}
|
||||
|
||||
JS_FRIEND_API(bool)
|
||||
JS_NeuterArrayBuffer(JSContext *cx, JSObject *obj)
|
||||
JS_NeuterArrayBuffer(JSContext *cx, HandleObject obj)
|
||||
{
|
||||
ArrayBufferObject &buffer = obj->as<ArrayBufferObject>();
|
||||
if (!buffer.neuterViews(cx))
|
||||
Rooted<ArrayBufferObject*> buffer(cx, &obj->as<ArrayBufferObject>());
|
||||
if (!buffer->neuterViews(cx))
|
||||
return false;
|
||||
buffer.neuter(cx);
|
||||
buffer->neuter(cx);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user