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

First working webExtesion.

This commit is contained in:
kkapsner 2017-06-25 22:33:12 +02:00
parent 4ea073132d
commit cba5680406
9 changed files with 266 additions and 310 deletions

View file

@ -5,7 +5,16 @@
(function(){
"use strict";
let Cu = require("chrome").Cu;
var scope;
if ((typeof exports) !== "undefined"){
scope = exports;
}
else {
window.scope.modifiedAPI = {};
scope = window.scope.modifiedAPI;
}
// let Cu = require("chrome").Cu;
var randomSupply = null;
@ -87,12 +96,12 @@
return status.type.indexOf(type) !== -1;
}
exports.setRandomSupply = function(supply){
scope.setRandomSupply = function(supply){
randomSupply = supply;
};
var canvasContextType = new WeakMap();
// changed functions and their fakes
exports.changedFunctions = {
scope.changedFunctions = {
getContext: {
type: "context",
getStatus: function(obj, status){
@ -288,7 +297,7 @@
return function readPixels(x, y, width, height, format, type, pixels){
// not able to use the getFakeCanvas function because the context type is wrong...
notify("fakedReadout");
var xPixels = Cu.waiveXrays(pixels);
var xPixels = pixels//Cu.waiveXrays(pixels);
var ret = original.apply(this, window.Array.from(arguments));
var l = xPixels.length;
var rng = randomSupply.getRng(l, window);