mirror of
https://github.com/kkapsner/CanvasBlocker
synced 2025-01-03 10:31:54 +01:00
Adjusted detection test
Firefox nightly failed function code test when CB was not installed.
This commit is contained in:
parent
8d347a376a
commit
a4d9be9bd5
@ -1,4 +1,4 @@
|
|||||||
/* eslint no-console: off */
|
/* eslint no-console: off, max-lines: off */
|
||||||
var addTest = (function(){
|
var addTest = (function(){
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
@ -116,15 +116,15 @@ addTest("function code", function(log){
|
|||||||
) || codeDetected;
|
) || codeDetected;
|
||||||
codeDetected = checkFunctionCode(
|
codeDetected = checkFunctionCode(
|
||||||
history.__lookupGetter__("length"),
|
history.__lookupGetter__("length"),
|
||||||
"get length"
|
"(get )?length"
|
||||||
) || codeDetected;
|
) || codeDetected;
|
||||||
codeDetected = checkFunctionCode(
|
codeDetected = checkFunctionCode(
|
||||||
window.__lookupGetter__("name"),
|
window.__lookupGetter__("name"),
|
||||||
"get name"
|
"(get )?name"
|
||||||
) || codeDetected;
|
) || codeDetected;
|
||||||
codeDetected = checkFunctionCode(
|
codeDetected = checkFunctionCode(
|
||||||
window.__lookupSetter__("name"),
|
window.__lookupSetter__("name"),
|
||||||
"set name"
|
"(set )?name"
|
||||||
) || codeDetected;
|
) || codeDetected;
|
||||||
return codeDetected;
|
return codeDetected;
|
||||||
});
|
});
|
||||||
@ -147,11 +147,41 @@ addTest("toString modified", function(log){
|
|||||||
log
|
log
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
addTest("function name", function(){
|
addTest("function name", function(log){
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
return HTMLCanvasElement.prototype.toDataURL.name !== "toDataURL" ||
|
function checkName({func, expectedName}){
|
||||||
CanvasRenderingContext2D.prototype.getImageData.name !== "getImageData";
|
if (func.name !== expectedName){
|
||||||
|
log("unexpected function name: " + func.name + " !== " + expectedName);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
func: HTMLCanvasElement.prototype.toDataURL,
|
||||||
|
expectedName: "toDataURL"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
func: CanvasRenderingContext2D.prototype.getImageData,
|
||||||
|
expectedName: "getImageData"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
func: history.__lookupGetter__("length"),
|
||||||
|
expectedName: "get length"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
func: window.__lookupGetter__("name"),
|
||||||
|
expectedName: "get name"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
func: window.__lookupSetter__("name"),
|
||||||
|
expectedName: "set name"
|
||||||
|
},
|
||||||
|
].map(checkName).some(function(b){return b;});
|
||||||
});
|
});
|
||||||
addTest("property descriptor", function(log){
|
addTest("property descriptor", function(log){
|
||||||
"use strict";
|
"use strict";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user