mirror of
https://github.com/kkapsner/CanvasBlocker
synced 2025-01-08 20:54:49 +01:00
Ask mode did not show canvas canvas any more.
This commit is contained in:
parent
95605ef746
commit
2f4fca10ab
@ -222,6 +222,7 @@
|
|||||||
}
|
}
|
||||||
var funcStatus = changedFunction.getStatus(this, siteStatus, prefs);
|
var funcStatus = changedFunction.getStatus(this, siteStatus, prefs);
|
||||||
|
|
||||||
|
const This = this;
|
||||||
function notifyCallback(messageId){
|
function notifyCallback(messageId){
|
||||||
notify({
|
notify({
|
||||||
url,
|
url,
|
||||||
@ -230,7 +231,7 @@
|
|||||||
timestamp: new Date(),
|
timestamp: new Date(),
|
||||||
functionName: name,
|
functionName: name,
|
||||||
api: changedFunction.api,
|
api: changedFunction.api,
|
||||||
dataURL: getDataURL(this, prefs)
|
dataURL: getDataURL(This, prefs)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
const protectedAPIFeatures = prefs("protectedAPIFeatures");
|
const protectedAPIFeatures = prefs("protectedAPIFeatures");
|
||||||
|
@ -214,7 +214,7 @@
|
|||||||
if (canvasSizeShouldBeFaked(this, prefs)){
|
if (canvasSizeShouldBeFaked(this, prefs)){
|
||||||
var fakeCanvas = getFakeCanvas(window, this, prefs);
|
var fakeCanvas = getFakeCanvas(window, this, prefs);
|
||||||
if (fakeCanvas !== this){
|
if (fakeCanvas !== this){
|
||||||
notify.call(this, "fakedReadout");
|
notify("fakedReadout");
|
||||||
}
|
}
|
||||||
return original.apply(fakeCanvas, window.Array.from(args));
|
return original.apply(fakeCanvas, window.Array.from(args));
|
||||||
}
|
}
|
||||||
@ -244,7 +244,7 @@
|
|||||||
if (canvasSizeShouldBeFaked(this, prefs)){
|
if (canvasSizeShouldBeFaked(this, prefs)){
|
||||||
var fakeCanvas = getFakeCanvas(window, this, prefs);
|
var fakeCanvas = getFakeCanvas(window, this, prefs);
|
||||||
if (fakeCanvas !== this){
|
if (fakeCanvas !== this){
|
||||||
notify.call(this, "fakedReadout");
|
notify("fakedReadout");
|
||||||
}
|
}
|
||||||
return original.apply(fakeCanvas, window.Array.from(args));
|
return original.apply(fakeCanvas, window.Array.from(args));
|
||||||
}
|
}
|
||||||
@ -275,7 +275,7 @@
|
|||||||
if (canvasSizeShouldBeFaked(this, prefs)){
|
if (canvasSizeShouldBeFaked(this, prefs)){
|
||||||
var fakeCanvas = getFakeCanvas(window, this, prefs);
|
var fakeCanvas = getFakeCanvas(window, this, prefs);
|
||||||
if (fakeCanvas !== this){
|
if (fakeCanvas !== this){
|
||||||
notify.call(this, "fakedReadout");
|
notify("fakedReadout");
|
||||||
}
|
}
|
||||||
return original.apply(fakeCanvas, window.Array.from(args));
|
return original.apply(fakeCanvas, window.Array.from(args));
|
||||||
}
|
}
|
||||||
@ -305,7 +305,7 @@
|
|||||||
fakeCanvas = getFakeCanvas(window, this.canvas, prefs);
|
fakeCanvas = getFakeCanvas(window, this.canvas, prefs);
|
||||||
}
|
}
|
||||||
if (fakeCanvas && fakeCanvas !== this.canvas){
|
if (fakeCanvas && fakeCanvas !== this.canvas){
|
||||||
notify.call(this, "fakedReadout");
|
notify("fakedReadout");
|
||||||
context = window.HTMLCanvasElement.prototype.getContext.call(
|
context = window.HTMLCanvasElement.prototype.getContext.call(
|
||||||
fakeCanvas,
|
fakeCanvas,
|
||||||
"2d"
|
"2d"
|
||||||
@ -335,7 +335,7 @@
|
|||||||
var rng = randomSupply.getValueRng(1, window);
|
var rng = randomSupply.getValueRng(1, window);
|
||||||
var originalValue = original.apply(this, window.Array.from(args));
|
var originalValue = original.apply(this, window.Array.from(args));
|
||||||
if ((typeof originalValue) === "boolean"){
|
if ((typeof originalValue) === "boolean"){
|
||||||
notify.call(this, "fakedReadout");
|
notify("fakedReadout");
|
||||||
var index = x + this.width * y;
|
var index = x + this.width * y;
|
||||||
return original.call(this, rng(x, index), rng(y, index));
|
return original.call(this, rng(x, index), rng(y, index));
|
||||||
}
|
}
|
||||||
@ -361,7 +361,7 @@
|
|||||||
var rng = randomSupply.getValueRng(1, window);
|
var rng = randomSupply.getValueRng(1, window);
|
||||||
var originalValue = original.apply(this, window.Array.from(args));
|
var originalValue = original.apply(this, window.Array.from(args));
|
||||||
if ((typeof originalValue) === "boolean"){
|
if ((typeof originalValue) === "boolean"){
|
||||||
notify.call(this, "fakedReadout");
|
notify("fakedReadout");
|
||||||
var index = x + this.width * y;
|
var index = x + this.width * y;
|
||||||
return original.call(this, rng(x, index), rng(y, index));
|
return original.call(this, rng(x, index), rng(y, index));
|
||||||
}
|
}
|
||||||
@ -385,7 +385,7 @@
|
|||||||
return checkerWrapper(checker, this, arguments, function(args, check){
|
return checkerWrapper(checker, this, arguments, function(args, check){
|
||||||
var {prefs, notify, window, original} = check;
|
var {prefs, notify, window, original} = check;
|
||||||
if (!this || canvasSizeShouldBeFaked(this.canvas, prefs)){
|
if (!this || canvasSizeShouldBeFaked(this.canvas, prefs)){
|
||||||
notify.call(this, "fakedInput");
|
notify("fakedInput");
|
||||||
var oldImageData;
|
var oldImageData;
|
||||||
try {
|
try {
|
||||||
// "this" is not trustable - it may be not a context
|
// "this" is not trustable - it may be not a context
|
||||||
@ -420,7 +420,7 @@
|
|||||||
return checkerWrapper(checker, this, arguments, function(args, check){
|
return checkerWrapper(checker, this, arguments, function(args, check){
|
||||||
var {prefs, notify, window, original} = check;
|
var {prefs, notify, window, original} = check;
|
||||||
if (!this || canvasSizeShouldBeFaked(this.canvas, prefs)){
|
if (!this || canvasSizeShouldBeFaked(this.canvas, prefs)){
|
||||||
notify.call(this, "fakedInput");
|
notify("fakedInput");
|
||||||
var oldImageData;
|
var oldImageData;
|
||||||
try {
|
try {
|
||||||
// "this" is not trustable - it may be not a context
|
// "this" is not trustable - it may be not a context
|
||||||
@ -455,7 +455,7 @@
|
|||||||
return checkerWrapper(checker, this, arguments, function(args, check){
|
return checkerWrapper(checker, this, arguments, function(args, check){
|
||||||
var {prefs, notify, window, original} = check;
|
var {prefs, notify, window, original} = check;
|
||||||
if (!this || canvasSizeShouldBeFaked(this.canvas, prefs)){
|
if (!this || canvasSizeShouldBeFaked(this.canvas, prefs)){
|
||||||
notify.call(this, "fakedReadout");
|
notify("fakedReadout");
|
||||||
var fakeCanvas = getFakeCanvas(window, this.canvas, prefs);
|
var fakeCanvas = getFakeCanvas(window, this.canvas, prefs);
|
||||||
var {context} = copyCanvasToWebgl(
|
var {context} = copyCanvasToWebgl(
|
||||||
window,
|
window,
|
||||||
|
@ -20,14 +20,14 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
scope.checkerWrapper = function checkerWrapper(checker, object, args, callback){
|
scope.checkerWrapper = function checkerWrapper(checker, object, args, callback){
|
||||||
const check = checker();
|
const check = checker.call(object);
|
||||||
if (check.allow){
|
if (check.allow){
|
||||||
if (check.allow === true){
|
if (check.allow === true){
|
||||||
return check.original.apply(object, check.window.Array.from(args));
|
return check.original.apply(object, check.window.Array.from(args));
|
||||||
}
|
}
|
||||||
return callback.call(object, args, check);
|
return callback.call(object, args, check);
|
||||||
}
|
}
|
||||||
check.notify.call(object, "blocked");
|
check.notify("blocked");
|
||||||
return undefined;
|
return undefined;
|
||||||
};
|
};
|
||||||
}());
|
}());
|
@ -18,6 +18,7 @@ Version 0.5.4:
|
|||||||
- window and audio API were always blocked when using any of the "block ..." modes
|
- window and audio API were always blocked when using any of the "block ..." modes
|
||||||
- canvas content was not stored to be displayed when wanted
|
- canvas content was not stored to be displayed when wanted
|
||||||
- hovering over toolbar icon created error in the browser console
|
- hovering over toolbar icon created error in the browser console
|
||||||
|
- canvas content was not shown in ask mode any more
|
||||||
|
|
||||||
known issues:
|
known issues:
|
||||||
- if a data URL is blocked the page action button does not appear
|
- if a data URL is blocked the page action button does not appear
|
||||||
|
Loading…
x
Reference in New Issue
Block a user