| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent d9967a2 commit 27cc4ec
25 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -33,7 +33,7 @@ const { triggerUncaughtException } = internalBinding('errors'); | |||
| 33 | 33 | const dc_binding = internalBinding('diagnostics_channel'); | |
| 34 | 34 | const { subscribers: subscriberCounts } = dc_binding; | |
| 35 | 35 | ||
| 36 | - const { WeakReference } = require('internal/util'); | ||
| 36 | + const { WeakReference, kEmptyObject } = require('internal/util'); | ||
| 37 | 37 | const { isPromise } = require('internal/util/types'); | |
| 38 | 38 | ||
| 39 | 39 | // Can't delete when weakref count reaches 0 as it could increment again. | |
@@ -390,7 +390,7 @@ class BoundedChannel { | |||
| 390 | 390 | return done; | |
| 391 | 391 | } | |
| 392 | 392 | ||
| 393 | - withScope(context = {}) { | ||
| 393 | + withScope(context = kEmptyObject) { | ||
| 394 | 394 | return new BoundedChannelScope(this, context); | |
| 395 | 395 | } | |
| 396 | 396 | ||
@@ -514,7 +514,7 @@ class TracingChannel { | |||
| 514 | 514 | return done; | |
| 515 | 515 | } | |
| 516 | 516 | ||
| 517 | - traceSync(fn, context = {}, thisArg, ...args) { | ||
| 517 | + traceSync(fn, context = { __proto__: null }, thisArg, ...args) { | ||
| 518 | 518 | if (!this.hasSubscribers) { | |
| 519 | 519 | return ReflectApply(fn, thisArg, args); | |
| 520 | 520 | } | |
@@ -534,7 +534,7 @@ class TracingChannel { | |||
| 534 | 534 | } | |
| 535 | 535 | } | |
| 536 | 536 | ||
| 537 | - tracePromise(fn, context = {}, thisArg, ...args) { | ||
| 537 | + tracePromise(fn, context = { __proto__: null }, thisArg, ...args) { | ||
| 538 | 538 | if (!this.hasSubscribers) { | |
| 539 | 539 | const result = ReflectApply(fn, thisArg, args); | |
| 540 | 540 | if (typeof result?.then !== 'function') { | |
@@ -589,7 +589,7 @@ class TracingChannel { | |||
| 589 | 589 | } | |
| 590 | 590 | } | |
| 591 | 591 | ||
| 592 | - traceCallback(fn, position = -1, context = {}, thisArg, ...args) { | ||
| 592 | + traceCallback(fn, position = -1, context = kEmptyObject, thisArg, ...args) { | ||
| 593 | 593 | if (!this.hasSubscribers) { | |
| 594 | 594 | return ReflectApply(fn, thisArg, args); | |
| 595 | 595 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1901,7 +1901,7 @@ function readdirSync(path, options) { | |||
| 1901 | 1901 | * ) => any} [callback] | |
| 1902 | 1902 | * @returns {void} | |
| 1903 | 1903 | */ | |
| 1904 | - function fstat(fd, options = { bigint: false }, callback) { | ||
| 1904 | + function fstat(fd, options = { __proto__: null, bigint: false }, callback) { | ||
| 1905 | 1905 | if (typeof options === 'function') { | |
| 1906 | 1906 | callback = options; | |
| 1907 | 1907 | options = kEmptyObject; | |
@@ -1928,7 +1928,7 @@ function fstat(fd, options = { bigint: false }, callback) { | |||
| 1928 | 1928 | * ) => any} callback | |
| 1929 | 1929 | * @returns {void} | |
| 1930 | 1930 | */ | |
| 1931 | - function lstat(path, options = { bigint: false }, callback) { | ||
| 1931 | + function lstat(path, options = { __proto__: null, bigint: false }, callback) { | ||
| 1932 | 1932 | if (typeof options === 'function') { | |
| 1933 | 1933 | callback = options; | |
| 1934 | 1934 | options = kEmptyObject; | |
@@ -1960,7 +1960,7 @@ function lstat(path, options = { bigint: false }, callback) { | |||
| 1960 | 1960 | * ) => any} callback | |
| 1961 | 1961 | * @returns {void} | |
| 1962 | 1962 | */ | |
| 1963 | - function stat(path, options = { bigint: false, throwIfNoEntry: true }, callback) { | ||
| 1963 | + function stat(path, options = { __proto__: null, bigint: false, throwIfNoEntry: true }, callback) { | ||
| 1964 | 1964 | if (typeof options === 'function') { | |
| 1965 | 1965 | callback = options; | |
| 1966 | 1966 | options = kEmptyObject; | |
@@ -1983,7 +1983,7 @@ function stat(path, options = { bigint: false, throwIfNoEntry: true }, callback) | |||
| 1983 | 1983 | binding.stat(getValidatedPath(path), options.bigint, req, options.throwIfNoEntry); | |
| 1984 | 1984 | } | |
| 1985 | 1985 | ||
| 1986 | - function statfs(path, options = { bigint: false }, callback) { | ||
| 1986 | + function statfs(path, options = { __proto__: null, bigint: false }, callback) { | ||
| 1987 | 1987 | if (typeof options === 'function') { | |
| 1988 | 1988 | callback = options; | |
| 1989 | 1989 | options = kEmptyObject; | |
@@ -2018,7 +2018,7 @@ function statfs(path, options = { bigint: false }, callback) { | |||
| 2018 | 2018 | * @param {{ bigint?: boolean; }} [options] | |
| 2019 | 2019 | * @returns {Stats | undefined} | |
| 2020 | 2020 | */ | |
| 2021 | - function fstatSync(fd, options = { bigint: false }) { | ||
| 2021 | + function fstatSync(fd, options = { __proto__: null, bigint: false }) { | ||
| 2022 | 2022 | const h = vfsState.handlers; | |
| 2023 | 2023 | if (h !== null) { | |
| 2024 | 2024 | const result = h.fstatSync(fd); | |
@@ -2041,7 +2041,7 @@ function fstatSync(fd, options = { bigint: false }) { | |||
| 2041 | 2041 | * }} [options] | |
| 2042 | 2042 | * @returns {Stats | undefined} | |
| 2043 | 2043 | */ | |
| 2044 | - function lstatSync(path, options = { bigint: false, throwIfNoEntry: true }) { | ||
| 2044 | + function lstatSync(path, options = { __proto__: null, bigint: false, throwIfNoEntry: true }) { | ||
| 2045 | 2045 | const h = vfsState.handlers; | |
| 2046 | 2046 | if (h !== null) { | |
| 2047 | 2047 | const result = h.lstatSync(path, options); | |
@@ -2075,7 +2075,7 @@ function lstatSync(path, options = { bigint: false, throwIfNoEntry: true }) { | |||
| 2075 | 2075 | * }} [options] | |
| 2076 | 2076 | * @returns {Stats} | |
| 2077 | 2077 | */ | |
| 2078 | - function statSync(path, options = { bigint: false, throwIfNoEntry: true }) { | ||
| 2078 | + function statSync(path, options = { __proto__: null, bigint: false, throwIfNoEntry: true }) { | ||
| 2079 | 2079 | const h = vfsState.handlers; | |
| 2080 | 2080 | if (h !== null) { | |
| 2081 | 2081 | const result = h.statSync(path, options); | |
@@ -2093,7 +2093,7 @@ function statSync(path, options = { bigint: false, throwIfNoEntry: true }) { | |||
| 2093 | 2093 | return getStatsFromBinding(stats); | |
| 2094 | 2094 | } | |
| 2095 | 2095 | ||
| 2096 | - function statfsSync(path, options = { bigint: false }) { | ||
| 2096 | + function statfsSync(path, options = { __proto__: null, bigint: false }) { | ||
| 2097 | 2097 | const h = vfsState.handlers; | |
| 2098 | 2098 | if (h !== null) { | |
| 2099 | 2099 | const result = h.statfsSync(path, options); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -13,6 +13,7 @@ const AsyncContextFrame = require('internal/async_context_frame'); | |||
| 13 | 13 | const { AsyncResource } = require('async_hooks'); | |
| 14 | 14 | ||
| 15 | 15 | const RunScope = require('internal/async_local_storage/run_scope'); | |
| 16 | + const { kEmptyObject } = require('internal/util'); | ||
| 16 | 17 | ||
| 17 | 18 | class AsyncLocalStorage { | |
| 18 | 19 | #defaultValue = undefined; | |
@@ -26,7 +27,7 @@ class AsyncLocalStorage { | |||
| 26 | 27 | /** | |
| 27 | 28 | * @param {AsyncLocalStorageOptions} [options] | |
| 28 | 29 | */ | |
| 29 | - constructor(options = {}) { | ||
| 30 | + constructor(options = kEmptyObject) { | ||
| 30 | 31 | validateObject(options, 'options'); | |
| 31 | 32 | this.#defaultValue = options.defaultValue; | |
| 32 | 33 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -20,6 +20,7 @@ const { | |||
| 20 | 20 | } = require('async_hooks'); | |
| 21 | 21 | ||
| 22 | 22 | const RunScope = require('internal/async_local_storage/run_scope'); | |
| 23 | + const { kEmptyObject } = require('internal/util'); | ||
| 23 | 24 | ||
| 24 | 25 | const storageList = []; | |
| 25 | 26 | const storageHook = createHook({ | |
@@ -44,7 +45,7 @@ class AsyncLocalStorage { | |||
| 44 | 45 | /** | |
| 45 | 46 | * @param {AsyncLocalStorageOptions} [options] | |
| 46 | 47 | */ | |
| 47 | - constructor(options = {}) { | ||
| 48 | + constructor(options = kEmptyObject) { | ||
| 48 | 49 | this.kResourceStore = Symbol('kResourceStore'); | |
| 49 | 50 | this.enabled = false; | |
| 50 | 51 | validateObject(options, 'options'); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -535,7 +535,7 @@ function createBlobReaderStream(reader) { | |||
| 535 | 535 | // unbounded memory growth when the DataQueue has a large burst of data. | |
| 536 | 536 | const kMaxBatchChunks = 16; | |
| 537 | 537 | ||
| 538 | - async function* createBlobReaderIterable(reader, options = {}) { | ||
| 538 | + async function* createBlobReaderIterable(reader, options = kEmptyObject) { | ||
| 539 | 539 | const { getReadError } = options; | |
| 540 | 540 | let wakeup = PromiseWithResolvers(); | |
| 541 | 541 | reader.setWakeup(wakeup.resolve); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -58,7 +58,7 @@ const assert = require('internal/assert'); | |||
| 58 | 58 | ||
| 59 | 59 | const LazyTransform = require('internal/streams/lazy_transform'); | |
| 60 | 60 | ||
| 61 | - const { normalizeEncoding } = require('internal/util'); | ||
| 61 | + const { normalizeEncoding, kEmptyObject } = require('internal/util'); | ||
| 62 | 62 | ||
| 63 | 63 | const { StringDecoder } = require('string_decoder'); | |
| 64 | 64 | ||
@@ -255,7 +255,7 @@ addCipherPrototypeFunctions(Decipheriv); | |||
| 255 | 255 | ||
| 256 | 256 | const kMinNid = 1; | |
| 257 | 257 | const kMaxNid = 2_147_483_647; | |
| 258 | - function getCipherInfo(nameOrNid, options = {}) { | ||
| 258 | + function getCipherInfo(nameOrNid, options = kEmptyObject) { | ||
| 259 | 259 | validateObject(options, 'options'); | |
| 260 | 260 | let { keyLength, ivLength } = options; | |
| 261 | 261 | if (keyLength !== undefined) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1772,7 +1772,7 @@ async function symlink(target, path, type) { | |||
| 1772 | 1772 | ); | |
| 1773 | 1773 | } | |
| 1774 | 1774 | ||
| 1775 | - async function fstat(handle, options = { bigint: false }) { | ||
| 1775 | + async function fstat(handle, options = { __proto__: null, bigint: false }) { | ||
| 1776 | 1776 | const result = await PromisePrototypeThen( | |
| 1777 | 1777 | binding.fstat(handle.fd, options.bigint, kUsePromises), | |
| 1778 | 1778 | undefined, | |
@@ -1781,7 +1781,7 @@ async function fstat(handle, options = { bigint: false }) { | |||
| 1781 | 1781 | return getStatsFromBinding(result); | |
| 1782 | 1782 | } | |
| 1783 | 1783 | ||
| 1784 | - async function lstat(path, options = { bigint: false }) { | ||
| 1784 | + async function lstat(path, options = { __proto__: null, bigint: false }) { | ||
| 1785 | 1785 | const h = vfsState.handlers; | |
| 1786 | 1786 | if (h !== null) { | |
| 1787 | 1787 | const promise = h.lstat(path, options); | |
@@ -1800,7 +1800,7 @@ async function lstat(path, options = { bigint: false }) { | |||
| 1800 | 1800 | return getStatsFromBinding(result); | |
| 1801 | 1801 | } | |
| 1802 | 1802 | ||
| 1803 | - async function stat(path, options = { bigint: false, throwIfNoEntry: true }) { | ||
| 1803 | + async function stat(path, options = { __proto__: null, bigint: false, throwIfNoEntry: true }) { | ||
| 1804 | 1804 | const h = vfsState.handlers; | |
| 1805 | 1805 | if (h !== null) { | |
| 1806 | 1806 | const promise = h.stat(path, options); | |
@@ -1818,7 +1818,7 @@ async function stat(path, options = { bigint: false, throwIfNoEntry: true }) { | |||
| 1818 | 1818 | return getStatsFromBinding(result); | |
| 1819 | 1819 | } | |
| 1820 | 1820 | ||
| 1821 | - async function statfs(path, options = { bigint: false }) { | ||
| 1821 | + async function statfs(path, options = { __proto__: null, bigint: false }) { | ||
| 1822 | 1822 | const h = vfsState.handlers; | |
| 1823 | 1823 | if (h !== null) { | |
| 1824 | 1824 | const result = h.statfs(path, options); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3753,7 +3753,7 @@ function getUnpackedSettings(buf, options = kEmptyObject) { | |||
| 3753 | 3753 | return settings; | |
| 3754 | 3754 | } | |
| 3755 | 3755 | ||
| 3756 | - function performServerHandshake(socket, options = {}) { | ||
| 3756 | + function performServerHandshake(socket, options = kEmptyObject) { | ||
| 3757 | 3757 | options = initializeOptions(options); | |
| 3758 | 3758 | return new ServerHttp2Session(options, socket, undefined); | |
| 3759 | 3759 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -19,6 +19,7 @@ const { | |||
| 19 | 19 | } = require('internal/inspector/network'); | |
| 20 | 20 | const { Network } = require('inspector'); | |
| 21 | 21 | const EventEmitter = require('events'); | |
| 22 | + const { kEmptyObject } = require('internal/util'); | ||
| 22 | 23 | ||
| 23 | 24 | const kRequestUrl = Symbol('kRequestUrl'); | |
| 24 | 25 | ||
@@ -36,7 +37,7 @@ function getRequestURL(request, host) { | |||
| 36 | 37 | } | |
| 37 | 38 | ||
| 38 | 39 | // Convert a Headers object (Map<string, number | string | string[]>) to a plain object (Map<string, string>) | |
| 39 | - const convertHeaderObject = (headers = {}) => { | ||
| 40 | + const convertHeaderObject = (headers = kEmptyObject) => { | ||
| 40 | 41 | // The 'host' header that contains the host and port of the URL. | |
| 41 | 42 | let host; | |
| 42 | 43 | let charset; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -30,11 +30,12 @@ const { | |||
| 30 | 30 | } = internalBinding('http2').constants; | |
| 31 | 31 | const EventEmitter = require('events'); | |
| 32 | 32 | const { Buffer } = require('buffer'); | |
| 33 | + const { kEmptyObject } = require('internal/util'); | ||
| 33 | 34 | ||
| 34 | 35 | const kRequestUrl = Symbol('kRequestUrl'); | |
| 35 | 36 | ||
| 36 | 37 | // Convert a Headers object (Map<string, number | string | string[]>) to a plain object (Map<string, string>) | |
| 37 | - function convertHeaderObject(headers = {}) { | ||
| 38 | + function convertHeaderObject(headers = kEmptyObject) { | ||
| 38 | 39 | let scheme; | |
| 39 | 40 | let authority; | |
| 40 | 41 | let path; | |
| Back | FazBrowse Home | New Git URL |
0 commit comments