fix(notrack): murder sentry
This commit is contained in:
parent
b32959126e
commit
a8b0ce6f03
|
@ -58,6 +58,9 @@ if (window[WEBPACK_CHUNK]) {
|
|||
// normally, this is populated via webpackGlobal.push, which we patch below.
|
||||
// However, Discord has their .m prepopulated.
|
||||
// Thus, we use this hack to immediately access their wreq.m and patch all already existing factories
|
||||
//
|
||||
// Update: Discord now has TWO webpack instances. Their normal one and sentry
|
||||
// Sentry does not push chunks to the global at all, so this same patch now also handles their sentry modules
|
||||
Object.defineProperty(Function.prototype, "m", {
|
||||
set(v: any) {
|
||||
// When using react devtools or other extensions, we may also catch their webpack here.
|
||||
|
@ -65,8 +68,6 @@ if (window[WEBPACK_CHUNK]) {
|
|||
if (new Error().stack?.includes("discord.com")) {
|
||||
logger.info("Found webpack module factory");
|
||||
patchFactories(v);
|
||||
|
||||
delete (Function.prototype as any).m;
|
||||
}
|
||||
|
||||
Object.defineProperty(this, "m", {
|
||||
|
@ -142,7 +143,7 @@ function patchFactories(factories: Record<string | number, (module: { exports: a
|
|||
|
||||
// There are (at the time of writing) 11 modules exporting the window
|
||||
// Make these non enumerable to improve webpack search performance
|
||||
if (exports === window) {
|
||||
if (exports === window && require.c) {
|
||||
Object.defineProperty(require.c, id, {
|
||||
value: require.c[id],
|
||||
enumerable: false,
|
||||
|
|
Loading…
Reference in a new issue