chromium/third_party/blink/web_tests/fast/workers/chromium/resources/worker-xhr-onerror.js

(function () {
    var xhr = new XMLHttpRequest();
    xhr.open('GET', 'does-not-exist.js');
    xhr.onerror = () => { postMessage('done'); };
    xhr.send();
})();
// |xhr| isn't in scope, but it will signal pending activity
// when the GC runs, hence will be kept alive and allowed to
// run to completion.
self.gc();