mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Various CanGc fixes in 8 files (#33893)
* Various CanGc fixes in 8 files Signed-off-by: L Ashwin B <lashwinib@gmail.com> * fixed merge conflicts and formatting Signed-off-by: L Ashwin B <lashwinib@gmail.com> --------- Signed-off-by: L Ashwin B <lashwinib@gmail.com>
This commit is contained in:
parent
6b87ecc291
commit
fde8d72aca
13 changed files with 77 additions and 58 deletions
|
@ -715,7 +715,11 @@ impl Callback for ConsumeBodyPromiseHandler {
|
|||
|
||||
// https://fetch.spec.whatwg.org/#concept-body-consume-body
|
||||
#[allow(crown::unrooted_must_root)]
|
||||
pub fn consume_body<T: BodyMixin + DomObject>(object: &T, body_type: BodyType) -> Rc<Promise> {
|
||||
pub fn consume_body<T: BodyMixin + DomObject>(
|
||||
object: &T,
|
||||
body_type: BodyType,
|
||||
can_gc: CanGc,
|
||||
) -> Rc<Promise> {
|
||||
let in_realm_proof = AlreadyInRealm::assert();
|
||||
let promise = Promise::new_in_current_realm(InRealm::Already(&in_realm_proof));
|
||||
|
||||
|
@ -732,6 +736,7 @@ pub fn consume_body<T: BodyMixin + DomObject>(object: &T, body_type: BodyType) -
|
|||
body_type,
|
||||
promise.clone(),
|
||||
InRealm::Already(&in_realm_proof),
|
||||
can_gc,
|
||||
);
|
||||
|
||||
promise
|
||||
|
@ -744,6 +749,7 @@ fn consume_body_with_promise<T: BodyMixin + DomObject>(
|
|||
body_type: BodyType,
|
||||
promise: Rc<Promise>,
|
||||
comp: InRealm,
|
||||
can_gc: CanGc,
|
||||
) {
|
||||
let global = object.global();
|
||||
|
||||
|
@ -771,7 +777,7 @@ fn consume_body_with_promise<T: BodyMixin + DomObject>(
|
|||
result_promise: promise.clone(),
|
||||
stream: Some(stream),
|
||||
body_type: DomRefCell::new(Some(body_type)),
|
||||
mime_type: DomRefCell::new(Some(object.get_mime_type())),
|
||||
mime_type: DomRefCell::new(Some(object.get_mime_type(can_gc))),
|
||||
// Step 2.
|
||||
bytes: DomRefCell::new(Some(vec![])),
|
||||
});
|
||||
|
@ -913,5 +919,5 @@ pub trait BodyMixin {
|
|||
/// <https://fetch.spec.whatwg.org/#concept-body-locked>
|
||||
fn is_locked(&self) -> bool;
|
||||
/// <https://fetch.spec.whatwg.org/#concept-body-mime-type>
|
||||
fn get_mime_type(&self) -> Vec<u8>;
|
||||
fn get_mime_type(&self, can_gc: CanGc) -> Vec<u8>;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue