blob: 50304b9b39bf56bbc0941323974b298124562ab7 [file] [log] [blame]
// Copyright 2017 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 network.mojom;
// Corresponds to Fetch request's "mode" and "use-CORS-preflight flag":
// https://fetch.spec.whatwg.org/#concept-request-mode
//
// This enum is also used in histograms. Append-only.
// See the "RequestMode" enum in enums.xml.
enum RequestMode {
kSameOrigin,
kNoCors,
kCors,
kCorsWithForcedPreflight,
kNavigate,
// Add a new type here, then update enums.xml.
};
// Corresponds to Fetch request's "destination":
// https://fetch.spec.whatwg.org/#concept-request-destination
//
// Note: some types like kIframe and kFrame are still in PR
// as of Feb 2020: https://github.com/whatwg/fetch/pull/948
//
// Note: if destination is kDocument it should be a main
// resource request for main frames, except for Portals cases.
enum RequestDestination {
kEmpty,
kAudio,
kAudioWorklet,
kDocument,
kEmbed,
kFont,
kFrame,
kIframe,
kImage,
kManifest,
kObject,
kPaintWorklet,
kReport,
kScript,
kServiceWorker,
kSharedWorker,
kStyle,
kTrack,
kVideo,
// kWebBundle represents a request for a WebBundle. A <link> element whose
// rel is "webbundle" uses this destination.
//
// e.g. <link rel=webbundle href="example.com/foo.wbn" resources="...">
//
// Fetch specifiction does not define this destination yet.
// Tracking issue: https://github.com/whatwg/fetch/issues/1120
kWebBundle,
kWorker,
kXslt,
};
// Corresponds to Fetch request's "redirect mode":
// https://fetch.spec.whatwg.org/#concept-request-redirect-mode
enum RedirectMode {
kFollow,
kError,
kManual,
};
// Corresponds to Fetch request's "credentials mode":
// https://fetch.spec.whatwg.org/#concept-request-credentials-mode
enum CredentialsMode {
// TODO(https://crbug.com/775438): Due to a bug, this does not properly
// correspond to Fetch's "credentials mode", in that client certificates will
// be sent is available, or the handshake will be aborted in order to allow
// selecting a client cert. The correct behavior is to omit all client certs
// and continue the handshake without sending one if requested.
kOmit,
kSameOrigin,
kInclude,
// TODO(https://crbug.com/775438): This works around kOmit not doing the
// spec-defined behavior. This is a temporary workaround that explicitly
// indicates the caller wants the spec-defined behavior. It's named as such
// because this should be only temporary, until kOmit is fixed.
kOmitBug_775438_Workaround
};
// Corresponds to response types from the Fetch spec:
// https://fetch.spec.whatwg.org/#concept-response-type
//
// This enum is also used in histograms. Append-only.
// See the "FetchResponseType" enum in enums.xml.
enum FetchResponseType {
kBasic,
kCors,
kDefault,
kError,
kOpaque,
kOpaqueRedirect,
// Add a new type here, then update enums.xml.
};
// Indicates the source of a response.
// This represents the source of the outmost response of a request.
// This is used only for histograms and isn't web-exposed.
enum FetchResponseSource {
// The source is unspecified: e.g. "new Response('hi')" or a response from
// a service worker.
kUnspecified,
// The response came from network: e.g. "fetch(req)".
kNetwork,
// The response came from HttpCache: e.g. "fetch(req)" and there is an entry
// in HttpCache.
kHttpCache,
// The response came from CacheStorage: e.g. "cache.match(req)" in a fetch
// event handler.
kCacheStorage,
};