2017-12-12 21:56:22 +01:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html>
|
|
|
|
<head>
|
2019-09-04 00:30:20 +02:00
|
|
|
<title>Settings loading test</title>
|
2019-02-20 08:13:37 +01:00
|
|
|
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
|
|
|
<link href="testIcon.svg" type="image/png" rel="icon">
|
|
|
|
<link href="testIcon.svg" type="image/png" rel="shortcut icon">
|
2017-12-12 21:56:22 +01:00
|
|
|
<script>
|
2018-08-27 00:33:39 +02:00
|
|
|
console.log(new Date(), "starting first fingerprint", window.name);
|
2017-12-13 20:08:53 +01:00
|
|
|
function fingerPrint(){
|
|
|
|
"use strict";var canvas = document.createElement("canvas");
|
|
|
|
canvas.setAttribute("width", 220);
|
|
|
|
canvas.setAttribute("height", 30);
|
|
|
|
|
|
|
|
var fp_text = "BrowserLeaks,com <canvas> 10";
|
|
|
|
|
|
|
|
var ctx = canvas.getContext("2d");
|
|
|
|
ctx.textBaseline = "top";
|
|
|
|
ctx.font = "14px 'Arial'";
|
|
|
|
ctx.textBaseline = "alphabetic";
|
|
|
|
ctx.fillStyle = "#f60";
|
|
|
|
ctx.fillRect(125, 1, 62, 20);
|
|
|
|
ctx.fillStyle = "#069";
|
|
|
|
ctx.fillText(fp_text, 2, 15);
|
|
|
|
ctx.fillStyle = "rgba(102, 204, 0, 07)";
|
|
|
|
ctx.fillText(fp_text, 4, 17);
|
|
|
|
|
|
|
|
return canvas.toDataURL();
|
|
|
|
}
|
|
|
|
function hash(url){
|
|
|
|
var buffer = new TextEncoder("utf-8").encode(url);
|
|
|
|
return crypto.subtle.digest("SHA-256", buffer).then(function(hash){
|
|
|
|
var chunks = [];
|
|
|
|
(new Uint32Array(hash)).forEach(function(num){
|
|
|
|
chunks.push(num.toString(16));
|
|
|
|
});
|
|
|
|
return chunks.map(function(chunk){
|
|
|
|
return "0".repeat(8 - chunk.length) + chunk;
|
|
|
|
}).join("");
|
|
|
|
});
|
|
|
|
}
|
2017-12-12 21:56:22 +01:00
|
|
|
try {
|
2017-12-13 20:08:53 +01:00
|
|
|
var firstFingerprint = fingerPrint();
|
2017-12-12 21:56:22 +01:00
|
|
|
}
|
2019-11-28 01:26:35 +01:00
|
|
|
catch (error){
|
|
|
|
console.log(new Date(), error);
|
2017-12-13 20:08:53 +01:00
|
|
|
var firstFingerprint = false;
|
2017-12-12 21:56:22 +01:00
|
|
|
}
|
|
|
|
</script>
|
2019-09-04 00:30:20 +02:00
|
|
|
<style>
|
|
|
|
#output {
|
|
|
|
padding: 1em;
|
|
|
|
}
|
|
|
|
</style>
|
2017-12-12 21:56:22 +01:00
|
|
|
</head>
|
|
|
|
<body>
|
2019-09-04 00:30:20 +02:00
|
|
|
<h1>Settings loading test</h1>
|
|
|
|
<h2>Expected result</h2>
|
|
|
|
<ul>
|
|
|
|
<li>the background of the test result is green and states "good"</li>
|
|
|
|
<li>the displayed hash changes upon reload</li>
|
|
|
|
</ul>
|
|
|
|
<h2>Test</h2>
|
|
|
|
<div id="output"></div>
|
2017-12-12 21:56:22 +01:00
|
|
|
<script>
|
2017-12-13 20:08:53 +01:00
|
|
|
if (firstFingerprint){
|
2019-09-04 00:30:20 +02:00
|
|
|
var output = document.getElementById("output");
|
|
|
|
output.textContent = "context API not blocked";
|
2017-12-13 20:08:53 +01:00
|
|
|
window.setTimeout(function(){
|
2018-08-27 00:33:39 +02:00
|
|
|
console.log(new Date(), "starting second fingerprint", window.name);
|
2019-09-04 00:30:20 +02:00
|
|
|
output.appendChild(document.createElement("br"));
|
2017-12-18 23:17:55 +01:00
|
|
|
var secondFingerprint = fingerPrint();
|
2017-12-13 20:08:53 +01:00
|
|
|
if (firstFingerprint === secondFingerprint){
|
|
|
|
hash(firstFingerprint).then(function(hash){
|
2019-09-04 00:30:20 +02:00
|
|
|
output.appendChild(document.createTextNode("fingerprint consistent (" + hash + ") -> good!"));
|
|
|
|
output.style.backgroundColor = "green";
|
2017-12-13 20:08:53 +01:00
|
|
|
});
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
Promise.all([hash(firstFingerprint), hash(secondFingerprint)]).then(function(hashes){
|
2019-09-04 00:30:20 +02:00
|
|
|
output.appendChild(document.createTextNode("fingerprint not consistent (" + hashes[0] + " != " + hashes[1] + ") -> very bad! (potential fingerprint leak)"));
|
|
|
|
output.style.backgroundColor = "red";
|
2017-12-13 20:08:53 +01:00
|
|
|
});
|
|
|
|
}
|
|
|
|
}, 500);
|
|
|
|
}
|
|
|
|
else {
|
2019-09-04 00:30:20 +02:00
|
|
|
output.textContent = "context API blocked";
|
|
|
|
output.style.backgroundColor = "orange";
|
2017-12-13 20:08:53 +01:00
|
|
|
}
|
2017-12-12 21:56:22 +01:00
|
|
|
</script>
|
|
|
|
</body></html>
|