1
0
mirror of https://github.com/kkapsner/CanvasBlocker synced 2024-12-22 12:50:36 +01:00
This commit is contained in:
kkapsner 2019-01-24 15:43:20 +01:00
parent 1dc9b50242
commit f38e55b538
4 changed files with 33 additions and 23 deletions

View File

@ -21,7 +21,7 @@
"constructor-super": "warn",
"eqeqeq": "error",
"max-len": ["warn", {"code": 120, "tabWidth": 4}],
"max-lines": ["warn", {"max": 400, "skipBlankLines": true, "skipComments": true}],
"max-lines": ["warn", {"max": 500, "skipBlankLines": true, "skipComments": true}],
"max-params": ["warn", 4],
"no-const-assign": "warn",
"no-this-before-super": "warn",

View File

@ -24,4 +24,30 @@
check.notify("blocked");
return undefined;
};
scope.setFunctionProperties = function setFunctionProperties(functions, data){
Object.keys(functions).forEach(function(key){
var func = functions[key];
["type", "api", "getStatus"].forEach(function(property){
if (data[property] && !func[property]){
func[property] = data[property];
}
});
});
};
scope.setGetterProperties = function setGetterProperties(getters, data){
getters.forEach(function(getter){
["type", "api", "getStatus"].forEach(function(property){
if (data[property] && !getter[property]){
getter[property] = data[property];
}
});
});
};
scope.setProperties = function setProperties(functions, getters, data){
scope.setFunctionProperties(functions, data);
scope.setGetterProperties(getters, data);
};
}());

View File

@ -13,7 +13,7 @@
scope = window.scope.modifiedDOMRectAPI;
}
const {checkerWrapper} = require("./modifiedAPIFunctions");
const {checkerWrapper, setProperties: setProperties} = require("./modifiedAPIFunctions");
const {byteArrayToString: hash} = require("./hash");
const getWrapped = require("sdk/getWrapped");
@ -89,9 +89,6 @@
scope.changedFunctions = {
getClientRects: {
type: "readout",
api: "domRect",
getStatus: getStatus,
object: ["Range", "Element"],
fakeGenerator: function(checker){
return function getClientRects(){
@ -107,9 +104,6 @@
}
},
getBoundingClientRect: {
type: "readout",
api: "domRect",
getStatus: getStatus,
object: ["Range", "Element"],
fakeGenerator: function(checker){
return function getBoundingClientRect(){
@ -124,9 +118,6 @@
}
},
getBounds: {
type: "readout",
api: "domRect",
getStatus: getStatus,
object: ["DOMQuad"],
fakeGenerator: function(checker){
return function getBounds(){
@ -140,9 +131,6 @@
}
},
getBBox: {
type: "readout",
api: "domRect",
getStatus: getStatus,
object: ["SVGGraphicsElement"],
fakeGenerator: function(checker){
return function getBBox(){
@ -156,9 +144,6 @@
}
},
getExtentOfChar: {
type: "readout",
api: "domRect",
getStatus: getStatus,
object: ["SVGTextContentElement"],
fakeGenerator: function(checker){
return function getBBox(){
@ -421,16 +406,15 @@
}
];
function getStatus(obj, status, prefs){
status = Object.create(status);
status.active = prefs("protectDOMRect", status.url);
return status;
}
scope.changedGetters.forEach(function(changedGetter){
changedGetter.type = "readout";
changedGetter.getStatus = getStatus;
changedGetter.api = "domRect";
setProperties(scope.changedFunctions, scope.changedGetters, {
type: "readout",
getStatus: getStatus,
api: "domRect"
});
}());

View File

@ -306,7 +306,7 @@
else {
return false;
}
}
};
}
let hideChangeListeners = [];