diff options
author | chickenleaf <lashwinib@gmail.com> | 2024-10-14 03:05:59 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-13 21:35:59 +0000 |
commit | fc0835bae3dc28b17e6002e0594d6112517ff61d (patch) | |
tree | ab06cf48acc57f451ad75ae8a4d384e51b3dff83 /components/script/dom/response.rs | |
parent | 92f12ff7cda3d3da667d2358ab3867b1dcc5b9a2 (diff) | |
download | servo-fc0835bae3dc28b17e6002e0594d6112517ff61d.tar.gz servo-fc0835bae3dc28b17e6002e0594d6112517ff61d.zip |
CanGc fixes in focusevent.rs oscillartornode.rs response.rs resizeobserversize.rs animationevent.rs (#33827)
Signed-off-by: L Ashwin B <lashwinib@gmail.com>
Diffstat (limited to 'components/script/dom/response.rs')
-rw-r--r-- | components/script/dom/response.rs | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/components/script/dom/response.rs b/components/script/dom/response.rs index 40f43daf869..6d483d925ae 100644 --- a/components/script/dom/response.rs +++ b/components/script/dom/response.rs @@ -72,8 +72,8 @@ impl Response { } // https://fetch.spec.whatwg.org/#dom-response - pub fn new(global: &GlobalScope) -> DomRoot<Response> { - Self::new_with_proto(global, None, CanGc::note()) + pub fn new(global: &GlobalScope, can_gc: CanGc) -> DomRoot<Response> { + Self::new_with_proto(global, None, can_gc) } fn new_with_proto( @@ -218,8 +218,8 @@ impl ResponseMethods for Response { } // https://fetch.spec.whatwg.org/#dom-response-error - fn Error(global: &GlobalScope) -> DomRoot<Response> { - let r = Response::new(global); + fn Error(global: &GlobalScope, can_gc: CanGc) -> DomRoot<Response> { + let r = Response::new(global, can_gc); *r.response_type.borrow_mut() = DOMResponseType::Error; r.Headers().set_guard(Guard::Immutable); *r.status.borrow_mut() = HttpStatus::new_error(); @@ -227,7 +227,12 @@ impl ResponseMethods for Response { } // https://fetch.spec.whatwg.org/#dom-response-redirect - fn Redirect(global: &GlobalScope, url: USVString, status: u16) -> Fallible<DomRoot<Response>> { + fn Redirect( + global: &GlobalScope, + url: USVString, + status: u16, + can_gc: CanGc, + ) -> Fallible<DomRoot<Response>> { // Step 1 let base_url = global.api_base_url(); let parsed_url = base_url.join(&url.0); @@ -245,7 +250,7 @@ impl ResponseMethods for Response { // Step 4 // see Step 4 continued - let r = Response::new(global); + let r = Response::new(global, can_gc); // Step 5 *r.status.borrow_mut() = HttpStatus::new_raw(status, vec![]); @@ -306,14 +311,14 @@ impl ResponseMethods for Response { } // https://fetch.spec.whatwg.org/#dom-response-clone - fn Clone(&self) -> Fallible<DomRoot<Response>> { + fn Clone(&self, can_gc: CanGc) -> Fallible<DomRoot<Response>> { // Step 1 if self.is_locked() || self.is_disturbed() { return Err(Error::Type("cannot clone a disturbed response".to_string())); } // Step 2 - let new_response = Response::new(&self.global()); + let new_response = Response::new(&self.global(), can_gc); new_response.Headers().copy_from_headers(self.Headers())?; new_response.Headers().set_guard(self.Headers().get_guard()); |