mirror of
https://github.com/kkapsner/CanvasBlocker
synced 2025-07-04 12:36:37 +02:00
Only Firefox < 57 block on pre-intercept
This commit is contained in:
parent
67438d15ff
commit
3fcc5774c2
3 changed files with 32 additions and 22 deletions
|
@ -65,6 +65,12 @@
|
|||
scope.intercept({subject: window}, apis);
|
||||
}
|
||||
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 intercepted = false;
|
||||
const forEachFunction = function(callback){
|
||||
|
@ -96,25 +102,29 @@
|
|||
enumerable: true,
|
||||
configureable: true,
|
||||
get: exportFunction(function(){
|
||||
var url = getURL(window);
|
||||
if (!url){
|
||||
return undef;
|
||||
if (forceLoad){
|
||||
undoPreIntercept();
|
||||
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),
|
||||
set: exportFunction(function(){}, window)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue