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

Get rid of eval.

This commit is contained in:
kkapsner 2019-12-12 00:09:53 +01:00
parent 32f9ea7447
commit 14a4d1cdc2
10 changed files with 96 additions and 50 deletions

View file

@ -20,19 +20,19 @@
objectGetters: [function(window){return window.Navigator && window.Navigator.prototype;}],
name: property,
getterGenerator: function(checker){
const temp = eval(`({
get ${property}(){
const temp = {
get [property](){
return checkerWrapper(checker, this, arguments, function(args, check){
const {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;
}
};