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>
This commit is contained in:
Kenta Moriuchi 2024-09-06 19:52:59 +09:00 committed by GitHub
parent 8ef08f1d29
commit f0a3d20642
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
34 changed files with 144 additions and 20 deletions

View file

@ -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(), {

View file

@ -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");

View file

@ -42,6 +42,7 @@ class HttpClient {
*/
constructor(rid) {
ObjectDefineProperty(this, internalRidSymbol, {
__proto__: null,
enumerable: false,
value: rid,
});

View file

@ -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);

View file

@ -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,
},
});

View file

@ -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,
},
);
}

View file

@ -585,6 +585,7 @@ class FsFile {
constructor(rid, symbol) {
ObjectDefineProperty(this, internalRidSymbol, {
__proto__: null,
enumerable: false,
value: rid,
});

View file

@ -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,
});

View file

@ -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,
});

View file

@ -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() },
};

View file

@ -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) {

View file

@ -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() {

View file

@ -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) {

View file

@ -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, "");

View file

@ -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 {

View file

@ -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))

View file

@ -177,6 +177,7 @@ export function inherits<T, U>(
);
}
ObjectDefineProperty(ctor, "super_", {
__proto__: null,
value: superCtor,
writable: true,
configurable: true,

View file

@ -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");

View file

@ -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);

View file

@ -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);
}

View file

@ -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;

View file

@ -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,

View file

@ -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,

View file

@ -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({

View file

@ -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,
});

View file

@ -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}
*/

View file

@ -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,

View file

@ -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,
},
});

View file

@ -119,6 +119,7 @@ function createStorage(persistent) {
set(target, key, value) {
if (typeof key === "symbol") {
return ReflectDefineProperty(target, key, {
__proto__: null,
value,
configurable: true,
});

View file

@ -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);
}

View file

@ -463,6 +463,7 @@ class Command {
spawn() {
const options = {
__proto__: null,
...(this.#options ?? {}),
stdout: this.#options?.stdout ?? "inherit",
stderr: this.#options?.stderr ?? "inherit",

View file

@ -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() {

View file

@ -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() {

View file

@ -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();
},