chromium/third_party/blink/web_tests/fast/events/dispatchEvent-crash.html

<p>This is a test for https://bugs.webkit.org/show_bug.cgi?id=21063 (NULL pointer crash in dispatchEvent(null)).  It passes if it does not crash.</p>
<script>
    if (window.testRunner)
        testRunner.dumpAsText();

    // FIXME: this should also test WorkerContext and MessagePort.
    var workerScriptBlob = new Blob([], {type: 'application/javascript'});
    var eventTargets = [new XMLHttpRequest, (new XMLHttpRequest).upload, new Worker(URL.createObjectURL(workerScriptBlob)), document.body];

    for (var i = 0; i < eventTargets.length; ++i) {
        eventTarget = eventTargets[i];
        try {
            eventTarget.dispatchEvent(null);
        } catch(e) {
        }
    
        try {
            eventTarget.dispatchEvent(undefined);
        } catch(e) {
        }
    
        try {
            eventTarget.dispatchEvent("string");
        } catch(e) {
        }
    
        try {
            eventTarget.dispatchEvent(0);
        } catch(e) {
        }
    
        try {
            eventTarget.dispatchEvent({});
        } catch(e) {
        }
    }
</script>