mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
Replace uses of spidermonkey-specific JS_GetArrayBufferViewType with ArrayBufferView impl's method get_array_type()
This commit is contained in:
parent
ccc1df2dfe
commit
4fc3e7e75d
3 changed files with 11 additions and 12 deletions
|
@ -37,7 +37,7 @@ use dom::window::Window;
|
|||
use euclid::size::Size2D;
|
||||
use ipc_channel::ipc::{self, IpcSender};
|
||||
use js::conversions::ConversionBehavior;
|
||||
use js::jsapi::{JSContext, JSObject, JS_GetArrayBufferViewType, Type, Rooted};
|
||||
use js::jsapi::{JSContext, JSObject, Type, Rooted};
|
||||
use js::jsval::{BooleanValue, DoubleValue, Int32Value, JSVal, NullValue, UndefinedValue};
|
||||
use js::typedarray::{TypedArray, TypedArrayElement, Float32, Int32};
|
||||
use net_traits::image::base::PixelFormat;
|
||||
|
@ -2080,8 +2080,8 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
|
|||
}
|
||||
|
||||
typedarray!(in(cx) let mut pixels_data: ArrayBufferView = pixels);
|
||||
let mut data = match { pixels_data.as_mut() } {
|
||||
Ok(data) => data.as_mut_slice(),
|
||||
let (array_type, mut data) = match { pixels_data.as_mut() } {
|
||||
Ok(data) => (data.get_array_type(), data.as_mut_slice()),
|
||||
Err(_) => return Err(Error::Type("Not an ArrayBufferView".to_owned())),
|
||||
};
|
||||
|
||||
|
@ -2089,7 +2089,7 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
|
|||
return Ok(());
|
||||
}
|
||||
|
||||
match { JS_GetArrayBufferViewType(pixels) } {
|
||||
match array_type {
|
||||
Type::Uint8 => (),
|
||||
_ => return Ok(self.webgl_error(InvalidOperation)),
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue