summaryrefslogtreecommitdiff
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
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>
-rw-r--r--ext/console/01_console.js6
-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
-rw-r--r--ext/ffi/00_ffi.js6
-rw-r--r--ext/fs/30_fs.js1
-rw-r--r--ext/net/01_net.js6
-rw-r--r--ext/net/02_tls.js2
-rw-r--r--ext/node/benchmarks/child_process_ipc.mjs1
-rw-r--r--ext/node/polyfills/_brotli.js4
-rw-r--r--ext/node/polyfills/_process/streams.mjs6
-rw-r--r--ext/node/polyfills/_util/async.ts2
-rw-r--r--ext/node/polyfills/_util/std_testing_diff.ts9
-rw-r--r--ext/node/polyfills/string_decoder.ts2
-rw-r--r--ext/node/polyfills/timers.ts1
-rw-r--r--ext/node/polyfills/util.ts1
-rw-r--r--ext/node/polyfills/vm.js11
-rw-r--r--ext/node/polyfills/worker_threads.ts2
-rw-r--r--ext/web/01_dom_exception.js2
-rw-r--r--ext/web/02_event.js8
-rw-r--r--ext/web/06_streams.js1
-rw-r--r--ext/web/10_filereader.js6
-rw-r--r--ext/web/12_location.js28
-rw-r--r--ext/web/13_message_port.js3
-rw-r--r--ext/webgpu/01_webgpu.js1
-rw-r--r--ext/webidl/00_webidl.js15
-rw-r--r--ext/websocket/01_websocket.js4
-rw-r--r--ext/webstorage/01_webstorage.js1
-rw-r--r--runtime/js/40_fs_events.js3
-rw-r--r--runtime/js/40_process.js1
-rw-r--r--runtime/js/98_global_scope_window.js5
-rw-r--r--runtime/js/98_global_scope_worker.js5
-rw-r--r--runtime/js/99_main.js3
34 files changed, 144 insertions, 20 deletions
diff --git a/ext/console/01_console.js b/ext/console/01_console.js
index 017e6cb77..15c5c837b 100644
--- a/ext/console/01_console.js
+++ b/ext/console/01_console.js
@@ -260,6 +260,7 @@ const colors = {
function defineColorAlias(target, alias) {
ObjectDefineProperty(colors, alias, {
+ __proto__: null,
get() {
return this[target];
},
@@ -3447,7 +3448,10 @@ function inspect(
function createFilteredInspectProxy({ object, keys, evaluate }) {
const obj = class {};
if (object.constructor?.name) {
- ObjectDefineProperty(obj, "name", { value: object.constructor.name });
+ ObjectDefineProperty(obj, "name", {
+ __proto__: null,
+ value: object.constructor.name,
+ });
}
return new Proxy(new obj(), {
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,
},
});
diff --git a/ext/ffi/00_ffi.js b/ext/ffi/00_ffi.js
index 1475f8d3f..d3b07dc37 100644
--- a/ext/ffi/00_ffi.js
+++ b/ext/ffi/00_ffi.js
@@ -484,10 +484,11 @@ class DynamicLibrary {
this.symbols,
symbol,
{
+ __proto__: null,
configurable: false,
enumerable: true,
- value,
writable: false,
+ value,
},
);
continue;
@@ -504,8 +505,10 @@ class DynamicLibrary {
this.symbols,
symbol,
{
+ __proto__: null,
configurable: false,
enumerable: true,
+ writable: false,
value: (...parameters) => {
if (isStructResult) {
const buffer = new Uint8Array(structSize);
@@ -527,7 +530,6 @@ class DynamicLibrary {
);
}
},
- writable: false,
},
);
}
diff --git a/ext/fs/30_fs.js b/ext/fs/30_fs.js
index 28d8365f0..b284b7fce 100644
--- a/ext/fs/30_fs.js
+++ b/ext/fs/30_fs.js
@@ -585,6 +585,7 @@ class FsFile {
constructor(rid, symbol) {
ObjectDefineProperty(this, internalRidSymbol, {
+ __proto__: null,
enumerable: false,
value: rid,
});
diff --git a/ext/net/01_net.js b/ext/net/01_net.js
index 87bbcd476..12a0a6bf2 100644
--- a/ext/net/01_net.js
+++ b/ext/net/01_net.js
@@ -103,11 +103,13 @@ class Conn {
constructor(rid, remoteAddr, localAddr) {
if (internals.future) {
ObjectDefineProperty(this, "rid", {
+ __proto__: null,
enumerable: false,
value: undefined,
});
}
ObjectDefineProperty(this, internalRidSymbol, {
+ __proto__: null,
enumerable: false,
value: rid,
});
@@ -214,6 +216,7 @@ class TcpConn extends Conn {
constructor(rid, remoteAddr, localAddr) {
super(rid, remoteAddr, localAddr);
ObjectDefineProperty(this, internalRidSymbol, {
+ __proto__: null,
enumerable: false,
value: rid,
});
@@ -244,6 +247,7 @@ class UnixConn extends Conn {
constructor(rid, remoteAddr, localAddr) {
super(rid, remoteAddr, localAddr);
ObjectDefineProperty(this, internalRidSymbol, {
+ __proto__: null,
enumerable: false,
value: rid,
});
@@ -269,11 +273,13 @@ class Listener {
constructor(rid, addr) {
if (internals.future) {
ObjectDefineProperty(this, "rid", {
+ __proto__: null,
enumerable: false,
value: undefined,
});
}
ObjectDefineProperty(this, internalRidSymbol, {
+ __proto__: null,
enumerable: false,
value: rid,
});
diff --git a/ext/net/02_tls.js b/ext/net/02_tls.js
index f6197e159..0ea5e8ca2 100644
--- a/ext/net/02_tls.js
+++ b/ext/net/02_tls.js
@@ -30,6 +30,7 @@ class TlsConn extends Conn {
constructor(rid, remoteAddr, localAddr) {
super(rid, remoteAddr, localAddr);
ObjectDefineProperty(this, internalRidSymbol, {
+ __proto__: null,
enumerable: false,
value: rid,
});
@@ -110,6 +111,7 @@ class TlsListener extends Listener {
constructor(rid, addr) {
super(rid, addr);
ObjectDefineProperty(this, internalRidSymbol, {
+ __proto__: null,
enumerable: false,
value: rid,
});
diff --git a/ext/node/benchmarks/child_process_ipc.mjs b/ext/node/benchmarks/child_process_ipc.mjs
index 7a5c992bd..fa671d76f 100644
--- a/ext/node/benchmarks/child_process_ipc.mjs
+++ b/ext/node/benchmarks/child_process_ipc.mjs
@@ -29,6 +29,7 @@ if (process.env.CHILD) {
const start = performance.now();
const options = {
+ __proto__: null,
"stdio": ["inherit", "inherit", "inherit", "ipc"],
"env": { "CHILD": len.toString() },
};
diff --git a/ext/node/polyfills/_brotli.js b/ext/node/polyfills/_brotli.js
index 0dcb58e04..ebd035156 100644
--- a/ext/node/polyfills/_brotli.js
+++ b/ext/node/polyfills/_brotli.js
@@ -60,7 +60,7 @@ export class BrotliDecompress extends Transform {
#context;
// TODO(littledivy): use `options` argument
- constructor(_options = {}) {
+ constructor(_options = { __proto__: null }) {
super({
// TODO(littledivy): use `encoding` argument
transform(chunk, _encoding, callback) {
@@ -91,7 +91,7 @@ export class BrotliDecompress extends Transform {
export class BrotliCompress extends Transform {
#context;
- constructor(options = {}) {
+ constructor(options = { __proto__: null }) {
super({
// TODO(littledivy): use `encoding` argument
transform(chunk, _encoding, callback) {
diff --git a/ext/node/polyfills/_process/streams.mjs b/ext/node/polyfills/_process/streams.mjs
index fa24bd155..19c1c9c18 100644
--- a/ext/node/polyfills/_process/streams.mjs
+++ b/ext/node/polyfills/_process/streams.mjs
@@ -65,22 +65,26 @@ export function createWritableStdioStream(writer, name, warmup = false) {
stream.once("close", () => writer?.close());
ObjectDefineProperties(stream, {
columns: {
+ __proto__: null,
enumerable: true,
configurable: true,
get: () =>
writer?.isTerminal() ? Deno.consoleSize?.().columns : undefined,
},
rows: {
+ __proto__: null,
enumerable: true,
configurable: true,
get: () => writer?.isTerminal() ? Deno.consoleSize?.().rows : undefined,
},
isTTY: {
+ __proto__: null,
enumerable: true,
configurable: true,
get: () => writer?.isTerminal(),
},
getWindowSize: {
+ __proto__: null,
enumerable: true,
configurable: true,
value: () =>
@@ -203,6 +207,7 @@ export const initStdin = (warmup = false) => {
stdin.on("close", () => io.stdin?.close());
stdin.fd = io.stdin ? io.STDIN_RID : -1;
ObjectDefineProperty(stdin, "isTTY", {
+ __proto__: null,
enumerable: true,
configurable: true,
get() {
@@ -216,6 +221,7 @@ export const initStdin = (warmup = false) => {
return stdin;
};
ObjectDefineProperty(stdin, "isRaw", {
+ __proto__: null,
enumerable: true,
configurable: true,
get() {
diff --git a/ext/node/polyfills/_util/async.ts b/ext/node/polyfills/_util/async.ts
index cc116412c..0cacccacc 100644
--- a/ext/node/polyfills/_util/async.ts
+++ b/ext/node/polyfills/_util/async.ts
@@ -13,7 +13,7 @@ import { clearTimeout, setTimeout } from "ext:deno_web/02_timers.js";
/** Resolve a Promise after a given amount of milliseconds. */
export function delay(
ms: number,
- options: { signal?: AbortSignal } = {},
+ options: { signal?: AbortSignal } = { __proto__: null },
): Promise<void> {
const { signal } = options;
if (signal?.aborted) {
diff --git a/ext/node/polyfills/_util/std_testing_diff.ts b/ext/node/polyfills/_util/std_testing_diff.ts
index 74e396b0c..5155fd242 100644
--- a/ext/node/polyfills/_util/std_testing_diff.ts
+++ b/ext/node/polyfills/_util/std_testing_diff.ts
@@ -325,7 +325,10 @@ export function diffstr(A: string, B: string) {
);
}
- function tokenize(string: string, { wordDiff = false } = {}): string[] {
+ function tokenize(
+ string: string,
+ { wordDiff = false } = { __proto__: null },
+ ): string[] {
if (wordDiff) {
// Split string on whitespace symbols
const tokens = StringPrototypeSplit(string, WHITESPACE_SYMBOL_PATTERN);
@@ -450,7 +453,7 @@ export function diffstr(A: string, B: string) {
*/
function createColor(
diffType: DiffType,
- { background = false } = {},
+ { background = false } = { __proto__: null },
): (s: string) => string {
// TODO(@littledivy): Remove this when we can detect
// true color terminals.
@@ -484,7 +487,7 @@ function createSign(diffType: DiffType): string {
export function buildMessage(
diffResult: ReadonlyArray<DiffResult<string>>,
- { stringDiff = false } = {},
+ { stringDiff = false } = { __proto__: null },
): string[] {
const messages: string[] = [], diffMessages: string[] = [];
ArrayPrototypePush(messages, "");
diff --git a/ext/node/polyfills/string_decoder.ts b/ext/node/polyfills/string_decoder.ts
index 4a49c2e3e..b4a422e4b 100644
--- a/ext/node/polyfills/string_decoder.ts
+++ b/ext/node/polyfills/string_decoder.ts
@@ -403,6 +403,7 @@ StringDecoder.prototype.text = function text(
ObjectDefineProperties(StringDecoder.prototype, {
lastNeed: {
+ __proto__: null,
configurable: true,
enumerable: true,
get(this: StringDecoder): number {
@@ -410,6 +411,7 @@ ObjectDefineProperties(StringDecoder.prototype, {
},
},
lastTotal: {
+ __proto__: null,
configurable: true,
enumerable: true,
get(this: StringDecoder): number {
diff --git a/ext/node/polyfills/timers.ts b/ext/node/polyfills/timers.ts
index b96f448da..613b87427 100644
--- a/ext/node/polyfills/timers.ts
+++ b/ext/node/polyfills/timers.ts
@@ -33,6 +33,7 @@ export function setTimeout(
}
ObjectDefineProperty(setTimeout, promisify.custom, {
+ __proto__: null,
value: (timeout: number, ...args: unknown[]) => {
return new Promise((cb) =>
setTimeout(cb, timeout, ...new SafeArrayIterator(args))
diff --git a/ext/node/polyfills/util.ts b/ext/node/polyfills/util.ts
index c94d0f14b..586fae17e 100644
--- a/ext/node/polyfills/util.ts
+++ b/ext/node/polyfills/util.ts
@@ -177,6 +177,7 @@ export function inherits<T, U>(
);
}
ObjectDefineProperty(ctor, "super_", {
+ __proto__: null,
value: superCtor,
writable: true,
configurable: true,
diff --git a/ext/node/polyfills/vm.js b/ext/node/polyfills/vm.js
index bc1a25045..eb9a0375d 100644
--- a/ext/node/polyfills/vm.js
+++ b/ext/node/polyfills/vm.js
@@ -34,7 +34,7 @@ const kParsingContext = Symbol("script parsing context");
export class Script {
#inner;
- constructor(code, options = {}) {
+ constructor(code, options = { __proto__: null }) {
code = `${code}`;
if (typeof options === "string") {
options = { filename: options };
@@ -80,7 +80,7 @@ export class Script {
: undefined;
}
- #runInContext(contextifiedObject, options = {}) {
+ #runInContext(contextifiedObject, options = { __proto__: null }) {
validateObject(options, "options");
let timeout = options.timeout;
@@ -181,7 +181,10 @@ function getContextOptions(options) {
}
let defaultContextNameIndex = 1;
-export function createContext(contextObject = {}, options = {}) {
+export function createContext(
+ contextObject = {},
+ options = { __proto__: null },
+) {
if (isContext(contextObject)) {
return contextObject;
}
@@ -276,7 +279,7 @@ export function isContext(object) {
return op_vm_is_context(object);
}
-export function compileFunction(code, params, options = {}) {
+export function compileFunction(code, params, options = { __proto__: null }) {
validateString(code, "code");
if (params !== undefined) {
validateStringArray(params, "params");
diff --git a/ext/node/polyfills/worker_threads.ts b/ext/node/polyfills/worker_threads.ts
index 24bcbe057..5ff4446f7 100644
--- a/ext/node/polyfills/worker_threads.ts
+++ b/ext/node/polyfills/worker_threads.ts
@@ -267,7 +267,7 @@ class NodeWorker extends EventEmitter {
}
};
- postMessage(message, transferOrOptions = {}) {
+ postMessage(message, transferOrOptions = { __proto__: null }) {
const prefix = "Failed to execute 'postMessage' on 'MessagePort'";
webidl.requiredArguments(arguments.length, 1, prefix);
message = webidl.converters.any(message);
diff --git a/ext/web/01_dom_exception.js b/ext/web/01_dom_exception.js
index f49337db5..38e4d088e 100644
--- a/ext/web/01_dom_exception.js
+++ b/ext/web/01_dom_exception.js
@@ -186,7 +186,7 @@ const entries = ObjectEntries({
});
for (let i = 0; i < entries.length; ++i) {
const { 0: key, 1: value } = entries[i];
- const desc = { value, enumerable: true };
+ const desc = { __proto__: null, value, enumerable: true };
ObjectDefineProperty(DOMException, key, desc);
ObjectDefineProperty(DOMException.prototype, key, desc);
}
diff --git a/ext/web/02_event.js b/ext/web/02_event.js
index 985578bcc..f031d0aed 100644
--- a/ext/web/02_event.js
+++ b/ext/web/02_event.js
@@ -392,6 +392,7 @@ const EventPrototype = Event.prototype;
// Not spec compliant. The spec defines it as [LegacyUnforgeable]
// but doing so has a big performance hit
ReflectDefineProperty(Event.prototype, "isTrusted", {
+ __proto__: null,
enumerable: true,
get: isTrusted,
});
@@ -402,7 +403,10 @@ function defineEnumerableProps(
) {
for (let i = 0; i < props.length; ++i) {
const prop = props[i];
- ReflectDefineProperty(Ctor.prototype, prop, { enumerable: true });
+ ReflectDefineProperty(Ctor.prototype, prop, {
+ __proto__: null,
+ enumerable: true,
+ });
}
}
@@ -1274,6 +1278,7 @@ class CustomEvent extends Event {
const CustomEventPrototype = CustomEvent.prototype;
ReflectDefineProperty(CustomEvent.prototype, "detail", {
+ __proto__: null,
enumerable: true,
});
@@ -1417,6 +1422,7 @@ function defineEventHandler(
) {
// HTML specification section 8.1.7.1
ObjectDefineProperty(emitter, `on${name}`, {
+ __proto__: null,
get() {
if (!this[_eventHandlers]) {
return null;
diff --git a/ext/web/06_streams.js b/ext/web/06_streams.js
index 3da3fe36c..1dbf769b2 100644
--- a/ext/web/06_streams.js
+++ b/ext/web/06_streams.js
@@ -5420,6 +5420,7 @@ class ReadableStream {
// TODO(lucacasonato): should be moved to webidl crate
ReadableStream.prototype[SymbolAsyncIterator] = ReadableStream.prototype.values;
ObjectDefineProperty(ReadableStream.prototype, SymbolAsyncIterator, {
+ __proto__: null,
writable: true,
enumerable: false,
configurable: true,
diff --git a/ext/web/10_filereader.js b/ext/web/10_filereader.js
index 05f577114..05b45202d 100644
--- a/ext/web/10_filereader.js
+++ b/ext/web/10_filereader.js
@@ -454,36 +454,42 @@ webidl.configureInterface(FileReader);
const FileReaderPrototype = FileReader.prototype;
ObjectDefineProperty(FileReader, "EMPTY", {
+ __proto__: null,
writable: false,
enumerable: true,
configurable: false,
value: 0,
});
ObjectDefineProperty(FileReader, "LOADING", {
+ __proto__: null,
writable: false,
enumerable: true,
configurable: false,
value: 1,
});
ObjectDefineProperty(FileReader, "DONE", {
+ __proto__: null,
writable: false,
enumerable: true,
configurable: false,
value: 2,
});
ObjectDefineProperty(FileReader.prototype, "EMPTY", {
+ __proto__: null,
writable: false,
enumerable: true,
configurable: false,
value: 0,
});
ObjectDefineProperty(FileReader.prototype, "LOADING", {
+ __proto__: null,
writable: false,
enumerable: true,
configurable: false,
value: 1,
});
ObjectDefineProperty(FileReader.prototype, "DONE", {
+ __proto__: null,
writable: false,
enumerable: true,
configurable: false,
diff --git a/ext/web/12_location.js b/ext/web/12_location.js
index a819f6a07..2cda9f719 100644
--- a/ext/web/12_location.js
+++ b/ext/web/12_location.js
@@ -35,6 +35,7 @@ class Location {
url.password = "";
ObjectDefineProperties(this, {
hash: {
+ __proto__: null,
get() {
return url.hash;
},
@@ -47,6 +48,7 @@ class Location {
enumerable: true,
},
host: {
+ __proto__: null,
get() {
return url.host;
},
@@ -59,6 +61,7 @@ class Location {
enumerable: true,
},
hostname: {
+ __proto__: null,
get() {
return url.hostname;
},
@@ -71,6 +74,7 @@ class Location {
enumerable: true,
},
href: {
+ __proto__: null,
get() {
return url.href;
},
@@ -83,12 +87,14 @@ class Location {
enumerable: true,
},
origin: {
+ __proto__: null,
get() {
return url.origin;
},
enumerable: true,
},
pathname: {
+ __proto__: null,
get() {
return url.pathname;
},
@@ -101,6 +107,7 @@ class Location {
enumerable: true,
},
port: {
+ __proto__: null,
get() {
return url.port;
},
@@ -113,6 +120,7 @@ class Location {
enumerable: true,
},
protocol: {
+ __proto__: null,
get() {
return url.protocol;
},
@@ -125,6 +133,7 @@ class Location {
enumerable: true,
},
search: {
+ __proto__: null,
get() {
return url.search;
},
@@ -137,6 +146,7 @@ class Location {
enumerable: true,
},
ancestorOrigins: {
+ __proto__: null,
get() {
// TODO(nayeemrmn): Replace with a `DOMStringList` instance.
return {
@@ -148,6 +158,7 @@ class Location {
enumerable: true,
},
assign: {
+ __proto__: null,
value: function assign() {
throw new DOMException(
`Cannot call "location.assign()".`,
@@ -157,6 +168,7 @@ class Location {
enumerable: true,
},
reload: {
+ __proto__: null,
value: function reload() {
throw new DOMException(
`Cannot call "location.reload()".`,
@@ -166,6 +178,7 @@ class Location {
enumerable: true,
},
replace: {
+ __proto__: null,
value: function replace() {
throw new DOMException(
`Cannot call "location.replace()".`,
@@ -175,12 +188,14 @@ class Location {
enumerable: true,
},
toString: {
+ __proto__: null,
value: function toString() {
return url.href;
},
enumerable: true,
},
[SymbolFor("Deno.privateCustomInspect")]: {
+ __proto__: null,
value: function (inspect, inspectOptions) {
return `${this.constructor.name} ${
inspect({
@@ -203,6 +218,7 @@ class Location {
ObjectDefineProperties(Location.prototype, {
[SymbolToStringTag]: {
+ __proto__: null,
value: "Location",
configurable: true,
},
@@ -224,6 +240,7 @@ class WorkerLocation {
ObjectDefineProperties(WorkerLocation.prototype, {
hash: {
+ __proto__: null,
get() {
const url = WeakMapPrototypeGet(workerLocationUrls, this);
if (url == null) {
@@ -235,6 +252,7 @@ ObjectDefineProperties(WorkerLocation.prototype, {
enumerable: true,
},
host: {
+ __proto__: null,
get() {
const url = WeakMapPrototypeGet(workerLocationUrls, this);
if (url == null) {
@@ -246,6 +264,7 @@ ObjectDefineProperties(WorkerLocation.prototype, {
enumerable: true,
},
hostname: {
+ __proto__: null,
get() {
const url = WeakMapPrototypeGet(workerLocationUrls, this);
if (url == null) {
@@ -257,6 +276,7 @@ ObjectDefineProperties(WorkerLocation.prototype, {
enumerable: true,
},
href: {
+ __proto__: null,
get() {
const url = WeakMapPrototypeGet(workerLocationUrls, this);
if (url == null) {
@@ -268,6 +288,7 @@ ObjectDefineProperties(WorkerLocation.prototype, {
enumerable: true,
},
origin: {
+ __proto__: null,
get() {
const url = WeakMapPrototypeGet(workerLocationUrls, this);
if (url == null) {
@@ -279,6 +300,7 @@ ObjectDefineProperties(WorkerLocation.prototype, {
enumerable: true,
},
pathname: {
+ __proto__: null,
get() {
const url = WeakMapPrototypeGet(workerLocationUrls, this);
if (url == null) {
@@ -290,6 +312,7 @@ ObjectDefineProperties(WorkerLocation.prototype, {
enumerable: true,
},
port: {
+ __proto__: null,
get() {
const url = WeakMapPrototypeGet(workerLocationUrls, this);
if (url == null) {
@@ -301,6 +324,7 @@ ObjectDefineProperties(WorkerLocation.prototype, {
enumerable: true,
},
protocol: {
+ __proto__: null,
get() {
const url = WeakMapPrototypeGet(workerLocationUrls, this);
if (url == null) {
@@ -312,6 +336,7 @@ ObjectDefineProperties(WorkerLocation.prototype, {
enumerable: true,
},
search: {
+ __proto__: null,
get() {
const url = WeakMapPrototypeGet(workerLocationUrls, this);
if (url == null) {
@@ -323,6 +348,7 @@ ObjectDefineProperties(WorkerLocation.prototype, {
enumerable: true,
},
toString: {
+ __proto__: null,
value: function toString() {
const url = WeakMapPrototypeGet(workerLocationUrls, this);
if (url == null) {
@@ -335,10 +361,12 @@ ObjectDefineProperties(WorkerLocation.prototype, {
writable: true,
},
[SymbolToStringTag]: {
+ __proto__: null,
value: "WorkerLocation",
configurable: true,
},
[SymbolFor("Deno.privateCustomInspect")]: {
+ __proto__: null,
value: function (inspect, inspectOptions) {
return `${this.constructor.name} ${
inspect({
diff --git a/ext/web/13_message_port.js b/ext/web/13_message_port.js
index d94ca1382..04697d6aa 100644
--- a/ext/web/13_message_port.js
+++ b/ext/web/13_message_port.js
@@ -132,14 +132,17 @@ class MessagePort extends EventTarget {
constructor() {
super();
ObjectDefineProperty(this, MessagePortReceiveMessageOnPortSymbol, {
+ __proto__: null,
value: false,
enumerable: false,
});
ObjectDefineProperty(this, nodeWorkerThreadCloseCb, {
+ __proto__: null,
value: null,
enumerable: false,
});
ObjectDefineProperty(this, nodeWorkerThreadCloseCbInvoked, {
+ __proto__: null,
value: false,
enumerable: false,
});
diff --git a/ext/webgpu/01_webgpu.js b/ext/webgpu/01_webgpu.js
index 36b35072c..bdabbdc32 100644
--- a/ext/webgpu/01_webgpu.js
+++ b/ext/webgpu/01_webgpu.js
@@ -907,6 +907,7 @@ const GPUDeviceLostInfoPrototype = GPUDeviceLostInfo.prototype;
function GPUObjectBaseMixin(name, type) {
type.prototype[_label] = null;
ObjectDefineProperty(type.prototype, "label", {
+ __proto__: null,
/**
* @return {string | null}
*/
diff --git a/ext/webidl/00_webidl.js b/ext/webidl/00_webidl.js
index 36fc89ce2..f23c9b7dd 100644
--- a/ext/webidl/00_webidl.js
+++ b/ext/webidl/00_webidl.js
@@ -753,6 +753,7 @@ function createDictionaryConverter(name, ...dictionaries) {
defaultValues[member.key] = member.converter(idlMemberValue, {});
} else {
ObjectDefineProperty(defaultValues, member.key, {
+ __proto__: null,
get() {
return member.converter(idlMemberValue, member.defaultValue);
},
@@ -1076,6 +1077,7 @@ function mixinPairIterable(name, prototype, dataSymbol, keyKey, valueKey) {
function createDefaultIterator(target, kind) {
const iterator = ObjectCreate(iteratorPrototype);
ObjectDefineProperty(iterator, _iteratorInternal, {
+ __proto__: null,
value: { target, kind, index: 0 },
configurable: true,
});
@@ -1149,6 +1151,7 @@ function configureInterface(interface_) {
configureProperties(interface_);
configureProperties(interface_.prototype);
ObjectDefineProperty(interface_.prototype, SymbolToStringTag, {
+ __proto__: null,
value: interface_.name,
enumerable: false,
configurable: true,
@@ -1170,12 +1173,14 @@ function configureProperties(obj) {
typeof descriptor.value === "function"
) {
ObjectDefineProperty(obj, key, {
+ __proto__: null,
enumerable: true,
writable: true,
configurable: true,
});
} else if (ReflectHas(descriptor, "get")) {
ObjectDefineProperty(obj, key, {
+ __proto__: null,
enumerable: true,
configurable: true,
});
@@ -1189,6 +1194,7 @@ const setlikeInner = Symbol("[[set]]");
function setlike(obj, objPrototype, readonly) {
ObjectDefineProperties(obj, {
size: {
+ __proto__: null,
configurable: true,
enumerable: true,
get() {
@@ -1197,6 +1203,7 @@ function setlike(obj, objPrototype, readonly) {
},
},
[SymbolIterator]: {
+ __proto__: null,
configurable: true,
enumerable: false,
writable: true,
@@ -1206,6 +1213,7 @@ function setlike(obj, objPrototype, readonly) {
},
},
entries: {
+ __proto__: null,
configurable: true,
enumerable: true,
writable: true,
@@ -1215,6 +1223,7 @@ function setlike(obj, objPrototype, readonly) {
},
},
keys: {
+ __proto__: null,
configurable: true,
enumerable: true,
writable: true,
@@ -1224,6 +1233,7 @@ function setlike(obj, objPrototype, readonly) {
},
},
values: {
+ __proto__: null,
configurable: true,
enumerable: true,
writable: true,
@@ -1233,6 +1243,7 @@ function setlike(obj, objPrototype, readonly) {
},
},
forEach: {
+ __proto__: null,
configurable: true,
enumerable: true,
writable: true,
@@ -1242,6 +1253,7 @@ function setlike(obj, objPrototype, readonly) {
},
},
has: {
+ __proto__: null,
configurable: true,
enumerable: true,
writable: true,
@@ -1255,6 +1267,7 @@ function setlike(obj, objPrototype, readonly) {
if (!readonly) {
ObjectDefineProperties(obj, {
add: {
+ __proto__: null,
configurable: true,
enumerable: true,
writable: true,
@@ -1264,6 +1277,7 @@ function setlike(obj, objPrototype, readonly) {
},
},
delete: {
+ __proto__: null,
configurable: true,
enumerable: true,
writable: true,
@@ -1273,6 +1287,7 @@ function setlike(obj, objPrototype, readonly) {
},
},
clear: {
+ __proto__: null,
configurable: true,
enumerable: true,
writable: true,
diff --git a/ext/websocket/01_websocket.js b/ext/websocket/01_websocket.js
index 60580a56c..c55685ac9 100644
--- a/ext/websocket/01_websocket.js
+++ b/ext/websocket/01_websocket.js
@@ -627,15 +627,19 @@ class WebSocket extends EventTarget {
ObjectDefineProperties(WebSocket, {
CONNECTING: {
+ __proto__: null,
value: 0,
},
OPEN: {
+ __proto__: null,
value: 1,
},
CLOSING: {
+ __proto__: null,
value: 2,
},
CLOSED: {
+ __proto__: null,
value: 3,
},
});
diff --git a/ext/webstorage/01_webstorage.js b/ext/webstorage/01_webstorage.js
index 635e80d6e..3cbdd708d 100644
--- a/ext/webstorage/01_webstorage.js
+++ b/ext/webstorage/01_webstorage.js
@@ -119,6 +119,7 @@ function createStorage(persistent) {
set(target, key, value) {
if (typeof key === "symbol") {
return ReflectDefineProperty(target, key, {
+ __proto__: null,
value,
configurable: true,
});
diff --git a/runtime/js/40_fs_events.js b/runtime/js/40_fs_events.js
index a0495540c..2140f29eb 100644
--- a/runtime/js/40_fs_events.js
+++ b/runtime/js/40_fs_events.js
@@ -23,6 +23,7 @@ class FsWatcher {
constructor(paths, options) {
if (internals.future) {
ObjectDefineProperty(this, "rid", {
+ __proto__: null,
enumerable: false,
value: undefined,
});
@@ -79,7 +80,7 @@ class FsWatcher {
function watchFs(
paths,
- options = { recursive: true },
+ options = { __proto__: null, recursive: true },
) {
return new FsWatcher(ArrayIsArray(paths) ? paths : [paths], options);
}
diff --git a/runtime/js/40_process.js b/runtime/js/40_process.js
index 954d8d00b..358805180 100644
--- a/runtime/js/40_process.js
+++ b/runtime/js/40_process.js
@@ -463,6 +463,7 @@ class Command {
spawn() {
const options = {
+ __proto__: null,
...(this.#options ?? {}),
stdout: this.#options?.stdout ?? "inherit",
stderr: this.#options?.stderr ?? "inherit",
diff --git a/runtime/js/98_global_scope_window.js b/runtime/js/98_global_scope_window.js
index aa18ed361..27a3d309a 100644
--- a/runtime/js/98_global_scope_window.js
+++ b/runtime/js/98_global_scope_window.js
@@ -60,6 +60,7 @@ const language = memoizeLazy(() => op_bootstrap_language());
ObjectDefineProperties(Navigator.prototype, {
gpu: {
+ __proto__: null,
configurable: true,
enumerable: true,
get() {
@@ -69,6 +70,7 @@ ObjectDefineProperties(Navigator.prototype, {
},
},
hardwareConcurrency: {
+ __proto__: null,
configurable: true,
enumerable: true,
get() {
@@ -77,6 +79,7 @@ ObjectDefineProperties(Navigator.prototype, {
},
},
userAgent: {
+ __proto__: null,
configurable: true,
enumerable: true,
get() {
@@ -85,6 +88,7 @@ ObjectDefineProperties(Navigator.prototype, {
},
},
language: {
+ __proto__: null,
configurable: true,
enumerable: true,
get() {
@@ -93,6 +97,7 @@ ObjectDefineProperties(Navigator.prototype, {
},
},
languages: {
+ __proto__: null,
configurable: true,
enumerable: true,
get() {
diff --git a/runtime/js/98_global_scope_worker.js b/runtime/js/98_global_scope_worker.js
index 8e292108f..4dc615786 100644
--- a/runtime/js/98_global_scope_worker.js
+++ b/runtime/js/98_global_scope_worker.js
@@ -58,6 +58,7 @@ const workerNavigator = webidl.createBranded(WorkerNavigator);
ObjectDefineProperties(WorkerNavigator.prototype, {
gpu: {
+ __proto__: null,
configurable: true,
enumerable: true,
get() {
@@ -67,6 +68,7 @@ ObjectDefineProperties(WorkerNavigator.prototype, {
},
},
hardwareConcurrency: {
+ __proto__: null,
configurable: true,
enumerable: true,
get() {
@@ -75,6 +77,7 @@ ObjectDefineProperties(WorkerNavigator.prototype, {
},
},
userAgent: {
+ __proto__: null,
configurable: true,
enumerable: true,
get() {
@@ -83,6 +86,7 @@ ObjectDefineProperties(WorkerNavigator.prototype, {
},
},
language: {
+ __proto__: null,
configurable: true,
enumerable: true,
get() {
@@ -91,6 +95,7 @@ ObjectDefineProperties(WorkerNavigator.prototype, {
},
},
languages: {
+ __proto__: null,
configurable: true,
enumerable: true,
get() {
diff --git a/runtime/js/99_main.js b/runtime/js/99_main.js
index d83bfbff1..2d5c96f6a 100644
--- a/runtime/js/99_main.js
+++ b/runtime/js/99_main.js
@@ -92,12 +92,14 @@ if (Symbol.metadata) {
}
ObjectDefineProperties(Symbol, {
dispose: {
+ __proto__: null,
value: SymbolDispose,
enumerable: false,
writable: false,
configurable: false,
},
metadata: {
+ __proto__: null,
value: SymbolMetadata,
enumerable: false,
writable: false,
@@ -533,6 +535,7 @@ ObjectDefineProperties(finalDenoNs, {
args: core.propGetterOnly(opArgs),
mainModule: core.propGetterOnly(() => op_main_module()),
exitCode: {
+ __proto__: null,
get() {
return os.getExitCode();
},