summaryrefslogtreecommitdiff
path: root/ext/fetch
diff options
context:
space:
mode:
authorKenta Moriuchi <moriken@kimamass.com>2024-09-06 19:52:59 +0900
committerGitHub <noreply@github.com>2024-09-06 12:52:59 +0200
commitf0a3d206422af3177e0f36ed22802c1ccc6f7654 (patch)
tree57ad718cc47b7b98c0bbd869d6c070adee3bf30a /ext/fetch
parent8ef08f1d294dbe7e3771202084ecbede73ca28aa (diff)
fix(runtime): use more null proto objects again (#25040)
proceed with #23921 This PR is a preparation for https://github.com/denoland/deno_lint/pull/1307 --------- Signed-off-by: Kenta Moriuchi <moriken@kimamass.com> Co-authored-by: Luca Casonato <hello@lcas.dev>
Diffstat (limited to 'ext/fetch')
-rw-r--r--ext/fetch/22_body.js8
-rw-r--r--ext/fetch/22_http_client.js1
-rw-r--r--ext/fetch/23_response.js6
-rw-r--r--ext/fetch/27_eventsource.js3
4 files changed, 15 insertions, 3 deletions
diff --git a/ext/fetch/22_body.js b/ext/fetch/22_body.js
index a8f5deac9..61a06b4af 100644
--- a/ext/fetch/22_body.js
+++ b/ext/fetch/22_body.js
@@ -263,6 +263,7 @@ function mixinBody(prototype, bodySymbol, mimeTypeSymbol) {
/** @type {PropertyDescriptorMap} */
const mixin = {
body: {
+ __proto__: null,
/**
* @returns {ReadableStream<Uint8Array> | null}
*/
@@ -278,6 +279,7 @@ function mixinBody(prototype, bodySymbol, mimeTypeSymbol) {
enumerable: true,
},
bodyUsed: {
+ __proto__: null,
/**
* @returns {boolean}
*/
@@ -292,6 +294,7 @@ function mixinBody(prototype, bodySymbol, mimeTypeSymbol) {
enumerable: true,
},
arrayBuffer: {
+ __proto__: null,
/** @returns {Promise<ArrayBuffer>} */
value: function arrayBuffer() {
return consumeBody(this, "ArrayBuffer");
@@ -301,6 +304,7 @@ function mixinBody(prototype, bodySymbol, mimeTypeSymbol) {
enumerable: true,
},
blob: {
+ __proto__: null,
/** @returns {Promise<Blob>} */
value: function blob() {
return consumeBody(this, "Blob");
@@ -310,6 +314,7 @@ function mixinBody(prototype, bodySymbol, mimeTypeSymbol) {
enumerable: true,
},
bytes: {
+ __proto__: null,
/** @returns {Promise<Uint8Array>} */
value: function bytes() {
return consumeBody(this, "bytes");
@@ -319,6 +324,7 @@ function mixinBody(prototype, bodySymbol, mimeTypeSymbol) {
enumerable: true,
},
formData: {
+ __proto__: null,
/** @returns {Promise<FormData>} */
value: function formData() {
return consumeBody(this, "FormData");
@@ -328,6 +334,7 @@ function mixinBody(prototype, bodySymbol, mimeTypeSymbol) {
enumerable: true,
},
json: {
+ __proto__: null,
/** @returns {Promise<any>} */
value: function json() {
return consumeBody(this, "JSON");
@@ -337,6 +344,7 @@ function mixinBody(prototype, bodySymbol, mimeTypeSymbol) {
enumerable: true,
},
text: {
+ __proto__: null,
/** @returns {Promise<string>} */
value: function text() {
return consumeBody(this, "text");
diff --git a/ext/fetch/22_http_client.js b/ext/fetch/22_http_client.js
index 061a3dda8..6a1243ee0 100644
--- a/ext/fetch/22_http_client.js
+++ b/ext/fetch/22_http_client.js
@@ -42,6 +42,7 @@ class HttpClient {
*/
constructor(rid) {
ObjectDefineProperty(this, internalRidSymbol, {
+ __proto__: null,
enumerable: false,
value: rid,
});
diff --git a/ext/fetch/23_response.js b/ext/fetch/23_response.js
index 7dad8c047..ff4ad5fac 100644
--- a/ext/fetch/23_response.js
+++ b/ext/fetch/23_response.js
@@ -432,9 +432,9 @@ class Response {
webidl.configureInterface(Response);
ObjectDefineProperties(Response, {
- json: { enumerable: true },
- redirect: { enumerable: true },
- error: { enumerable: true },
+ json: { __proto__: null, enumerable: true },
+ redirect: { __proto__: null, enumerable: true },
+ error: { __proto__: null, enumerable: true },
});
const ResponsePrototype = Response.prototype;
mixinBody(ResponsePrototype, _body, _mimeType);
diff --git a/ext/fetch/27_eventsource.js b/ext/fetch/27_eventsource.js
index 685eb47c2..aadbb5fe7 100644
--- a/ext/fetch/27_eventsource.js
+++ b/ext/fetch/27_eventsource.js
@@ -355,12 +355,15 @@ const EventSourcePrototype = EventSource.prototype;
ObjectDefineProperties(EventSource, {
CONNECTING: {
+ __proto__: null,
value: 0,
},
OPEN: {
+ __proto__: null,
value: 1,
},
CLOSED: {
+ __proto__: null,
value: 2,
},
});