1
0
Fork 0
mirror of https://github.com/kkapsner/CanvasBlocker synced 2025-07-03 12:06:31 +02:00

Added window.open protection

This commit is contained in:
kkapsner 2019-12-02 22:57:11 +01:00
parent a181780020
commit 762367a87b
5 changed files with 55 additions and 0 deletions

View file

@ -65,5 +65,11 @@
Hash: <span class="hash"></span> (isPointInPath: <span class="isPointInPath"></span>)
<button>refresh</button>
</div>
<div id="windowOpen">
<h3>window.open Test</h3>
<img class="display"><br>
Hash: <span class="hash"><i>click anywhere to populate</i></span> (isPointInPath: <span class="isPointInPath"></span>)
<button>refresh</button>
</div>
<script src="test.js"></script>
</body></html>

View file

@ -45,6 +45,17 @@
catch (error){console.error(error);}
try {show(document.getElementById("iframe6"), dynamicIframeTest3());}
catch (error){console.error(error);}
window.addEventListener("click", function windowOpenTest(){
window.removeEventListener("click", windowOpenTest);
var newWindow = window.open("/");
try{
show(document.getElementById("windowOpen"), copyToDifferentDocumentTest(newWindow.document));
}
catch (error){
console.error(error);
}
newWindow.close();
});
}
document.querySelector("#top button").addEventListener("click", function(){
show(document.getElementById("top"), topTest());
@ -67,6 +78,11 @@
document.querySelector("#iframe6 button").addEventListener("click", function(){
show(document.getElementById("iframe6"), dynamicIframeTest3());
});
document.querySelector("#windowOpen button").addEventListener("click", function(){
var newWindow = window.open("/");
show(document.getElementById("windowOpen"), copyToDifferentDocumentTest(newWindow.document));
newWindow.close();
});
}());
function draw(canvas){