summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcos Casagrande <marcoscvp90@gmail.com>2022-11-10 00:31:14 +0100
committerGitHub <noreply@github.com>2022-11-10 00:31:14 +0100
commit7bd2c607dd5aba82f4afb94a5c2e35ba5f0738cf (patch)
treec54bdc0e7aacdb5cdb828dbabdafd087ef6e56a6
parentfca539e65c3b824990fae3b992389d984aac7a95 (diff)
fix(ext/response): make error, json, redirect enumerable (#16497)
-rw-r--r--ext/fetch/23_response.js8
-rw-r--r--tools/wpt/expectation.json6
2 files changed, 7 insertions, 7 deletions
diff --git a/ext/fetch/23_response.js b/ext/fetch/23_response.js
index d5adb8042..542a62020 100644
--- a/ext/fetch/23_response.js
+++ b/ext/fetch/23_response.js
@@ -34,6 +34,7 @@
const {
ArrayPrototypeMap,
ArrayPrototypePush,
+ ObjectDefineProperties,
ObjectPrototypeIsPrototypeOf,
RangeError,
RegExp,
@@ -287,7 +288,7 @@
* @param {ResponseInit} init
* @returns {Response}
*/
- static json(data, init = {}) {
+ static json(data = undefined, init = {}) {
const prefix = "Failed to call 'Response.json'";
data = webidl.converters.any(data);
init = webidl.converters["ResponseInit_fast"](init, {
@@ -435,6 +436,11 @@
}
webidl.configurePrototype(Response);
+ ObjectDefineProperties(Response, {
+ json: { enumerable: true },
+ redirect: { enumerable: true },
+ error: { enumerable: true },
+ });
const ResponsePrototype = Response.prototype;
mixinBody(ResponsePrototype, _body, _mimeType);
diff --git a/tools/wpt/expectation.json b/tools/wpt/expectation.json
index 6eee11ef8..c58b8934f 100644
--- a/tools/wpt/expectation.json
+++ b/tools/wpt/expectation.json
@@ -3173,9 +3173,6 @@
"Request interface: new Request('about:blank') must inherit property \"isReloadNavigation\" with the proper type",
"Request interface: new Request('about:blank') must inherit property \"isHistoryNavigation\" with the proper type",
"Request interface: new Request('about:blank') must inherit property \"duplex\" with the proper type",
- "Response interface: operation error()",
- "Response interface: operation redirect(USVString, optional unsigned short)",
- "Response interface: operation json(any, optional ResponseInit)",
"Response interface: attribute body",
"Response interface: attribute bodyUsed",
"Response interface: calling redirect(USVString, optional unsigned short) on new Response() with too few arguments must throw TypeError",
@@ -3206,9 +3203,6 @@
"Request interface: new Request('about:blank') must inherit property \"isReloadNavigation\" with the proper type",
"Request interface: new Request('about:blank') must inherit property \"isHistoryNavigation\" with the proper type",
"Request interface: new Request('about:blank') must inherit property \"duplex\" with the proper type",
- "Response interface: operation error()",
- "Response interface: operation redirect(USVString, optional unsigned short)",
- "Response interface: operation json(any, optional ResponseInit)",
"Response interface: attribute body",
"Response interface: attribute bodyUsed",
"Response interface: calling redirect(USVString, optional unsigned short) on new Response() with too few arguments must throw TypeError",