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,14 +157,19 @@
}); });
} }
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){
return original.apply(thisArgs, args); try {
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);

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"
} }
] ]
} }