) {
    // t.step_func() does not preserve `this`, which we test below.
    t.step(() => {
      out("beforeprint");
      assert_equals(Object.getPrototypeOf(ev), Event.prototype);
      assert_equals(this, window);
      assert_equals(ev.target, window);
      assert_equals(ev.type, "beforeprint");
    });
  });
  window.addEventListener("afterprint", function (ev) {
    // t.step_func() does not preserve `this`, which we test below.
    t.step(() => {
      out("afterprint");
      assert_equals(Object.g