1
0
mirror of https://github.com/kkapsner/CanvasBlocker synced 2024-12-22 12:50:36 +01:00

Added getImageData raw display test.

This commit is contained in:
kkapsner 2020-10-26 14:17:34 +01:00
parent 71c9baec0a
commit e65ac94dda
2 changed files with 19 additions and 1 deletions

View File

@ -23,6 +23,12 @@
Hash: <span class="hash"></span> (isPointInPath: <span class="isPointInPath"></span>)
<button>refresh</button>
</div>
<div id="getImageDataTest">
<h3>getimageData Test</h3>
<canvas class="display"></canvas><br>
Hash: <span class="hash"></span> (isPointInPath: <span class="isPointInPath"></span>)
<button>refresh</button>
</div>
<div id="iframe">
<h3>iFrame Test. Thanks to DocumentRoot.</h3>
<img class="display"><br>

View File

@ -4,7 +4,18 @@
async function show(container, {url, imageData, isPointInPath}){
const display = container.querySelector(".display");
display.src = url;
switch (display.nodeName){
case "IMG":
display.src = url;
break;
case "CANVAS": {
display.height = imageData.height;
display.width = imageData.width;
const context = display.getContext("2d");
context.putImageData(imageData, 0, 0);
}
break;
}
display.title = url;
const hashes = await Promise.all([
testAPI.hash(url),
@ -25,6 +36,7 @@
const tests = {
top: function(){return canvasAPI.fingerprint();},
getImageDataTest: function(){return canvasAPI.fingerprint();},
iframe: iframeTest,
iframe2: iframeTest,
iframe3: iframeTest,