chromium/third_party/blink/web_tests/http/tests/workers/worker-invalid-context.html

<html>
<body>
<p>This test checks that the invalid context doesn't cause crashes.</p>
<script src="resources/worker-util.js"></script>
<div id=result></div>
<script>
if (window.testRunner) {
    testRunner.dumpAsText();
    testRunner.setPopupBlockingEnabled(false);
    testRunner.waitUntilDone();
}

var callbackCount = 0;

function callback() {
  ++callbackCount;
  if (callbackCount == 10) {
    done();
    return;
  }
  try {
    // After "p.Worker = w.Worker;" is called, Worker::create() may be called with an invalid context.
    var a = new Worker('a');
  } catch (error) { }
  var p = window.parent;
  var w = window.open("x", "y");
  p.Worker = w.Worker;
  setTimeout(callback, 1);
}

setTimeout(callback, 1);
</script>
</body>
</html>