mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
refactor: add CanGc as argument to create_buffer_source (#35597)
Signed-off-by: Yerkebulan Tulibergenov <yerkebulan@gmail.com>
This commit is contained in:
parent
35f21e426b
commit
245a39c07e
22 changed files with 169 additions and 96 deletions
|
@ -98,14 +98,19 @@ impl FileReaderSyncMethods<crate::DomTypeHolder> for FileReaderSync {
|
|||
}
|
||||
|
||||
/// <https://w3c.github.io/FileAPI/#readAsArrayBufferSyncSection>
|
||||
fn ReadAsArrayBuffer(&self, cx: JSContext, blob: &Blob) -> Fallible<ArrayBuffer> {
|
||||
fn ReadAsArrayBuffer(
|
||||
&self,
|
||||
cx: JSContext,
|
||||
blob: &Blob,
|
||||
can_gc: CanGc,
|
||||
) -> Fallible<ArrayBuffer> {
|
||||
// step 1
|
||||
let blob_contents = FileReaderSync::get_blob_bytes(blob)?;
|
||||
|
||||
// step 2
|
||||
rooted!(in(*cx) let mut array_buffer = ptr::null_mut::<JSObject>());
|
||||
|
||||
create_buffer_source::<ArrayBufferU8>(cx, &blob_contents, array_buffer.handle_mut())
|
||||
create_buffer_source::<ArrayBufferU8>(cx, &blob_contents, array_buffer.handle_mut(), can_gc)
|
||||
.map_err(|_| Error::JSFailed)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue