CanvasBlocker/test/cspTest.js

28 lines
706 B
JavaScript
Raw Permalink Normal View History

2020-01-06 15:15:04 +01:00
/* globals testAPI, canvasAPI*/
2019-12-16 19:27:28 +01:00
const addLine = function(){
2019-12-14 21:22:18 +01:00
"use strict";
2019-12-16 19:27:28 +01:00
const output = document.getElementById("results");
2019-12-14 21:22:18 +01:00
return function(text){
2019-12-16 19:27:28 +01:00
const line = document.createElement("div");
2019-12-14 21:22:18 +01:00
line.textContent = text;
output.appendChild(line);
};
}();
addLine("window name at start: " + window.name);
window.name = "CanvasBlocker CSP test";
addLine("window name after set: " + window.name);
2019-12-16 19:27:28 +01:00
(async function(){
2019-12-14 21:22:18 +01:00
"use strict";
2020-01-06 15:15:04 +01:00
const hashValue = await testAPI.hash(canvasAPI.fingerprint(window).url);
2019-12-16 19:27:28 +01:00
addLine("canvas hash: " + hashValue);
2021-09-08 23:09:08 +02:00
}());
document.getElementById("reloadWith304").addEventListener("click", function(){
"use strict";
document.cookie = "304=1";
location.reload();
});