dom/webidl/Response.webidl
author James Cheng <jacheng@mozilla.com>
Fri, 05 Aug 2016 13:23:44 -0400
changeset 308428 8ee6f2eb8b349a351f6f76585eb85e0ec2b5c475
parent 296849 77a81adaa885b6b1d0f4a5a404480ec52242fa38
child 311758 88cc4d51a1ba8aaa05559c4c7abaa1a0d20bb301
permissions -rw-r--r--
Bug 1291229 - Fix typo for moving Java bindings to mozilla::java namespace. r=jchen MozReview-Commit-ID: KGAS6EhnwAI

/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
 * You can obtain one at http://mozilla.org/MPL/2.0/.
 *
 * The origin of this IDL file is
 * https://fetch.spec.whatwg.org/#response-class
 */

[Constructor(optional BodyInit body, optional ResponseInit init),
 Exposed=(Window,Worker)]
interface Response {
  [NewObject] static Response error();
  [Throws,
   NewObject] static Response redirect(USVString url, optional unsigned short status = 302);

  readonly attribute ResponseType type;

  readonly attribute USVString url;
  readonly attribute boolean redirected;
  readonly attribute unsigned short status;
  readonly attribute boolean ok;
  readonly attribute ByteString statusText;
  [SameObject] readonly attribute Headers headers;

  [Throws,
   NewObject] Response clone();

  [ChromeOnly, NewObject, Throws] Response cloneUnfiltered();
};
Response implements Body;

dictionary ResponseInit {
  unsigned short status = 200;
  // WebIDL spec doesn't allow default values for ByteString.
  ByteString statusText;
  HeadersInit headers;
};

enum ResponseType { "basic", "cors", "default", "error", "opaque", "opaqueredirect" };