From eff7659a2cb15aed801a9dbfc00c58e22efbbd42 Mon Sep 17 00:00:00 2001 From: autokagami Date: Tue, 24 Sep 2019 22:59:53 +0900 Subject: [PATCH] Align with IDL constructor changes Fixes #929. --- fetch.bs | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/fetch.bs b/fetch.bs index 5d80b9790..81261a8e2 100644 --- a/fetch.bs +++ b/fetch.bs @@ -5152,16 +5152,18 @@ fetch("/music/pk/altes-kamuffel.flac")
 typedef (sequence<sequence<ByteString>> or record<ByteString, ByteString>) HeadersInit;
 
-[Constructor(optional HeadersInit init),
- Exposed=(Window,Worker)]
+[Exposed=(Window,Worker)]
 interface Headers {
+  constructor(optional HeadersInit init);
+
   void append(ByteString name, ByteString value);
   void delete(ByteString name);
   ByteString? get(ByteString name);
   boolean has(ByteString name);
   void set(ByteString name, ByteString value);
   iterable<ByteString, ByteString>;
-};
+}; +

Unlike a header list, a {{Headers}} object cannot represent more than one `Set-Cookie` header. In a way this is problematic as unlike all other @@ -5689,9 +5691,10 @@ invoked, must return the result of running

 typedef (Request or USVString) RequestInfo;
 
-[Constructor(RequestInfo input, optional RequestInit init = {}),
- Exposed=(Window,Worker)]
+[Exposed=(Window,Worker)]
 interface Request {
+  constructor(RequestInfo input, optional RequestInit init = {});
+
   readonly attribute ByteString method;
   readonly attribute USVString url;
   [SameObject] readonly attribute Headers headers;
@@ -5733,7 +5736,8 @@ enum RequestDestination { "", "audio", "audioworklet", "document", "embed", "fon
 enum RequestMode { "navigate", "same-origin", "no-cors", "cors" };
 enum RequestCredentials { "omit", "same-origin", "include" };
 enum RequestCache { "default", "no-store", "reload", "no-cache", "force-cache", "only-if-cached" };
-enum RequestRedirect { "follow", "error", "manual" };
+enum RequestRedirect { "follow", "error", "manual" }; +

"serviceworker" is omitted from RequestDestination as it cannot be observed from JavaScript. Implementations @@ -6336,9 +6340,10 @@ run these steps:

Response class

-
[Constructor(optional BodyInit? body = null, optional ResponseInit init = {}),
- Exposed=(Window,Worker)]
+
[Exposed=(Window,Worker)]
 interface Response {
+  constructor(optional BodyInit? body = null, optional ResponseInit init = {});
+
   [NewObject] static Response error();
   [NewObject] static Response redirect(USVString url, optional unsigned short status = 302);
 
@@ -6362,7 +6367,8 @@ dictionary ResponseInit {
   HeadersInit headers;
 };
 
-enum ResponseType { "basic", "cors", "default", "error", "opaque", "opaqueredirect" };
+enum ResponseType { "basic", "cors", "default", "error", "opaque", "opaqueredirect" }; +

A {{Response}} object has an associated response (a @@ -6559,8 +6565,9 @@ run these steps:

 partial interface mixin WindowOrWorkerGlobalScope {
-  [NewObject] Promise<Response> fetch(RequestInfo input, optional RequestInit init);
-};
+ [NewObject] Promise<Response> fetch(RequestInfo input, optional RequestInit init = {}); +}; +

The fetch(input, init)