Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ext/response): make error, json, redirect enumerable #16497

Merged
merged 2 commits into from
Nov 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion ext/fetch/23_response.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
const {
ArrayPrototypeMap,
ArrayPrototypePush,
ObjectDefineProperties,
ObjectPrototypeIsPrototypeOf,
RangeError,
RegExp,
Expand Down Expand Up @@ -287,7 +288,7 @@
* @param {ResponseInit} init
* @returns {Response}
*/
static json(data, init = {}) {
static json(data = undefined, init = {}) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fixes: Response interface: operation json(any, optional ResponseInit)

const prefix = "Failed to call 'Response.json'";
data = webidl.converters.any(data);
init = webidl.converters["ResponseInit_fast"](init, {
Expand Down Expand Up @@ -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);

Expand Down
6 changes: 0 additions & 6 deletions tools/wpt/expectation.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down