<!DOCTYPE html> | |
<script> | |
var popups = 0; | |
window.addEventListener('message', function(a) { | |
if (a.data == 1) { | |
let popup = !!window.open(); | |
popups += popup ? 1 : 0; | |
} else { | |
window.domAutomationController.send(popups); | |
} | |
}); | |
// Tries to open two popups and reports how many successfully opened. | |
function openPopupsAndReport() { | |
window.postMessage(1, document.location); | |
window.postMessage(1, document.location); | |
window.postMessage(2, document.location); | |
} | |
</script> |