aboutsummaryrefslogtreecommitdiffstats
path: root/components/net_traits/request.rs
diff options
context:
space:
mode:
authorAnthony Ramine <n.oxyde@gmail.com>2017-04-04 21:25:45 +0200
committerAnthony Ramine <n.oxyde@gmail.com>2017-04-05 14:26:49 +0200
commitd2dc425336cab24f8995cd10fba4d4606e1c0b02 (patch)
treee3ef4dafae4cfaf7b98f9558b219ed2da13d8d15 /components/net_traits/request.rs
parenta55cb8425dc41fc6909047841c985a4ede3fa8f9 (diff)
downloadservo-d2dc425336cab24f8995cd10fba4d4606e1c0b02.tar.gz
servo-d2dc425336cab24f8995cd10fba4d4606e1c0b02.zip
Add spec links to the Request fields
Diffstat (limited to 'components/net_traits/request.rs')
-rw-r--r--components/net_traits/request.rs30
1 files changed, 29 insertions, 1 deletions
diff --git a/components/net_traits/request.rs b/components/net_traits/request.rs
index c2c58ff1694..b306184a796 100644
--- a/components/net_traits/request.rs
+++ b/components/net_traits/request.rs
@@ -186,45 +186,69 @@ impl Default for RequestInit {
}
}
-/// A [Request](https://fetch.spec.whatwg.org/#requests) as defined by the Fetch spec
+/// A [Request](https://fetch.spec.whatwg.org/#concept-request) as defined by
+/// the Fetch spec.
#[derive(Clone, HeapSizeOf)]
pub struct Request {
+ /// https://fetch.spec.whatwg.org/#concept-request-method
#[ignore_heap_size_of = "Defined in hyper"]
pub method: Method,
+ /// https://fetch.spec.whatwg.org/#local-urls-only-flag
pub local_urls_only: bool,
+ /// https://fetch.spec.whatwg.org/#sandboxed-storage-area-urls-flag
pub sandboxed_storage_area_urls: bool,
+ /// https://fetch.spec.whatwg.org/#concept-request-header-list
#[ignore_heap_size_of = "Defined in hyper"]
pub headers: Headers,
+ /// https://fetch.spec.whatwg.org/#unsafe-request-flag
pub unsafe_request: bool,
+ /// https://fetch.spec.whatwg.org/#concept-request-body
pub body: Option<Vec<u8>>,
// TODO: client object
pub is_service_worker_global_scope: bool,
pub window: Window,
// TODO: target browsing context
+ /// https://fetch.spec.whatwg.org/#request-keepalive-flag
pub keep_alive: bool,
pub skip_service_worker: bool,
+ /// https://fetch.spec.whatwg.org/#concept-request-initiator
pub initiator: Initiator,
+ /// https://fetch.spec.whatwg.org/#concept-request-type
pub type_: Type,
+ /// https://fetch.spec.whatwg.org/#concept-request-destination
pub destination: Destination,
// TODO: priority object
+ /// https://fetch.spec.whatwg.org/#concept-request-origin
pub origin: Origin,
pub omit_origin_header: bool,
/// https://fetch.spec.whatwg.org/#concept-request-referrer
pub referrer: Referrer,
+ /// https://fetch.spec.whatwg.org/#concept-request-referrer-policy
pub referrer_policy: Option<ReferrerPolicy>,
pub pipeline_id: Option<PipelineId>,
+ /// https://fetch.spec.whatwg.org/#synchronous-flag
pub synchronous: bool,
+ /// https://fetch.spec.whatwg.org/#concept-request-mode
pub mode: RequestMode,
+ /// https://fetch.spec.whatwg.org/#use-cors-preflight-flag
pub use_cors_preflight: bool,
+ /// https://fetch.spec.whatwg.org/#concept-request-credentials-mode
pub credentials_mode: CredentialsMode,
+ /// https://fetch.spec.whatwg.org/#concept-request-use-url-credentials-flag
pub use_url_credentials: bool,
+ /// https://fetch.spec.whatwg.org/#concept-request-cache-mode
pub cache_mode: CacheMode,
+ /// https://fetch.spec.whatwg.org/#concept-request-redirect-mode
pub redirect_mode: RedirectMode,
+ /// https://fetch.spec.whatwg.org/#concept-request-integrity-metadata
pub integrity_metadata: String,
// Use the last method on url_list to act as spec current url field, and
// first method to act as spec url field
+ /// https://fetch.spec.whatwg.org/#concept-request-url-list
pub url_list: Vec<ServoUrl>,
+ /// https://fetch.spec.whatwg.org/#concept-request-redirect-count
pub redirect_count: u32,
+ /// https://fetch.spec.whatwg.org/#concept-request-response-tainting
pub response_tainting: ResponseTainting,
}
@@ -296,18 +320,22 @@ impl Request {
req
}
+ /// https://fetch.spec.whatwg.org/#concept-request-url
pub fn url(&self) -> ServoUrl {
self.url_list.first().unwrap().clone()
}
+ /// https://fetch.spec.whatwg.org/#concept-request-current-url
pub fn current_url(&self) -> ServoUrl {
self.url_list.last().unwrap().clone()
}
+ /// https://fetch.spec.whatwg.org/#navigation-request
pub fn is_navigation_request(&self) -> bool {
self.destination == Destination::Document
}
+ /// https://fetch.spec.whatwg.org/#subresource-request
pub fn is_subresource_request(&self) -> bool {
match self.destination {
Destination::Font | Destination::Image | Destination::Manifest | Destination::Media |