I found what looks to be a bug in Microsoft Edge. The callback to setInterval() is sometimes called while print() is executing. This results in 2 JavaScript functions running in parallel which shouldn't be allowed, right?
The behavior can be observed with this simple test app.
index.html:
<!DOCTYPE html>
<html>
<head>
<script src="script.js"></script>
</head>
<body>
<input type="button" onclick="printPage()" value="Print"/>
</body>
</html>
script.js:
var isPrinting = false;
setInterval(function tick() {
if (isPrinting) {
alert('Interval callback called conurrently with click handler!');
}
}, 10);
function printPage() {
isPrinting = true;
try {
print();
}
finally {
isPrinting = false;
}
}
https://plnkr.co/edit/eKMQEHjRiXzl1vzjzIEN
When I click on the "Print" button, I do not expect to see an alert, but I do observe an alert.
Environment: Microsoft Edge 38.14393.0.0, Windows 10
Is this a bug or do I not understand something?