/*
 * Copyright (C) 2016 Canon Inc.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted, provided that the following conditions
 * are required to be met:
 *
 * 1.  Redistributions of source code must retain the above copyright
 *     notice, this list of conditions and the following disclaimer.
 * 2.  Redistributions in binary form must reproduce the above copyright
 *     notice, this list of conditions and the following disclaimer in the
 *     documentation and/or other materials provided with the distribution.
 * 3.  Neither the name of Canon Inc. nor the names of
 *     its contributors may be used to endorse or promote products derived
 *     from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY CANON INC. AND ITS CONTRIBUTORS "AS IS" AND ANY
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL CANON INC. AND ITS CONTRIBUTORS BE LIABLE FOR
 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

enum FetchRequestDestination { "", "audio", "document", "embed", "font", "image", "manifest", "object", "report", "script", "serviceworker", "sharedworker", "style", "track", "video", "worker", "xslt" };

typedef (FetchRequest or USVString) RequestInfo;

typedef (Blob or BufferSource or DOMFormData or URLSearchParams or ReadableStream or USVString) BodyInit;

[
    ActiveDOMObject,
    EnabledAtRuntime=FetchAPI,
    Exposed=(Window,Worker),
    GenerateIsReachable=Impl,
    InterfaceName=Request,
] interface FetchRequest {
    [CallWith=ScriptExecutionContext, MayThrowException] constructor(RequestInfo input, optional FetchRequestInit init);

    readonly attribute ByteString method;
    [ImplementedAs=urlString] readonly attribute USVString url;
    readonly attribute FetchHeaders headers; // FIXME: Should be [SameObject].

    readonly attribute FetchRequestDestination destination;
    readonly attribute USVString referrer;
    readonly attribute FetchReferrerPolicy referrerPolicy;
    readonly attribute FetchRequestMode mode;
    readonly attribute FetchRequestCredentials credentials;
    readonly attribute FetchRequestCache cache;
    readonly attribute FetchRequestRedirect redirect;
    readonly attribute DOMString integrity;
    [EnabledAtRuntime=FetchAPIKeepAlive] readonly attribute boolean keepalive;
    readonly attribute AbortSignal signal;

    [CallWith=ScriptExecutionContext, MayThrowException, NewObject] FetchRequest clone();
};

FetchRequest implements FetchBody;
