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;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -20,19 +20,19 @@
|
|||
objectGetters: [function(window){return window.Navigator && window.Navigator.prototype;}],
|
||||
name: property,
|
||||
getterGenerator: function(checker){
|
||||
const temp = {
|
||||
get [property](){
|
||||
const temp = eval(`({
|
||||
get ${property}(){
|
||||
return checkerWrapper(checker, this, arguments, function(args, check){
|
||||
const {prefs, notify, window, original} = check;
|
||||
const originalValue = original.apply(this, window.Array.from(args));
|
||||
const returnValue = navigator.getNavigatorValue(property);
|
||||
const returnValue = navigator.getNavigatorValue("${property}");
|
||||
if (originalValue !== returnValue){
|
||||
notify("fakedNavigatorReadout");
|
||||
}
|
||||
return returnValue;
|
||||
});
|
||||
}
|
||||
};
|
||||
})`);
|
||||
return Object.getOwnPropertyDescriptor(temp, property).get;
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue