WebpackPatcher: Avoid patching wrong instances (like Stripe)

This commit is contained in:
Nuckyz 2025-02-15 16:33:39 -03:00
parent 94d45780f9
commit 5ec564558e
No known key found for this signature in database
GPG key ID: 440BF8296E1C4AD9
4 changed files with 152 additions and 101 deletions

View file

@ -20,8 +20,7 @@ export async function loadLazyChunks() {
const invalidChunks = new Set<PropertyKey>();
const deferredRequires = new Set<PropertyKey>();
let chunksSearchingResolve: (value: void) => void;
const chunksSearchingDone = new Promise<void>(r => chunksSearchingResolve = r);
const { promise: chunksSearchingDone, resolve: chunksSearchingResolve } = Promise.withResolvers<void>();
// True if resolved, false otherwise
const chunksSearchPromises = [] as Array<() => boolean>;

View file

@ -17,8 +17,7 @@ async function runReporter() {
try {
ReporterLogger.log("Starting test...");
let loadLazyChunksResolve: (value: void) => void;
const loadLazyChunksDone = new Promise<void>(r => loadLazyChunksResolve = r);
const { promise: loadLazyChunksDone, resolve: loadLazyChunksResolve } = Promise.withResolvers<void>();
// The main patch for starting the reporter chunk loading
addPatch({