chromium/third_party/blink/web_tests/external/wpt/html/webappapis/user-prompts/resources/print-during-event.sub.html

<!DOCTYPE html>
<meta charset="utf-8">
<title>Page that tries to print during an event</title>

<script>
"use strict";

window.on{{GET[event]}} = () => {
  try {
    window.print();
  } catch (e) {
    window.opener.postMessage(`error: ${e.message}`);
  }
};

window.opener.postMessage("start", "*");
</script>