Skip to content

Commit

Permalink
Linting
Browse files Browse the repository at this point in the history
  • Loading branch information
kkapsner committed Jan 24, 2019
1 parent 1dc9b50 commit f38e55b
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.json
Expand Up @@ -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",
Expand Down
26 changes: 26 additions & 0 deletions lib/modifiedAPIFunctions.js
Expand Up @@ -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);
};
}());
26 changes: 5 additions & 21 deletions lib/modifiedDOMRectAPI.js
Expand Up @@ -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");

Expand Down Expand Up @@ -89,9 +89,6 @@

scope.changedFunctions = {
getClientRects: {
type: "readout",
api: "domRect",
getStatus: getStatus,
object: ["Range", "Element"],
fakeGenerator: function(checker){
return function getClientRects(){
Expand All @@ -107,9 +104,6 @@
}
},
getBoundingClientRect: {
type: "readout",
api: "domRect",
getStatus: getStatus,
object: ["Range", "Element"],
fakeGenerator: function(checker){
return function getBoundingClientRect(){
Expand All @@ -124,9 +118,6 @@
}
},
getBounds: {
type: "readout",
api: "domRect",
getStatus: getStatus,
object: ["DOMQuad"],
fakeGenerator: function(checker){
return function getBounds(){
Expand All @@ -140,9 +131,6 @@
}
},
getBBox: {
type: "readout",
api: "domRect",
getStatus: getStatus,
object: ["SVGGraphicsElement"],
fakeGenerator: function(checker){
return function getBBox(){
Expand All @@ -156,9 +144,6 @@
}
},
getExtentOfChar: {
type: "readout",
api: "domRect",
getStatus: getStatus,
object: ["SVGTextContentElement"],
fakeGenerator: function(checker){
return function getBBox(){
Expand Down Expand Up @@ -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"
});
}());
2 changes: 1 addition & 1 deletion options/options.js
Expand Up @@ -306,7 +306,7 @@
else {
return false;
}
}
};
}

let hideChangeListeners = [];
Expand Down

0 comments on commit f38e55b

Please sign in to comment.