#[repr(C)]pub(crate) struct Response {
reflector_: Reflector,
headers_reflector: MutNullableDom<Headers>,
status: DomRefCell<HttpStatus>,
response_type: DomRefCell<ResponseType>,
url: DomRefCell<Option<ServoUrl>>,
url_list: DomRefCell<Vec<ServoUrl>>,
body_stream: MutNullableDom<ReadableStream>,
fetch_body_stream: MutNullableDom<ReadableStream>,
stream_consumer: DomRefCell<Option<StreamConsumer>>,
redirected: Cell<bool>,
}Fields§
§reflector_: Reflector§headers_reflector: MutNullableDom<Headers>§status: DomRefCell<HttpStatus>§response_type: DomRefCell<ResponseType>§url: DomRefCell<Option<ServoUrl>>https://fetch.spec.whatwg.org/#concept-response-url
FIXME: This should always point to the last entry of url_list.
Somehow we directly set it instead.
url_list: DomRefCell<Vec<ServoUrl>>§body_stream: MutNullableDom<ReadableStream>The stream of https://fetch.spec.whatwg.org/#body.
fetch_body_stream: MutNullableDom<ReadableStream>The stream that receives network delivered bytes for Fetch responses.
This must remain stable even if body_stream is replaced by tee() branches during clone().
stream_consumer: DomRefCell<Option<StreamConsumer>>§redirected: Cell<bool>FIXME: This should be removed.
Implementations§
Source§impl Response
impl Response
fn __assert_parent_type(&self)
Source§impl Response
impl Response
pub(crate) fn new_inherited(body_stream: Option<&ReadableStream>) -> Response
fn new_with_proto( cx: &mut JSContext, global: &GlobalScope, proto: Option<HandleObject<'_>>, ) -> DomRoot<Response>
Sourcepub(crate) fn new_fetch_response(
cx: &mut JSContext,
global: &GlobalScope,
) -> DomRoot<Response>
pub(crate) fn new_fetch_response( cx: &mut JSContext, global: &GlobalScope, ) -> DomRoot<Response>
Create a Response whose body stream receives the chunks delivered by the network.
This is only for the fetch machinery; a JS-created Response is never network-backed.
pub(crate) fn error_stream(&self, cx: &mut JSContext, error: Error)
pub(crate) fn is_disturbed(&self) -> bool
pub(crate) fn is_locked(&self) -> bool
Source§impl Response
impl Response
pub(crate) fn set_type( &self, cx: &mut JSContext, new_response_type: DOMResponseType, )
pub(crate) fn set_headers( &self, cx: &mut JSContext, option_hyper_headers: Option<Serde<HyperHeaders>>, )
pub(crate) fn set_status(&self, status: &HttpStatus)
pub(crate) fn set_final_url(&self, final_url: ServoUrl)
pub(crate) fn set_redirected(&self, is_redirected: bool)
fn set_response_members_by_type( &self, cx: &mut JSContext, response_type: DOMResponseType, )
pub(crate) fn set_stream_consumer(&self, sc: Option<StreamConsumer>)
pub(crate) fn stream_chunk(&self, cx: &mut JSContext, chunk: Bytes)
pub(crate) fn finish(&self, cx: &mut JSContext)
Trait Implementations§
Source§impl BodyMixin for Response
impl BodyMixin for Response
Source§impl DomObject for Response
impl DomObject for Response
type ReflectorType = <Reflector as DomObject>::ReflectorType
Source§fn reflector(&self) -> &Reflector<Self::ReflectorType>
fn reflector(&self) -> &Reflector<Self::ReflectorType>
Source§impl DomObjectWrap<DomTypeHolder> for Response
impl DomObjectWrap<DomTypeHolder> for Response
Source§impl IDLInterface for Response
impl IDLInterface for Response
Source§const PROTO_ID: ID = PrototypeList::ID::Response
const PROTO_ID: ID = PrototypeList::ID::Response
Source§const PROTO_FIRST: u16 = 496
const PROTO_FIRST: u16 = 496
Source§const PROTO_LAST: u16 = 496
const PROTO_LAST: u16 = 496
Source§impl MallocSizeOf for Response
impl MallocSizeOf for Response
Source§fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
Source§impl MutDomObject for Response
impl MutDomObject for Response
Source§impl ResponseMethods<DomTypeHolder> for Response
impl ResponseMethods<DomTypeHolder> for Response
Source§fn Constructor(
cx: &mut JSContext,
global: &GlobalScope,
proto: Option<HandleObject<'_>>,
body_init: Option<BodyInit<DomTypeHolder>>,
init: &ResponseInit,
) -> Fallible<DomRoot<Response>>
fn Constructor( cx: &mut JSContext, global: &GlobalScope, proto: Option<HandleObject<'_>>, body_init: Option<BodyInit<DomTypeHolder>>, init: &ResponseInit, ) -> Fallible<DomRoot<Response>>
Source§fn Redirect(
cx: &mut JSContext,
global: &GlobalScope,
url: USVString,
status: u16,
) -> Fallible<DomRoot<Response>>
fn Redirect( cx: &mut JSContext, global: &GlobalScope, url: USVString, status: u16, ) -> Fallible<DomRoot<Response>>
Source§fn CreateFromJson(
cx: &mut JSContext,
global: &GlobalScope,
data: HandleValue<'_>,
init: &ResponseInit,
) -> Fallible<DomRoot<Response>>
fn CreateFromJson( cx: &mut JSContext, global: &GlobalScope, data: HandleValue<'_>, init: &ResponseInit, ) -> Fallible<DomRoot<Response>>
Source§fn Redirected(&self) -> bool
fn Redirected(&self) -> bool
https://fetch.spec.whatwg.org/#dom-response-redirected TODO: The redirected getter steps are to return true if this’s response’s URL list’s size is greater than 1; otherwise false.
But if we do like spec says, test fails, probably because we not fully set URL list in spec steps.
Source§fn Text(&self, cx: &mut JSContext) -> RootedPromise
fn Text(&self, cx: &mut JSContext) -> RootedPromise
Source§fn Blob(&self, cx: &mut JSContext) -> RootedPromise
fn Blob(&self, cx: &mut JSContext) -> RootedPromise
Source§fn FormData(&self, cx: &mut JSContext) -> RootedPromise
fn FormData(&self, cx: &mut JSContext) -> RootedPromise
Source§fn Json(&self, cx: &mut JSContext) -> RootedPromise
fn Json(&self, cx: &mut JSContext) -> RootedPromise
Source§fn ArrayBuffer(&self, cx: &mut JSContext) -> RootedPromise
fn ArrayBuffer(&self, cx: &mut JSContext) -> RootedPromise
Source§fn Bytes(&self, cx: &mut JSContext) -> RootedPromise
fn Bytes(&self, cx: &mut JSContext) -> RootedPromise
Source§fn TextStream(&self, cx: &mut JSContext) -> Fallible<DomRoot<ReadableStream>>
fn TextStream(&self, cx: &mut JSContext) -> Fallible<DomRoot<ReadableStream>>
Source§impl ToJSValConvertible for Response
impl ToJSValConvertible for Response
Source§fn to_jsval(&self, cx: &mut JSContext, rval: MutableHandleValue<'_>)
fn to_jsval(&self, cx: &mut JSContext, rval: MutableHandleValue<'_>)
self to a JSVal. JSAPI failure causes a panic.impl Eq for Response
Auto Trait Implementations§
impl !Freeze for Response
impl !RefUnwindSafe for Response
impl !Send for Response
impl !Sync for Response
impl Unpin for Response
impl UnsafeUnpin for Response
impl !UnwindSafe for Response
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<D, T> DomGlobalGeneric<D> for T
impl<D, T> DomGlobalGeneric<D> for T
Source§fn global_from_reflector(&self) -> Root<Dom<<D as DomTypes>::GlobalScope>>where
Self: Sized,
fn global_from_reflector(&self) -> Root<Dom<<D as DomTypes>::GlobalScope>>where
Self: Sized,
GlobalScope] of the realm that the DomObject was created in. If this
object is a Node, this will be different from it’s owning Document if adopted by. For
Nodes it’s almost always better to use NodeTraits::owning_global.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more