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", "constructor-super": "warn",
"eqeqeq": "error", "eqeqeq": "error",
"max-len": ["warn", {"code": 120, "tabWidth": 4}], "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], "max-params": ["warn", 4],
"no-const-assign": "warn", "no-const-assign": "warn",
"no-this-before-super": "warn", "no-this-before-super": "warn",

View File

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

View File

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