Fix occasional freezing on firefox (cache related)

This commit is contained in:
V 2023-05-30 15:21:24 +02:00
parent d8cd557fb2
commit a2a33ca62d
No known key found for this signature in database
GPG key ID: A1DC0CFB5615D905

View file

@ -28,7 +28,12 @@ let webpackChunk: any[];
const logger = new Logger("WebpackInterceptor", "#8caaee");
Object.defineProperty(window, WEBPACK_CHUNK, {
if (window[WEBPACK_CHUNK]) {
logger.info(`Patching ${WEBPACK_CHUNK}.push (was already existant, likely from cache!)`);
_initWebpack(window[WEBPACK_CHUNK]);
patchPush();
} else {
Object.defineProperty(window, WEBPACK_CHUNK, {
get: () => webpackChunk,
set: v => {
if (v?.push !== Array.prototype.push) {
@ -42,7 +47,8 @@ Object.defineProperty(window, WEBPACK_CHUNK, {
webpackChunk = v;
},
configurable: true
});
});
}
function patchPush() {
function handlePush(chunk: any) {