mirror of
https://github.com/kkapsner/CanvasBlocker
synced 2024-12-22 12:50:36 +01:00
Added ability to use objectGetters on faked functions.
This commit is contained in:
parent
73657852d3
commit
5d6c2d9a47
@ -79,10 +79,23 @@
|
||||
Array.isArray(changedFunction.object)?
|
||||
changedFunction.object:
|
||||
[changedFunction.object]
|
||||
).forEach(function(object){
|
||||
const constructor = getWrapped(window)[object];
|
||||
).map(function(name){
|
||||
if (name){
|
||||
const constructor = getWrapped(window)[name];
|
||||
if (constructor){
|
||||
callback({name, object: constructor.prototype});
|
||||
return constructor.prototype;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}).concat(
|
||||
changedFunction.objectGetters?
|
||||
changedFunction.objectGetters.map(function(objectGetter){
|
||||
return objectGetter(getWrapped(window));
|
||||
}):
|
||||
[]
|
||||
).forEach(function(object){
|
||||
if (object){
|
||||
callback({name, object: object});
|
||||
}
|
||||
});
|
||||
});
|
||||
@ -295,12 +308,25 @@
|
||||
Array.isArray(changedFunction.object)?
|
||||
changedFunction.object:
|
||||
[changedFunction.object]
|
||||
).forEach(function(object){
|
||||
const constructor = getWrapped(window)[object];
|
||||
).map(function(name){
|
||||
if (name){
|
||||
const constructor = getWrapped(window)[name];
|
||||
if (constructor){
|
||||
const original = constructor.prototype[name];
|
||||
return constructor.prototype;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}).concat(
|
||||
changedFunction.objectGetters?
|
||||
changedFunction.objectGetters.map(function(objectGetter){
|
||||
return objectGetter(getWrapped(window));
|
||||
}):
|
||||
[]
|
||||
).forEach(function(object){
|
||||
if (object){
|
||||
const original = object[name];
|
||||
const checker = generateChecker(name, changedFunction, siteStatus, original);
|
||||
const descriptor = Object.getOwnPropertyDescriptor(constructor.prototype, name);
|
||||
const descriptor = Object.getOwnPropertyDescriptor(object, name);
|
||||
if (descriptor){
|
||||
if (descriptor.hasOwnProperty("value")){
|
||||
if (changedFunction.fakeGenerator){
|
||||
@ -321,7 +347,7 @@
|
||||
);
|
||||
}, window);
|
||||
}
|
||||
Object.defineProperty(constructor.prototype, name, descriptor);
|
||||
Object.defineProperty(object, name, descriptor);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user