1
0
Fork 0
mirror of https://github.com/kkapsner/CanvasBlocker synced 2025-07-04 20:46:39 +02:00

First proxy attempt

This commit is contained in:
kkapsner 2021-01-26 13:47:59 +01:00
parent 42b19a4ba5
commit 211d6710f6
4 changed files with 46 additions and 17 deletions

View file

@ -136,6 +136,16 @@
}
};
scope.createProxyFunction = function createProxyFunction(window, original, replacement){
const wrappedWindow = scope.getWrapped(window);
const handler = wrappedWindow.Object.create(wrappedWindow.Object);
handler.apply = scope.exportFunctionWithName(function(target, thisArgs, args){
// console.log(target, thisArgs, args);
return replacement.apply(thisArgs, args);
}, window, "");
return new wrappedWindow.Proxy(original, handler);
};
const changedPropertiesByWindow = new WeakMap();
scope.changeProperty = function(window, group, {object, name, type, changed}){
let changedProperties = changedPropertiesByWindow.get(scope.getWrapped(window));