1
0
mirror of https://github.com/kkapsner/CanvasBlocker synced 2024-12-22 21:00:23 +01:00

wrapped original funtion may gets destroyed before usage

For #564
This commit is contained in:
kkapsner 2021-06-21 20:41:33 +02:00
parent cf0243d487
commit 4ac02003de
2 changed files with 11 additions and 2 deletions

View File

@ -157,15 +157,20 @@
}); });
} }
const handler = scope.getWrapped(window).Object.create(null); const handler = scope.getWrapped(window).Object.create(null);
handler.apply = scope.exportFunctionWithName(function(_target, thisArgs, args){ handler.apply = scope.exportFunctionWithName(function(target, thisArgs, args){
try { try {
return args.length? return args.length?
replacement.call(thisArgs, ...args): replacement.call(thisArgs, ...args):
replacement.call(thisArgs); replacement.call(thisArgs);
} }
catch (error){ catch (error){
try {
return original.apply(thisArgs, args); return original.apply(thisArgs, args);
} }
catch (error){
return target.apply(thisArgs, args);
}
}
}, window, ""); }, window, "");
const proxy = new window.Proxy(original, handler); const proxy = new window.Proxy(original, handler);
proxies.set(proxy, original.toString()); proxies.set(proxy, original.toString());

View File

@ -197,6 +197,10 @@
{ {
"version": "1.7Alpha20210620", "version": "1.7Alpha20210620",
"update_link": "https://canvasblocker.kkapsner.de/versions/canvasblocker_beta-1.7Alpha20210620-an+fx.xpi" "update_link": "https://canvasblocker.kkapsner.de/versions/canvasblocker_beta-1.7Alpha20210620-an+fx.xpi"
},
{
"version": "1.7Alpha20210621",
"update_link": "https://canvasblocker.kkapsner.de/versions/canvasblocker_beta-1.7Alpha20210621-an+fx.xpi"
} }
] ]
} }