| // Copyright 2018 The Chromium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| module blink.mojom; |
| |
| import "mojo/public/mojom/base/time.mojom"; |
| import "services/network/public/mojom/fetch_api.mojom"; |
| import "services/network/public/mojom/parsed_headers.mojom"; |
| import "services/network/public/mojom/network_param.mojom"; |
| import "services/network/public/mojom/network_types.mojom"; |
| import "third_party/blink/public/mojom/blob/serialized_blob.mojom"; |
| import "third_party/blink/public/mojom/service_worker/service_worker_error_type.mojom"; |
| import "url/mojom/url.mojom"; |
| |
| // Describes a Response in terms of the concept from the Fetch spec. |
| // https://fetch.spec.whatwg.org/#response-class |
| // Note: Be sure to update CacheStorageCache::EstimatedResponseSizeWithoutBlob() |
| // when adding or removing members. |
| struct FetchAPIResponse { |
| // List of URLs that originally generated this response, it includes all URLs |
| // in case of HTTP redirect, first URL on redirect chain is on position 0. |
| // It can be empty if respones was generated programatically as in |
| // responsdWith(new Response()). |
| array<url.mojom.Url> url_list; |
| |
| // Status code as number, e.g.: 200, 404. |
| // Zero status code indicates an error happened and the request was not |
| // handled. |
| uint16 status_code = 0; |
| |
| // Status code as text. e.g.: "OK", "Not Found". |
| string status_text; |
| |
| // Corresponds to response types from the Fetch spec: |
| // https://fetch.spec.whatwg.org/#concept-response-type |
| network.mojom.FetchResponseType response_type = |
| network.mojom.FetchResponseType.kDefault; |
| |
| // Pre-computed padding for this response. This should only be non-zero |
| // for when |response_type| is kOpaque. |
| int64 padding = 0; |
| |
| // The source of this response, e.g. network, CacheStorage. |
| network.mojom.FetchResponseSource response_source = |
| network.mojom.FetchResponseSource.kUnspecified; |
| |
| // The response headers. It's case insensitive for header name as key. |
| map<string, string> headers; |
| |
| // The mime type of the response, if one has been set. |
| string? mime_type; |
| |
| // The http request method used to load the response. May be unset for |
| // synthetic Response objects created via the constructor. |
| string? request_method; |
| |
| // Mojo interface to read the response payload. |
| SerializedBlob? blob; |
| |
| // Error codes for service worker APIs. |
| ServiceWorkerResponseError error = |
| blink.mojom.ServiceWorkerResponseError.kUnknown; |
| |
| // The time at which the response headers were received. For cached |
| // responses, this time could be "far" in the past. |
| mojo_base.mojom.Time response_time; |
| |
| // Name of cache where this response was retrieved, empty otherwise. |
| string? cache_storage_cache_name; |
| |
| // In case this is a CORS response fetched by a ServiceWorker, this is the |
| // set of headers that should be exposed. |
| array<string> cors_exposed_header_names; |
| |
| // Used to pass code cache for responses produced by cache_storage. The code |
| // cache will be stored in the side data stream of the blob. |
| SerializedBlob? side_data_blob; |
| |
| // Used to pass code cache for a response that is being newly stored in |
| // cache_storage. This blob is created from a memory buffer in the renderer |
| // and the code cache is contained in the primary data stream of the blob. |
| SerializedBlob? side_data_blob_for_cache_put; |
| |
| // A set of parsed headers for clients that can't do the parsing themselves, |
| // because they aren't sandboxed (e.g. the browser process). This is the |
| // output of blink::ParseHeaders(headers, url); |
| network.mojom.ParsedHeaders? parsed_headers; |
| |
| // Enumeration that describes the kind of connection originally used to |
| // fetch this request. |
| network.mojom.ConnectionInfo connection_info; |
| |
| // ALPN negotiated protocol of the socket which fetched this resource. |
| string alpn_negotiated_protocol = "unknown"; |
| |
| // True if the response was originally loaded via a request fetched over a |
| // SPDY channel. |
| bool was_fetched_via_spdy = false; |
| |
| // https://fetch.spec.whatwg.org/#concept-response-range-requested-flag |
| bool has_range_requested = false; |
| |
| // Information related to an authentication challenge from the response, if |
| // there was one. |
| network.mojom.AuthChallengeInfo? auth_challenge_info; |
| }; |