haikuwebkit/LayoutTests/fast/events/window-event-onerror.html

23 lines
683 B
HTML

<!DOCTYPE html>
<html>
<body>
<script src="../../resources/js-test.js"></script>
<script>
description("Tests that window.event is set on the right global when an error event is fired.");
const otherWindow = document.body.appendChild(document.createElement("iframe")).contentWindow;
otherWindow.onerror = (e) => {
passedEvent = e;
shouldBeUndefined("otherWindow.event");
shouldBe("passedEvent", "window.event");
}
shouldBeUndefined("otherWindow.event");
shouldBeUndefined("window.event");
debug("Dispatching error event");
otherWindow.dispatchEvent(new Event("error"));
shouldBeUndefined("otherWindow.event");
shouldBeUndefined("window.event");
</script>
</body>
</html>