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