From 2f16cdf77b5ac8ee1ccd1886f48bd33268d734c5 Mon Sep 17 00:00:00 2001 From: Nuckyz <61953774+Nuckyz@users.noreply.github.com> Date: Fri, 24 May 2024 07:59:56 -0300 Subject: [PATCH] Make toStringTag non enumerable --- src/webpack/patchWebpack.ts | 10 ++++++---- src/webpack/webpack.ts | 7 +++++-- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/webpack/patchWebpack.ts b/src/webpack/patchWebpack.ts index a37169258..7aaa4e329 100644 --- a/src/webpack/patchWebpack.ts +++ b/src/webpack/patchWebpack.ts @@ -17,9 +17,7 @@ type PatchedModuleFactory = ModuleFactory & { $$vencordOriginal?: ModuleFactory; }; -type PatchedModuleFactories = Record & { - [Symbol.toStringTag]?: string; -}; +type PatchedModuleFactories = Record; const logger = new Logger("WebpackInterceptor", "#8caaee"); @@ -140,7 +138,11 @@ Object.defineProperty(Function.prototype, "m", { allModuleFactories.add(moduleFactories); - moduleFactories[Symbol.toStringTag] = "ModuleFactories"; + Object.defineProperty(moduleFactories, Symbol.toStringTag, { + value: "ModuleFactories", + configurable: true, + writable: true + }); moduleFactories = new Proxy(moduleFactories, moduleFactoriesHandler); } diff --git a/src/webpack/webpack.ts b/src/webpack/webpack.ts index ab9ded1e0..480ccb078 100644 --- a/src/webpack/webpack.ts +++ b/src/webpack/webpack.ts @@ -78,8 +78,11 @@ export function _initWebpack(webpackRequire: WebpackRequire) { wreq = webpackRequire; cache = webpackRequire.c; - // @ts-ignore - webpackRequire.c[Symbol.toStringTag] = "ModuleCache"; + Object.defineProperty(webpackRequire.c, Symbol.toStringTag, { + value: "ModuleCache", + configurable: true, + writable: true + }); } let devToolsOpen = false;