mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +01:00
add response tainting to request builder
This commit is contained in:
parent
e09f85e17b
commit
5adff93054
2 changed files with 10 additions and 1 deletions
|
@ -93,7 +93,7 @@ pub enum RedirectMode {
|
|||
}
|
||||
|
||||
/// [Response tainting](https://fetch.spec.whatwg.org/#concept-request-response-tainting)
|
||||
#[derive(Clone, Copy, MallocSizeOf, PartialEq)]
|
||||
#[derive(Clone, Copy, Debug, Deserialize, MallocSizeOf, PartialEq, Serialize)]
|
||||
pub enum ResponseTainting {
|
||||
Basic,
|
||||
CorsTainting,
|
||||
|
@ -253,6 +253,7 @@ pub struct RequestBuilder {
|
|||
pub parser_metadata: ParserMetadata,
|
||||
pub initiator: Initiator,
|
||||
pub https_state: HttpsState,
|
||||
pub response_tainting: ResponseTainting,
|
||||
}
|
||||
|
||||
impl RequestBuilder {
|
||||
|
@ -282,6 +283,7 @@ impl RequestBuilder {
|
|||
initiator: Initiator::None,
|
||||
csp_list: None,
|
||||
https_state: HttpsState::None,
|
||||
response_tainting: ResponseTainting::Basic,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -375,6 +377,11 @@ impl RequestBuilder {
|
|||
self
|
||||
}
|
||||
|
||||
pub fn response_tainting(mut self, response_tainting: ResponseTainting) -> RequestBuilder {
|
||||
self.response_tainting = response_tainting;
|
||||
self
|
||||
}
|
||||
|
||||
pub fn build(self) -> Request {
|
||||
let mut request = Request::new(
|
||||
self.url.clone(),
|
||||
|
@ -407,6 +414,7 @@ impl RequestBuilder {
|
|||
request.integrity_metadata = self.integrity_metadata;
|
||||
request.parser_metadata = self.parser_metadata;
|
||||
request.csp_list = self.csp_list;
|
||||
request.response_tainting = self.response_tainting;
|
||||
request
|
||||
}
|
||||
}
|
||||
|
|
|
@ -127,6 +127,7 @@ fn request_init_from_request(request: NetTraitsRequest) -> RequestBuilder {
|
|||
initiator: request.initiator,
|
||||
csp_list: None,
|
||||
https_state: request.https_state,
|
||||
response_tainting: request.response_tainting,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue