diff --git a/components/script/dom/audiobuffer.rs b/components/script/dom/audiobuffer.rs index 761bcde404b..ccce8510586 100644 --- a/components/script/dom/audiobuffer.rs +++ b/components/script/dom/audiobuffer.rs @@ -134,8 +134,8 @@ impl AudioBuffer { // Move the channel data from shared_channels to js_channels. rooted!(in (cx) let mut array = ptr::null_mut::()); - let shared_channel = (*self.shared_channels.borrow_mut()).buffers.remove(i); - if Float32Array::create(cx, CreateWith::Slice(&shared_channel), array.handle_mut()) + let shared_channel = &(*self.shared_channels.borrow_mut()).buffers[i]; + if Float32Array::create(cx, CreateWith::Slice(shared_channel), array.handle_mut()) .is_err() { return false; @@ -182,8 +182,6 @@ impl AudioBuffer { // data into js_channels ArrayBuffers in restore_js_channel_data. } - self.js_channels.borrow_mut().clear(); - Some((*self.shared_channels.borrow()).clone()) } }