mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Propagate CanGc when interacting with readable streams. (#33975)
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
This commit is contained in:
parent
f553bda7eb
commit
12e6ec25aa
10 changed files with 80 additions and 57 deletions
|
@ -190,7 +190,7 @@ impl ResponseMethods for Response {
|
|||
total_bytes: _,
|
||||
content_type,
|
||||
source: _,
|
||||
} = body.extract(global)?;
|
||||
} = body.extract(global, can_gc)?;
|
||||
|
||||
r.body_stream.set(Some(&*stream));
|
||||
|
||||
|
@ -210,7 +210,7 @@ impl ResponseMethods for Response {
|
|||
} else {
|
||||
// Reset FetchResponse to an in-memory stream with empty byte sequence here for
|
||||
// no-init-body case
|
||||
let stream = ReadableStream::new_from_bytes(global, Vec::with_capacity(0));
|
||||
let stream = ReadableStream::new_from_bytes(global, Vec::with_capacity(0), can_gc);
|
||||
r.body_stream.set(Some(&*stream));
|
||||
}
|
||||
|
||||
|
@ -444,12 +444,12 @@ impl Response {
|
|||
*self.stream_consumer.borrow_mut() = sc;
|
||||
}
|
||||
|
||||
pub fn stream_chunk(&self, chunk: Vec<u8>) {
|
||||
pub fn stream_chunk(&self, chunk: Vec<u8>, can_gc: CanGc) {
|
||||
// Note, are these two actually mutually exclusive?
|
||||
if let Some(stream_consumer) = self.stream_consumer.borrow_mut().as_ref() {
|
||||
stream_consumer.consume_chunk(chunk.as_slice());
|
||||
} else if let Some(body) = self.body_stream.get() {
|
||||
body.enqueue_native(chunk);
|
||||
body.enqueue_native(chunk, can_gc);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue