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:
parent
79a9034051
commit
e0dda5ec0f
4 changed files with 33 additions and 13 deletions
|
@ -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;
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue