mirror of
https://github.com/kkapsner/CanvasBlocker
synced 2025-01-03 10:31:54 +01:00
Added getImageData raw display test.
This commit is contained in:
parent
71c9baec0a
commit
e65ac94dda
@ -23,6 +23,12 @@
|
|||||||
Hash: <span class="hash"></span> (isPointInPath: <span class="isPointInPath"></span>)
|
Hash: <span class="hash"></span> (isPointInPath: <span class="isPointInPath"></span>)
|
||||||
<button>refresh</button>
|
<button>refresh</button>
|
||||||
</div>
|
</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">
|
<div id="iframe">
|
||||||
<h3>iFrame Test. Thanks to DocumentRoot.</h3>
|
<h3>iFrame Test. Thanks to DocumentRoot.</h3>
|
||||||
<img class="display"><br>
|
<img class="display"><br>
|
||||||
|
12
test/test.js
12
test/test.js
@ -4,7 +4,18 @@
|
|||||||
|
|
||||||
async function show(container, {url, imageData, isPointInPath}){
|
async function show(container, {url, imageData, isPointInPath}){
|
||||||
const display = container.querySelector(".display");
|
const display = container.querySelector(".display");
|
||||||
|
switch (display.nodeName){
|
||||||
|
case "IMG":
|
||||||
display.src = url;
|
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;
|
display.title = url;
|
||||||
const hashes = await Promise.all([
|
const hashes = await Promise.all([
|
||||||
testAPI.hash(url),
|
testAPI.hash(url),
|
||||||
@ -25,6 +36,7 @@
|
|||||||
|
|
||||||
const tests = {
|
const tests = {
|
||||||
top: function(){return canvasAPI.fingerprint();},
|
top: function(){return canvasAPI.fingerprint();},
|
||||||
|
getImageDataTest: function(){return canvasAPI.fingerprint();},
|
||||||
iframe: iframeTest,
|
iframe: iframeTest,
|
||||||
iframe2: iframeTest,
|
iframe2: iframeTest,
|
||||||
iframe3: iframeTest,
|
iframe3: iframeTest,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user