1
0
mirror of https://github.com/kkapsner/CanvasBlocker synced 2024-11-11 07:38:58 +01:00

Added new performance tests

This commit is contained in:
kkapsner 2019-05-22 23:43:26 +02:00
parent 5785c3c2a0
commit ac9f1282fd

View File

@ -151,5 +151,27 @@ var randomImageTest = function(){
}; };
}(); }();
var innerHTMlTest = function(html, repeats){
"use strict";
var div;
return {
prepareOnce: function(){
div = document.createElement("div");
div.style.visibility = "hidden";
document.body.appendChild(div);
},
test: function randomImageTest(){
for (var i = repeats; i--;){
div.innerHTML = html;
div.innerHTML = "";
}
}
};
};
performTest("fingerprinting", fingerprintTest, 10, 100); performTest("fingerprinting", fingerprintTest, 10, 100);
performTest("big random image", randomImageTest, 10, 10); performTest("big random image", randomImageTest, 10, 10);
performTest("innerHTML (100 times)", innerHTMlTest("text <br>no iframe", 1000), 10, 30);
performTest("innerHTML with iframe (20 times)", innerHTMlTest("text <br>iframe: <iframe></iframe>", 20), 10, 10);