1
0
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:
kkapsner 2017-12-13 20:15:50 +01:00
parent 67438d15ff
commit 3fcc5774c2
3 changed files with 32 additions and 22 deletions

View File

@ -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,6 +102,14 @@
enumerable: true, enumerable: true,
configureable: true, configureable: true,
get: exportFunction(function(){ get: exportFunction(function(){
if (forceLoad){
undoPreIntercept();
settings.forceLoad();
doRealIntercept();
var descriptor = Object.getOwnPropertyDescriptor(constructor.prototype, name);
return descriptor.value || descriptor.get();
}
else {
var url = getURL(window); var url = getURL(window);
if (!url){ if (!url){
return undef; return undef;
@ -110,11 +124,7 @@
dataURL: false dataURL: false
}); });
return; 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)
} }

View File

@ -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

View File

@ -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>