1
0
Fork 0
mirror of https://github.com/kkapsner/CanvasBlocker synced 2025-07-03 03:56:26 +02:00

Code linting.

This commit is contained in:
kkapsner 2017-10-03 15:35:31 +02:00
parent cde71f8a62
commit ef38abe545
24 changed files with 642 additions and 559 deletions

View file

@ -1,4 +1,3 @@
/* jslint moz: true */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
@ -18,8 +17,6 @@
const logging = require("./logging");
const {copyCanvasToWebgl} = require("./webgl");
// let Cu = require("chrome").Cu;
var randomSupply = null;
function getContext(window, canvas){
@ -82,9 +79,9 @@
var fakeAlphaChannel = prefs("fakeAlphaChannel");
for (var i = 0; i < l; i += 4){
var [r, g, b, a] = rng(
source[i + 0],
source[i + 1],
source[i + 2],
source[i + 0],
source[i + 1],
source[i + 2],
source[i + 3],
i / 4
);
@ -134,7 +131,7 @@
return size > minSize & size <= maxSize;
}
else {
return true
return true;
}
}
@ -156,7 +153,7 @@
mode: "allow",
type: status.type,
active: false
}
};
}
else if (hasType(status, "context") || hasType(status, "input")){
return {
@ -166,7 +163,7 @@
};
}
else {
var status = Object.create(status);
status = Object.create(status);
status.active = false;
return status;
}
@ -182,7 +179,7 @@
toDataURL: {
type: "readout",
getStatus: function(obj, status){
var status = Object.create(status);
status = Object.create(status);
if (hasType(status, "input")){
var contextType = canvasContextType.get(obj);
status.active = contextType !== "2d";
@ -208,7 +205,7 @@
toBlob: {
type: "readout",
getStatus: function(obj, status){
var status = Object.create(status);
status = Object.create(status);
if (hasType(status, "input")){
var contextType = canvasContextType.get(obj);
status.active = contextType !== "2d";
@ -235,7 +232,7 @@
mozGetAsFile: {
type: "readout",
getStatus: function(obj, status){
var status = Object.create(status);
status = Object.create(status);
if (hasType(status, "input")){
var contextType = canvasContextType.get(obj);
status.active = contextType !== "2d";
@ -261,7 +258,7 @@
getImageData: {
type: "readout",
getStatus: function(obj, status){
var status = Object.create(status);
status = Object.create(status);
if (hasType(status, "input")){
var contextType = canvasContextType.get(obj && obj.canvas);
status.active = contextType !== "2d";
@ -298,7 +295,7 @@
fillText: {
type: "input",
getStatus: function(obj, status){
var status = Object.create(status);
status = Object.create(status);
status.active = hasType(status, "input");
return status;
},
@ -312,7 +309,9 @@
// "this" is not trustable - it may be not a context
oldImageData = getImageData(window, this).imageData;
}
catch (e){}
catch (e){
// nothing to do here
}
// if "this" is not a correct context the next line will throw an error
var ret = original.apply(this, window.Array.from(arguments));
var newImageData = getImageData(window, this).imageData;
@ -328,7 +327,7 @@
strokeText: {
type: "input",
getStatus: function(obj, status){
var status = Object.create(status);
status = Object.create(status);
status.active = hasType(status, "input");
return status;
},
@ -342,7 +341,9 @@
// "this" is not trustable - it may be not a context
oldImageData = getImageData(window, this).imageData;
}
catch (e){}
catch (e){
// nothing to do here
}
// if "this" is not a correct context the next line will throw an error
var ret = original.apply(this, window.Array.from(arguments));
var newImageData = getImageData(window, this).imageData;
@ -358,7 +359,7 @@
readPixels: {
type: "readout",
getStatus: function(obj, status){
var status = Object.create(status);
status = Object.create(status);
status.active = hasType(status, "readout") || hasType(status, "input");
return status;
},