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

Detection over navigator and DOMRect getters was possible

This commit is contained in:
kkapsner 2019-05-20 08:45:31 +02:00
parent 79a9034051
commit e0dda5ec0f
4 changed files with 33 additions and 13 deletions

View file

@ -170,8 +170,8 @@
],
name: property,
getterGenerator: function(){
const temp = {
get [property](){
const temp = eval(`({
get ${property}(){
const registration = getDOMRectRegistration(this);
if (registration){
return getFakeDomRect(
@ -179,24 +179,24 @@
this,
registration.prefs,
registration.notify
)[property];
).${property};
}
return this[property];
return this.${property};
}
};
})`);
return Object.getOwnPropertyDescriptor(temp, property).get;
}
};
if (!readonly){
changedGetter.setterGenerator = function(window, original, prefs){
const temp = {
set [property](newValue){
const temp = eval(`({
set ${property}(newValue){
const registration = getDOMRectRegistration(this);
if (registration){
const fakeDomRect = getFakeDomRect(window, this, prefs, registration.notify);
registeredRects.delete(getWrapped(this));
["x", "y", "width", "height"].forEach((prop) => {
if (prop === property){
if (prop === "${property}"){
this[prop] = newValue;
}
else {
@ -208,7 +208,7 @@
original.apply(this, window.Array.from(arguments));
}
}
};
})`);
return Object.getOwnPropertyDescriptor(temp, property).set;
};
}