fix(notrack): murder sentry
This commit is contained in:
parent
b32959126e
commit
a8b0ce6f03
1 changed files with 4 additions and 3 deletions
|
@ -58,6 +58,9 @@ if (window[WEBPACK_CHUNK]) {
|
||||||
// normally, this is populated via webpackGlobal.push, which we patch below.
|
// normally, this is populated via webpackGlobal.push, which we patch below.
|
||||||
// However, Discord has their .m prepopulated.
|
// However, Discord has their .m prepopulated.
|
||||||
// Thus, we use this hack to immediately access their wreq.m and patch all already existing factories
|
// 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", {
|
Object.defineProperty(Function.prototype, "m", {
|
||||||
set(v: any) {
|
set(v: any) {
|
||||||
// When using react devtools or other extensions, we may also catch their webpack here.
|
// 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")) {
|
if (new Error().stack?.includes("discord.com")) {
|
||||||
logger.info("Found webpack module factory");
|
logger.info("Found webpack module factory");
|
||||||
patchFactories(v);
|
patchFactories(v);
|
||||||
|
|
||||||
delete (Function.prototype as any).m;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Object.defineProperty(this, "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
|
// There are (at the time of writing) 11 modules exporting the window
|
||||||
// Make these non enumerable to improve webpack search performance
|
// Make these non enumerable to improve webpack search performance
|
||||||
if (exports === window) {
|
if (exports === window && require.c) {
|
||||||
Object.defineProperty(require.c, id, {
|
Object.defineProperty(require.c, id, {
|
||||||
value: require.c[id],
|
value: require.c[id],
|
||||||
enumerable: false,
|
enumerable: false,
|
||||||
|
|
Loading…
Reference in a new issue