mirror of
https://github.com/kkapsner/CanvasBlocker
synced 2025-04-18 08:08:28 +02:00
Only Firefox < 57 block on pre-intercept
This commit is contained in:
parent
67438d15ff
commit
3fcc5774c2
@ -65,6 +65,12 @@
|
|||||||
scope.intercept({subject: window}, apis);
|
scope.intercept({subject: window}, apis);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
let firefoxVersion = navigator.userAgent.match(/Firefox\/([\d.]+)$/);
|
||||||
|
let forceLoad = true;
|
||||||
|
if (firefoxVersion){
|
||||||
|
let versionParts = firefoxVersion[1].split(".");
|
||||||
|
forceLoad = parseInt(versionParts[0], 10) >= 57;
|
||||||
|
}
|
||||||
let preIntercepted = false;
|
let preIntercepted = false;
|
||||||
let intercepted = false;
|
let intercepted = false;
|
||||||
const forEachFunction = function(callback){
|
const forEachFunction = function(callback){
|
||||||
@ -96,25 +102,29 @@
|
|||||||
enumerable: true,
|
enumerable: true,
|
||||||
configureable: true,
|
configureable: true,
|
||||||
get: exportFunction(function(){
|
get: exportFunction(function(){
|
||||||
var url = getURL(window);
|
if (forceLoad){
|
||||||
if (!url){
|
undoPreIntercept();
|
||||||
return undef;
|
settings.forceLoad();
|
||||||
|
doRealIntercept();
|
||||||
|
var descriptor = Object.getOwnPropertyDescriptor(constructor.prototype, name);
|
||||||
|
return descriptor.value || descriptor.get();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
var url = getURL(window);
|
||||||
|
if (!url){
|
||||||
|
return undef;
|
||||||
|
}
|
||||||
|
var error = new Error();
|
||||||
|
apis.notify({
|
||||||
|
url,
|
||||||
|
errorStack: error.stack,
|
||||||
|
messageId: "preBlock",
|
||||||
|
timestamp: new Date(),
|
||||||
|
functionName: name,
|
||||||
|
dataURL: false
|
||||||
|
});
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
var error = new Error();
|
|
||||||
apis.notify({
|
|
||||||
url,
|
|
||||||
errorStack: error.stack,
|
|
||||||
messageId: "preBlock",
|
|
||||||
timestamp: new Date(),
|
|
||||||
functionName: name,
|
|
||||||
dataURL: false
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
// undoPreIntercept();
|
|
||||||
// settings.forceLoad();
|
|
||||||
// doRealIntercept();
|
|
||||||
// var descriptor = Object.getOwnPropertyDescriptor(constructor.prototype, name);
|
|
||||||
// return descriptor.value || descriptor.get();
|
|
||||||
}, window),
|
}, window),
|
||||||
set: exportFunction(function(){}, window)
|
set: exportFunction(function(){}, window)
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
Version 0.4.3:
|
Version 0.4.3:
|
||||||
todos:
|
|
||||||
-
|
|
||||||
|
|
||||||
changes:
|
changes:
|
||||||
- hide white, black and ignore list as they can be done with the url specific settings. They are still present and working in the background.
|
- hide white, black and ignore list as they can be done with the url specific settings. They are still present and working in the background.
|
||||||
|
- if settings are not loaded fast enough the loading is not force but all APIs are blocked (only Firefox < 57)
|
||||||
|
|
||||||
new features:
|
new features:
|
||||||
- reset settings
|
- reset settings
|
||||||
|
@ -55,7 +55,8 @@
|
|||||||
secondFingerprint = fingerPrint();
|
secondFingerprint = fingerPrint();
|
||||||
if (firstFingerprint === secondFingerprint){
|
if (firstFingerprint === secondFingerprint){
|
||||||
hash(firstFingerprint).then(function(hash){
|
hash(firstFingerprint).then(function(hash){
|
||||||
document.body.appendChild(document.createTextNode("fingerprint consistent (" + firstFingerprint + ") -> good!"));
|
document.body.appendChild(document.createTextNode("fingerprint consistent (" + hash + ") -> good!"));
|
||||||
|
document.body.style.backgroundColor = "green";
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -68,6 +69,7 @@
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
document.body.textContent = "context API blocked";
|
document.body.textContent = "context API blocked";
|
||||||
|
document.body.style.backgroundColor = "orange";
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
</body></html>
|
</body></html>
|
Loading…
x
Reference in New Issue
Block a user