1
0
Fork 0
mirror of https://github.com/kkapsner/CanvasBlocker synced 2025-07-03 12:06:31 +02:00

Added protection for window.name and window.opener

As requested by #231.

But this protection is disabled by default.
This commit is contained in:
kkapsner 2018-08-27 00:33:39 +02:00
parent fd7c4fabbd
commit 83efac5e49
13 changed files with 195 additions and 2 deletions

View file

@ -118,6 +118,14 @@ addTest("function code", function(log){
history.__lookupGetter__("length"),
"get length"
) || codeDetected;
codeDetected = checkFunctionCode(
window.__lookupGetter__("name"),
"get name"
) || codeDetected;
codeDetected = checkFunctionCode(
window.__lookupSetter__("name"),
"set name"
) || codeDetected;
return codeDetected;
});
addTest("toString modified", function(log){
@ -395,4 +403,20 @@ addTest("readout - in - out test", function(log){
}
}
return false;
});
addTest("window name change", function(log){
"use strict";
var oldName = window.name;
log("old name:", oldName);
var newName = oldName + " added";
log("new name:", newName);
window.name = newName;
if (window.name !== newName){
log("window name not set:", window.name);
return true;
}
return false;
});

View file

@ -3,7 +3,7 @@
<head>
<title>Test</title>
<script>
console.log(new Date(), "starting first fingerprint");
console.log(new Date(), "starting first fingerprint", window.name);
function fingerPrint(){
"use strict";var canvas = document.createElement("canvas");
canvas.setAttribute("width", 220);
@ -50,7 +50,7 @@
if (firstFingerprint){
document.body.textContent = "context API not blocked";
window.setTimeout(function(){
console.log(new Date(), "starting second fingerprint");
console.log(new Date(), "starting second fingerprint", window.name);
document.body.appendChild(document.createElement("br"));
var secondFingerprint = fingerPrint();
if (firstFingerprint === secondFingerprint){