diff --git a/lib/modifiedAPI.js b/lib/modifiedAPI.js
index a6a9973..c34ea6b 100644
--- a/lib/modifiedAPI.js
+++ b/lib/modifiedAPI.js
@@ -316,9 +316,14 @@
return function isPointInPath(x, y){
var rng = randomSupply.getRng(1, window);
var originalValue = original.apply(this, window.Array.from(arguments));
- var value = rng(originalValue, x + this.width * y);
- notify.call(this, "fakedReadout");
- return !!(value & 1);
+ if ((typeof originalValue) === "boolean"){
+ notify.call(this, "fakedReadout");
+ var index = x + this.width * y;
+ return original.call(this, rng(x, index), rng(y, index));
+ }
+ else {
+ return originalValue;
+ }
};
}
},
@@ -334,9 +339,14 @@
return function isPointInStroke(x, y){
var rng = randomSupply.getRng(1, window);
var originalValue = original.apply(this, window.Array.from(arguments));
- var value = rng(originalValue, x + this.width * y);
- notify.call(this, "fakedReadout");
- return !!(value & 1);
+ if ((typeof originalValue) === "boolean"){
+ notify.call(this, "fakedReadout");
+ var index = x + this.width * y;
+ return original.call(this, rng(x, index), rng(y, index));
+ }
+ else {
+ return originalValue;
+ }
};
}
},
diff --git a/releaseNotes.txt b/releaseNotes.txt
index 1053c17..12012a5 100644
--- a/releaseNotes.txt
+++ b/releaseNotes.txt
@@ -6,7 +6,7 @@ Version 0.4.6:
- Added setting to whitelist parts of the canvas API
fixes:
- -
+ - respect resistFingerPrinting setting in isPointInPath and isPointInStroke
Version 0.4.5b:
known issues:
diff --git a/test/test.html b/test/test.html
index 9894663..a22ea8a 100644
--- a/test/test.html
+++ b/test/test.html
@@ -8,13 +8,13 @@
top Test
- Hash:
+ Hash:
(isPointInPath:
)
iFrame Test. Thanks to DocumentRoot.
- Hash:
+ Hash:
(isPointInPath:
)
@@ -22,7 +22,7 @@
iFrame Test 2 - with URL
- Hash:
+ Hash:
(isPointInPath:
)
@@ -30,7 +30,7 @@
iFrame Test 3 - violating SOP
- Hash:
+ Hash:
(isPointInPath:
)
diff --git a/test/test.js b/test/test.js
index a77c962..8072570 100644
--- a/test/test.js
+++ b/test/test.js
@@ -2,7 +2,7 @@
(function(){
"use strict";
- function show(container, url){
+ function show(container, {url, isPointInPath}){
var display = container.querySelector(".display");
display.src = url;
display.title = url;
@@ -16,6 +16,7 @@
return "0".repeat(8 - chunk.length) + chunk;
}).join("");
});
+ container.querySelector(".isPointInPath").textContent = isPointInPath;
}
if (location.search !== "?notInitial"){
@@ -64,14 +65,29 @@ function draw(canvas){
return ctx;
}
+function getIsPointInPath(ctx){
+ "use strict";
+ ctx.beginPath();
+ ctx.moveTo(20, 19);
+ ctx.lineTo(40, 19);
+ ctx.lineTo(30, 30);
+ ctx.closePath();
+ ctx.stroke();
+
+ return ctx.isPointInPath(30, 19);
+}
+
function topTest(){
"use strict";
// create window canvas
var canvas = document.createElement("canvas");
// draw image in window canvas
- draw(canvas);
- return canvas.toDataURL();
+ var ctx = draw(canvas);
+ return {
+ url: canvas.toDataURL(),
+ isPointInPath: getIsPointInPath(ctx)
+ };
}
function iframeTest(iframe){
@@ -92,5 +108,8 @@ function iframeTest(iframe){
// copy image from window canvas to iframe ctx
iframe_ctx.drawImage(canvas, 0, 0);
- return iframe_canvas.toDataURL();
+ return {
+ url: iframe_canvas.toDataURL(),
+ isPointInPath: getIsPointInPath(iframe_ctx)
+ };
}
\ No newline at end of file