1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-21 15:04:11 -05:00

fix: remove unimplemented Request attributes (#10784)

Not having them is better than throwing "unimplemented" errors on
access.
This commit is contained in:
Luca Casonato 2021-05-31 11:03:17 +02:00 committed by Bert Belder
parent 8a7e1c616d
commit 2c1f37b4a9
No known key found for this signature in database
GPG key ID: 7A77887B2E2ED461
2 changed files with 12 additions and 112 deletions

View file

@ -316,66 +316,11 @@
return this[_headers]; return this[_headers];
} }
get destination() {
webidl.assertBranded(this, Request);
throw new TypeError("This property is not implemented.");
}
get referrer() {
webidl.assertBranded(this, Request);
throw new TypeError("This property is not implemented.");
}
get referrerPolicy() {
webidl.assertBranded(this, Request);
throw new TypeError("This property is not implemented.");
}
get mode() {
webidl.assertBranded(this, Request);
throw new TypeError("This property is not implemented.");
}
get credentials() {
webidl.assertBranded(this, Request);
throw new TypeError("This property is not implemented.");
}
get cache() {
webidl.assertBranded(this, Request);
throw new TypeError("This property is not implemented.");
}
get redirect() { get redirect() {
webidl.assertBranded(this, Request); webidl.assertBranded(this, Request);
return this[_request].redirectMode; return this[_request].redirectMode;
} }
get integrity() {
webidl.assertBranded(this, Request);
throw new TypeError("This property is not implemented.");
}
get keepalive() {
webidl.assertBranded(this, Request);
throw new TypeError("This property is not implemented.");
}
get isReloadNavigation() {
webidl.assertBranded(this, Request);
throw new TypeError("This property is not implemented.");
}
get isHistoryNavigation() {
webidl.assertBranded(this, Request);
throw new TypeError("This property is not implemented.");
}
get signal() {
webidl.assertBranded(this, Request);
throw new TypeError("This property is not implemented.");
}
clone() { clone() {
webidl.assertBranded(this, Request); webidl.assertBranded(this, Request);
if (this[_body] && this[_body].unusable()) { if (this[_body] && this[_body].unusable()) {
@ -438,46 +383,6 @@
} }
return webidl.converters["USVString"](V, opts); return webidl.converters["USVString"](V, opts);
}; };
webidl.converters["ReferrerPolicy"] = webidl.createEnumConverter(
"ReferrerPolicy",
[
"",
"no-referrer",
"no-referrer-when-downgrade",
"same-origin",
"origin",
"strict-origin",
"origin-when-cross-origin",
"strict-origin-when-cross-origin",
"unsafe-url",
],
);
webidl.converters["RequestMode"] = webidl.createEnumConverter("RequestMode", [
"navigate",
"same-origin",
"no-cors",
"cors",
]);
webidl.converters["RequestCredentials"] = webidl.createEnumConverter(
"RequestCredentials",
[
"omit",
"same-origin",
"include",
],
);
webidl.converters["RequestCache"] = webidl.createEnumConverter(
"RequestCache",
[
"default",
"no-store",
"reload",
"no-cache",
"force-cache",
"only-if-cached",
],
);
webidl.converters["RequestRedirect"] = webidl.createEnumConverter( webidl.converters["RequestRedirect"] = webidl.createEnumConverter(
"RequestRedirect", "RequestRedirect",
[ [
@ -497,23 +402,7 @@
webidl.converters["BodyInit"], webidl.converters["BodyInit"],
), ),
}, },
{ key: "referrer", converter: webidl.converters["USVString"] },
{ key: "referrerPolicy", converter: webidl.converters["ReferrerPolicy"] },
{ key: "mode", converter: webidl.converters["RequestMode"] },
{
key: "credentials",
converter: webidl.converters["RequestCredentials"],
},
{ key: "cache", converter: webidl.converters["RequestCache"] },
{ key: "redirect", converter: webidl.converters["RequestRedirect"] }, { key: "redirect", converter: webidl.converters["RequestRedirect"] },
{ key: "integrity", converter: webidl.converters["DOMString"] },
{ key: "keepalive", converter: webidl.converters["boolean"] },
{
key: "signal",
converter: webidl.createNullableConverter(
webidl.converters["AbortSignal"],
),
},
{ key: "client", converter: webidl.converters.any }, { key: "client", converter: webidl.converters.any },
], ],
); );

View file

@ -942,6 +942,17 @@
"Request interface: attribute signal", "Request interface: attribute signal",
"Request interface: attribute body", "Request interface: attribute body",
"Request interface: attribute bodyUsed", "Request interface: attribute bodyUsed",
"Request interface: new Request('about:blank') must inherit property \"destination\" with the proper type",
"Request interface: new Request('about:blank') must inherit property \"referrer\" with the proper type",
"Request interface: new Request('about:blank') must inherit property \"referrerPolicy\" with the proper type",
"Request interface: new Request('about:blank') must inherit property \"mode\" with the proper type",
"Request interface: new Request('about:blank') must inherit property \"credentials\" with the proper type",
"Request interface: new Request('about:blank') must inherit property \"cache\" with the proper type",
"Request interface: new Request('about:blank') must inherit property \"integrity\" with the proper type",
"Request interface: new Request('about:blank') must inherit property \"keepalive\" with the proper type",
"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 \"signal\" with the proper type",
"Response interface: operation error()", "Response interface: operation error()",
"Response interface: operation redirect(USVString, optional unsigned short)", "Response interface: operation redirect(USVString, optional unsigned short)",
"Response interface: attribute body", "Response interface: attribute body",
@ -1076,4 +1087,4 @@
"set.any.html": true "set.any.html": true
} }
} }
} }