Prevent detection of wrapped functions (e.g. in WebGL interception) on Chromium.

This commit is contained in:
hackademix 2021-01-29 23:07:28 +01:00
parent 1d90c874f9
commit 3e501cd0c1
1 changed files with 5 additions and 4 deletions

View File

@ -6,11 +6,12 @@ function patchWindow(patchingCallback, env = {}) {
// Chromium
let exportFunction = (func, targetObject, {defineAs}) => {
let original = targetObject[defineAs];
if (original && original.toString) {
func.toString = original.toString.bind(original);
}
console.log(`Setting ${targetObject}.${defineAs}`, func);
targetObject[defineAs] = func;
targetObject[defineAs] = new Proxy(original, {
apply(target, thisArg, args) {
return func.apply(thisArg, args);
}
});
};
let cloneInto = (obj, targetObject) => {
return obj; // dummy for assignment