<!doctype html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
async_test(t => {
  window.onload = t.step_func_done(() => {
    let abort_signal;
    let onabort_called = false;
    let canceled_in_second_handler = false;
    navigation.addEventListener("navigate", t.step_func(e => {
      abort_signal = e.signal;
      abort_signal.onabort = () => onabort_called = true;
      window.stop();
    }));
    navigation.addEventListener("navigate", t.step_func(e => {
      canceled_in_second_handler = e.defaultPrevented;
    }));
    navigation.navigate("?1");
    assert_true(abort_signal.aborted);
    assert_true(onabort_called);
    assert_true(canceled_in_second_handler);
  });
}, "window.stop() signals event.signal inside a navigate event handler");
</script>
