mirror of
https://github.com/kkapsner/CanvasBlocker
synced 2024-12-22 04:40:20 +01:00
Added linting for consistent-return
This commit is contained in:
parent
635cdf8061
commit
1aff68d802
@ -29,6 +29,7 @@
|
||||
"brace-style": ["error", "stroustrup", {"allowSingleLine": true}],
|
||||
"comma-spacing": ["error", { "before": false, "after": true }],
|
||||
"complexity": ["warn", 20],
|
||||
"consistent-return": "error",
|
||||
"constructor-super": "warn",
|
||||
"eqeqeq": "error",
|
||||
"eslint-comments/no-use": ["error", {"allow": ["eslint-disable-next-line"]}],
|
||||
|
@ -45,7 +45,7 @@
|
||||
}
|
||||
else {
|
||||
if (isWhitelisted(window.location)){
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return changeProperty;
|
||||
@ -265,6 +265,10 @@
|
||||
scope.protect = function protect(window, wrappedWindow, singleCallback, allCallback){
|
||||
const changeProperty = createChangeProperty(window);
|
||||
|
||||
if (!changeProperty){
|
||||
return;
|
||||
}
|
||||
|
||||
const api = {window, wrappedWindow, changeProperty, singleCallback, allCallback};
|
||||
|
||||
protectFrameProperties(api);
|
||||
|
@ -174,7 +174,7 @@
|
||||
functionName: name,
|
||||
dataURL: false
|
||||
});
|
||||
return;
|
||||
return undef;
|
||||
}
|
||||
}, windowToProcess),
|
||||
set: exportFunction(function(){}, windowToProcess)
|
||||
|
@ -20,6 +20,7 @@
|
||||
}
|
||||
else {
|
||||
warning("logging: Settings can only be set once.");
|
||||
return settings.loaded;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -89,6 +89,26 @@
|
||||
return window.screen;
|
||||
}
|
||||
|
||||
function fakeWidth(args, check){
|
||||
const {prefs, notify, window, original} = check;
|
||||
const originalValue = original.apply(this, window.Array.from(args));
|
||||
const returnValue = Math.round(getScreenDimensions(prefs, window).width);
|
||||
if (originalValue !== returnValue){
|
||||
notify("fakedScreenReadout");
|
||||
}
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
function fakeHeight(args, check){
|
||||
const {prefs, notify, window, original} = check;
|
||||
const originalValue = original.apply(this, window.Array.from(args));
|
||||
const returnValue = Math.round(getScreenDimensions(prefs, window).height);
|
||||
if (originalValue !== returnValue){
|
||||
notify("fakedScreenReadout");
|
||||
}
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
scope.changedGetters = [
|
||||
{
|
||||
objectGetters: [function(window){return window.Screen && window.Screen.prototype;}],
|
||||
@ -96,15 +116,7 @@
|
||||
getterGenerator: function(checker){
|
||||
const temp = {
|
||||
get width(){
|
||||
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 = Math.round(getScreenDimensions(prefs, window).width);
|
||||
if (originalValue !== returnValue){
|
||||
notify("fakedScreenReadout");
|
||||
}
|
||||
return returnValue;
|
||||
});
|
||||
return checkerWrapper(checker, this, arguments, fakeWidth);
|
||||
}
|
||||
};
|
||||
return Object.getOwnPropertyDescriptor(temp, "width").get;
|
||||
@ -116,15 +128,7 @@
|
||||
getterGenerator: function(checker){
|
||||
const temp = {
|
||||
get height(){
|
||||
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 = Math.round(getScreenDimensions(prefs, window).height);
|
||||
if (originalValue !== returnValue){
|
||||
notify("fakedScreenReadout");
|
||||
}
|
||||
return returnValue;
|
||||
});
|
||||
return checkerWrapper(checker, this, arguments, fakeHeight);
|
||||
}
|
||||
};
|
||||
return Object.getOwnPropertyDescriptor(temp, "height").get;
|
||||
@ -136,15 +140,7 @@
|
||||
getterGenerator: function(checker){
|
||||
const temp = {
|
||||
get availWidth(){
|
||||
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 = Math.round(getScreenDimensions(prefs, window).width);
|
||||
if (originalValue !== returnValue){
|
||||
notify("fakedScreenReadout");
|
||||
}
|
||||
return returnValue;
|
||||
});
|
||||
return checkerWrapper(checker, this, arguments, fakeWidth);
|
||||
}
|
||||
};
|
||||
return Object.getOwnPropertyDescriptor(temp, "availWidth").get;
|
||||
@ -156,15 +152,7 @@
|
||||
getterGenerator: function(checker){
|
||||
const temp = {
|
||||
get availHeight(){
|
||||
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 = Math.round(getScreenDimensions(prefs, window).height);
|
||||
if (originalValue !== returnValue){
|
||||
notify("fakedScreenReadout");
|
||||
}
|
||||
return returnValue;
|
||||
});
|
||||
return checkerWrapper(checker, this, arguments, fakeHeight);
|
||||
}
|
||||
};
|
||||
return Object.getOwnPropertyDescriptor(temp, "availHeight").get;
|
||||
|
@ -146,6 +146,7 @@
|
||||
}
|
||||
else {
|
||||
logging.warning("Transient setting %s cannot be stored.", name);
|
||||
return Promise.reject("Transient setting " + name + " cannot be stored.");
|
||||
}
|
||||
};
|
||||
|
||||
@ -162,6 +163,7 @@
|
||||
}
|
||||
else{
|
||||
logging.warning("Invalid value for %s (%s):", name, url, newValue);
|
||||
return Promise.reject("Invalid value for " + name + " (" + url + "): " + newValue);
|
||||
}
|
||||
};
|
||||
}
|
||||
@ -173,6 +175,7 @@
|
||||
}
|
||||
else{
|
||||
logging.warning("Invalid value for %s:", name, newValue);
|
||||
return Promise.reject("Invalid value for " + name + ": " + newValue);
|
||||
}
|
||||
};
|
||||
}
|
||||
@ -307,6 +310,7 @@
|
||||
}
|
||||
else {
|
||||
logging.error("Try to set unknown setting:", name);
|
||||
return Promise.reject("Try to set unknown setting: " + name);
|
||||
}
|
||||
};
|
||||
scope.get = function(name, ...args){
|
||||
@ -316,6 +320,7 @@
|
||||
}
|
||||
else {
|
||||
logging.error("Try to get unknown setting:", name);
|
||||
return undefined;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -614,7 +614,7 @@
|
||||
if (reallyShare){
|
||||
return this.originalSet(value, ...args);
|
||||
}
|
||||
return;
|
||||
return false;
|
||||
}).catch(function(error){
|
||||
logging.warning("Unable to set sharePersistentRndBetweenDomains:", error);
|
||||
});
|
||||
|
@ -85,6 +85,7 @@
|
||||
setSelect.selectedIndex = index;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}) &&
|
||||
searchParameters.has("domain")
|
||||
){
|
||||
|
@ -65,7 +65,7 @@
|
||||
if (choice){
|
||||
return settings.set("showNotifications", false, choice);
|
||||
}
|
||||
return;
|
||||
return false;
|
||||
}).then(function(){
|
||||
return window.close();
|
||||
});
|
||||
@ -123,7 +123,7 @@
|
||||
if (choice){
|
||||
return settings.set(setting.name, setting.value, choice);
|
||||
}
|
||||
return;
|
||||
return false;
|
||||
}).then(function(){
|
||||
return window.close();
|
||||
});
|
||||
@ -142,7 +142,7 @@
|
||||
if (choice){
|
||||
return lists.appendTo("sessionWhite", choice);
|
||||
}
|
||||
return;
|
||||
return false;
|
||||
}).then(function(){
|
||||
return window.close();
|
||||
});
|
||||
|
@ -1,6 +1,7 @@
|
||||
Version 0.5.15:
|
||||
changes:
|
||||
- improved storage of protected API features
|
||||
- code cleanup
|
||||
|
||||
new features:
|
||||
- added screen protection
|
||||
|
Loading…
x
Reference in New Issue
Block a user