chromium/third_party/blink/web_tests/external/wpt/html/semantics/embedded-content/the-iframe-element/support/iframe-that-opens-modals.html

<!DOCTYPE html>
<script>
function openModal(name) {
    switch (name) {
    case "alert":
        return alert("MESSAGE");
    break;
    case "confirm":
        return confirm("MESSAGE?");
    break;
    case "prompt":
        return prompt("MESSAGE:", "DEFAULT VALUE");
    break;
    case "print":
        return print();
    break;
  }
}

onmessage = function(e) {
    parent.postMessage(openModal(e.data), "*");
}
</script>